Repository Public MIT
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// Project : SP GlassKit7// File : Tests/SPGlassComponentsTests/GlassPopoverTests.swift8// Module : Tests9// Repository : https://git.spboucher.ai/sp-glasskit10// Project Website : https://glass.spboucher.ai11// Created : 2026-12-0212// Last Modified : 2026-12-0213//14// Author : Simon-Pierre Boucher15// Position : Professor of Finance16// Institution : Université du Québec en Outaouais (UQO)17// Organization : SP Boucher18// Website : https://spboucher.ai19// Git : https://git.spboucher.ai20//21// Preferred Contact: contact@spboucher.ai22// Development : dev@spboucher.ai23// Support : support@spboucher.ai24// Security/Admin : admin@spboucher.ai25//26// Copyright (c) 202627// Simon-Pierre Boucher28// All rights reserved where applicable. This file is governed by the29// applicable project license, copyright notices and relevant law.30// Existing third-party rights and notices remain unaffected.31//32// License : MIT33//34// Do not embed credentials, private keys, access tokens,35// certificates or confidential personal information.36//37// =============================================================================38// END OF SP BOUCHER SOURCE HEADER39// =============================================================================4041import SwiftUI42import Testing43import SPGlassCore44@testable import SPGlassComponents4546@Suite("GlassPopover")47struct GlassPopoverTests {48 @Test("An adapted popover gets a close button", arguments: [GlassPopoverAdaptation.automatic, .sheet, .fullScreenCover], [GlassPlatform.iOS, .iPadOS])49 func adaptedNeedsClose(adaptation: GlassPopoverAdaptation, platform: GlassPlatform) {50 #expect(adaptation.needsCloseButton(isCompact: true, platform: platform))51 #expect(!adaptation.needsCloseButton(isCompact: false, platform: platform))52 }5354 @Test func aPopoverThatStaysAPopoverNeedsNoButton() {55 #expect(!GlassPopoverAdaptation.popover.needsCloseButton(isCompact: true, platform: .iOS))56 #expect(!GlassPopoverAdaptation.popover.needsCloseButton(isCompact: false, platform: .iPadOS))57 }5859 @Test("macOS popovers never adapt", arguments: GlassPopoverAdaptation.allCases)60 func macNeverAdapts(adaptation: GlassPopoverAdaptation) {61 #expect(!adaptation.needsCloseButton(isCompact: true, platform: .macOS))62 #expect(!adaptation.needsCloseButton(isCompact: false, platform: .macOS))63 }6465 @Test func fourAdaptationsAreOffered() {66 #expect(GlassPopoverAdaptation.allCases == [.automatic, .popover, .sheet, .fullScreenCover])67 }68}69