diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1a7c0f534..d881c44a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,18 +42,19 @@ jobs: include: - platform: [iOS, 15] runtime: iOS 15.5 - os: macos-14 - xcode: 16.2 + os: macos-15 + xcode: 16.4 install: true - platform: [iOS, 16] runtime: iOS 16.4 - os: macos-14 - xcode: 16.2 + os: macos-15 + xcode: 16.4 install: true - platform: [iOS, 17] runtime: iOS 17.5 - os: macos-14 - xcode: 16.2 + os: macos-15 + xcode: 16.4 + install: true - platform: [iOS, 18] runtime: iOS 18.5 os: macos-15 @@ -65,18 +66,19 @@ jobs: - platform: [tvOS, 15] runtime: tvOS 15.4 - os: macos-14 - xcode: 16.2 + os: macos-15 + xcode: 16.4 install: true - platform: [tvOS, 16] runtime: tvOS 16.4 - os: macos-14 - xcode: 16.2 + os: macos-15 + xcode: 16.4 install: true - platform: [tvOS, 17] runtime: tvOS 17.5 - os: macos-14 - xcode: 16.2 + os: macos-15 + xcode: 16.4 + install: true - platform: [tvOS, 18] runtime: tvOS 18.5 os: macos-15 @@ -88,18 +90,19 @@ jobs: - platform: [watchOS, 8] runtime: watchOS 8.5 - os: macos-14 - xcode: 16.2 + os: macos-15 + xcode: 16.4 install: true - platform: [watchOS, 9] runtime: watchOS 9.4 - os: macos-14 - xcode: 16.2 + os: macos-15 + xcode: 16.4 install: true - platform: [watchOS, 10] runtime: watchOS 10.5 - os: macos-14 - xcode: 16.2 + os: macos-15 + xcode: 16.4 + install: true - platform: [watchOS, 11] runtime: watchOS 11.5 os: macos-15 @@ -109,14 +112,10 @@ jobs: # os: macos-15 # xcode: 26.0 - - platform: [macOS, 14] - runtime: macOS 14 - os: macos-14 - xcode: 16.2 - platform: [macOS, 15] runtime: macOS 15 os: macos-15 - xcode: 16.2 + xcode: 16.4 # - platform: [macOS, 26] # runtime: macOS 26.0 # os: macos-15 @@ -124,8 +123,9 @@ jobs: - platform: [visionOS, 1] runtime: visionOS 1.2 - os: macos-14 - xcode: 16.2 + os: macos-15 + xcode: 16.4 + install: true - platform: [visionOS, 2] runtime: visionOS 2.5 os: macos-15 @@ -172,7 +172,3 @@ jobs: - if: ${{ matrix.platform[0] != 'watchOS' }} name: Run Tests run: fastlane test platform:${{ matrix.platform[0] }} version:${{ matrix.platform[1] }} scheme:SwiftUIIntrospectTests configuration:Debug - - # - if: ${{ matrix.platform[0] == 'iOS' && matrix.platform[1] <= '16' }} - # name: Run UI Tests - # run: fastlane test platform:${{ matrix.platform[0] }} version:${{ matrix.platform[1] }} scheme:SwiftUIIntrospectUITests configuration:Debug diff --git a/SwiftUIIntrospect.xcworkspace/xcshareddata/swiftpm/Package.resolved b/SwiftUIIntrospect.xcworkspace/xcshareddata/swiftpm/Package.resolved deleted file mode 100644 index 01642cef6..000000000 --- a/SwiftUIIntrospect.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ /dev/null @@ -1,14 +0,0 @@ -{ - "pins" : [ - { - "identity" : "swift-snapshot-testing", - "kind" : "remoteSourceControl", - "location" : "https://github.com/pointfreeco/swift-snapshot-testing.git", - "state" : { - "revision" : "dc46eeb3928a75390651fac6c1ef7f93ad59a73b", - "version" : "1.11.1" - } - } - ], - "version" : 2 -} diff --git a/Tests/Tests.xcodeproj/project.pbxproj b/Tests/Tests.xcodeproj/project.pbxproj index 2de80383f..30f6ad12c 100644 --- a/Tests/Tests.xcodeproj/project.pbxproj +++ b/Tests/Tests.xcodeproj/project.pbxproj @@ -51,25 +51,12 @@ D58547FA2A1D12270068ADF4 /* NavigationSplitViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D58547F92A1D12270068ADF4 /* NavigationSplitViewTests.swift */; }; D58CE15629C621B30081BFB0 /* SwiftUIIntrospect in Frameworks */ = {isa = PBXBuildFile; productRef = D58CE15529C621B30081BFB0 /* SwiftUIIntrospect */; }; D58CE15829C621DD0081BFB0 /* TestUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = D58CE15729C621DD0081BFB0 /* TestUtils.swift */; }; - D58D832E2A66BDD500A203BE /* StatusBarStyleUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D58D832D2A66BDD500A203BE /* StatusBarStyleUITests.swift */; }; - D58D83382A66C01300A203BE /* SnapshotTesting in Frameworks */ = {isa = PBXBuildFile; productRef = D58D83372A66C01300A203BE /* SnapshotTesting */; }; - D58D833A2A66C04600A203BE /* SwiftUIIntrospect in Frameworks */ = {isa = PBXBuildFile; productRef = D58D83392A66C04600A203BE /* SwiftUIIntrospect */; }; - D58D83422A66C5EC00A203BE /* UITestsHostApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = D58D83412A66C5EC00A203BE /* UITestsHostApp.swift */; }; - D58D83462A66C5EF00A203BE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D58D83452A66C5EF00A203BE /* Assets.xcassets */; }; - D58D83492A66C5EF00A203BE /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D58D83482A66C5EF00A203BE /* Preview Assets.xcassets */; }; - D58D83502A66C67A00A203BE /* TestCases.swift in Sources */ = {isa = PBXBuildFile; fileRef = D58D834F2A66C67A00A203BE /* TestCases.swift */; }; D591D1122A9CC2FF00AE05E8 /* WeakTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D591D1112A9CC2FF00AE05E8 /* WeakTests.swift */; }; - D5983E7D2A66FD3F00C50953 /* TestCases.swift in Sources */ = {isa = PBXBuildFile; fileRef = D58D834F2A66C67A00A203BE /* TestCases.swift */; }; D5AAF56F2A502EF000CAFFB6 /* MapTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5AAF56E2A502EF000CAFFB6 /* MapTests.swift */; }; D5AD0D912A114B98003D8DEC /* TextFieldWithVerticalAxisTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5AD0D902A114B98003D8DEC /* TextFieldWithVerticalAxisTests.swift */; }; D5ADFACC2A4A22AE009494FD /* SheetTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5ADFACB2A4A22AE009494FD /* SheetTests.swift */; }; D5ADFACE2A4A3482009494FD /* FullScreenCoverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5ADFACD2A4A3482009494FD /* FullScreenCoverTests.swift */; }; D5ADFAD02A4A3E54009494FD /* PopoverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5ADFACF2A4A3E54009494FD /* PopoverTests.swift */; }; - D5AEC33F2A66F31F0015AC1D /* UITestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5AEC33E2A66F31F0015AC1D /* UITestCase.swift */; }; - D5AEC3442A66F6470015AC1D /* RootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5AEC3412A66F6470015AC1D /* RootView.swift */; }; - D5AEC3452A66F6470015AC1D /* HostingController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5AEC3422A66F6470015AC1D /* HostingController.swift */; }; - D5AEC3462A66F6470015AC1D /* NavigationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5AEC3432A66F6470015AC1D /* NavigationView.swift */; }; - D5AEC3482A66F6AA0015AC1D /* SwiftUIIntrospect in Frameworks */ = {isa = PBXBuildFile; productRef = D5AEC3472A66F6AA0015AC1D /* SwiftUIIntrospect */; }; D5B67B842A0D318F007D5D9B /* TextFieldTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5B67B832A0D318F007D5D9B /* TextFieldTests.swift */; }; D5F0BE4D29C0DBE800AD95AB /* TestsHostApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5F0BE4C29C0DBE800AD95AB /* TestsHostApp.swift */; }; D5F0BE6A29C0DC4900AD95AB /* PlatformVersionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5F0BE6729C0DC4900AD95AB /* PlatformVersionTests.swift */; }; @@ -77,17 +64,9 @@ D5F26E042A56E74B001209E6 /* ViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5F26E032A56E74B001209E6 /* ViewControllerTests.swift */; }; D5F8D5ED2A1E7B490054E9AB /* NavigationViewWithStackStyleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5F8D5EC2A1E7B490054E9AB /* NavigationViewWithStackStyleTests.swift */; }; D5F8D5EF2A1E87950054E9AB /* NavigationViewWithColumnsStyleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5F8D5EE2A1E87950054E9AB /* NavigationViewWithColumnsStyleTests.swift */; }; - E8B5A7882AA271BA002C4AD3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E8B5A7872AA271BA002C4AD3 /* LaunchScreen.storyboard */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - D58D834D2A66C61700A203BE /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D5F0BE3F29C0DB9700AD95AB /* Project object */; - proxyType = 1; - remoteGlobalIDString = D58D833E2A66C5EC00A203BE; - remoteInfo = UITestsHostApp; - }; D5F0BE6129C0DC0000AD95AB /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = D5F0BE3F29C0DB9700AD95AB /* Project object */; @@ -101,7 +80,6 @@ D503B2AB2A49BFE300027F5F /* VideoPlayerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoPlayerTests.swift; sourceTree = ""; }; D50FFE8D2A17E2A400C32641 /* ScrollViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScrollViewTests.swift; sourceTree = ""; }; D534D4DB2A4A596200218BFB /* WindowTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowTests.swift; sourceTree = ""; }; - D549D9732A66D876005D4FB5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; D55BAD132DFF2B050038443E /* WebViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewTests.swift; sourceTree = ""; }; D55F448C2A1FF209003381E4 /* ListTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTests.swift; sourceTree = ""; }; D57506772A27BBBD00A628E4 /* PickerWithSegmentedStyleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PickerWithSegmentedStyleTests.swift; sourceTree = ""; }; @@ -142,24 +120,12 @@ D58547F72A1CDD740068ADF4 /* NavigationStackTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationStackTests.swift; sourceTree = ""; }; D58547F92A1D12270068ADF4 /* NavigationSplitViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationSplitViewTests.swift; sourceTree = ""; }; D58CE15729C621DD0081BFB0 /* TestUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestUtils.swift; sourceTree = ""; }; - D58D832B2A66BDD500A203BE /* UITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - D58D832D2A66BDD500A203BE /* StatusBarStyleUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusBarStyleUITests.swift; sourceTree = ""; }; - D58D833F2A66C5EC00A203BE /* UITestsHostApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UITestsHostApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; - D58D83412A66C5EC00A203BE /* UITestsHostApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UITestsHostApp.swift; sourceTree = ""; }; - D58D83452A66C5EF00A203BE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - D58D83482A66C5EF00A203BE /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; - D58D834F2A66C67A00A203BE /* TestCases.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestCases.swift; sourceTree = ""; }; D591D1112A9CC2FF00AE05E8 /* WeakTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeakTests.swift; sourceTree = ""; }; D5AAF56E2A502EF000CAFFB6 /* MapTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapTests.swift; sourceTree = ""; }; D5AD0D902A114B98003D8DEC /* TextFieldWithVerticalAxisTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldWithVerticalAxisTests.swift; sourceTree = ""; }; D5ADFACB2A4A22AE009494FD /* SheetTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SheetTests.swift; sourceTree = ""; }; D5ADFACD2A4A3482009494FD /* FullScreenCoverTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FullScreenCoverTests.swift; sourceTree = ""; }; D5ADFACF2A4A3E54009494FD /* PopoverTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PopoverTests.swift; sourceTree = ""; }; - D5AEC33E2A66F31F0015AC1D /* UITestCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UITestCase.swift; sourceTree = ""; }; - D5AEC3412A66F6470015AC1D /* RootView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RootView.swift; sourceTree = ""; }; - D5AEC3422A66F6470015AC1D /* HostingController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HostingController.swift; sourceTree = ""; }; - D5AEC3432A66F6470015AC1D /* NavigationView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationView.swift; sourceTree = ""; }; - D5B5B03E2A6725500086B9DE /* UITests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; name = UITests.xctestplan; path = "/Users/davdroman/Developer/davdroman/swiftui-introspect/Tests/UITests/UITests.xctestplan"; sourceTree = ""; }; D5B67B832A0D318F007D5D9B /* TextFieldTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldTests.swift; sourceTree = ""; }; D5F0BE4929C0DBE800AD95AB /* TestsHostApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TestsHostApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; D5F0BE4C29C0DBE800AD95AB /* TestsHostApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestsHostApp.swift; sourceTree = ""; }; @@ -169,27 +135,9 @@ D5F26E032A56E74B001209E6 /* ViewControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewControllerTests.swift; sourceTree = ""; }; D5F8D5EC2A1E7B490054E9AB /* NavigationViewWithStackStyleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationViewWithStackStyleTests.swift; sourceTree = ""; }; D5F8D5EE2A1E87950054E9AB /* NavigationViewWithColumnsStyleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationViewWithColumnsStyleTests.swift; sourceTree = ""; }; - E8B5A7872AA271BA002C4AD3 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - D58D83282A66BDD500A203BE /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - D58D83382A66C01300A203BE /* SnapshotTesting in Frameworks */, - D58D833A2A66C04600A203BE /* SwiftUIIntrospect in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D58D833C2A66C5EC00A203BE /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - D5AEC3482A66F6AA0015AC1D /* SwiftUIIntrospect in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; D5F0BE4629C0DBE800AD95AB /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -208,64 +156,6 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - D5459AA32A67072F00F0D737 /* __Snapshots__ */ = { - isa = PBXGroup; - children = ( - D5459AA42A67072F00F0D737 /* StatusBarStyleUITests */, - ); - path = __Snapshots__; - sourceTree = ""; - }; - D5459AA42A67072F00F0D737 /* StatusBarStyleUITests */ = { - isa = PBXGroup; - children = ( - ); - path = StatusBarStyleUITests; - sourceTree = ""; - }; - D58D832C2A66BDD500A203BE /* UITests */ = { - isa = PBXGroup; - children = ( - D5B5B03E2A6725500086B9DE /* UITests.xctestplan */, - D58D832D2A66BDD500A203BE /* StatusBarStyleUITests.swift */, - D5AEC33E2A66F31F0015AC1D /* UITestCase.swift */, - D5459AA32A67072F00F0D737 /* __Snapshots__ */, - ); - path = UITests; - sourceTree = ""; - }; - D58D83402A66C5EC00A203BE /* UITestsHostApp */ = { - isa = PBXGroup; - children = ( - E8B5A7872AA271BA002C4AD3 /* LaunchScreen.storyboard */, - D549D9732A66D876005D4FB5 /* Info.plist */, - D58D83412A66C5EC00A203BE /* UITestsHostApp.swift */, - D58D834F2A66C67A00A203BE /* TestCases.swift */, - D5AEC3402A66F6210015AC1D /* StatusBarStyle */, - D58D83452A66C5EF00A203BE /* Assets.xcassets */, - D58D83472A66C5EF00A203BE /* Preview Content */, - ); - path = UITestsHostApp; - sourceTree = ""; - }; - D58D83472A66C5EF00A203BE /* Preview Content */ = { - isa = PBXGroup; - children = ( - D58D83482A66C5EF00A203BE /* Preview Assets.xcassets */, - ); - path = "Preview Content"; - sourceTree = ""; - }; - D5AEC3402A66F6210015AC1D /* StatusBarStyle */ = { - isa = PBXGroup; - children = ( - D5AEC3422A66F6470015AC1D /* HostingController.swift */, - D5AEC3432A66F6470015AC1D /* NavigationView.swift */, - D5AEC3412A66F6470015AC1D /* RootView.swift */, - ); - path = StatusBarStyle; - sourceTree = ""; - }; D5B67B852A0D3193007D5D9B /* ViewTypes */ = { isa = PBXGroup; children = ( @@ -330,8 +220,6 @@ children = ( D5F0BE4B29C0DBE800AD95AB /* TestsHostApp */, D5F0BE5E29C0DC0000AD95AB /* Tests */, - D58D83402A66C5EC00A203BE /* UITestsHostApp */, - D58D832C2A66BDD500A203BE /* UITests */, D5F0BE4A29C0DBE800AD95AB /* Products */, D5F0BE7029C0E12300AD95AB /* Frameworks */, ); @@ -342,8 +230,6 @@ children = ( D5F0BE4929C0DBE800AD95AB /* TestsHostApp.app */, D5F0BE5D29C0DC0000AD95AB /* Tests.xctest */, - D58D832B2A66BDD500A203BE /* UITests.xctest */, - D58D833F2A66C5EC00A203BE /* UITestsHostApp.app */, ); name = Products; sourceTree = ""; @@ -377,48 +263,6 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - D58D832A2A66BDD500A203BE /* UITests */ = { - isa = PBXNativeTarget; - buildConfigurationList = D58D83352A66BDD500A203BE /* Build configuration list for PBXNativeTarget "UITests" */; - buildPhases = ( - D58D83272A66BDD500A203BE /* Sources */, - D58D83282A66BDD500A203BE /* Frameworks */, - D58D83292A66BDD500A203BE /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - D58D834E2A66C61700A203BE /* PBXTargetDependency */, - ); - name = UITests; - packageProductDependencies = ( - D58D83372A66C01300A203BE /* SnapshotTesting */, - D58D83392A66C04600A203BE /* SwiftUIIntrospect */, - ); - productName = UITests; - productReference = D58D832B2A66BDD500A203BE /* UITests.xctest */; - productType = "com.apple.product-type.bundle.ui-testing"; - }; - D58D833E2A66C5EC00A203BE /* UITestsHostApp */ = { - isa = PBXNativeTarget; - buildConfigurationList = D58D834C2A66C5EF00A203BE /* Build configuration list for PBXNativeTarget "UITestsHostApp" */; - buildPhases = ( - D58D833B2A66C5EC00A203BE /* Sources */, - D58D833C2A66C5EC00A203BE /* Frameworks */, - D58D833D2A66C5EC00A203BE /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = UITestsHostApp; - packageProductDependencies = ( - D5AEC3472A66F6AA0015AC1D /* SwiftUIIntrospect */, - ); - productName = UITestsHostApp; - productReference = D58D833F2A66C5EC00A203BE /* UITestsHostApp.app */; - productType = "com.apple.product-type.application"; - }; D5F0BE4829C0DBE800AD95AB /* TestsHostApp */ = { isa = PBXNativeTarget; buildConfigurationList = D5F0BE5829C0DBE900AD95AB /* Build configuration list for PBXNativeTarget "TestsHostApp" */; @@ -467,13 +311,6 @@ LastSwiftUpdateCheck = 1500; LastUpgradeCheck = 1500; TargetAttributes = { - D58D832A2A66BDD500A203BE = { - CreatedOnToolsVersion = 15.0; - TestTargetID = D58D833E2A66C5EC00A203BE; - }; - D58D833E2A66C5EC00A203BE = { - CreatedOnToolsVersion = 15.0; - }; D5F0BE4829C0DBE800AD95AB = { CreatedOnToolsVersion = 14.2; }; @@ -494,7 +331,6 @@ ); mainGroup = D5F0BE3E29C0DB9700AD95AB; packageReferences = ( - D58D83362A66C01300A203BE /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */, ); productRefGroup = D5F0BE4A29C0DBE800AD95AB /* Products */; projectDirPath = ""; @@ -502,30 +338,11 @@ targets = ( D5F0BE4829C0DBE800AD95AB /* TestsHostApp */, D5F0BE5C29C0DC0000AD95AB /* Tests */, - D58D833E2A66C5EC00A203BE /* UITestsHostApp */, - D58D832A2A66BDD500A203BE /* UITests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ - D58D83292A66BDD500A203BE /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D58D833D2A66C5EC00A203BE /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - E8B5A7882AA271BA002C4AD3 /* LaunchScreen.storyboard in Resources */, - D58D83492A66C5EF00A203BE /* Preview Assets.xcassets in Resources */, - D58D83462A66C5EF00A203BE /* Assets.xcassets in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; D5F0BE4729C0DBE800AD95AB /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -543,28 +360,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - D58D83272A66BDD500A203BE /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - D58D832E2A66BDD500A203BE /* StatusBarStyleUITests.swift in Sources */, - D5AEC33F2A66F31F0015AC1D /* UITestCase.swift in Sources */, - D5983E7D2A66FD3F00C50953 /* TestCases.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D58D833B2A66C5EC00A203BE /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - D58D83422A66C5EC00A203BE /* UITestsHostApp.swift in Sources */, - D58D83502A66C67A00A203BE /* TestCases.swift in Sources */, - D5AEC3462A66F6470015AC1D /* NavigationView.swift in Sources */, - D5AEC3452A66F6470015AC1D /* HostingController.swift in Sources */, - D5AEC3442A66F6470015AC1D /* RootView.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; D5F0BE4529C0DBE800AD95AB /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -638,11 +433,6 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - D58D834E2A66C61700A203BE /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = D58D833E2A66C5EC00A203BE /* UITestsHostApp */; - targetProxy = D58D834D2A66C61700A203BE /* PBXContainerItemProxy */; - }; D5F0BE6229C0DC0000AD95AB /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = D5F0BE4829C0DBE800AD95AB /* TestsHostApp */; @@ -651,330 +441,6 @@ /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ - D58D83332A66BDD500A203BE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_STYLE = Automatic; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEVELOPMENT_TEAM = ""; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - ENABLE_USER_SCRIPT_SANDBOXING = YES; - GCC_C_LANGUAGE_STANDARD = gnu17; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - GENERATE_INFOPLIST_FILE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; - LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MARKETING_VERSION = 1.0; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - ONLY_ACTIVE_ARCH = YES; - PRODUCT_BUNDLE_IDENTIFIER = com.siteline.UITests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = iphoneos; - SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; - SUPPORTS_MACCATALYST = NO; - SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; - SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; - SWIFT_EMIT_LOC_STRINGS = NO; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_TARGET_NAME = UITestsHostApp; - TVOS_DEPLOYMENT_TARGET = 14.0; - }; - name = Debug; - }; - D58D83342A66BDD500A203BE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_STYLE = Automatic; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEVELOPMENT_TEAM = ""; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_USER_SCRIPT_SANDBOXING = YES; - GCC_C_LANGUAGE_STANDARD = gnu17; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - GENERATE_INFOPLIST_FILE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; - LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MARKETING_VERSION = 1.0; - MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = com.siteline.UITests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = iphoneos; - SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; - SUPPORTS_MACCATALYST = NO; - SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; - SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_EMIT_LOC_STRINGS = NO; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_TARGET_NAME = UITestsHostApp; - TVOS_DEPLOYMENT_TARGET = 14.0; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - D58D834A2A66C5EF00A203BE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_STYLE = Automatic; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEVELOPMENT_ASSET_PATHS = "\"UITestsHostApp/Preview Content\""; - ENABLE_PREVIEWS = YES; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - ENABLE_USER_SCRIPT_SANDBOXING = YES; - GCC_C_LANGUAGE_STANDARD = gnu17; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = UITestsHostApp/Info.plist; - INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; - INFOPLIST_KEY_UILaunchScreen_Generation = YES; - INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen.storyboard; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MARKETING_VERSION = 1.0; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - ONLY_ACTIVE_ARCH = YES; - PRODUCT_BUNDLE_IDENTIFIER = com.siteline.UITestsHostApp; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = iphoneos; - SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; - SUPPORTS_MACCATALYST = NO; - SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; - SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; - SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - D58D834B2A66C5EF00A203BE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_STYLE = Automatic; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEVELOPMENT_ASSET_PATHS = "\"UITestsHostApp/Preview Content\""; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_PREVIEWS = YES; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_USER_SCRIPT_SANDBOXING = YES; - GCC_C_LANGUAGE_STANDARD = gnu17; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = UITestsHostApp/Info.plist; - INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; - INFOPLIST_KEY_UILaunchScreen_Generation = YES; - INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen.storyboard; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MARKETING_VERSION = 1.0; - MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = com.siteline.UITestsHostApp; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = iphoneos; - SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; - SUPPORTS_MACCATALYST = NO; - SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; - SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; D5F0BE4329C0DB9700AD95AB /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1400,24 +866,6 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - D58D83352A66BDD500A203BE /* Build configuration list for PBXNativeTarget "UITests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D58D83332A66BDD500A203BE /* Debug */, - D58D83342A66BDD500A203BE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - D58D834C2A66C5EF00A203BE /* Build configuration list for PBXNativeTarget "UITestsHostApp" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D58D834A2A66C5EF00A203BE /* Debug */, - D58D834B2A66C5EF00A203BE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; D5F0BE4229C0DB9700AD95AB /* Build configuration list for PBXProject "Tests" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -1447,35 +895,11 @@ }; /* End XCConfigurationList section */ -/* Begin XCRemoteSwiftPackageReference section */ - D58D83362A66C01300A203BE /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/pointfreeco/swift-snapshot-testing.git"; - requirement = { - kind = upToNextMajorVersion; - minimumVersion = 1.11.1; - }; - }; -/* End XCRemoteSwiftPackageReference section */ - /* Begin XCSwiftPackageProductDependency section */ D58CE15529C621B30081BFB0 /* SwiftUIIntrospect */ = { isa = XCSwiftPackageProductDependency; productName = SwiftUIIntrospect; }; - D58D83372A66C01300A203BE /* SnapshotTesting */ = { - isa = XCSwiftPackageProductDependency; - package = D58D83362A66C01300A203BE /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */; - productName = SnapshotTesting; - }; - D58D83392A66C04600A203BE /* SwiftUIIntrospect */ = { - isa = XCSwiftPackageProductDependency; - productName = SwiftUIIntrospect; - }; - D5AEC3472A66F6AA0015AC1D /* SwiftUIIntrospect */ = { - isa = XCSwiftPackageProductDependency; - productName = SwiftUIIntrospect; - }; /* End XCSwiftPackageProductDependency section */ }; rootObject = D5F0BE3F29C0DB9700AD95AB /* Project object */; diff --git a/Tests/Tests.xcodeproj/xcshareddata/xcschemes/SwiftUIIntrospectTests.xcscheme b/Tests/Tests.xcodeproj/xcshareddata/xcschemes/SwiftUIIntrospectTests.xcscheme index ae540df31..e79e1d06f 100644 --- a/Tests/Tests.xcodeproj/xcshareddata/xcschemes/SwiftUIIntrospectTests.xcscheme +++ b/Tests/Tests.xcodeproj/xcshareddata/xcschemes/SwiftUIIntrospectTests.xcscheme @@ -29,7 +29,8 @@ shouldUseLaunchSchemeArgsEnv = "YES"> + skipped = "NO" + parallelizable = "NO"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Tests/Tests/PlatformVersionTests.swift b/Tests/Tests/PlatformVersionTests.swift index fcd4cf8ec..6f26ab710 100644 --- a/Tests/Tests/PlatformVersionTests.swift +++ b/Tests/Tests/PlatformVersionTests.swift @@ -1,433 +1,434 @@ @_spi(Internals) import SwiftUIIntrospect -import XCTest +import Testing -final class PlatformVersionTests: XCTestCase { - func test_iOS_isCurrent() { +@Suite +struct PlatformVersionTests { + @Test func iOS_isCurrent() { #if os(iOS) if #available(iOS 26, *) { - XCTAssertEqual(iOSVersion.v26.isCurrent, true) - XCTAssertEqual(iOSVersion.v18.isCurrent, false) - XCTAssertEqual(iOSVersion.v17.isCurrent, false) - XCTAssertEqual(iOSVersion.v16.isCurrent, false) - XCTAssertEqual(iOSVersion.v15.isCurrent, false) - XCTAssertEqual(iOSVersion.v14.isCurrent, false) - XCTAssertEqual(iOSVersion.v13.isCurrent, false) + #expect(iOSVersion.v26.isCurrent == true) + #expect(iOSVersion.v18.isCurrent == false) + #expect(iOSVersion.v17.isCurrent == false) + #expect(iOSVersion.v16.isCurrent == false) + #expect(iOSVersion.v15.isCurrent == false) + #expect(iOSVersion.v14.isCurrent == false) + #expect(iOSVersion.v13.isCurrent == false) } else if #available(iOS 18, *) { - XCTAssertEqual(iOSVersion.v18.isCurrent, true) - XCTAssertEqual(iOSVersion.v17.isCurrent, false) - XCTAssertEqual(iOSVersion.v16.isCurrent, false) - XCTAssertEqual(iOSVersion.v15.isCurrent, false) - XCTAssertEqual(iOSVersion.v14.isCurrent, false) - XCTAssertEqual(iOSVersion.v13.isCurrent, false) + #expect(iOSVersion.v18.isCurrent == true) + #expect(iOSVersion.v17.isCurrent == false) + #expect(iOSVersion.v16.isCurrent == false) + #expect(iOSVersion.v15.isCurrent == false) + #expect(iOSVersion.v14.isCurrent == false) + #expect(iOSVersion.v13.isCurrent == false) } else if #available(iOS 17, *) { - XCTAssertEqual(iOSVersion.v18.isCurrent, false) - XCTAssertEqual(iOSVersion.v17.isCurrent, true) - XCTAssertEqual(iOSVersion.v16.isCurrent, false) - XCTAssertEqual(iOSVersion.v15.isCurrent, false) - XCTAssertEqual(iOSVersion.v14.isCurrent, false) - XCTAssertEqual(iOSVersion.v13.isCurrent, false) + #expect(iOSVersion.v18.isCurrent == false) + #expect(iOSVersion.v17.isCurrent == true) + #expect(iOSVersion.v16.isCurrent == false) + #expect(iOSVersion.v15.isCurrent == false) + #expect(iOSVersion.v14.isCurrent == false) + #expect(iOSVersion.v13.isCurrent == false) } else if #available(iOS 16, *) { - XCTAssertEqual(iOSVersion.v18.isCurrent, false) - XCTAssertEqual(iOSVersion.v17.isCurrent, false) - XCTAssertEqual(iOSVersion.v16.isCurrent, true) - XCTAssertEqual(iOSVersion.v15.isCurrent, false) - XCTAssertEqual(iOSVersion.v14.isCurrent, false) - XCTAssertEqual(iOSVersion.v13.isCurrent, false) + #expect(iOSVersion.v18.isCurrent == false) + #expect(iOSVersion.v17.isCurrent == false) + #expect(iOSVersion.v16.isCurrent == true) + #expect(iOSVersion.v15.isCurrent == false) + #expect(iOSVersion.v14.isCurrent == false) + #expect(iOSVersion.v13.isCurrent == false) } else if #available(iOS 15, *) { - XCTAssertEqual(iOSVersion.v18.isCurrent, false) - XCTAssertEqual(iOSVersion.v17.isCurrent, false) - XCTAssertEqual(iOSVersion.v16.isCurrent, false) - XCTAssertEqual(iOSVersion.v15.isCurrent, true) - XCTAssertEqual(iOSVersion.v14.isCurrent, false) - XCTAssertEqual(iOSVersion.v13.isCurrent, false) + #expect(iOSVersion.v18.isCurrent == false) + #expect(iOSVersion.v17.isCurrent == false) + #expect(iOSVersion.v16.isCurrent == false) + #expect(iOSVersion.v15.isCurrent == true) + #expect(iOSVersion.v14.isCurrent == false) + #expect(iOSVersion.v13.isCurrent == false) } else if #available(iOS 14, *) { - XCTAssertEqual(iOSVersion.v18.isCurrent, false) - XCTAssertEqual(iOSVersion.v17.isCurrent, false) - XCTAssertEqual(iOSVersion.v16.isCurrent, false) - XCTAssertEqual(iOSVersion.v15.isCurrent, false) - XCTAssertEqual(iOSVersion.v14.isCurrent, true) - XCTAssertEqual(iOSVersion.v13.isCurrent, false) + #expect(iOSVersion.v18.isCurrent == false) + #expect(iOSVersion.v17.isCurrent == false) + #expect(iOSVersion.v16.isCurrent == false) + #expect(iOSVersion.v15.isCurrent == false) + #expect(iOSVersion.v14.isCurrent == true) + #expect(iOSVersion.v13.isCurrent == false) } else if #available(iOS 13, *) { - XCTAssertEqual(iOSVersion.v18.isCurrent, false) - XCTAssertEqual(iOSVersion.v17.isCurrent, false) - XCTAssertEqual(iOSVersion.v16.isCurrent, false) - XCTAssertEqual(iOSVersion.v15.isCurrent, false) - XCTAssertEqual(iOSVersion.v14.isCurrent, false) - XCTAssertEqual(iOSVersion.v13.isCurrent, true) + #expect(iOSVersion.v18.isCurrent == false) + #expect(iOSVersion.v17.isCurrent == false) + #expect(iOSVersion.v16.isCurrent == false) + #expect(iOSVersion.v15.isCurrent == false) + #expect(iOSVersion.v14.isCurrent == false) + #expect(iOSVersion.v13.isCurrent == true) } #else - XCTAssertEqual(iOSVersion.v26.isCurrent, false) - XCTAssertEqual(iOSVersion.v18.isCurrent, false) - XCTAssertEqual(iOSVersion.v17.isCurrent, false) - XCTAssertEqual(iOSVersion.v16.isCurrent, false) - XCTAssertEqual(iOSVersion.v15.isCurrent, false) - XCTAssertEqual(iOSVersion.v14.isCurrent, false) - XCTAssertEqual(iOSVersion.v13.isCurrent, false) + #expect(iOSVersion.v26.isCurrent == false) + #expect(iOSVersion.v18.isCurrent == false) + #expect(iOSVersion.v17.isCurrent == false) + #expect(iOSVersion.v16.isCurrent == false) + #expect(iOSVersion.v15.isCurrent == false) + #expect(iOSVersion.v14.isCurrent == false) + #expect(iOSVersion.v13.isCurrent == false) #endif } - func test_iOS_isCurrentOrPast() { + @Test func iOS_isCurrentOrPast() { #if os(iOS) if #available(iOS 26, *) { - XCTAssertEqual(iOSVersion.v26.isCurrentOrPast, true) - XCTAssertEqual(iOSVersion.v18.isCurrentOrPast, true) - XCTAssertEqual(iOSVersion.v17.isCurrentOrPast, true) - XCTAssertEqual(iOSVersion.v16.isCurrentOrPast, true) - XCTAssertEqual(iOSVersion.v15.isCurrentOrPast, true) - XCTAssertEqual(iOSVersion.v14.isCurrentOrPast, true) - XCTAssertEqual(iOSVersion.v13.isCurrentOrPast, true) + #expect(iOSVersion.v26.isCurrentOrPast == true) + #expect(iOSVersion.v18.isCurrentOrPast == true) + #expect(iOSVersion.v17.isCurrentOrPast == true) + #expect(iOSVersion.v16.isCurrentOrPast == true) + #expect(iOSVersion.v15.isCurrentOrPast == true) + #expect(iOSVersion.v14.isCurrentOrPast == true) + #expect(iOSVersion.v13.isCurrentOrPast == true) } else if #available(iOS 18, *) { - XCTAssertEqual(iOSVersion.v18.isCurrentOrPast, true) - XCTAssertEqual(iOSVersion.v17.isCurrentOrPast, true) - XCTAssertEqual(iOSVersion.v16.isCurrentOrPast, true) - XCTAssertEqual(iOSVersion.v15.isCurrentOrPast, true) - XCTAssertEqual(iOSVersion.v14.isCurrentOrPast, true) - XCTAssertEqual(iOSVersion.v13.isCurrentOrPast, true) + #expect(iOSVersion.v18.isCurrentOrPast == true) + #expect(iOSVersion.v17.isCurrentOrPast == true) + #expect(iOSVersion.v16.isCurrentOrPast == true) + #expect(iOSVersion.v15.isCurrentOrPast == true) + #expect(iOSVersion.v14.isCurrentOrPast == true) + #expect(iOSVersion.v13.isCurrentOrPast == true) } else if #available(iOS 17, *) { - XCTAssertEqual(iOSVersion.v18.isCurrentOrPast, false) - XCTAssertEqual(iOSVersion.v17.isCurrentOrPast, true) - XCTAssertEqual(iOSVersion.v16.isCurrentOrPast, true) - XCTAssertEqual(iOSVersion.v15.isCurrentOrPast, true) - XCTAssertEqual(iOSVersion.v14.isCurrentOrPast, true) - XCTAssertEqual(iOSVersion.v13.isCurrentOrPast, true) + #expect(iOSVersion.v18.isCurrentOrPast == false) + #expect(iOSVersion.v17.isCurrentOrPast == true) + #expect(iOSVersion.v16.isCurrentOrPast == true) + #expect(iOSVersion.v15.isCurrentOrPast == true) + #expect(iOSVersion.v14.isCurrentOrPast == true) + #expect(iOSVersion.v13.isCurrentOrPast == true) } else if #available(iOS 16, *) { - XCTAssertEqual(iOSVersion.v18.isCurrentOrPast, false) - XCTAssertEqual(iOSVersion.v17.isCurrentOrPast, false) - XCTAssertEqual(iOSVersion.v16.isCurrentOrPast, true) - XCTAssertEqual(iOSVersion.v15.isCurrentOrPast, true) - XCTAssertEqual(iOSVersion.v14.isCurrentOrPast, true) - XCTAssertEqual(iOSVersion.v13.isCurrentOrPast, true) + #expect(iOSVersion.v18.isCurrentOrPast == false) + #expect(iOSVersion.v17.isCurrentOrPast == false) + #expect(iOSVersion.v16.isCurrentOrPast == true) + #expect(iOSVersion.v15.isCurrentOrPast == true) + #expect(iOSVersion.v14.isCurrentOrPast == true) + #expect(iOSVersion.v13.isCurrentOrPast == true) } else if #available(iOS 15, *) { - XCTAssertEqual(iOSVersion.v18.isCurrentOrPast, false) - XCTAssertEqual(iOSVersion.v17.isCurrentOrPast, false) - XCTAssertEqual(iOSVersion.v16.isCurrentOrPast, false) - XCTAssertEqual(iOSVersion.v15.isCurrentOrPast, true) - XCTAssertEqual(iOSVersion.v14.isCurrentOrPast, true) - XCTAssertEqual(iOSVersion.v13.isCurrentOrPast, true) + #expect(iOSVersion.v18.isCurrentOrPast == false) + #expect(iOSVersion.v17.isCurrentOrPast == false) + #expect(iOSVersion.v16.isCurrentOrPast == false) + #expect(iOSVersion.v15.isCurrentOrPast == true) + #expect(iOSVersion.v14.isCurrentOrPast == true) + #expect(iOSVersion.v13.isCurrentOrPast == true) } else if #available(iOS 14, *) { - XCTAssertEqual(iOSVersion.v18.isCurrentOrPast, false) - XCTAssertEqual(iOSVersion.v17.isCurrentOrPast, false) - XCTAssertEqual(iOSVersion.v16.isCurrentOrPast, false) - XCTAssertEqual(iOSVersion.v15.isCurrentOrPast, false) - XCTAssertEqual(iOSVersion.v14.isCurrentOrPast, true) - XCTAssertEqual(iOSVersion.v13.isCurrentOrPast, true) + #expect(iOSVersion.v18.isCurrentOrPast == false) + #expect(iOSVersion.v17.isCurrentOrPast == false) + #expect(iOSVersion.v16.isCurrentOrPast == false) + #expect(iOSVersion.v15.isCurrentOrPast == false) + #expect(iOSVersion.v14.isCurrentOrPast == true) + #expect(iOSVersion.v13.isCurrentOrPast == true) } else if #available(iOS 13, *) { - XCTAssertEqual(iOSVersion.v18.isCurrentOrPast, false) - XCTAssertEqual(iOSVersion.v17.isCurrentOrPast, false) - XCTAssertEqual(iOSVersion.v16.isCurrentOrPast, false) - XCTAssertEqual(iOSVersion.v15.isCurrentOrPast, false) - XCTAssertEqual(iOSVersion.v14.isCurrentOrPast, false) - XCTAssertEqual(iOSVersion.v13.isCurrentOrPast, true) + #expect(iOSVersion.v18.isCurrentOrPast == false) + #expect(iOSVersion.v17.isCurrentOrPast == false) + #expect(iOSVersion.v16.isCurrentOrPast == false) + #expect(iOSVersion.v15.isCurrentOrPast == false) + #expect(iOSVersion.v14.isCurrentOrPast == false) + #expect(iOSVersion.v13.isCurrentOrPast == true) } #else - XCTAssertEqual(iOSVersion.v26.isCurrentOrPast, false) - XCTAssertEqual(iOSVersion.v18.isCurrentOrPast, false) - XCTAssertEqual(iOSVersion.v17.isCurrentOrPast, false) - XCTAssertEqual(iOSVersion.v16.isCurrentOrPast, false) - XCTAssertEqual(iOSVersion.v15.isCurrentOrPast, false) - XCTAssertEqual(iOSVersion.v14.isCurrentOrPast, false) - XCTAssertEqual(iOSVersion.v13.isCurrentOrPast, false) + #expect(iOSVersion.v26.isCurrentOrPast == false) + #expect(iOSVersion.v18.isCurrentOrPast == false) + #expect(iOSVersion.v17.isCurrentOrPast == false) + #expect(iOSVersion.v16.isCurrentOrPast == false) + #expect(iOSVersion.v15.isCurrentOrPast == false) + #expect(iOSVersion.v14.isCurrentOrPast == false) + #expect(iOSVersion.v13.isCurrentOrPast == false) #endif } - func test_macOS_isCurrent() { + @Test func macOS_isCurrent() { #if os(macOS) if #available(macOS 26, *) { - XCTAssertEqual(macOSVersion.v26.isCurrent, true) - XCTAssertEqual(macOSVersion.v15.isCurrent, false) - XCTAssertEqual(macOSVersion.v14.isCurrent, false) - XCTAssertEqual(macOSVersion.v13.isCurrent, false) - XCTAssertEqual(macOSVersion.v12.isCurrent, false) - XCTAssertEqual(macOSVersion.v11.isCurrent, false) - XCTAssertEqual(macOSVersion.v10_15.isCurrent, false) + #expect(macOSVersion.v26.isCurrent == true) + #expect(macOSVersion.v15.isCurrent == false) + #expect(macOSVersion.v14.isCurrent == false) + #expect(macOSVersion.v13.isCurrent == false) + #expect(macOSVersion.v12.isCurrent == false) + #expect(macOSVersion.v11.isCurrent == false) + #expect(macOSVersion.v10_15.isCurrent == false) } else if #available(macOS 15, *) { - XCTAssertEqual(macOSVersion.v15.isCurrent, true) - XCTAssertEqual(macOSVersion.v14.isCurrent, false) - XCTAssertEqual(macOSVersion.v13.isCurrent, false) - XCTAssertEqual(macOSVersion.v12.isCurrent, false) - XCTAssertEqual(macOSVersion.v11.isCurrent, false) - XCTAssertEqual(macOSVersion.v10_15.isCurrent, false) + #expect(macOSVersion.v15.isCurrent == true) + #expect(macOSVersion.v14.isCurrent == false) + #expect(macOSVersion.v13.isCurrent == false) + #expect(macOSVersion.v12.isCurrent == false) + #expect(macOSVersion.v11.isCurrent == false) + #expect(macOSVersion.v10_15.isCurrent == false) } else if #available(macOS 14, *) { - XCTAssertEqual(macOSVersion.v15.isCurrent, false) - XCTAssertEqual(macOSVersion.v14.isCurrent, true) - XCTAssertEqual(macOSVersion.v13.isCurrent, false) - XCTAssertEqual(macOSVersion.v12.isCurrent, false) - XCTAssertEqual(macOSVersion.v11.isCurrent, false) - XCTAssertEqual(macOSVersion.v10_15.isCurrent, false) + #expect(macOSVersion.v15.isCurrent == false) + #expect(macOSVersion.v14.isCurrent == true) + #expect(macOSVersion.v13.isCurrent == false) + #expect(macOSVersion.v12.isCurrent == false) + #expect(macOSVersion.v11.isCurrent == false) + #expect(macOSVersion.v10_15.isCurrent == false) } else if #available(macOS 13, *) { - XCTAssertEqual(macOSVersion.v15.isCurrent, false) - XCTAssertEqual(macOSVersion.v14.isCurrent, false) - XCTAssertEqual(macOSVersion.v13.isCurrent, true) - XCTAssertEqual(macOSVersion.v12.isCurrent, false) - XCTAssertEqual(macOSVersion.v11.isCurrent, false) - XCTAssertEqual(macOSVersion.v10_15.isCurrent, false) + #expect(macOSVersion.v15.isCurrent == false) + #expect(macOSVersion.v14.isCurrent == false) + #expect(macOSVersion.v13.isCurrent == true) + #expect(macOSVersion.v12.isCurrent == false) + #expect(macOSVersion.v11.isCurrent == false) + #expect(macOSVersion.v10_15.isCurrent == false) } else if #available(macOS 12, *) { - XCTAssertEqual(macOSVersion.v15.isCurrent, false) - XCTAssertEqual(macOSVersion.v14.isCurrent, false) - XCTAssertEqual(macOSVersion.v13.isCurrent, false) - XCTAssertEqual(macOSVersion.v12.isCurrent, true) - XCTAssertEqual(macOSVersion.v11.isCurrent, false) - XCTAssertEqual(macOSVersion.v10_15.isCurrent, false) + #expect(macOSVersion.v15.isCurrent == false) + #expect(macOSVersion.v14.isCurrent == false) + #expect(macOSVersion.v13.isCurrent == false) + #expect(macOSVersion.v12.isCurrent == true) + #expect(macOSVersion.v11.isCurrent == false) + #expect(macOSVersion.v10_15.isCurrent == false) } else if #available(macOS 11, *) { - XCTAssertEqual(macOSVersion.v15.isCurrent, false) - XCTAssertEqual(macOSVersion.v14.isCurrent, false) - XCTAssertEqual(macOSVersion.v13.isCurrent, false) - XCTAssertEqual(macOSVersion.v12.isCurrent, false) - XCTAssertEqual(macOSVersion.v11.isCurrent, true) - XCTAssertEqual(macOSVersion.v10_15.isCurrent, false) + #expect(macOSVersion.v15.isCurrent == false) + #expect(macOSVersion.v14.isCurrent == false) + #expect(macOSVersion.v13.isCurrent == false) + #expect(macOSVersion.v12.isCurrent == false) + #expect(macOSVersion.v11.isCurrent == true) + #expect(macOSVersion.v10_15.isCurrent == false) } else if #available(macOS 10.15, *) { - XCTAssertEqual(macOSVersion.v15.isCurrent, false) - XCTAssertEqual(macOSVersion.v14.isCurrent, false) - XCTAssertEqual(macOSVersion.v13.isCurrent, false) - XCTAssertEqual(macOSVersion.v12.isCurrent, false) - XCTAssertEqual(macOSVersion.v11.isCurrent, false) - XCTAssertEqual(macOSVersion.v10_15.isCurrent, true) + #expect(macOSVersion.v15.isCurrent == false) + #expect(macOSVersion.v14.isCurrent == false) + #expect(macOSVersion.v13.isCurrent == false) + #expect(macOSVersion.v12.isCurrent == false) + #expect(macOSVersion.v11.isCurrent == false) + #expect(macOSVersion.v10_15.isCurrent == true) } #else - XCTAssertEqual(macOSVersion.v26.isCurrent, false) - XCTAssertEqual(macOSVersion.v15.isCurrent, false) - XCTAssertEqual(macOSVersion.v14.isCurrent, false) - XCTAssertEqual(macOSVersion.v13.isCurrent, false) - XCTAssertEqual(macOSVersion.v12.isCurrent, false) - XCTAssertEqual(macOSVersion.v11.isCurrent, false) - XCTAssertEqual(macOSVersion.v10_15.isCurrent, false) + #expect(macOSVersion.v26.isCurrent == false) + #expect(macOSVersion.v15.isCurrent == false) + #expect(macOSVersion.v14.isCurrent == false) + #expect(macOSVersion.v13.isCurrent == false) + #expect(macOSVersion.v12.isCurrent == false) + #expect(macOSVersion.v11.isCurrent == false) + #expect(macOSVersion.v10_15.isCurrent == false) #endif } - func test_macOS_isCurrentOrPast() { + @Test func macOS_isCurrentOrPast() { #if os(macOS) if #available(macOS 26, *) { - XCTAssertEqual(macOSVersion.v26.isCurrentOrPast, true) - XCTAssertEqual(macOSVersion.v15.isCurrentOrPast, true) - XCTAssertEqual(macOSVersion.v14.isCurrentOrPast, true) - XCTAssertEqual(macOSVersion.v13.isCurrentOrPast, true) - XCTAssertEqual(macOSVersion.v12.isCurrentOrPast, true) - XCTAssertEqual(macOSVersion.v11.isCurrentOrPast, true) - XCTAssertEqual(macOSVersion.v10_15.isCurrentOrPast, true) + #expect(macOSVersion.v26.isCurrentOrPast == true) + #expect(macOSVersion.v15.isCurrentOrPast == true) + #expect(macOSVersion.v14.isCurrentOrPast == true) + #expect(macOSVersion.v13.isCurrentOrPast == true) + #expect(macOSVersion.v12.isCurrentOrPast == true) + #expect(macOSVersion.v11.isCurrentOrPast == true) + #expect(macOSVersion.v10_15.isCurrentOrPast == true) } else if #available(macOS 15, *) { - XCTAssertEqual(macOSVersion.v15.isCurrentOrPast, true) - XCTAssertEqual(macOSVersion.v14.isCurrentOrPast, true) - XCTAssertEqual(macOSVersion.v13.isCurrentOrPast, true) - XCTAssertEqual(macOSVersion.v12.isCurrentOrPast, true) - XCTAssertEqual(macOSVersion.v11.isCurrentOrPast, true) - XCTAssertEqual(macOSVersion.v10_15.isCurrentOrPast, true) + #expect(macOSVersion.v15.isCurrentOrPast == true) + #expect(macOSVersion.v14.isCurrentOrPast == true) + #expect(macOSVersion.v13.isCurrentOrPast == true) + #expect(macOSVersion.v12.isCurrentOrPast == true) + #expect(macOSVersion.v11.isCurrentOrPast == true) + #expect(macOSVersion.v10_15.isCurrentOrPast == true) } else if #available(macOS 14, *) { - XCTAssertEqual(macOSVersion.v15.isCurrentOrPast, false) - XCTAssertEqual(macOSVersion.v14.isCurrentOrPast, true) - XCTAssertEqual(macOSVersion.v13.isCurrentOrPast, true) - XCTAssertEqual(macOSVersion.v12.isCurrentOrPast, true) - XCTAssertEqual(macOSVersion.v11.isCurrentOrPast, true) - XCTAssertEqual(macOSVersion.v10_15.isCurrentOrPast, true) + #expect(macOSVersion.v15.isCurrentOrPast == false) + #expect(macOSVersion.v14.isCurrentOrPast == true) + #expect(macOSVersion.v13.isCurrentOrPast == true) + #expect(macOSVersion.v12.isCurrentOrPast == true) + #expect(macOSVersion.v11.isCurrentOrPast == true) + #expect(macOSVersion.v10_15.isCurrentOrPast == true) } else if #available(macOS 13, *) { - XCTAssertEqual(macOSVersion.v15.isCurrentOrPast, false) - XCTAssertEqual(macOSVersion.v14.isCurrentOrPast, false) - XCTAssertEqual(macOSVersion.v13.isCurrentOrPast, true) - XCTAssertEqual(macOSVersion.v12.isCurrentOrPast, true) - XCTAssertEqual(macOSVersion.v11.isCurrentOrPast, true) - XCTAssertEqual(macOSVersion.v10_15.isCurrentOrPast, true) + #expect(macOSVersion.v15.isCurrentOrPast == false) + #expect(macOSVersion.v14.isCurrentOrPast == false) + #expect(macOSVersion.v13.isCurrentOrPast == true) + #expect(macOSVersion.v12.isCurrentOrPast == true) + #expect(macOSVersion.v11.isCurrentOrPast == true) + #expect(macOSVersion.v10_15.isCurrentOrPast == true) } else if #available(macOS 12, *) { - XCTAssertEqual(macOSVersion.v15.isCurrentOrPast, false) - XCTAssertEqual(macOSVersion.v14.isCurrentOrPast, false) - XCTAssertEqual(macOSVersion.v13.isCurrentOrPast, false) - XCTAssertEqual(macOSVersion.v12.isCurrentOrPast, true) - XCTAssertEqual(macOSVersion.v11.isCurrentOrPast, true) - XCTAssertEqual(macOSVersion.v10_15.isCurrentOrPast, true) + #expect(macOSVersion.v15.isCurrentOrPast == false) + #expect(macOSVersion.v14.isCurrentOrPast == false) + #expect(macOSVersion.v13.isCurrentOrPast == false) + #expect(macOSVersion.v12.isCurrentOrPast == true) + #expect(macOSVersion.v11.isCurrentOrPast == true) + #expect(macOSVersion.v10_15.isCurrentOrPast == true) } else if #available(macOS 11, *) { - XCTAssertEqual(macOSVersion.v15.isCurrentOrPast, false) - XCTAssertEqual(macOSVersion.v14.isCurrentOrPast, false) - XCTAssertEqual(macOSVersion.v13.isCurrentOrPast, false) - XCTAssertEqual(macOSVersion.v12.isCurrentOrPast, false) - XCTAssertEqual(macOSVersion.v11.isCurrentOrPast, true) - XCTAssertEqual(macOSVersion.v10_15.isCurrentOrPast, true) + #expect(macOSVersion.v15.isCurrentOrPast == false) + #expect(macOSVersion.v14.isCurrentOrPast == false) + #expect(macOSVersion.v13.isCurrentOrPast == false) + #expect(macOSVersion.v12.isCurrentOrPast == false) + #expect(macOSVersion.v11.isCurrentOrPast == true) + #expect(macOSVersion.v10_15.isCurrentOrPast == true) } else if #available(macOS 10.15, *) { - XCTAssertEqual(macOSVersion.v15.isCurrentOrPast, false) - XCTAssertEqual(macOSVersion.v14.isCurrentOrPast, false) - XCTAssertEqual(macOSVersion.v13.isCurrentOrPast, false) - XCTAssertEqual(macOSVersion.v12.isCurrentOrPast, false) - XCTAssertEqual(macOSVersion.v11.isCurrentOrPast, false) - XCTAssertEqual(macOSVersion.v10_15.isCurrentOrPast, true) + #expect(macOSVersion.v15.isCurrentOrPast == false) + #expect(macOSVersion.v14.isCurrentOrPast == false) + #expect(macOSVersion.v13.isCurrentOrPast == false) + #expect(macOSVersion.v12.isCurrentOrPast == false) + #expect(macOSVersion.v11.isCurrentOrPast == false) + #expect(macOSVersion.v10_15.isCurrentOrPast == true) } #else - XCTAssertEqual(macOSVersion.v26.isCurrentOrPast, false) - XCTAssertEqual(macOSVersion.v15.isCurrentOrPast, false) - XCTAssertEqual(macOSVersion.v14.isCurrentOrPast, false) - XCTAssertEqual(macOSVersion.v13.isCurrentOrPast, false) - XCTAssertEqual(macOSVersion.v12.isCurrentOrPast, false) - XCTAssertEqual(macOSVersion.v11.isCurrentOrPast, false) - XCTAssertEqual(macOSVersion.v10_15.isCurrentOrPast, false) + #expect(macOSVersion.v26.isCurrentOrPast == false) + #expect(macOSVersion.v15.isCurrentOrPast == false) + #expect(macOSVersion.v14.isCurrentOrPast == false) + #expect(macOSVersion.v13.isCurrentOrPast == false) + #expect(macOSVersion.v12.isCurrentOrPast == false) + #expect(macOSVersion.v11.isCurrentOrPast == false) + #expect(macOSVersion.v10_15.isCurrentOrPast == false) #endif } - func test_tvOS_isCurrent() { + @Test func tvOS_isCurrent() { #if os(tvOS) if #available(tvOS 26, *) { - XCTAssertEqual(tvOSVersion.v26.isCurrent, true) - XCTAssertEqual(tvOSVersion.v18.isCurrent, false) - XCTAssertEqual(tvOSVersion.v17.isCurrent, false) - XCTAssertEqual(tvOSVersion.v16.isCurrent, false) - XCTAssertEqual(tvOSVersion.v15.isCurrent, false) - XCTAssertEqual(tvOSVersion.v14.isCurrent, false) - XCTAssertEqual(tvOSVersion.v13.isCurrent, false) + #expect(tvOSVersion.v26.isCurrent == true) + #expect(tvOSVersion.v18.isCurrent == false) + #expect(tvOSVersion.v17.isCurrent == false) + #expect(tvOSVersion.v16.isCurrent == false) + #expect(tvOSVersion.v15.isCurrent == false) + #expect(tvOSVersion.v14.isCurrent == false) + #expect(tvOSVersion.v13.isCurrent == false) } else if #available(tvOS 18, *) { - XCTAssertEqual(tvOSVersion.v18.isCurrent, true) - XCTAssertEqual(tvOSVersion.v17.isCurrent, false) - XCTAssertEqual(tvOSVersion.v16.isCurrent, false) - XCTAssertEqual(tvOSVersion.v15.isCurrent, false) - XCTAssertEqual(tvOSVersion.v14.isCurrent, false) - XCTAssertEqual(tvOSVersion.v13.isCurrent, false) + #expect(tvOSVersion.v18.isCurrent == true) + #expect(tvOSVersion.v17.isCurrent == false) + #expect(tvOSVersion.v16.isCurrent == false) + #expect(tvOSVersion.v15.isCurrent == false) + #expect(tvOSVersion.v14.isCurrent == false) + #expect(tvOSVersion.v13.isCurrent == false) } else if #available(tvOS 17, *) { - XCTAssertEqual(tvOSVersion.v18.isCurrent, false) - XCTAssertEqual(tvOSVersion.v17.isCurrent, true) - XCTAssertEqual(tvOSVersion.v16.isCurrent, false) - XCTAssertEqual(tvOSVersion.v15.isCurrent, false) - XCTAssertEqual(tvOSVersion.v14.isCurrent, false) - XCTAssertEqual(tvOSVersion.v13.isCurrent, false) + #expect(tvOSVersion.v18.isCurrent == false) + #expect(tvOSVersion.v17.isCurrent == true) + #expect(tvOSVersion.v16.isCurrent == false) + #expect(tvOSVersion.v15.isCurrent == false) + #expect(tvOSVersion.v14.isCurrent == false) + #expect(tvOSVersion.v13.isCurrent == false) } else if #available(tvOS 16, *) { - XCTAssertEqual(tvOSVersion.v18.isCurrent, false) - XCTAssertEqual(tvOSVersion.v17.isCurrent, false) - XCTAssertEqual(tvOSVersion.v17.isCurrent, false) - XCTAssertEqual(tvOSVersion.v16.isCurrent, true) - XCTAssertEqual(tvOSVersion.v15.isCurrent, false) - XCTAssertEqual(tvOSVersion.v14.isCurrent, false) - XCTAssertEqual(tvOSVersion.v13.isCurrent, false) + #expect(tvOSVersion.v18.isCurrent == false) + #expect(tvOSVersion.v17.isCurrent == false) + #expect(tvOSVersion.v17.isCurrent == false) + #expect(tvOSVersion.v16.isCurrent == true) + #expect(tvOSVersion.v15.isCurrent == false) + #expect(tvOSVersion.v14.isCurrent == false) + #expect(tvOSVersion.v13.isCurrent == false) } else if #available(tvOS 15, *) { - XCTAssertEqual(tvOSVersion.v18.isCurrent, false) - XCTAssertEqual(tvOSVersion.v17.isCurrent, false) - XCTAssertEqual(tvOSVersion.v16.isCurrent, false) - XCTAssertEqual(tvOSVersion.v15.isCurrent, true) - XCTAssertEqual(tvOSVersion.v14.isCurrent, false) - XCTAssertEqual(tvOSVersion.v13.isCurrent, false) + #expect(tvOSVersion.v18.isCurrent == false) + #expect(tvOSVersion.v17.isCurrent == false) + #expect(tvOSVersion.v16.isCurrent == false) + #expect(tvOSVersion.v15.isCurrent == true) + #expect(tvOSVersion.v14.isCurrent == false) + #expect(tvOSVersion.v13.isCurrent == false) } else if #available(tvOS 14, *) { - XCTAssertEqual(tvOSVersion.v18.isCurrent, false) - XCTAssertEqual(tvOSVersion.v17.isCurrent, false) - XCTAssertEqual(tvOSVersion.v16.isCurrent, false) - XCTAssertEqual(tvOSVersion.v15.isCurrent, false) - XCTAssertEqual(tvOSVersion.v14.isCurrent, true) - XCTAssertEqual(tvOSVersion.v13.isCurrent, false) + #expect(tvOSVersion.v18.isCurrent == false) + #expect(tvOSVersion.v17.isCurrent == false) + #expect(tvOSVersion.v16.isCurrent == false) + #expect(tvOSVersion.v15.isCurrent == false) + #expect(tvOSVersion.v14.isCurrent == true) + #expect(tvOSVersion.v13.isCurrent == false) } else if #available(tvOS 13, *) { - XCTAssertEqual(tvOSVersion.v18.isCurrent, false) - XCTAssertEqual(tvOSVersion.v17.isCurrent, false) - XCTAssertEqual(tvOSVersion.v16.isCurrent, false) - XCTAssertEqual(tvOSVersion.v15.isCurrent, false) - XCTAssertEqual(tvOSVersion.v14.isCurrent, false) - XCTAssertEqual(tvOSVersion.v13.isCurrent, true) + #expect(tvOSVersion.v18.isCurrent == false) + #expect(tvOSVersion.v17.isCurrent == false) + #expect(tvOSVersion.v16.isCurrent == false) + #expect(tvOSVersion.v15.isCurrent == false) + #expect(tvOSVersion.v14.isCurrent == false) + #expect(tvOSVersion.v13.isCurrent == true) } #else - XCTAssertEqual(tvOSVersion.v26.isCurrent, false) - XCTAssertEqual(tvOSVersion.v18.isCurrent, false) - XCTAssertEqual(tvOSVersion.v17.isCurrent, false) - XCTAssertEqual(tvOSVersion.v16.isCurrent, false) - XCTAssertEqual(tvOSVersion.v15.isCurrent, false) - XCTAssertEqual(tvOSVersion.v14.isCurrent, false) - XCTAssertEqual(tvOSVersion.v13.isCurrent, false) + #expect(tvOSVersion.v26.isCurrent == false) + #expect(tvOSVersion.v18.isCurrent == false) + #expect(tvOSVersion.v17.isCurrent == false) + #expect(tvOSVersion.v16.isCurrent == false) + #expect(tvOSVersion.v15.isCurrent == false) + #expect(tvOSVersion.v14.isCurrent == false) + #expect(tvOSVersion.v13.isCurrent == false) #endif } - func test_tvOS_isCurrentOrPast() { + @Test func tvOS_isCurrentOrPast() { #if os(tvOS) if #available(tvOS 26, *) { - XCTAssertEqual(tvOSVersion.v26.isCurrentOrPast, true) - XCTAssertEqual(tvOSVersion.v18.isCurrentOrPast, true) - XCTAssertEqual(tvOSVersion.v17.isCurrentOrPast, true) - XCTAssertEqual(tvOSVersion.v16.isCurrentOrPast, true) - XCTAssertEqual(tvOSVersion.v15.isCurrentOrPast, true) - XCTAssertEqual(tvOSVersion.v14.isCurrentOrPast, true) - XCTAssertEqual(tvOSVersion.v13.isCurrentOrPast, true) + #expect(tvOSVersion.v26.isCurrentOrPast == true) + #expect(tvOSVersion.v18.isCurrentOrPast == true) + #expect(tvOSVersion.v17.isCurrentOrPast == true) + #expect(tvOSVersion.v16.isCurrentOrPast == true) + #expect(tvOSVersion.v15.isCurrentOrPast == true) + #expect(tvOSVersion.v14.isCurrentOrPast == true) + #expect(tvOSVersion.v13.isCurrentOrPast == true) } else if #available(tvOS 18, *) { - XCTAssertEqual(tvOSVersion.v18.isCurrentOrPast, true) - XCTAssertEqual(tvOSVersion.v17.isCurrentOrPast, true) - XCTAssertEqual(tvOSVersion.v16.isCurrentOrPast, true) - XCTAssertEqual(tvOSVersion.v15.isCurrentOrPast, true) - XCTAssertEqual(tvOSVersion.v14.isCurrentOrPast, true) - XCTAssertEqual(tvOSVersion.v13.isCurrentOrPast, true) + #expect(tvOSVersion.v18.isCurrentOrPast == true) + #expect(tvOSVersion.v17.isCurrentOrPast == true) + #expect(tvOSVersion.v16.isCurrentOrPast == true) + #expect(tvOSVersion.v15.isCurrentOrPast == true) + #expect(tvOSVersion.v14.isCurrentOrPast == true) + #expect(tvOSVersion.v13.isCurrentOrPast == true) } else if #available(tvOS 17, *) { - XCTAssertEqual(tvOSVersion.v18.isCurrentOrPast, false) - XCTAssertEqual(tvOSVersion.v17.isCurrentOrPast, true) - XCTAssertEqual(tvOSVersion.v16.isCurrentOrPast, true) - XCTAssertEqual(tvOSVersion.v15.isCurrentOrPast, true) - XCTAssertEqual(tvOSVersion.v14.isCurrentOrPast, true) - XCTAssertEqual(tvOSVersion.v13.isCurrentOrPast, true) + #expect(tvOSVersion.v18.isCurrentOrPast == false) + #expect(tvOSVersion.v17.isCurrentOrPast == true) + #expect(tvOSVersion.v16.isCurrentOrPast == true) + #expect(tvOSVersion.v15.isCurrentOrPast == true) + #expect(tvOSVersion.v14.isCurrentOrPast == true) + #expect(tvOSVersion.v13.isCurrentOrPast == true) } else if #available(tvOS 16, *) { - XCTAssertEqual(tvOSVersion.v18.isCurrentOrPast, false) - XCTAssertEqual(tvOSVersion.v17.isCurrentOrPast, false) - XCTAssertEqual(tvOSVersion.v16.isCurrentOrPast, true) - XCTAssertEqual(tvOSVersion.v15.isCurrentOrPast, true) - XCTAssertEqual(tvOSVersion.v14.isCurrentOrPast, true) - XCTAssertEqual(tvOSVersion.v13.isCurrentOrPast, true) + #expect(tvOSVersion.v18.isCurrentOrPast == false) + #expect(tvOSVersion.v17.isCurrentOrPast == false) + #expect(tvOSVersion.v16.isCurrentOrPast == true) + #expect(tvOSVersion.v15.isCurrentOrPast == true) + #expect(tvOSVersion.v14.isCurrentOrPast == true) + #expect(tvOSVersion.v13.isCurrentOrPast == true) } else if #available(tvOS 15, *) { - XCTAssertEqual(tvOSVersion.v18.isCurrentOrPast, false) - XCTAssertEqual(tvOSVersion.v17.isCurrentOrPast, false) - XCTAssertEqual(tvOSVersion.v16.isCurrentOrPast, false) - XCTAssertEqual(tvOSVersion.v15.isCurrentOrPast, true) - XCTAssertEqual(tvOSVersion.v14.isCurrentOrPast, true) - XCTAssertEqual(tvOSVersion.v13.isCurrentOrPast, true) + #expect(tvOSVersion.v18.isCurrentOrPast == false) + #expect(tvOSVersion.v17.isCurrentOrPast == false) + #expect(tvOSVersion.v16.isCurrentOrPast == false) + #expect(tvOSVersion.v15.isCurrentOrPast == true) + #expect(tvOSVersion.v14.isCurrentOrPast == true) + #expect(tvOSVersion.v13.isCurrentOrPast == true) } else if #available(tvOS 14, *) { - XCTAssertEqual(tvOSVersion.v18.isCurrentOrPast, false) - XCTAssertEqual(tvOSVersion.v17.isCurrentOrPast, false) - XCTAssertEqual(tvOSVersion.v16.isCurrentOrPast, false) - XCTAssertEqual(tvOSVersion.v15.isCurrentOrPast, false) - XCTAssertEqual(tvOSVersion.v14.isCurrentOrPast, true) - XCTAssertEqual(tvOSVersion.v13.isCurrentOrPast, true) + #expect(tvOSVersion.v18.isCurrentOrPast == false) + #expect(tvOSVersion.v17.isCurrentOrPast == false) + #expect(tvOSVersion.v16.isCurrentOrPast == false) + #expect(tvOSVersion.v15.isCurrentOrPast == false) + #expect(tvOSVersion.v14.isCurrentOrPast == true) + #expect(tvOSVersion.v13.isCurrentOrPast == true) } else if #available(tvOS 13, *) { - XCTAssertEqual(tvOSVersion.v18.isCurrentOrPast, false) - XCTAssertEqual(tvOSVersion.v17.isCurrentOrPast, false) - XCTAssertEqual(tvOSVersion.v16.isCurrentOrPast, false) - XCTAssertEqual(tvOSVersion.v15.isCurrentOrPast, false) - XCTAssertEqual(tvOSVersion.v14.isCurrentOrPast, false) - XCTAssertEqual(tvOSVersion.v13.isCurrentOrPast, true) + #expect(tvOSVersion.v18.isCurrentOrPast == false) + #expect(tvOSVersion.v17.isCurrentOrPast == false) + #expect(tvOSVersion.v16.isCurrentOrPast == false) + #expect(tvOSVersion.v15.isCurrentOrPast == false) + #expect(tvOSVersion.v14.isCurrentOrPast == false) + #expect(tvOSVersion.v13.isCurrentOrPast == true) } #else - XCTAssertEqual(tvOSVersion.v26.isCurrentOrPast, false) - XCTAssertEqual(tvOSVersion.v18.isCurrentOrPast, false) - XCTAssertEqual(tvOSVersion.v17.isCurrentOrPast, false) - XCTAssertEqual(tvOSVersion.v16.isCurrentOrPast, false) - XCTAssertEqual(tvOSVersion.v15.isCurrentOrPast, false) - XCTAssertEqual(tvOSVersion.v14.isCurrentOrPast, false) - XCTAssertEqual(tvOSVersion.v13.isCurrentOrPast, false) + #expect(tvOSVersion.v26.isCurrentOrPast == false) + #expect(tvOSVersion.v18.isCurrentOrPast == false) + #expect(tvOSVersion.v17.isCurrentOrPast == false) + #expect(tvOSVersion.v16.isCurrentOrPast == false) + #expect(tvOSVersion.v15.isCurrentOrPast == false) + #expect(tvOSVersion.v14.isCurrentOrPast == false) + #expect(tvOSVersion.v13.isCurrentOrPast == false) #endif } - func test_visionOS_isCurrent() { + @Test func visionOS_isCurrent() { #if os(visionOS) if #available(visionOS 26, *) { - XCTAssertEqual(visionOSVersion.v26.isCurrent, true) - XCTAssertEqual(visionOSVersion.v2.isCurrent, false) - XCTAssertEqual(visionOSVersion.v1.isCurrent, false) + #expect(visionOSVersion.v26.isCurrent == true) + #expect(visionOSVersion.v2.isCurrent == false) + #expect(visionOSVersion.v1.isCurrent == false) } else if #available(visionOS 2, *) { - XCTAssertEqual(visionOSVersion.v26.isCurrent, false) - XCTAssertEqual(visionOSVersion.v2.isCurrent, true) - XCTAssertEqual(visionOSVersion.v1.isCurrent, false) + #expect(visionOSVersion.v26.isCurrent == false) + #expect(visionOSVersion.v2.isCurrent == true) + #expect(visionOSVersion.v1.isCurrent == false) } else if #available(visionOS 1, *) { - XCTAssertEqual(visionOSVersion.v26.isCurrent, false) - XCTAssertEqual(visionOSVersion.v2.isCurrent, false) - XCTAssertEqual(visionOSVersion.v1.isCurrent, true) + #expect(visionOSVersion.v26.isCurrent == false) + #expect(visionOSVersion.v2.isCurrent == false) + #expect(visionOSVersion.v1.isCurrent == true) } #else - XCTAssertEqual(visionOSVersion.v26.isCurrent, false) - XCTAssertEqual(visionOSVersion.v2.isCurrent, false) - XCTAssertEqual(visionOSVersion.v1.isCurrent, false) + #expect(visionOSVersion.v26.isCurrent == false) + #expect(visionOSVersion.v2.isCurrent == false) + #expect(visionOSVersion.v1.isCurrent == false) #endif } - func test_visionOS_isCurrentOrPast() { + @Test func visionOS_isCurrentOrPast() { #if os(visionOS) if #available(visionOS 26, *) { - XCTAssertEqual(visionOSVersion.v26.isCurrentOrPast, true) - XCTAssertEqual(visionOSVersion.v2.isCurrentOrPast, true) - XCTAssertEqual(visionOSVersion.v1.isCurrentOrPast, true) + #expect(visionOSVersion.v26.isCurrentOrPast == true) + #expect(visionOSVersion.v2.isCurrentOrPast == true) + #expect(visionOSVersion.v1.isCurrentOrPast == true) } else if #available(visionOS 2, *) { - XCTAssertEqual(visionOSVersion.v26.isCurrentOrPast, false) - XCTAssertEqual(visionOSVersion.v2.isCurrentOrPast, true) - XCTAssertEqual(visionOSVersion.v1.isCurrentOrPast, true) + #expect(visionOSVersion.v26.isCurrentOrPast == false) + #expect(visionOSVersion.v2.isCurrentOrPast == true) + #expect(visionOSVersion.v1.isCurrentOrPast == true) } else if #available(visionOS 1, *) { - XCTAssertEqual(visionOSVersion.v26.isCurrentOrPast, false) - XCTAssertEqual(visionOSVersion.v2.isCurrentOrPast, false) - XCTAssertEqual(visionOSVersion.v1.isCurrentOrPast, true) + #expect(visionOSVersion.v26.isCurrentOrPast == false) + #expect(visionOSVersion.v2.isCurrentOrPast == false) + #expect(visionOSVersion.v1.isCurrentOrPast == true) } #else - XCTAssertEqual(visionOSVersion.v26.isCurrentOrPast, false) - XCTAssertEqual(visionOSVersion.v2.isCurrentOrPast, false) - XCTAssertEqual(visionOSVersion.v1.isCurrentOrPast, false) + #expect(visionOSVersion.v26.isCurrentOrPast == false) + #expect(visionOSVersion.v2.isCurrentOrPast == false) + #expect(visionOSVersion.v1.isCurrentOrPast == false) #endif } } diff --git a/Tests/Tests/TestUtils.swift b/Tests/Tests/TestUtils.swift index 2cc8329a0..6c7de51cf 100644 --- a/Tests/Tests/TestUtils.swift +++ b/Tests/Tests/TestUtils.swift @@ -1,5 +1,5 @@ import SwiftUI -import XCTest +import Testing #if canImport(UIKit) @MainActor @@ -43,79 +43,181 @@ enum TestUtils { #endif @MainActor -func XCTAssertViewIntrospection( +@discardableResult +func introspection( of type: Entity.Type, - @ViewBuilder view: (Spies) -> some View, - extraAssertions: ([Entity]) -> Void = { _ in }, - file: StaticString = #file, - line: UInt = #line -) { - let spies = Spies() - let view = view(spies) - TestUtils.present(view: view) - XCTWaiter(delegate: spies).wait(for: spies.expectations.values.map(\.0), timeout: 3) - extraAssertions(spies.entities.sorted(by: { $0.key < $1.key }).map(\.value)) -} + @ViewBuilder view: ( + _ spy1: @escaping (Entity) -> Void + ) -> some View +) async throws -> Entity { + var entity1: Entity? + return try await confirmation(expectedCount: 1...) { confirmation1 in + let view = view( + { + confirmation1() + entity1 = $0 + }, + ) -final class Spies: NSObject, XCTWaiterDelegate { - private(set) var entities: [Int: Entity] = [:] - private(set) var expectations: [ObjectIdentifier: (XCTestExpectation, StaticString, UInt)] = [:] - - subscript( - number: Int, - file: StaticString = #file, - line: UInt = #line - ) -> (Entity) -> Void { - let expectation = XCTestExpectation() - expectations[ObjectIdentifier(expectation)] = (expectation, file, line) - return { [self] in - if let entity = entities[number] { - XCTAssert(entity === $0, "Found view was overriden by another view", file: file, line: line) - } - entities[number] = $0 - expectation.fulfill() + TestUtils.present(view: view) + + while entity1 == nil { + await Task.yield() } + + return try #require(entity1) } +} - func waiter( - _ waiter: XCTWaiter, - didTimeoutWithUnfulfilledExpectations unfulfilledExpectations: [XCTestExpectation] - ) { - for expectation in unfulfilledExpectations { - let (_, file, line) = expectations[ObjectIdentifier(expectation)]! - XCTFail("Spy not called", file: file, line: line) +@MainActor +@discardableResult +func introspection( + of type: Entity.Type, + @ViewBuilder view: ( + _ spy1: @escaping (Entity) -> Void, + _ spy2: @escaping (Entity) -> Void + ) -> some View +) async throws -> (Entity, Entity) { + var entity1: Entity? + var entity2: Entity? + return try await confirmation(expectedCount: 1...) { confirmation1 in + try await confirmation(expectedCount: 1...) { confirmation2 in + let view = view( + { + confirmation1() + entity1 = $0 + }, + { + confirmation2() + entity2 = $0 + }, + ) + + TestUtils.present(view: view) + + while + entity1 == nil || + entity2 == nil + { + await Task.yield() + } + + return try ( + #require(entity1), + #require(entity2), + ) } } +} - func nestedWaiter( - _ waiter: XCTWaiter, - wasInterruptedByTimedOutWaiter outerWaiter: XCTWaiter - ) { - XCTFail("wasInterruptedByTimedOutWaiter") - } +@MainActor +@discardableResult +func introspection( + of type: Entity.Type, + @ViewBuilder view: ( + _ spy1: @escaping (Entity) -> Void, + _ spy2: @escaping (Entity) -> Void, + _ spy3: @escaping (Entity) -> Void + ) -> some View +) async throws -> (Entity, Entity, Entity) { + var entity1: Entity? + var entity2: Entity? + var entity3: Entity? + return try await confirmation(expectedCount: 1...) { confirmation1 in + try await confirmation(expectedCount: 1...) { confirmation2 in + try await confirmation(expectedCount: 1...) { confirmation3 in + let view = view( + { + confirmation1() + entity1 = $0 + }, + { + confirmation2() + entity2 = $0 + }, + { + confirmation3() + entity3 = $0 + }, + ) - func waiter( - _ waiter: XCTWaiter, - fulfillmentDidViolateOrderingConstraintsFor expectation: XCTestExpectation, - requiredExpectation: XCTestExpectation - ) { - XCTFail("fulfillmentDidViolateOrderingConstraintsFor") - } + TestUtils.present(view: view) - func waiter( - _ waiter: XCTWaiter, - didFulfillInvertedExpectation expectation: XCTestExpectation - ) { - XCTFail("didFulfillInvertedExpectation") + while + entity1 == nil || + entity2 == nil || + entity3 == nil + { + await Task.yield() + } + + return try ( + #require(entity1), + #require(entity2), + #require(entity3), + ) + } + } } } -extension Collection { - subscript(safe index: Index, file: StaticString = #file, line: UInt = #line) -> Element? { - guard indices.contains(index) else { - XCTFail("Index \(index) is out of bounds", file: file, line: line) - return nil +@MainActor +@discardableResult +func introspection( + of type: Entity.Type, + @ViewBuilder view: ( + _ spy1: @escaping (Entity) -> Void, + _ spy2: @escaping (Entity) -> Void, + _ spy3: @escaping (Entity) -> Void, + _ spy4: @escaping (Entity) -> Void + ) -> some View +) async throws -> (Entity, Entity, Entity, Entity) { + var entity1: Entity? + var entity2: Entity? + var entity3: Entity? + var entity4: Entity? + return try await confirmation(expectedCount: 1...) { confirmation1 in + try await confirmation(expectedCount: 1...) { confirmation2 in + try await confirmation(expectedCount: 1...) { confirmation3 in + try await confirmation(expectedCount: 1...) { confirmation4 in + let view = view( + { + confirmation1() + entity1 = $0 + }, + { + confirmation2() + entity2 = $0 + }, + { + confirmation3() + entity3 = $0 + }, + { + confirmation4() + entity4 = $0 + }, + ) + + TestUtils.present(view: view) + + while + entity1 == nil || + entity2 == nil || + entity3 == nil || + entity4 == nil + { + await Task.yield() + } + + return try ( + #require(entity1), + #require(entity2), + #require(entity3), + #require(entity4), + ) + } + } } - return self[index] } } diff --git a/Tests/Tests/ViewTypes/ButtonTests.swift b/Tests/Tests/ViewTypes/ButtonTests.swift index f155f258d..1c15314fc 100644 --- a/Tests/Tests/ViewTypes/ButtonTests.swift +++ b/Tests/Tests/ViewTypes/ButtonTests.swift @@ -1,50 +1,45 @@ #if !os(iOS) && !os(tvOS) && !os(visionOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class ButtonTests: XCTestCase { +@Suite +struct ButtonTests { #if canImport(AppKit) typealias PlatformButton = NSButton #endif - func testButton() { - XCTAssertViewIntrospection(of: PlatformButton.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] - let spy3 = spies[3] - + @Test func introspect() async throws { + let (entity1, entity2, entity3, entity4) = try await introspection(of: PlatformButton.self) { spy1, spy2, spy3, spy4 in VStack { Button("Button 0", action: {}) .buttonStyle(.bordered) #if os(macOS) - .introspect(.button, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.button, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) #endif Button("Button 1", action: {}) .buttonStyle(.borderless) #if os(macOS) - .introspect(.button, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) + .introspect(.button, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif Button("Button 2", action: {}) .buttonStyle(.link) #if os(macOS) - .introspect(.button, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) + .introspect(.button, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy3) #endif Button("Button 3", action: {}) #if os(macOS) - .introspect(.button, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy3) + .introspect(.button, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy4) #endif } - } extraAssertions: { - #if canImport(AppKit) - XCTAssert(Set($0.map(ObjectIdentifier.init)).count == 4) - #endif } + #if canImport(AppKit) + #expect(Set([entity1, entity2, entity3, entity4].map(ObjectIdentifier.init)).count == 4) + #endif } } #endif diff --git a/Tests/Tests/ViewTypes/ColorPickerTests.swift b/Tests/Tests/ViewTypes/ColorPickerTests.swift index 83abf8095..c2da636c4 100644 --- a/Tests/Tests/ViewTypes/ColorPickerTests.swift +++ b/Tests/Tests/ViewTypes/ColorPickerTests.swift @@ -1,11 +1,11 @@ #if !os(tvOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing -@available(iOS 14, macOS 11, *) @MainActor -final class ColorPickerTests: XCTestCase { +@Suite +struct ColorPickerTests { #if canImport(UIKit) typealias PlatformColor = UIColor typealias PlatformColorPicker = UIColorWell @@ -14,49 +14,40 @@ final class ColorPickerTests: XCTestCase { typealias PlatformColorPicker = NSColorWell #endif - func testColorPicker() throws { - guard #available(iOS 14, macOS 11, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformColorPicker.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] - + @Test func introspect() async throws { + let (entity1, entity2, entity3) = try await introspection(of: PlatformColorPicker.self) { spy1, spy2, spy3 in VStack { ColorPicker("", selection: .constant(PlatformColor.red.cgColor)) #if os(iOS) || os(visionOS) - .introspect(.colorPicker, on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy0) + .introspect(.colorPicker, on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) #elseif os(macOS) - .introspect(.colorPicker, on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.colorPicker, on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) #endif ColorPicker("", selection: .constant(PlatformColor.green.cgColor)) #if os(iOS) || os(visionOS) - .introspect(.colorPicker, on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) + .introspect(.colorPicker, on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) #elseif os(macOS) - .introspect(.colorPicker, on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) + .introspect(.colorPicker, on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif ColorPicker("", selection: .constant(PlatformColor.blue.cgColor)) #if os(iOS) || os(visionOS) - .introspect(.colorPicker, on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) + .introspect(.colorPicker, on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy3) #elseif os(macOS) - .introspect(.colorPicker, on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) + .introspect(.colorPicker, on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy3) #endif } - } extraAssertions: { - #if canImport(UIKit) - XCTAssertEqual($0[safe: 0]?.selectedColor, .red) - XCTAssertEqual($0[safe: 1]?.selectedColor, .green) - XCTAssertEqual($0[safe: 2]?.selectedColor, .blue) - #elseif canImport(AppKit) - XCTAssertEqual($0[safe: 0]?.color, .red) - XCTAssertEqual($0[safe: 1]?.color, .green) - XCTAssertEqual($0[safe: 2]?.color, .blue) - #endif } + #if canImport(UIKit) + #expect(entity1.selectedColor == .red) + #expect(entity2.selectedColor == .green) + #expect(entity3.selectedColor == .blue) + #elseif canImport(AppKit) + #expect(entity1.color == .red) + #expect(entity2.color == .green) + #expect(entity3.color == .blue) + #endif } } #endif diff --git a/Tests/Tests/ViewTypes/DatePickerTests.swift b/Tests/Tests/ViewTypes/DatePickerTests.swift index 07a2527ba..e6b515a46 100644 --- a/Tests/Tests/ViewTypes/DatePickerTests.swift +++ b/Tests/Tests/ViewTypes/DatePickerTests.swift @@ -1,35 +1,24 @@ #if !os(tvOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class DatePickerTests: XCTestCase { +@Suite +struct DatePickerTests { #if canImport(UIKit) typealias PlatformDatePicker = UIDatePicker #elseif canImport(AppKit) typealias PlatformDatePicker = NSDatePicker #endif - func testDatePicker() { - let date0 = Date(timeIntervalSince1970: 0) - let date1 = Date(timeIntervalSince1970: 5) - let date2 = Date(timeIntervalSince1970: 10) - - XCTAssertViewIntrospection(of: PlatformDatePicker.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] + @Test func introspect() async throws { + let date1 = Date(timeIntervalSince1970: 0) + let date2 = Date(timeIntervalSince1970: 5) + let date3 = Date(timeIntervalSince1970: 10) + let (entity1, entity2, entity3) = try await introspection(of: PlatformDatePicker.self) { spy1, spy2, spy3 in VStack { - DatePicker("", selection: .constant(date0)) - #if os(iOS) || os(visionOS) - .introspect(.datePicker, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy0) - #elseif os(macOS) - .introspect(.datePicker, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) - #endif - .cornerRadius(8) - DatePicker("", selection: .constant(date1)) #if os(iOS) || os(visionOS) .introspect(.datePicker, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) @@ -44,18 +33,25 @@ final class DatePickerTests: XCTestCase { #elseif os(macOS) .introspect(.datePicker, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif + .cornerRadius(8) + + DatePicker("", selection: .constant(date3)) + #if os(iOS) || os(visionOS) + .introspect(.datePicker, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy3) + #elseif os(macOS) + .introspect(.datePicker, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy3) + #endif } - } extraAssertions: { - #if canImport(UIKit) - XCTAssertEqual($0[safe: 0]?.date, date0) - XCTAssertEqual($0[safe: 1]?.date, date1) - XCTAssertEqual($0[safe: 2]?.date, date2) - #elseif canImport(AppKit) - XCTAssertEqual($0[safe: 0]?.dateValue, date0) - XCTAssertEqual($0[safe: 1]?.dateValue, date1) - XCTAssertEqual($0[safe: 2]?.dateValue, date2) - #endif } + #if canImport(UIKit) + #expect(entity1.date == date1) + #expect(entity2.date == date2) + #expect(entity3.date == date3) + #elseif canImport(AppKit) + #expect(entity1.dateValue == date1) + #expect(entity2.dateValue == date2) + #expect(entity3.dateValue == date3) + #endif } } #endif diff --git a/Tests/Tests/ViewTypes/DatePickerWithCompactFieldStyleTests.swift b/Tests/Tests/ViewTypes/DatePickerWithCompactFieldStyleTests.swift index 237812e97..d1a9379a4 100644 --- a/Tests/Tests/ViewTypes/DatePickerWithCompactFieldStyleTests.swift +++ b/Tests/Tests/ViewTypes/DatePickerWithCompactFieldStyleTests.swift @@ -1,41 +1,24 @@ #if !os(tvOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing -@available(iOS 14, macOS 10.15.4, *) @MainActor -final class DatePickerWithCompactStyleTests: XCTestCase { +@Suite +struct DatePickerWithCompactStyleTests { #if canImport(UIKit) typealias PlatformDatePickerWithCompactStyle = UIDatePicker #elseif canImport(AppKit) typealias PlatformDatePickerWithCompactStyle = NSDatePicker #endif - func testDatePickerWithCompactStyle() throws { - guard #available(iOS 14, macOS 10.15.4, *) else { - throw XCTSkip() - } - - let date0 = Date(timeIntervalSince1970: 0) - let date1 = Date(timeIntervalSince1970: 5) - let date2 = Date(timeIntervalSince1970: 10) - - XCTAssertViewIntrospection(of: PlatformDatePickerWithCompactStyle.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] + func introspect() async throws { + let date1 = Date(timeIntervalSince1970: 0) + let date2 = Date(timeIntervalSince1970: 5) + let date3 = Date(timeIntervalSince1970: 10) + let (entity1, entity2, entity3) = try await introspection(of: PlatformDatePickerWithCompactStyle.self) { spy1, spy2, spy3 in VStack { - DatePicker("", selection: .constant(date0)) - .datePickerStyle(.compact) - #if os(iOS) || os(visionOS) - .introspect(.datePicker(style: .compact), on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy0) - #elseif os(macOS) - .introspect(.datePicker(style: .compact), on: .macOS(.v10_15_4, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) - #endif - .cornerRadius(8) - DatePicker("", selection: .constant(date1)) .datePickerStyle(.compact) #if os(iOS) || os(visionOS) @@ -52,18 +35,26 @@ final class DatePickerWithCompactStyleTests: XCTestCase { #elseif os(macOS) .introspect(.datePicker(style: .compact), on: .macOS(.v10_15_4, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif + .cornerRadius(8) + + DatePicker("", selection: .constant(date3)) + .datePickerStyle(.compact) + #if os(iOS) || os(visionOS) + .introspect(.datePicker(style: .compact), on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy3) + #elseif os(macOS) + .introspect(.datePicker(style: .compact), on: .macOS(.v10_15_4, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy3) + #endif } - } extraAssertions: { - #if canImport(UIKit) - XCTAssertEqual($0[safe: 0]?.date, date0) - XCTAssertEqual($0[safe: 1]?.date, date1) - XCTAssertEqual($0[safe: 2]?.date, date2) - #elseif canImport(AppKit) - XCTAssertEqual($0[safe: 0]?.dateValue, date0) - XCTAssertEqual($0[safe: 1]?.dateValue, date1) - XCTAssertEqual($0[safe: 2]?.dateValue, date2) - #endif } + #if canImport(UIKit) + #expect(entity1.date == date1) + #expect(entity2.date == date2) + #expect(entity3.date == date3) + #elseif canImport(AppKit) + #expect(entity1.dateValue == date1) + #expect(entity2.dateValue == date2) + #expect(entity3.dateValue == date3) + #endif } } #endif diff --git a/Tests/Tests/ViewTypes/DatePickerWithFieldStyleTests.swift b/Tests/Tests/ViewTypes/DatePickerWithFieldStyleTests.swift index b3227df3b..3cf6fff16 100644 --- a/Tests/Tests/ViewTypes/DatePickerWithFieldStyleTests.swift +++ b/Tests/Tests/ViewTypes/DatePickerWithFieldStyleTests.swift @@ -1,52 +1,48 @@ #if !os(iOS) && !os(tvOS) && !os(visionOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class DatePickerWithFieldStyleTests: XCTestCase { +@Suite +struct DatePickerWithFieldStyleTests { #if canImport(AppKit) && !targetEnvironment(macCatalyst) typealias PlatformDatePickerWithFieldStyle = NSDatePicker #endif - func testDatePickerWithFieldStyle() { - let date0 = Date(timeIntervalSince1970: 0) - let date1 = Date(timeIntervalSince1970: 5) - let date2 = Date(timeIntervalSince1970: 10) - - XCTAssertViewIntrospection(of: PlatformDatePickerWithFieldStyle.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] + @Test func introspect() async throws { + let date1 = Date(timeIntervalSince1970: 0) + let date2 = Date(timeIntervalSince1970: 5) + let date3 = Date(timeIntervalSince1970: 10) + let (entity1, entity2, entity3) = try await introspection(of: PlatformDatePickerWithFieldStyle.self) { spy1, spy2, spy3 in VStack { - DatePicker("", selection: .constant(date0)) + DatePicker("", selection: .constant(date1)) .datePickerStyle(.field) #if os(macOS) - .introspect(.datePicker(style: .field), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.datePicker(style: .field), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) #endif .cornerRadius(8) - DatePicker("", selection: .constant(date1)) + DatePicker("", selection: .constant(date2)) .datePickerStyle(.field) #if os(macOS) - .introspect(.datePicker(style: .field), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) + .introspect(.datePicker(style: .field), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif .cornerRadius(8) - DatePicker("", selection: .constant(date2)) + DatePicker("", selection: .constant(date3)) .datePickerStyle(.field) #if os(macOS) - .introspect(.datePicker(style: .field), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) + .introspect(.datePicker(style: .field), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy3) #endif } - } extraAssertions: { - #if canImport(AppKit) && !targetEnvironment(macCatalyst) - XCTAssertEqual($0[safe: 0]?.dateValue, date0) - XCTAssertEqual($0[safe: 1]?.dateValue, date1) - XCTAssertEqual($0[safe: 2]?.dateValue, date2) - #endif } + #if canImport(AppKit) && !targetEnvironment(macCatalyst) + #expect(entity1.dateValue == date1) + #expect(entity2.dateValue == date2) + #expect(entity3.dateValue == date3) + #endif } } #endif diff --git a/Tests/Tests/ViewTypes/DatePickerWithGraphicalStyleTests.swift b/Tests/Tests/ViewTypes/DatePickerWithGraphicalStyleTests.swift index 0fa485b25..3034bfdca 100644 --- a/Tests/Tests/ViewTypes/DatePickerWithGraphicalStyleTests.swift +++ b/Tests/Tests/ViewTypes/DatePickerWithGraphicalStyleTests.swift @@ -1,41 +1,24 @@ #if !os(tvOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing -@available(iOS 14, *) @MainActor -final class DatePickerWithGraphicalStyleTests: XCTestCase { +@Suite +struct DatePickerWithGraphicalStyleTests { #if canImport(UIKit) typealias PlatformDatePickerWithGraphicalStyle = UIDatePicker #elseif canImport(AppKit) typealias PlatformDatePickerWithGraphicalStyle = NSDatePicker #endif - func testDatePickerWithGraphicalStyle() throws { - guard #available(iOS 14, *) else { - throw XCTSkip() - } - - let date0 = Date(timeIntervalSince1970: 0) - let date1 = Date(timeIntervalSince1970: 3600 * 24 * 1) - let date2 = Date(timeIntervalSince1970: 3600 * 24 * 2) - - XCTAssertViewIntrospection(of: PlatformDatePickerWithGraphicalStyle.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] + @Test func introspect() async throws { + let date1 = Date(timeIntervalSince1970: 0) + let date2 = Date(timeIntervalSince1970: 3600 * 24 * 1) + let date3 = Date(timeIntervalSince1970: 3600 * 24 * 2) + let (entity1, entity2, entity3) = try await introspection(of: PlatformDatePickerWithGraphicalStyle.self) { spy1, spy2, spy3 in VStack { - DatePicker("", selection: .constant(date0)) - .datePickerStyle(.graphical) - #if os(iOS) || os(visionOS) - .introspect(.datePicker(style: .graphical), on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy0) - #elseif os(macOS) - .introspect(.datePicker(style: .graphical), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) - #endif - .cornerRadius(8) - DatePicker("", selection: .constant(date1)) .datePickerStyle(.graphical) #if os(iOS) || os(visionOS) @@ -52,18 +35,26 @@ final class DatePickerWithGraphicalStyleTests: XCTestCase { #elseif os(macOS) .introspect(.datePicker(style: .graphical), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif + .cornerRadius(8) + + DatePicker("", selection: .constant(date3)) + .datePickerStyle(.graphical) + #if os(iOS) || os(visionOS) + .introspect(.datePicker(style: .graphical), on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy3) + #elseif os(macOS) + .introspect(.datePicker(style: .graphical), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy3) + #endif } - } extraAssertions: { - #if canImport(UIKit) - XCTAssertEqual($0[safe: 0]?.date, date0) - XCTAssertEqual($0[safe: 1]?.date, date1) - XCTAssertEqual($0[safe: 2]?.date, date2) - #elseif canImport(AppKit) - XCTAssertEqual($0[safe: 0]?.dateValue, date0) - XCTAssertEqual($0[safe: 1]?.dateValue, date1) - XCTAssertEqual($0[safe: 2]?.dateValue, date2) - #endif } + #if canImport(UIKit) + #expect(entity1.date == date1) + #expect(entity2.date == date2) + #expect(entity3.date == date3) + #elseif canImport(AppKit) + #expect(entity1.dateValue == date1) + #expect(entity2.dateValue == date2) + #expect(entity3.dateValue == date3) + #endif } } #endif diff --git a/Tests/Tests/ViewTypes/DatePickerWithStepperFieldStyleTests.swift b/Tests/Tests/ViewTypes/DatePickerWithStepperFieldStyleTests.swift index a333a94c3..e644b2faa 100644 --- a/Tests/Tests/ViewTypes/DatePickerWithStepperFieldStyleTests.swift +++ b/Tests/Tests/ViewTypes/DatePickerWithStepperFieldStyleTests.swift @@ -1,52 +1,47 @@ #if !os(iOS) && !os(tvOS) && !os(visionOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class DatePickerWithStepperFieldStyleTests: XCTestCase { +@Suite struct DatePickerWithStepperFieldStyleTests { #if canImport(AppKit) && !targetEnvironment(macCatalyst) typealias PlatformDatePickerWithStepperFieldStyle = NSDatePicker #endif - func testDatePickerWithStepperFieldStyle() { - let date0 = Date(timeIntervalSince1970: 0) - let date1 = Date(timeIntervalSince1970: 5) - let date2 = Date(timeIntervalSince1970: 10) - - XCTAssertViewIntrospection(of: PlatformDatePickerWithStepperFieldStyle.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] + @Test func introspect() async throws { + let date1 = Date(timeIntervalSince1970: 0) + let date2 = Date(timeIntervalSince1970: 5) + let date3 = Date(timeIntervalSince1970: 10) + let (entity1, entity2, entity3) = try await introspection(of: PlatformDatePickerWithStepperFieldStyle.self) { spy1, spy2, spy3 in VStack { - DatePicker("", selection: .constant(date0)) + DatePicker("", selection: .constant(date1)) .datePickerStyle(.stepperField) #if os(macOS) - .introspect(.datePicker(style: .stepperField), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.datePicker(style: .stepperField), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) #endif .cornerRadius(8) - DatePicker("", selection: .constant(date1)) + DatePicker("", selection: .constant(date2)) .datePickerStyle(.stepperField) #if os(macOS) - .introspect(.datePicker(style: .stepperField), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) + .introspect(.datePicker(style: .stepperField), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif .cornerRadius(8) - DatePicker("", selection: .constant(date2)) + DatePicker("", selection: .constant(date3)) .datePickerStyle(.stepperField) #if os(macOS) - .introspect(.datePicker(style: .stepperField), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) + .introspect(.datePicker(style: .stepperField), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy3) #endif } - } extraAssertions: { - #if canImport(AppKit) && !targetEnvironment(macCatalyst) - XCTAssertEqual($0[safe: 0]?.dateValue, date0) - XCTAssertEqual($0[safe: 1]?.dateValue, date1) - XCTAssertEqual($0[safe: 2]?.dateValue, date2) - #endif } + #if canImport(AppKit) && !targetEnvironment(macCatalyst) + #expect(entity1.dateValue == date1) + #expect(entity2.dateValue == date2) + #expect(entity3.dateValue == date3) + #endif } } #endif diff --git a/Tests/Tests/ViewTypes/DatePickerWithWheelStyleTests.swift b/Tests/Tests/ViewTypes/DatePickerWithWheelStyleTests.swift index 1294d80f0..30c4e5246 100644 --- a/Tests/Tests/ViewTypes/DatePickerWithWheelStyleTests.swift +++ b/Tests/Tests/ViewTypes/DatePickerWithWheelStyleTests.swift @@ -1,52 +1,48 @@ #if !os(tvOS) && !os(macOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class DatePickerWithWheelStyleTests: XCTestCase { +@Suite +struct DatePickerWithWheelStyleTests { #if canImport(UIKit) typealias PlatformDatePickerWithWheelStyle = UIDatePicker #endif - func testDatePickerWithWheelStyle() { - let date0 = Date(timeIntervalSince1970: 0) - let date1 = Date(timeIntervalSince1970: 5) - let date2 = Date(timeIntervalSince1970: 10) - - XCTAssertViewIntrospection(of: PlatformDatePickerWithWheelStyle.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] + @Test func introspect() async throws { + let date1 = Date(timeIntervalSince1970: 0) + let date2 = Date(timeIntervalSince1970: 5) + let date3 = Date(timeIntervalSince1970: 10) + let (entity1, entity2, entity3) = try await introspection(of: PlatformDatePickerWithWheelStyle.self) { spy1, spy2, spy3 in VStack { - DatePicker("", selection: .constant(date0)) + DatePicker("", selection: .constant(date1)) .datePickerStyle(.wheel) #if os(iOS) || os(visionOS) - .introspect(.datePicker(style: .wheel), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy0) + .introspect(.datePicker(style: .wheel), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) #endif .cornerRadius(8) - DatePicker("", selection: .constant(date1)) + DatePicker("", selection: .constant(date2)) .datePickerStyle(.wheel) #if os(iOS) || os(visionOS) - .introspect(.datePicker(style: .wheel), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) + .introspect(.datePicker(style: .wheel), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) #endif .cornerRadius(8) - DatePicker("", selection: .constant(date2)) + DatePicker("", selection: .constant(date3)) .datePickerStyle(.wheel) #if os(iOS) || os(visionOS) - .introspect(.datePicker(style: .wheel), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) + .introspect(.datePicker(style: .wheel), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy3) #endif } - } extraAssertions: { - #if canImport(UIKit) - XCTAssertEqual($0[safe: 0]?.date, date0) - XCTAssertEqual($0[safe: 1]?.date, date1) - XCTAssertEqual($0[safe: 2]?.date, date2) - #endif } + #if canImport(UIKit) + #expect(entity1.date == date1) + #expect(entity2.date == date2) + #expect(entity3.date == date3) + #endif } } #endif diff --git a/Tests/Tests/ViewTypes/FormTests.swift b/Tests/Tests/ViewTypes/FormTests.swift index 35f021ebe..866b1110f 100644 --- a/Tests/Tests/ViewTypes/FormTests.swift +++ b/Tests/Tests/ViewTypes/FormTests.swift @@ -1,41 +1,38 @@ #if !os(macOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class FormTests: XCTestCase { +@Suite +struct FormTests { #if canImport(UIKit) typealias PlatformForm = UIScrollView // covers both UITableView and UICollectionView #elseif canImport(AppKit) typealias PlatformForm = NSScrollView #endif - func testForm() throws { - XCTAssertViewIntrospection(of: PlatformForm.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - + @Test func introspect() async throws { + let (entity1, entity2) = try await introspection(of: PlatformForm.self) { spy1, spy2 in HStack { Form { Text("Item 1") } #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.form, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { spy0($0) } - .introspect(.form, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)) { spy0($0) } + .introspect(.form, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy1) + .introspect(.form, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) #endif Form { Text("Item 1") #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.form, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), scope: .ancestor) { spy1($0) } - .introspect(.form, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), scope: .ancestor) { spy1($0) } + .introspect(.form, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), scope: .ancestor, customize: spy2) + .introspect(.form, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), scope: .ancestor, customize: spy2) #endif } } - } extraAssertions: { - XCTAssert($0[safe: 0] !== $0[safe: 1]) } + #expect(entity1 !== entity2) } } #endif diff --git a/Tests/Tests/ViewTypes/FormWithGroupedStyleTests.swift b/Tests/Tests/ViewTypes/FormWithGroupedStyleTests.swift index 0297fadc3..0e3ed0417 100644 --- a/Tests/Tests/ViewTypes/FormWithGroupedStyleTests.swift +++ b/Tests/Tests/ViewTypes/FormWithGroupedStyleTests.swift @@ -1,50 +1,43 @@ import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing -@available(iOS 16, tvOS 16, macOS 13, *) @MainActor -final class FormWithGroupedStyleTests: XCTestCase { +@Suite +struct FormWithGroupedStyleTests { #if canImport(UIKit) typealias PlatformFormWithGroupedStyle = UIScrollView // covers both UITableView and UICollectionView #elseif canImport(AppKit) typealias PlatformFormWithGroupedStyle = NSScrollView #endif - func testFormWithGroupedStyle() throws { - guard #available(iOS 16, tvOS 16, macOS 13, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformFormWithGroupedStyle.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - + @available(iOS 16, tvOS 16, macOS 13, *) + @Test func introspect() async throws { + let (entity1, entity2) = try await introspection(of: PlatformFormWithGroupedStyle.self) { spy1, spy2 in HStack { Form { Text("Item 1") } .formStyle(.grouped) #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.form(style: .grouped), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)) { spy0($0) } - .introspect(.form(style: .grouped), on: .tvOS(.v16, .v17, .v18, .v26)) { spy0($0) } + .introspect(.form(style: .grouped), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) + .introspect(.form(style: .grouped), on: .tvOS(.v16, .v17, .v18, .v26), customize: spy1) #elseif os(macOS) - .introspect(.form(style: .grouped), on: .macOS(.v13, .v14, .v15, .v26)) { spy0($0) } + .introspect(.form(style: .grouped), on: .macOS(.v13, .v14, .v15, .v26), customize: spy1) #endif Form { Text("Item 1") #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.form(style: .grouped), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), scope: .ancestor) { spy1($0) } - .introspect(.form(style: .grouped), on: .tvOS(.v16, .v17, .v18, .v26), scope: .ancestor) { spy1($0) } + .introspect(.form(style: .grouped), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), scope: .ancestor, customize: spy2) + .introspect(.form(style: .grouped), on: .tvOS(.v16, .v17, .v18, .v26), scope: .ancestor, customize: spy2) #elseif os(macOS) - .introspect(.form(style: .grouped), on: .macOS(.v13, .v14, .v15, .v26), scope: .ancestor) { spy1($0) } + .introspect(.form(style: .grouped), on: .macOS(.v13, .v14, .v15, .v26), scope: .ancestor, customize: spy2) #endif } .formStyle(.grouped) } - } extraAssertions: { - XCTAssert($0[safe: 0] !== $0[safe: 1]) } + #expect(entity1 !== entity2) } } diff --git a/Tests/Tests/ViewTypes/FullScreenCoverTests.swift b/Tests/Tests/ViewTypes/FullScreenCoverTests.swift index 563d95db1..421271f83 100644 --- a/Tests/Tests/ViewTypes/FullScreenCoverTests.swift +++ b/Tests/Tests/ViewTypes/FullScreenCoverTests.swift @@ -1,19 +1,13 @@ #if !os(macOS) && !targetEnvironment(macCatalyst) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing -@available(iOS 14, tvOS 14, *) @MainActor -final class FullScreenCoverTests: XCTestCase { - func testPresentationAsFullScreenCover() throws { - guard #available(iOS 14, tvOS 14, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: UIPresentationController.self) { spies in - let spy0 = spies[0] - +@Suite +struct FullScreenCoverTests { + @Test func introspect() async throws { + try await introspection(of: UIPresentationController.self) { spy in Text("Root") .fullScreenCover(isPresented: .constant(true)) { Text("Content") @@ -21,7 +15,7 @@ final class FullScreenCoverTests: XCTestCase { .introspect( .fullScreenCover, on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), - customize: spy0 + customize: spy ) #endif } diff --git a/Tests/Tests/ViewTypes/ListCellTests.swift b/Tests/Tests/ViewTypes/ListCellTests.swift index e95c6f7ca..4ccad6411 100644 --- a/Tests/Tests/ViewTypes/ListCellTests.swift +++ b/Tests/Tests/ViewTypes/ListCellTests.swift @@ -1,42 +1,39 @@ import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class ListCellTests: XCTestCase { +@Suite +struct ListCellTests { #if canImport(UIKit) typealias PlatformListCell = UIView // covers both UITableViewCell and UICollectionViewCell #elseif canImport(AppKit) typealias PlatformListCell = NSTableCellView #endif - func testListCell() { - XCTAssertViewIntrospection(of: PlatformListCell.self) { spies in - let spy = spies[0] - + @Test func introspect() async throws { + try await introspection(of: PlatformListCell.self) { spy in List { Text("Item 1") #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.listCell, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { spy($0) } - .introspect(.listCell, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)) { spy($0) } + .introspect(.listCell, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy) + .introspect(.listCell, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy) #elseif os(macOS) - .introspect(.listCell, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { spy($0) } + .introspect(.listCell, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy) #endif } } } - func testMaskedListCell() { - XCTAssertViewIntrospection(of: PlatformListCell.self) { spies in - let spy = spies[0] - + @Test func introspectMasked() async throws { + try await introspection(of: PlatformListCell.self) { spy in List { Text("Item 1") #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.listCell, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { spy($0) } - .introspect(.listCell, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)) { spy($0) } + .introspect(.listCell, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy) + .introspect(.listCell, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy) #elseif os(macOS) - .introspect(.listCell, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { spy($0) } + .introspect(.listCell, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy) #endif .clipped() .clipShape(RoundedRectangle(cornerRadius: 20.0)) diff --git a/Tests/Tests/ViewTypes/ListTests.swift b/Tests/Tests/ViewTypes/ListTests.swift index 8dafe2fd9..e8cf9b373 100644 --- a/Tests/Tests/ViewTypes/ListTests.swift +++ b/Tests/Tests/ViewTypes/ListTests.swift @@ -1,52 +1,46 @@ import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class ListTests: XCTestCase { +@Suite +struct ListTests { #if canImport(UIKit) typealias PlatformList = UIScrollView // covers both UITableView and UICollectionView #elseif canImport(AppKit) typealias PlatformList = NSTableView #endif - func testList() { - XCTAssertViewIntrospection(of: PlatformList.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - + @Test func introspect() async throws { + let (entity1, entity2) = try await introspection(of: PlatformList.self) { spy1, spy2 in HStack { List { Text("Item 1") } #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.list, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { spy0($0) } - .introspect(.list, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)) { spy0($0) } + .introspect(.list, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy1) + .introspect(.list, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) #elseif os(macOS) - .introspect(.list, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { spy0($0) } + .introspect(.list, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) #endif List { Text("Item 1") #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.list, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), scope: .ancestor) { spy1($0) } - .introspect(.list, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), scope: .ancestor) { spy1($0) } + .introspect(.list, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), scope: .ancestor, customize: spy2) + .introspect(.list, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), scope: .ancestor, customize: spy2) #elseif os(macOS) - .introspect(.list, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), scope: .ancestor) { spy1($0) } + .introspect(.list, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), scope: .ancestor, customize: spy2) #endif } } - } extraAssertions: { - XCTAssert($0[safe: 0] !== $0[safe: 1]) } + #expect(entity1 !== entity2) } #if !os(macOS) - func testNestedList() { - XCTAssertViewIntrospection(of: PlatformList.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - + @Test func introspectNested() async throws { + let (entity1, entity2) = try await introspection(of: PlatformList.self) { spy1, spy2 in List { Text("Item 1") @@ -54,34 +48,30 @@ final class ListTests: XCTestCase { Text("Item 1") } #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.list, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { spy1($0) } - .introspect(.list, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)) { spy1($0) } + .introspect(.list, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy2) + .introspect(.list, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) #endif } #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.list, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { spy0($0) } - .introspect(.list, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)) { spy0($0) } + .introspect(.list, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy1) + .introspect(.list, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) #endif - } extraAssertions: { - XCTAssert($0[safe: 0] !== $0[safe: 1]) } + #expect(entity1 !== entity2) } #endif - func testMaskedList() { - XCTAssertViewIntrospection(of: PlatformList.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - + @Test func introspectMasked() async throws { + let (entity1, entity2) = try await introspection(of: PlatformList.self) { spy1, spy2 in HStack { List { Text("Item 1") } #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.list, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { spy0($0) } - .introspect(.list, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)) { spy0($0) } + .introspect(.list, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy1) + .introspect(.list, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) #elseif os(macOS) - .introspect(.list, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { spy0($0) } + .introspect(.list, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) #endif .clipped() .clipShape(RoundedRectangle(cornerRadius: 20.0)) @@ -90,15 +80,14 @@ final class ListTests: XCTestCase { List { Text("Item 1") #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.list, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), scope: .ancestor) { spy1($0) } - .introspect(.list, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), scope: .ancestor) { spy1($0) } + .introspect(.list, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), scope: .ancestor, customize: spy2) + .introspect(.list, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), scope: .ancestor, customize: spy2) #elseif os(macOS) - .introspect(.list, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), scope: .ancestor) { spy1($0) } + .introspect(.list, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), scope: .ancestor, customize: spy2) #endif } } - } extraAssertions: { - XCTAssert($0[safe: 0] !== $0[safe: 1]) } + #expect(entity1 !== entity2) } } diff --git a/Tests/Tests/ViewTypes/ListWithBorderedStyleTests.swift b/Tests/Tests/ViewTypes/ListWithBorderedStyleTests.swift index 6f28505f7..dd9603d5b 100644 --- a/Tests/Tests/ViewTypes/ListWithBorderedStyleTests.swift +++ b/Tests/Tests/ViewTypes/ListWithBorderedStyleTests.swift @@ -1,44 +1,37 @@ #if !os(iOS) && !os(tvOS) && !os(visionOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing -@available(macOS 12, *) @MainActor -final class ListWithBorderedStyleTests: XCTestCase { +@Suite +struct ListWithBorderedStyleTests { #if canImport(AppKit) typealias PlatformListWithBorderedStyle = NSTableView #endif - func testListWithBorderedStyle() throws { - guard #available(macOS 12, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformListWithBorderedStyle.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - + @available(macOS 12, *) + @Test func introspect() async throws { + let (entity1, entity2) = try await introspection(of: PlatformListWithBorderedStyle.self) { spy1, spy2 in HStack { List { Text("Item 1") } .listStyle(.bordered) #if os(macOS) - .introspect(.list(style: .bordered), on: .macOS(.v12, .v13, .v14, .v15, .v26)) { spy0($0) } + .introspect(.list(style: .bordered), on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy1) #endif List { Text("Item 1") #if os(macOS) - .introspect(.list(style: .bordered), on: .macOS(.v12, .v13, .v14, .v15, .v26), scope: .ancestor) { spy1($0) } + .introspect(.list(style: .bordered), on: .macOS(.v12, .v13, .v14, .v15, .v26), scope: .ancestor, customize: spy2) #endif } .listStyle(.bordered) } - } extraAssertions: { - XCTAssert($0[safe: 0] !== $0[safe: 1]) } + #expect(entity1 !== entity2) } } #endif diff --git a/Tests/Tests/ViewTypes/ListWithGroupedStyleTests.swift b/Tests/Tests/ViewTypes/ListWithGroupedStyleTests.swift index a06981548..f7f3ec6b3 100644 --- a/Tests/Tests/ViewTypes/ListWithGroupedStyleTests.swift +++ b/Tests/Tests/ViewTypes/ListWithGroupedStyleTests.swift @@ -1,41 +1,38 @@ #if !os(macOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class ListWithGroupedStyleTests: XCTestCase { +@Suite +struct ListWithGroupedStyleTests { #if canImport(UIKit) typealias PlatformListWithGroupedStyle = UIScrollView // covers both UITableView and UICollectionView #endif - func testListWithGroupedStyle() { - XCTAssertViewIntrospection(of: PlatformListWithGroupedStyle.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - + @Test func introspect() async throws { + let (entity1, entity2) = try await introspection(of: PlatformListWithGroupedStyle.self) { spy1, spy2 in HStack { List { Text("Item 1") } .listStyle(.grouped) #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.list(style: .grouped), on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { spy0($0) } - .introspect(.list(style: .grouped), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)) { spy0($0) } + .introspect(.list(style: .grouped), on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy1) + .introspect(.list(style: .grouped), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) #endif List { Text("Item 1") #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.list(style: .grouped), on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), scope: .ancestor) { spy1($0) } - .introspect(.list(style: .grouped), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), scope: .ancestor) { spy1($0) } + .introspect(.list(style: .grouped), on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), scope: .ancestor, customize: spy2) + .introspect(.list(style: .grouped), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), scope: .ancestor, customize: spy2) #endif } .listStyle(.grouped) } - } extraAssertions: { - XCTAssert($0[safe: 0] !== $0[safe: 1]) } + #expect(entity1 !== entity2) } } #endif diff --git a/Tests/Tests/ViewTypes/ListWithInsetGroupedStyleTests.swift b/Tests/Tests/ViewTypes/ListWithInsetGroupedStyleTests.swift index aad000d9a..28fc45eca 100644 --- a/Tests/Tests/ViewTypes/ListWithInsetGroupedStyleTests.swift +++ b/Tests/Tests/ViewTypes/ListWithInsetGroupedStyleTests.swift @@ -1,46 +1,38 @@ #if !os(tvOS) && !os(macOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing -@available(iOS 14, *) @MainActor -final class ListWithInsetGroupedStyleTests: XCTestCase { +@Suite +struct ListWithInsetGroupedStyleTests { #if canImport(UIKit) typealias PlatformListWithInsetGroupedStyle = UIScrollView // covers both UITableView and UICollectionView #endif - func testListWithInsetGroupedStyle() throws { - guard #available(iOS 14, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformListWithInsetGroupedStyle.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - + @Test func introspect() async throws { + let (entity1, entity2) = try await introspection(of: PlatformListWithInsetGroupedStyle.self) { spy1, spy2 in HStack { List { Text("Item 1") } .listStyle(.insetGrouped) #if os(iOS) || os(visionOS) - .introspect(.list(style: .insetGrouped), on: .iOS(.v14, .v15)) { spy0($0) } - .introspect(.list(style: .insetGrouped), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)) { spy0($0) } + .introspect(.list(style: .insetGrouped), on: .iOS(.v14, .v15), customize: spy1) + .introspect(.list(style: .insetGrouped), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) #endif List { Text("Item 1") #if os(iOS) || os(visionOS) - .introspect(.list(style: .insetGrouped), on: .iOS(.v14, .v15), scope: .ancestor) { spy1($0) } - .introspect(.list(style: .insetGrouped), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), scope: .ancestor) { spy1($0) } + .introspect(.list(style: .insetGrouped), on: .iOS(.v14, .v15), scope: .ancestor, customize: spy2) + .introspect(.list(style: .insetGrouped), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), scope: .ancestor, customize: spy2) #endif } .listStyle(.insetGrouped) } - } extraAssertions: { - XCTAssert($0[safe: 0] !== $0[safe: 1]) } + #expect(entity1 !== entity2) } } #endif diff --git a/Tests/Tests/ViewTypes/ListWithInsetStyleTests.swift b/Tests/Tests/ViewTypes/ListWithInsetStyleTests.swift index 22a87262c..0482416e1 100644 --- a/Tests/Tests/ViewTypes/ListWithInsetStyleTests.swift +++ b/Tests/Tests/ViewTypes/ListWithInsetStyleTests.swift @@ -1,52 +1,44 @@ #if !os(tvOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing -@available(iOS 14, macOS 11, *) @MainActor -final class ListWithInsetStyleTests: XCTestCase { +@Suite +struct ListWithInsetStyleTests { #if canImport(UIKit) typealias PlatformListWithInsetStyle = UIScrollView // covers both UITableView and UICollectionView #elseif canImport(AppKit) typealias PlatformListWithInsetStyle = NSTableView #endif - func testListWithInsetStyle() throws { - guard #available(iOS 14, macOS 11, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformListWithInsetStyle.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - + @Test func introspect() async throws { + let (entity1, entity2) = try await introspection(of: PlatformListWithInsetStyle.self) { spy1, spy2 in HStack { List { Text("Item 1") } .listStyle(.inset) #if os(iOS) || os(visionOS) - .introspect(.list(style: .inset), on: .iOS(.v14, .v15)) { spy0($0) } - .introspect(.list(style: .inset), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)) { spy0($0) } + .introspect(.list(style: .inset), on: .iOS(.v14, .v15), customize: spy1) + .introspect(.list(style: .inset), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) #elseif os(macOS) - .introspect(.list(style: .inset), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26)) { spy0($0) } + .introspect(.list(style: .inset), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) #endif List { Text("Item 1") #if os(iOS) || os(visionOS) - .introspect(.list(style: .inset), on: .iOS(.v14, .v15), scope: .ancestor) { spy1($0) } - .introspect(.list(style: .inset), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), scope: .ancestor) { spy1($0) } + .introspect(.list(style: .inset), on: .iOS(.v14, .v15), scope: .ancestor, customize: spy2) + .introspect(.list(style: .inset), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), scope: .ancestor, customize: spy2) #elseif os(macOS) - .introspect(.list(style: .inset), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), scope: .ancestor) { spy1($0) } + .introspect(.list(style: .inset), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), scope: .ancestor, customize: spy2) #endif } .listStyle(.inset) } - } extraAssertions: { - XCTAssert($0[safe: 0] !== $0[safe: 1]) } + #expect(entity1 !== entity2) } } #endif diff --git a/Tests/Tests/ViewTypes/ListWithPlainStyleTests.swift b/Tests/Tests/ViewTypes/ListWithPlainStyleTests.swift index b170db52c..5b462575a 100644 --- a/Tests/Tests/ViewTypes/ListWithPlainStyleTests.swift +++ b/Tests/Tests/ViewTypes/ListWithPlainStyleTests.swift @@ -1,45 +1,42 @@ import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class ListWithPlainStyleTests: XCTestCase { +@Suite +struct ListWithPlainStyleTests { #if canImport(UIKit) typealias PlatformListWithPlainStyle = UIScrollView // covers both UITableView and UICollectionView #elseif canImport(AppKit) typealias PlatformListWithPlainStyle = NSTableView #endif - func testListWithPlainStyle() { - XCTAssertViewIntrospection(of: PlatformListWithPlainStyle.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - + @Test func introspect() async throws { + let (entity1, entity2) = try await introspection(of: PlatformListWithPlainStyle.self) { spy1, spy2 in HStack { List { Text("Item 1") } .listStyle(.plain) #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.list(style: .plain), on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { spy0($0) } - .introspect(.list(style: .plain), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)) { spy0($0) } + .introspect(.list(style: .plain), on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy1) + .introspect(.list(style: .plain), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) #elseif os(macOS) - .introspect(.list(style: .plain), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { spy0($0) } + .introspect(.list(style: .plain), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) #endif List { Text("Item 1") #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.list(style: .plain), on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), scope: .ancestor) { spy1($0) } - .introspect(.list(style: .plain), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), scope: .ancestor) { spy1($0) } + .introspect(.list(style: .plain), on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), scope: .ancestor, customize: spy2) + .introspect(.list(style: .plain), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), scope: .ancestor, customize: spy2) #elseif os(macOS) - .introspect(.list(style: .plain), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), scope: .ancestor) { spy1($0) } + .introspect(.list(style: .plain), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), scope: .ancestor, customize: spy2) #endif } .listStyle(.plain) } - } extraAssertions: { - XCTAssert($0[safe: 0] !== $0[safe: 1]) } + #expect(entity1 !== entity2) } } diff --git a/Tests/Tests/ViewTypes/ListWithSidebarStyleTests.swift b/Tests/Tests/ViewTypes/ListWithSidebarStyleTests.swift index a60bd6f0e..754cef041 100644 --- a/Tests/Tests/ViewTypes/ListWithSidebarStyleTests.swift +++ b/Tests/Tests/ViewTypes/ListWithSidebarStyleTests.swift @@ -1,52 +1,44 @@ #if !os(tvOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing -@available(iOS 14, macOS 10.15, *) @MainActor -final class ListWithSidebarStyleTests: XCTestCase { +@Suite +struct ListWithSidebarStyleTests { #if canImport(UIKit) typealias PlatformListWithSidebarStyle = UIScrollView // covers both UITableView and UICollectionView #elseif canImport(AppKit) typealias PlatformListWithSidebarStyle = NSTableView #endif - func testListWithSidebarStyle() throws { - guard #available(iOS 14, macOS 10.15, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformListWithSidebarStyle.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - + @Test func introspect() async throws { + let (entity1, entity2) = try await introspection(of: PlatformListWithSidebarStyle.self) { spy1, spy2 in HStack { List { Text("Item 1") } .listStyle(.sidebar) #if os(iOS) || os(visionOS) - .introspect(.list(style: .sidebar), on: .iOS(.v14, .v15)) { spy0($0) } - .introspect(.list(style: .sidebar), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)) { spy0($0) } + .introspect(.list(style: .sidebar), on: .iOS(.v14, .v15), customize: spy1) + .introspect(.list(style: .sidebar), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) #elseif os(macOS) - .introspect(.list(style: .sidebar), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { spy0($0) } + .introspect(.list(style: .sidebar), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) #endif List { Text("Item 1") #if os(iOS) || os(visionOS) - .introspect(.list(style: .sidebar), on: .iOS(.v14, .v15), scope: .ancestor) { spy1($0) } - .introspect(.list(style: .sidebar), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), scope: .ancestor) { spy1($0) } + .introspect(.list(style: .sidebar), on: .iOS(.v14, .v15), scope: .ancestor, customize: spy2) + .introspect(.list(style: .sidebar), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), scope: .ancestor, customize: spy2) #elseif os(macOS) - .introspect(.list(style: .sidebar), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), scope: .ancestor) { spy1($0) } + .introspect(.list(style: .sidebar), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), scope: .ancestor, customize: spy2) #endif } .listStyle(.sidebar) } - } extraAssertions: { - XCTAssert($0[safe: 0] !== $0[safe: 1]) } + #expect(entity1 !== entity2) } } #endif diff --git a/Tests/Tests/ViewTypes/MapTests.swift b/Tests/Tests/ViewTypes/MapTests.swift index 0e5aceef3..9958a5502 100644 --- a/Tests/Tests/ViewTypes/MapTests.swift +++ b/Tests/Tests/ViewTypes/MapTests.swift @@ -2,23 +2,14 @@ import MapKit import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing -@available(iOS 14, tvOS 14, macOS 11, *) @MainActor -final class MapTests: XCTestCase { +@Suite struct MapTests { typealias PlatformMap = MKMapView - func testMap() throws { - guard #available(iOS 14, tvOS 14, macOS 11, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformMap.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] - + @Test func introspect() async throws { + let (entity1, entity2, entity3) = try await introspection(of: PlatformMap.self) { spy1, spy2, spy3 in let region = Binding.constant(MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: 51.507222, longitude: -0.1275), span: MKCoordinateSpan(latitudeDelta: 0.5, longitudeDelta: 0.5))) VStack { @@ -26,28 +17,27 @@ final class MapTests: XCTestCase { .introspect( .map, on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v14, .v15, .v16, .v17, .v18, .v26), .macOS(.v11, .v12, .v13, .v14, .v15, .v26), .visionOS(.v1, .v2, .v26), - customize: spy0 + customize: spy1 ) Map(coordinateRegion: region) .introspect( .map, on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v14, .v15, .v16, .v17, .v18, .v26), .macOS(.v11, .v12, .v13, .v14, .v15, .v26), .visionOS(.v1, .v2, .v26), - customize: spy1 + customize: spy2 ) Map(coordinateRegion: region) .introspect( .map, on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v14, .v15, .v16, .v17, .v18, .v26), .macOS(.v11, .v12, .v13, .v14, .v15, .v26), .visionOS(.v1, .v2, .v26), - customize: spy2 + customize: spy3 ) } - } extraAssertions: { - XCTAssertNotIdentical($0[safe: 0], $0[safe: 1]) - XCTAssertNotIdentical($0[safe: 0], $0[safe: 2]) - XCTAssertNotIdentical($0[safe: 1], $0[safe: 2]) } + #expect(entity1 !== entity2) + #expect(entity1 !== entity3) + #expect(entity2 !== entity3) } } #endif diff --git a/Tests/Tests/ViewTypes/NavigationSplitViewTests.swift b/Tests/Tests/ViewTypes/NavigationSplitViewTests.swift index f895a1823..5cbf7cac9 100644 --- a/Tests/Tests/ViewTypes/NavigationSplitViewTests.swift +++ b/Tests/Tests/ViewTypes/NavigationSplitViewTests.swift @@ -1,10 +1,10 @@ import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing -@available(iOS 16, tvOS 16, macOS 13, *) @MainActor -final class NavigationSplitViewTests: XCTestCase { +@Suite +struct NavigationSplitViewTests { #if canImport(UIKit) && (os(iOS) || os(visionOS)) typealias PlatformNavigationSplitView = UISplitViewController #elseif canImport(UIKit) && os(tvOS) @@ -13,17 +13,10 @@ final class NavigationSplitViewTests: XCTestCase { typealias PlatformNavigationSplitView = NSSplitView #endif - func testNavigationSplitView() throws { - guard #available(iOS 16, tvOS 16, macOS 13, *) else { - throw XCTSkip() - } - guard #unavailable(tvOS 18) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformNavigationSplitView.self) { spies in - let spy = spies[0] - + @available(iOS 16, macOS 13, *) + @available(tvOS, introduced: 16, obsoleted: 18) + @Test func introspect() async throws { + try await introspection(of: PlatformNavigationSplitView.self) { spy in NavigationSplitView { ZStack { Color.red @@ -45,17 +38,10 @@ final class NavigationSplitViewTests: XCTestCase { } } - func testNavigationSplitViewAsAncestor() throws { - guard #available(iOS 16, tvOS 16, macOS 13, *) else { - throw XCTSkip() - } - guard #unavailable(tvOS 18) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformNavigationSplitView.self) { spies in - let spy = spies[0] - + @available(iOS 16, macOS 13, *) + @available(tvOS, introduced: 16, obsoleted: 18) + @Test func introspectAsAncestor() async throws { + try await introspection(of: PlatformNavigationSplitView.self) { spy in // NB: columnVisibility is explicitly set here for ancestor introspection to work, because initially on iPad the sidebar is hidden, so the introspection modifier isn't triggered until the user makes the sidebar appear. This is why ancestor introspection is discouraged for most situations and it's opt-in. NavigationSplitView(columnVisibility: .constant(.all)) { ZStack { diff --git a/Tests/Tests/ViewTypes/NavigationStackTests.swift b/Tests/Tests/ViewTypes/NavigationStackTests.swift index a5ffd787e..6dba62c9d 100644 --- a/Tests/Tests/ViewTypes/NavigationStackTests.swift +++ b/Tests/Tests/ViewTypes/NavigationStackTests.swift @@ -1,23 +1,18 @@ #if !os(macOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing -@available(iOS 16, tvOS 16, *) @MainActor -final class NavigationStackTests: XCTestCase { +@Suite +struct NavigationStackTests { #if canImport(UIKit) typealias PlatformNavigationStack = UINavigationController #endif - func testNavigationStack() throws { - guard #available(iOS 16, tvOS 16, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformNavigationStack.self) { spies in - let spy = spies[0] - + @available(iOS 16, tvOS 16, *) + @Test func introspect() async throws { + try await introspection(of: PlatformNavigationStack.self) { spy in NavigationStack { ZStack { Color.red @@ -30,14 +25,9 @@ final class NavigationStackTests: XCTestCase { } } - func testNavigationStackAsAncestor() throws { - guard #available(iOS 16, tvOS 16, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformNavigationStack.self) { spies in - let spy = spies[0] - + @available(iOS 16, tvOS 16, *) + @Test func introspectAsAncestor() async throws { + try await introspection(of: PlatformNavigationStack.self) { spy in NavigationStack { ZStack { Color.red diff --git a/Tests/Tests/ViewTypes/NavigationViewWithColumnsStyleTests.swift b/Tests/Tests/ViewTypes/NavigationViewWithColumnsStyleTests.swift index 22ebd547e..8cb78860a 100644 --- a/Tests/Tests/ViewTypes/NavigationViewWithColumnsStyleTests.swift +++ b/Tests/Tests/ViewTypes/NavigationViewWithColumnsStyleTests.swift @@ -1,9 +1,10 @@ import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class NavigationViewWithColumnsStyleTests: XCTestCase { +@Suite +struct NavigationViewWithColumnsStyleTests { #if canImport(UIKit) && (os(iOS) || os(visionOS)) typealias PlatformNavigationViewWithColumnsStyle = UISplitViewController #elseif canImport(UIKit) && os(tvOS) @@ -12,10 +13,8 @@ final class NavigationViewWithColumnsStyleTests: XCTestCase { typealias PlatformNavigationViewWithColumnsStyle = NSSplitView #endif - func testNavigationViewWithColumnsStyle() { - XCTAssertViewIntrospection(of: PlatformNavigationViewWithColumnsStyle.self) { spies in - let spy = spies[0] - + @Test func introspect() async throws { + try await introspection(of: PlatformNavigationViewWithColumnsStyle.self) { spy in NavigationView { ZStack { Color.red @@ -33,10 +32,8 @@ final class NavigationViewWithColumnsStyleTests: XCTestCase { } } - func testNavigationViewWithColumnsStyleAsAncestor() { - XCTAssertViewIntrospection(of: PlatformNavigationViewWithColumnsStyle.self) { spies in - let spy = spies[0] - + @Test func introspectAsAncestor() async throws { + try await introspection(of: PlatformNavigationViewWithColumnsStyle.self) { spy in NavigationView { ZStack { Color.red diff --git a/Tests/Tests/ViewTypes/NavigationViewWithStackStyleTests.swift b/Tests/Tests/ViewTypes/NavigationViewWithStackStyleTests.swift index 3d9de6700..50a95ca10 100644 --- a/Tests/Tests/ViewTypes/NavigationViewWithStackStyleTests.swift +++ b/Tests/Tests/ViewTypes/NavigationViewWithStackStyleTests.swift @@ -1,18 +1,17 @@ #if !os(macOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class NavigationViewWithStackStyleTests: XCTestCase { +@Suite +struct NavigationViewWithStackStyleTests { #if canImport(UIKit) typealias PlatformNavigationViewWithStackStyle = UINavigationController #endif - func testNavigationViewWithStackStyle() { - XCTAssertViewIntrospection(of: PlatformNavigationViewWithStackStyle.self) { spies in - let spy = spies[0] - + @Test func introspect() async throws { + try await introspection(of: PlatformNavigationViewWithStackStyle.self) { spy in NavigationView { ZStack { Color.red @@ -26,10 +25,8 @@ final class NavigationViewWithStackStyleTests: XCTestCase { } } - func testNavigationViewWithStackStyleAsAncestor() { - XCTAssertViewIntrospection(of: PlatformNavigationViewWithStackStyle.self) { spies in - let spy = spies[0] - + @Test func introspectAsAncestor() async throws { + try await introspection(of: PlatformNavigationViewWithStackStyle.self) { spy in NavigationView { ZStack { Color.red diff --git a/Tests/Tests/ViewTypes/PageControlTests.swift b/Tests/Tests/ViewTypes/PageControlTests.swift index 9564e6afc..848df2ae8 100644 --- a/Tests/Tests/ViewTypes/PageControlTests.swift +++ b/Tests/Tests/ViewTypes/PageControlTests.swift @@ -1,23 +1,17 @@ #if !os(macOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing -@available(iOS 14, tvOS 14, *) @MainActor -final class PageControlTests: XCTestCase { +@Suite +struct PageControlTests { #if canImport(UIKit) typealias PlatformPageControl = UIPageControl #endif - func testPageControl() throws { - guard #available(iOS 14, tvOS 14, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformPageControl.self) { spies in - let spy = spies[0] - + @Test func introspect() async throws { + try await introspection(of: PlatformPageControl.self) { spy in TabView { Text("Page 1").frame(maxWidth: .infinity, maxHeight: .infinity).background(Color.red) Text("Page 2").frame(maxWidth: .infinity, maxHeight: .infinity).background(Color.blue) diff --git a/Tests/Tests/ViewTypes/PickerWithMenuStyleTests.swift b/Tests/Tests/ViewTypes/PickerWithMenuStyleTests.swift index 8bd0ce65d..a836a04ec 100644 --- a/Tests/Tests/ViewTypes/PickerWithMenuStyleTests.swift +++ b/Tests/Tests/ViewTypes/PickerWithMenuStyleTests.swift @@ -1,27 +1,24 @@ #if !os(iOS) && !os(tvOS) && !os(visionOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class PickerWithMenuStyleTests: XCTestCase { +@Suite +struct PickerWithMenuStyleTests { #if canImport(AppKit) && !targetEnvironment(macCatalyst) typealias PlatformPickerWithMenuStyle = NSPopUpButton #endif - func testPickerWithMenuStyle() { - XCTAssertViewIntrospection(of: PlatformPickerWithMenuStyle.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] - + @Test func introspect() async throws { + let (entity1, entity2, entity3) = try await introspection(of: PlatformPickerWithMenuStyle.self) { spy1, spy2, spy3 in VStack { Picker("Pick", selection: .constant("1")) { Text("1").tag("1") } .pickerStyle(.menu) #if os(macOS) - .introspect(.picker(style: .menu), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.picker(style: .menu), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) #endif .cornerRadius(8) @@ -31,7 +28,7 @@ final class PickerWithMenuStyleTests: XCTestCase { } .pickerStyle(.menu) #if os(macOS) - .introspect(.picker(style: .menu), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) + .introspect(.picker(style: .menu), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif .cornerRadius(8) @@ -42,16 +39,15 @@ final class PickerWithMenuStyleTests: XCTestCase { } .pickerStyle(.menu) #if os(macOS) - .introspect(.picker(style: .menu), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) + .introspect(.picker(style: .menu), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy3) #endif } - } extraAssertions: { - #if canImport(AppKit) && !targetEnvironment(macCatalyst) - XCTAssertEqual($0[safe: 0]?.numberOfItems, 1) - XCTAssertEqual($0[safe: 1]?.numberOfItems, 2) - XCTAssertEqual($0[safe: 2]?.numberOfItems, 3) - #endif } + #if canImport(AppKit) && !targetEnvironment(macCatalyst) + #expect(entity1.numberOfItems == 1) + #expect(entity2.numberOfItems == 2) + #expect(entity3.numberOfItems == 3) + #endif } } #endif diff --git a/Tests/Tests/ViewTypes/PickerWithSegmentedStyleTests.swift b/Tests/Tests/ViewTypes/PickerWithSegmentedStyleTests.swift index 5f85aac50..c30fb1408 100644 --- a/Tests/Tests/ViewTypes/PickerWithSegmentedStyleTests.swift +++ b/Tests/Tests/ViewTypes/PickerWithSegmentedStyleTests.swift @@ -1,30 +1,27 @@ import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class PickerWithSegmentedStyleTests: XCTestCase { +@Suite +struct PickerWithSegmentedStyleTests { #if canImport(UIKit) typealias PlatformPickerWithSegmentedStyle = UISegmentedControl #elseif canImport(AppKit) typealias PlatformPickerWithSegmentedStyle = NSSegmentedControl #endif - func testPickerWithSegmentedStyle() { - XCTAssertViewIntrospection(of: PlatformPickerWithSegmentedStyle.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] - + @Test func introspect() async throws { + let (entity1, entity2, entity3) = try await introspection(of: PlatformPickerWithSegmentedStyle.self) { spy1, spy2, spy3 in VStack { Picker("Pick", selection: .constant("1")) { Text("1").tag("1") } .pickerStyle(.segmented) #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.picker(style: .segmented), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy0) + .introspect(.picker(style: .segmented), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) #elseif os(macOS) - .introspect(.picker(style: .segmented), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.picker(style: .segmented), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) #endif .cornerRadius(8) @@ -34,9 +31,9 @@ final class PickerWithSegmentedStyleTests: XCTestCase { } .pickerStyle(.segmented) #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.picker(style: .segmented), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) + .introspect(.picker(style: .segmented), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) #elseif os(macOS) - .introspect(.picker(style: .segmented), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) + .introspect(.picker(style: .segmented), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif .cornerRadius(8) @@ -47,21 +44,20 @@ final class PickerWithSegmentedStyleTests: XCTestCase { } .pickerStyle(.segmented) #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.picker(style: .segmented), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) + .introspect(.picker(style: .segmented), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy3) #elseif os(macOS) - .introspect(.picker(style: .segmented), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) + .introspect(.picker(style: .segmented), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy3) #endif } - } extraAssertions: { - #if canImport(UIKit) - XCTAssertEqual($0[safe: 0]?.numberOfSegments, 1) - XCTAssertEqual($0[safe: 1]?.numberOfSegments, 2) - XCTAssertEqual($0[safe: 2]?.numberOfSegments, 3) - #elseif canImport(AppKit) - XCTAssertEqual($0[safe: 0]?.segmentCount, 1) - XCTAssertEqual($0[safe: 1]?.segmentCount, 2) - XCTAssertEqual($0[safe: 2]?.segmentCount, 3) - #endif } + #if canImport(UIKit) + #expect(entity1.numberOfSegments == 1) + #expect(entity2.numberOfSegments == 2) + #expect(entity3.numberOfSegments == 3) + #elseif canImport(AppKit) + #expect(entity1.segmentCount == 1) + #expect(entity2.segmentCount == 2) + #expect(entity3.segmentCount == 3) + #endif } } diff --git a/Tests/Tests/ViewTypes/PickerWithWheelStyleTests.swift b/Tests/Tests/ViewTypes/PickerWithWheelStyleTests.swift index 63a9ceb6a..de1bfaa68 100644 --- a/Tests/Tests/ViewTypes/PickerWithWheelStyleTests.swift +++ b/Tests/Tests/ViewTypes/PickerWithWheelStyleTests.swift @@ -1,27 +1,24 @@ #if !os(tvOS) && !os(macOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class PickerWithWheelStyleTests: XCTestCase { +@Suite +struct PickerWithWheelStyleTests { #if canImport(UIKit) typealias PlatformPickerWithWheelStyle = UIPickerView #endif - func testPickerWithWheelStyle() { - XCTAssertViewIntrospection(of: PlatformPickerWithWheelStyle.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] - + @Test func introspect() async throws { + let (entity1, entity2, entity3) = try await introspection(of: PlatformPickerWithWheelStyle.self) { spy1, spy2, spy3 in VStack { Picker("Pick", selection: .constant("1")) { Text("1").tag("1") } .pickerStyle(.wheel) #if os(iOS) || os(visionOS) - .introspect(.picker(style: .wheel), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy0) + .introspect(.picker(style: .wheel), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) #endif .cornerRadius(8) @@ -31,7 +28,7 @@ final class PickerWithWheelStyleTests: XCTestCase { } .pickerStyle(.wheel) #if os(iOS) || os(visionOS) - .introspect(.picker(style: .wheel), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) + .introspect(.picker(style: .wheel), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) #endif .cornerRadius(8) @@ -42,16 +39,15 @@ final class PickerWithWheelStyleTests: XCTestCase { } .pickerStyle(.wheel) #if os(iOS) || os(visionOS) - .introspect(.picker(style: .wheel), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) + .introspect(.picker(style: .wheel), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy3) #endif } - } extraAssertions: { - #if canImport(UIKit) - XCTAssertEqual($0[safe: 0]?.numberOfRows(inComponent: 0), 1) - XCTAssertEqual($0[safe: 1]?.numberOfRows(inComponent: 0), 2) - XCTAssertEqual($0[safe: 2]?.numberOfRows(inComponent: 0), 3) - #endif } + #if canImport(UIKit) + #expect(entity1.numberOfRows(inComponent: 0) == 1) + #expect(entity2.numberOfRows(inComponent: 0) == 2) + #expect(entity3.numberOfRows(inComponent: 0) == 3) + #endif } } #endif diff --git a/Tests/Tests/ViewTypes/PopoverTests.swift b/Tests/Tests/ViewTypes/PopoverTests.swift index 438fa7192..d8af3704c 100644 --- a/Tests/Tests/ViewTypes/PopoverTests.swift +++ b/Tests/Tests/ViewTypes/PopoverTests.swift @@ -1,21 +1,20 @@ #if !os(tvOS) && !os(macOS) && !targetEnvironment(macCatalyst) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class PopoverTests: XCTestCase { - func testPopover() throws { - XCTAssertViewIntrospection(of: UIPopoverPresentationController.self) { spies in - let spy0 = spies[0] - +@Suite +struct PopoverTests { + @Test func introspect() async throws { + try await introspection(of: UIPopoverPresentationController.self) { spy in Text("Root") .popover(isPresented: .constant(true)) { Text("Popover") .introspect( .popover, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), - customize: spy0 + customize: spy ) } } diff --git a/Tests/Tests/ViewTypes/ProgressViewWithCircularStyleTests.swift b/Tests/Tests/ViewTypes/ProgressViewWithCircularStyleTests.swift index 71d181584..571c89e40 100644 --- a/Tests/Tests/ViewTypes/ProgressViewWithCircularStyleTests.swift +++ b/Tests/Tests/ViewTypes/ProgressViewWithCircularStyleTests.swift @@ -1,56 +1,48 @@ import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class ProgressViewWithCircularStyleTests: XCTestCase { +@Suite +struct ProgressViewWithCircularStyleTests { #if canImport(UIKit) typealias PlatformProgressViewWithCircularStyle = UIActivityIndicatorView #elseif canImport(AppKit) typealias PlatformProgressViewWithCircularStyle = NSProgressIndicator #endif - func testProgressViewWithCircularStyle() throws { - guard #available(iOS 14, tvOS 14, macOS 11, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformProgressViewWithCircularStyle.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] - + @Test func introspect() async throws { + let (entity1, entity2, entity3) = try await introspection(of: PlatformProgressViewWithCircularStyle.self) { spy1, spy2, spy3 in VStack { ProgressView(value: 0.25) .progressViewStyle(.circular) #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.progressView(style: .circular), on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy0) + .introspect(.progressView(style: .circular), on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) #elseif os(macOS) - .introspect(.progressView(style: .circular), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.progressView(style: .circular), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) #endif ProgressView(value: 0.5) .progressViewStyle(.circular) #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.progressView(style: .circular), on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) + .introspect(.progressView(style: .circular), on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) #elseif os(macOS) - .introspect(.progressView(style: .circular), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) + .introspect(.progressView(style: .circular), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif ProgressView(value: 0.75) .progressViewStyle(.circular) #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.progressView(style: .circular), on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) + .introspect(.progressView(style: .circular), on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy3) #elseif os(macOS) - .introspect(.progressView(style: .circular), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) + .introspect(.progressView(style: .circular), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy3) #endif } - } extraAssertions: { - #if canImport(AppKit) && !targetEnvironment(macCatalyst) - XCTAssertEqual($0[safe: 0]?.doubleValue, 0.25) - XCTAssertEqual($0[safe: 1]?.doubleValue, 0.5) - XCTAssertEqual($0[safe: 2]?.doubleValue, 0.75) - #endif } + #if canImport(AppKit) && !targetEnvironment(macCatalyst) + #expect(entity1.doubleValue == 0.25) + #expect(entity2.doubleValue == 0.5) + #expect(entity3.doubleValue == 0.75) + #endif } } diff --git a/Tests/Tests/ViewTypes/ProgressViewWithLinearStyleTests.swift b/Tests/Tests/ViewTypes/ProgressViewWithLinearStyleTests.swift index ef66aaea5..ce69a5e00 100644 --- a/Tests/Tests/ViewTypes/ProgressViewWithLinearStyleTests.swift +++ b/Tests/Tests/ViewTypes/ProgressViewWithLinearStyleTests.swift @@ -1,60 +1,52 @@ import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class ProgressViewWithLinearStyleTests: XCTestCase { +@Suite +struct ProgressViewWithLinearStyleTests { #if canImport(UIKit) typealias PlatformProgressViewWithLinearStyle = UIProgressView #elseif canImport(AppKit) typealias PlatformProgressViewWithLinearStyle = NSProgressIndicator #endif - func testProgressViewWithLinearStyle() throws { - guard #available(iOS 14, tvOS 14, macOS 11, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformProgressViewWithLinearStyle.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] - + @Test func introspect() async throws { + let (entity1, entity2, entity3) = try await introspection(of: PlatformProgressViewWithLinearStyle.self) { spy1, spy2, spy3 in VStack { ProgressView(value: 0.25) .progressViewStyle(.linear) #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.progressView(style: .linear), on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy0) + .introspect(.progressView(style: .linear), on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) #elseif os(macOS) - .introspect(.progressView(style: .linear), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.progressView(style: .linear), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) #endif ProgressView(value: 0.5) .progressViewStyle(.linear) #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.progressView(style: .linear), on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) + .introspect(.progressView(style: .linear), on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) #elseif os(macOS) - .introspect(.progressView(style: .linear), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) + .introspect(.progressView(style: .linear), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif ProgressView(value: 0.75) .progressViewStyle(.linear) #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.progressView(style: .linear), on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) + .introspect(.progressView(style: .linear), on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy3) #elseif os(macOS) - .introspect(.progressView(style: .linear), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) + .introspect(.progressView(style: .linear), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy3) #endif } - } extraAssertions: { - #if canImport(UIKit) - XCTAssertEqual($0[safe: 0]?.progress, 0.25) - XCTAssertEqual($0[safe: 1]?.progress, 0.5) - XCTAssertEqual($0[safe: 2]?.progress, 0.75) - #elseif canImport(AppKit) && !targetEnvironment(macCatalyst) - XCTAssertEqual($0[safe: 0]?.doubleValue, 0.25) - XCTAssertEqual($0[safe: 1]?.doubleValue, 0.5) - XCTAssertEqual($0[safe: 2]?.doubleValue, 0.75) - #endif } + #if canImport(UIKit) + #expect(entity1.progress == 0.25) + #expect(entity2.progress == 0.5) + #expect(entity3.progress == 0.75) + #elseif canImport(AppKit) && !targetEnvironment(macCatalyst) + #expect(entity1.doubleValue == 0.25) + #expect(entity2.doubleValue == 0.5) + #expect(entity3.doubleValue == 0.75) + #endif } } diff --git a/Tests/Tests/ViewTypes/ScrollViewTests.swift b/Tests/Tests/ViewTypes/ScrollViewTests.swift index 30d7f2238..2059f9f27 100644 --- a/Tests/Tests/ViewTypes/ScrollViewTests.swift +++ b/Tests/Tests/ViewTypes/ScrollViewTests.swift @@ -1,60 +1,51 @@ import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class ScrollViewTests: XCTestCase { +@Suite +struct ScrollViewTests { #if canImport(UIKit) typealias PlatformScrollView = UIScrollView #elseif canImport(AppKit) typealias PlatformScrollView = NSScrollView #endif - func testScrollView() { - XCTAssertViewIntrospection(of: PlatformScrollView.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - + @Test func introspect() async throws { + let (entity1, entity2) = try await introspection(of: PlatformScrollView.self) { spy1, spy2 in HStack { ScrollView(showsIndicators: false) { Text("Item 1") } #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy0) + .introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) #elseif os(macOS) - .introspect(.scrollView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.scrollView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) #endif ScrollView(showsIndicators: true) { Text("Item 1") #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), scope: .ancestor, customize: spy1) + .introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), scope: .ancestor, customize: spy2) #elseif os(macOS) - .introspect(.scrollView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), scope: .ancestor, customize: spy1) + .introspect(.scrollView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), scope: .ancestor, customize: spy2) #endif } } - } extraAssertions: { - #if canImport(UIKit) - XCTAssertEqual($0[safe: 0]?.showsVerticalScrollIndicator, false) - XCTAssertEqual($0[safe: 1]?.showsVerticalScrollIndicator, true) - #elseif canImport(AppKit) - // FIXME: these assertions don't pass on macOS 12, not sure why... maybe callback is too premature in relation to view lifecycle? - if #available(macOS 13, *) { - XCTAssert($0[safe: 0]?.verticalScroller == nil) - XCTAssert($0[safe: 1]?.verticalScroller != nil) - } - #endif - - XCTAssert($0[safe: 0] !== $0[safe: 1]) } - } + #if canImport(UIKit) + #expect(entity1.showsVerticalScrollIndicator == false) + #expect(entity2.showsVerticalScrollIndicator == true) + #elseif canImport(AppKit) + #expect(entity1.verticalScroller == nil) + #expect(entity2.verticalScroller != nil) + #endif - func testNestedScrollView() { - XCTAssertViewIntrospection(of: PlatformScrollView.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] + #expect(entity1 !== entity2) + } + @Test func introspectNested() async throws { + let (entity1, entity2) = try await introspection(of: PlatformScrollView.self) { spy1, spy2 in ScrollView(showsIndicators: true) { Text("Item 1") @@ -62,45 +53,38 @@ final class ScrollViewTests: XCTestCase { Text("Item 1") } #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) + .introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) #elseif os(macOS) - .introspect(.scrollView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) + .introspect(.scrollView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif } #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy0) + .introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) #elseif os(macOS) - .introspect(.scrollView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.scrollView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) #endif - } extraAssertions: { - #if canImport(UIKit) - XCTAssertEqual($0[safe: 0]?.showsVerticalScrollIndicator, true) - XCTAssertEqual($0[safe: 1]?.showsVerticalScrollIndicator, false) - #elseif canImport(AppKit) - // FIXME: these assertions don't pass on macOS 12, not sure why... maybe callback is too premature in relation to view lifecycle? - if #available(macOS 13, *) { - XCTAssert($0[safe: 0]?.verticalScroller != nil) - XCTAssert($0[safe: 1]?.verticalScroller == nil) - } - #endif - - XCTAssert($0[safe: 0] !== $0[safe: 1]) } - } + #if canImport(UIKit) + #expect(entity1.showsVerticalScrollIndicator == true) + #expect(entity2.showsVerticalScrollIndicator == false) + #elseif canImport(AppKit) + #expect(entity1.verticalScroller != nil) + #expect(entity2.verticalScroller == nil) + #endif - func testMaskedScrollView() { - XCTAssertViewIntrospection(of: PlatformScrollView.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] + #expect(entity1 !== entity2) + } + @Test func introspectMasked() async throws { + let (entity1, entity2) = try await introspection(of: PlatformScrollView.self) { spy1, spy2 in HStack { ScrollView(showsIndicators: false) { Text("Item 1") } #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy0) + .introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) #elseif os(macOS) - .introspect(.scrollView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.scrollView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) #endif .clipped() .clipShape(RoundedRectangle(cornerRadius: 20.0)) @@ -109,25 +93,21 @@ final class ScrollViewTests: XCTestCase { ScrollView(showsIndicators: true) { Text("Item 1") #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), scope: .ancestor, customize: spy1) + .introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), scope: .ancestor, customize: spy2) #elseif os(macOS) - .introspect(.scrollView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), scope: .ancestor, customize: spy1) + .introspect(.scrollView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), scope: .ancestor, customize: spy2) #endif } } - } extraAssertions: { - #if canImport(UIKit) - XCTAssertEqual($0[safe: 0]?.showsVerticalScrollIndicator, false) - XCTAssertEqual($0[safe: 1]?.showsVerticalScrollIndicator, true) - #elseif canImport(AppKit) - // FIXME: these assertions don't pass on macOS 12, not sure why... maybe callback is too premature in relation to view lifecycle? - if #available(macOS 13, *) { - XCTAssert($0[safe: 0]?.verticalScroller == nil) - XCTAssert($0[safe: 1]?.verticalScroller != nil) - } - #endif - - XCTAssert($0[safe: 0] !== $0[safe: 1]) } + #if canImport(UIKit) + #expect(entity1.showsVerticalScrollIndicator == false) + #expect(entity2.showsVerticalScrollIndicator == true) + #elseif canImport(AppKit) + #expect(entity1.verticalScroller == nil) + #expect(entity2.verticalScroller != nil) + #endif + + #expect(entity1 !== entity2) } } diff --git a/Tests/Tests/ViewTypes/SearchFieldTests.swift b/Tests/Tests/ViewTypes/SearchFieldTests.swift index e48995c18..a729ec937 100644 --- a/Tests/Tests/ViewTypes/SearchFieldTests.swift +++ b/Tests/Tests/ViewTypes/SearchFieldTests.swift @@ -1,23 +1,18 @@ #if !os(macOS) && !targetEnvironment(macCatalyst) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing -@available(iOS 15, tvOS 15, *) @MainActor -final class SearchFieldTests: XCTestCase { +@Suite +struct SearchFieldTests { #if canImport(UIKit) typealias PlatformSearchField = UISearchBar #endif - func testSearchFieldInNavigationStack() throws { - guard #available(iOS 15, tvOS 15, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformSearchField.self) { spies in - let spy = spies[0] - + @available(iOS 15, tvOS 15, *) + @Test func introspectInNavigationStack() async throws { + try await introspection(of: PlatformSearchField.self) { spy in NavigationView { Text("Customized") .searchable(text: .constant("")) @@ -29,14 +24,9 @@ final class SearchFieldTests: XCTestCase { } } - func testSearchFieldInNavigationStackAsAncestor() throws { - guard #available(iOS 15, tvOS 15, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformSearchField.self) { spies in - let spy = spies[0] - + @available(iOS 15, tvOS 15, *) + @Test func introspectInNavigationStackAsAncestor() async throws { + try await introspection(of: PlatformSearchField.self) { spy in NavigationView { Text("Customized") .searchable(text: .constant("")) @@ -48,17 +38,10 @@ final class SearchFieldTests: XCTestCase { } } - func testSearchFieldInNavigationSplitView() throws { - guard #available(iOS 15, tvOS 15, *) else { - throw XCTSkip() - } - guard #unavailable(visionOS 26) else { // TODO: verify this - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformSearchField.self) { spies in - let spy = spies[0] - + @available(iOS 15, tvOS 15, *) + @available(visionOS, introduced: 1, obsoleted: 26) + @Test func introspectInNavigationSplitView() async throws { + try await introspection(of: PlatformSearchField.self) { spy in NavigationView { Text("Customized") .searchable(text: .constant("")) @@ -76,14 +59,9 @@ final class SearchFieldTests: XCTestCase { } } - func testSearchFieldInNavigationSplitViewAsAncestor() throws { - guard #available(iOS 15, tvOS 15, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformSearchField.self) { spies in - let spy = spies[0] - + @available(iOS 15, tvOS 15, *) + @Test func introspectInNavigationSplitViewAsAncestor() async throws { + try await introspection(of: PlatformSearchField.self) { spy in NavigationView { Text("Customized") .searchable(text: .constant("")) diff --git a/Tests/Tests/ViewTypes/SecureFieldTests.swift b/Tests/Tests/ViewTypes/SecureFieldTests.swift index a6127556c..db5dc4d6e 100644 --- a/Tests/Tests/ViewTypes/SecureFieldTests.swift +++ b/Tests/Tests/ViewTypes/SecureFieldTests.swift @@ -1,30 +1,19 @@ import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class SecureFieldTests: XCTestCase { +@Suite +struct SecureFieldTests { #if canImport(UIKit) typealias PlatformSecureField = UITextField #elseif canImport(AppKit) typealias PlatformSecureField = NSTextField #endif - func testSecureField() { - XCTAssertViewIntrospection(of: PlatformSecureField.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] - + @Test func introspect() async throws { + let (entity1, entity2, entity3) = try await introspection(of: PlatformSecureField.self) { spy1, spy2, spy3 in VStack { - SecureField("", text: .constant("Secure Field 0")) - #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.secureField, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy0) - #elseif os(macOS) - .introspect(.secureField, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) - #endif - .cornerRadius(8) - SecureField("", text: .constant("Secure Field 1")) #if os(iOS) || os(tvOS) || os(visionOS) .introspect(.secureField, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) @@ -39,34 +28,30 @@ final class SecureFieldTests: XCTestCase { #elseif os(macOS) .introspect(.secureField, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif - } - } extraAssertions: { - #if canImport(UIKit) - XCTAssertEqual($0[safe: 0]?.text, "Secure Field 0") - XCTAssertEqual($0[safe: 1]?.text, "Secure Field 1") - XCTAssertEqual($0[safe: 2]?.text, "Secure Field 2") - #elseif canImport(AppKit) - XCTAssertEqual($0[safe: 0]?.stringValue, "Secure Field 0") - XCTAssertEqual($0[safe: 1]?.stringValue, "Secure Field 1") - XCTAssertEqual($0[safe: 2]?.stringValue, "Secure Field 2") - #endif - } - } - - func testSecureFieldsEmbeddedInList() { - XCTAssertViewIntrospection(of: PlatformSecureField.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] + .cornerRadius(8) - List { - SecureField("", text: .constant("Secure Field 0")) + SecureField("", text: .constant("Secure Field 3")) #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.secureField, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy0) + .introspect(.secureField, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy3) #elseif os(macOS) - .introspect(.secureField, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.secureField, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy3) #endif + } + } + #if canImport(UIKit) + #expect(entity1.text == "Secure Field 1") + #expect(entity2.text == "Secure Field 2") + #expect(entity3.text == "Secure Field 3") + #elseif canImport(AppKit) + #expect(entity1.stringValue == "Secure Field 1") + #expect(entity2.stringValue == "Secure Field 2") + #expect(entity3.stringValue == "Secure Field 3") + #endif + } + @Test func introspectEmbeddedInList() async throws { + let (entity1, entity2, entity3) = try await introspection(of: PlatformSecureField.self) { spy1, spy2, spy3 in + List { SecureField("", text: .constant("Secure Field 1")) #if os(iOS) || os(tvOS) || os(visionOS) .introspect(.secureField, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) @@ -80,17 +65,23 @@ final class SecureFieldTests: XCTestCase { #elseif os(macOS) .introspect(.secureField, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif + + SecureField("", text: .constant("Secure Field 3")) + #if os(iOS) || os(tvOS) || os(visionOS) + .introspect(.secureField, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy3) + #elseif os(macOS) + .introspect(.secureField, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy3) + #endif } - } extraAssertions: { - #if canImport(UIKit) - XCTAssertEqual($0[safe: 0]?.text, "Secure Field 0") - XCTAssertEqual($0[safe: 1]?.text, "Secure Field 1") - XCTAssertEqual($0[safe: 2]?.text, "Secure Field 2") - #elseif canImport(AppKit) - XCTAssertEqual($0[safe: 0]?.stringValue, "Secure Field 0") - XCTAssertEqual($0[safe: 1]?.stringValue, "Secure Field 1") - XCTAssertEqual($0[safe: 2]?.stringValue, "Secure Field 2") - #endif } + #if canImport(UIKit) + #expect(entity1.text == "Secure Field 1") + #expect(entity2.text == "Secure Field 2") + #expect(entity3.text == "Secure Field 3") + #elseif canImport(AppKit) + #expect(entity1.stringValue == "Secure Field 1") + #expect(entity2.stringValue == "Secure Field 2") + #expect(entity3.stringValue == "Secure Field 3") + #endif } } diff --git a/Tests/Tests/ViewTypes/SheetTests.swift b/Tests/Tests/ViewTypes/SheetTests.swift index e849bcef7..0cae40a69 100644 --- a/Tests/Tests/ViewTypes/SheetTests.swift +++ b/Tests/Tests/ViewTypes/SheetTests.swift @@ -1,74 +1,64 @@ #if !os(macOS) && !targetEnvironment(macCatalyst) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class SheetTests: XCTestCase { +@Suite +struct SheetTests { #if os(iOS) - func testSheet() throws { - XCTAssertViewIntrospection(of: UIPresentationController.self) { spies in - let spy0 = spies[0] - + @Test func introspect() async throws { + try await introspection(of: UIPresentationController.self) { spy in Text("Root") .sheet(isPresented: .constant(true)) { Text("Sheet") .introspect( .sheet, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), - customize: spy0 + customize: spy ) } } } - func testSheetAsSheetPresentationController() throws { - guard #available(iOS 15, tvOS 15, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: UISheetPresentationController.self) { spies in - let spy0 = spies[0] - + @available(iOS 15, tvOS 15, *) + @Test func introspectAsSheetPresentationController() async throws { + try await introspection(of: UISheetPresentationController.self) { spy in Text("Root") .sheet(isPresented: .constant(true)) { Text("Sheet") .introspect( .sheet, on: .iOS(.v15, .v16, .v17, .v18, .v26), - customize: spy0 + customize: spy ) } } } #elseif os(tvOS) - func testSheet() throws { - XCTAssertViewIntrospection(of: UIPresentationController.self) { spies in - let spy0 = spies[0] - + @Test func introspect() async throws { + try await introspection(of: UIPresentationController.self) { spy in Text("Root") .sheet(isPresented: .constant(true)) { Text("Content") .introspect( .sheet, on: .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), - customize: spy0 + customize: spy ) } } } #elseif os(visionOS) - func testSheet() throws { - XCTAssertViewIntrospection(of: UIPresentationController.self) { spies in - let spy0 = spies[0] - + @Test func introspect() async throws { + try await introspection(of: UIPresentationController.self) { spy in Text("Root") .sheet(isPresented: .constant(true)) { Text("Sheet") .introspect( .sheet, on: .visionOS(.v1, .v2, .v26), - customize: spy0 + customize: spy ) } } diff --git a/Tests/Tests/ViewTypes/SliderTests.swift b/Tests/Tests/ViewTypes/SliderTests.swift index 64371431c..7d12e6e20 100644 --- a/Tests/Tests/ViewTypes/SliderTests.swift +++ b/Tests/Tests/ViewTypes/SliderTests.swift @@ -1,57 +1,53 @@ #if !os(tvOS) && !os(visionOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class SliderTests: XCTestCase { +@Suite +struct SliderTests { #if canImport(UIKit) typealias PlatformSlider = UISlider #elseif canImport(AppKit) typealias PlatformSlider = NSSlider #endif - func testSlider() { - XCTAssertViewIntrospection(of: PlatformSlider.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] - + @Test func introspect() async throws { + let (entity1, entity2, entity3) = try await introspection(of: PlatformSlider.self) { spy1, spy2, spy3 in VStack { Slider(value: .constant(0.2), in: 0...1) #if os(iOS) - .introspect(.slider, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy0) + .introspect(.slider, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy1) #elseif os(macOS) - .introspect(.slider, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.slider, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) #endif .cornerRadius(8) Slider(value: .constant(0.5), in: 0...1) #if os(iOS) - .introspect(.slider, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy1) + .introspect(.slider, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy2) #elseif os(macOS) - .introspect(.slider, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) + .introspect(.slider, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif .cornerRadius(8) Slider(value: .constant(0.8), in: 0...1) #if os(iOS) - .introspect(.slider, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy2) + .introspect(.slider, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy3) #elseif os(macOS) - .introspect(.slider, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) + .introspect(.slider, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy3) #endif } - } extraAssertions: { - #if canImport(UIKit) - XCTAssertEqual($0[safe: 0]?.value, 0.2) - XCTAssertEqual($0[safe: 1]?.value, 0.5) - XCTAssertEqual($0[safe: 2]?.value, 0.8) - #elseif canImport(AppKit) - XCTAssertEqual($0[safe: 0]?.floatValue, 0.2) - XCTAssertEqual($0[safe: 1]?.floatValue, 0.5) - XCTAssertEqual($0[safe: 2]?.floatValue, 0.8) - #endif } + #if canImport(UIKit) + #expect(entity1.value == 0.2) + #expect(entity2.value == 0.5) + #expect(entity3.value == 0.8) + #elseif canImport(AppKit) + #expect(entity1.floatValue == 0.2) + #expect(entity2.floatValue == 0.5) + #expect(entity3.floatValue == 0.8) + #endif } } #endif diff --git a/Tests/Tests/ViewTypes/StepperTests.swift b/Tests/Tests/ViewTypes/StepperTests.swift index 70f2d9178..ee3a89c82 100644 --- a/Tests/Tests/ViewTypes/StepperTests.swift +++ b/Tests/Tests/ViewTypes/StepperTests.swift @@ -1,49 +1,45 @@ #if !os(tvOS) && !os(visionOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class StepperTests: XCTestCase { +@Suite +struct StepperTests { #if canImport(UIKit) typealias PlatformStepper = UIStepper #elseif canImport(AppKit) typealias PlatformStepper = NSStepper #endif - func testStepper() { - XCTAssertViewIntrospection(of: PlatformStepper.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] - + @Test func introspect() async throws { + let (entity1, entity2, entity3) = try await introspection(of: PlatformStepper.self) { spy1, spy2, spy3 in VStack { Stepper("", value: .constant(0), in: 0...10) #if os(iOS) - .introspect(.stepper, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy0) + .introspect(.stepper, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy1) #elseif os(macOS) - .introspect(.stepper, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.stepper, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) #endif .cornerRadius(8) Stepper("", value: .constant(0), in: 0...10) #if os(iOS) - .introspect(.stepper, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy1) + .introspect(.stepper, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy2) #elseif os(macOS) - .introspect(.stepper, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) + .introspect(.stepper, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif .cornerRadius(8) Stepper("", value: .constant(0), in: 0...10) #if os(iOS) - .introspect(.stepper, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy2) + .introspect(.stepper, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy3) #elseif os(macOS) - .introspect(.stepper, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) + .introspect(.stepper, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy3) #endif } - } extraAssertions: { - XCTAssert(Set($0.map(ObjectIdentifier.init)).count == 3) } + #expect(Set([entity1, entity2, entity3].map(ObjectIdentifier.init)).count == 3) } } #endif diff --git a/Tests/Tests/ViewTypes/TabViewTests.swift b/Tests/Tests/ViewTypes/TabViewTests.swift index 1b7a63f60..0b520eb23 100644 --- a/Tests/Tests/ViewTypes/TabViewTests.swift +++ b/Tests/Tests/ViewTypes/TabViewTests.swift @@ -1,24 +1,20 @@ #if !os(visionOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class TabViewTests: XCTestCase { +@Suite +struct TabViewTests { #if canImport(UIKit) typealias PlatformTabView = UITabBarController #elseif canImport(AppKit) typealias PlatformTabView = NSTabView #endif - func testTabView() throws { - guard #unavailable(macOS 15) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformTabView.self) { spies in - let spy = spies[0] - + @available(macOS, introduced: 10.15, obsoleted: 15) + @Test func introspect() async throws { + try await introspection(of: PlatformTabView.self) { spy in TabView { ZStack { Color.red @@ -33,14 +29,9 @@ final class TabViewTests: XCTestCase { } } - func testTabViewAsAncestor() throws { - guard #unavailable(macOS 15) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformTabView.self) { spies in - let spy = spies[0] - + @available(macOS, introduced: 10.15, obsoleted: 15) + @Test func introspectAsAncestor() async throws { + try await introspection(of: PlatformTabView.self) { spy in TabView { ZStack { Color.red diff --git a/Tests/Tests/ViewTypes/TabViewWithPageStyleTests.swift b/Tests/Tests/ViewTypes/TabViewWithPageStyleTests.swift index d012b30ad..e63bdf11a 100644 --- a/Tests/Tests/ViewTypes/TabViewWithPageStyleTests.swift +++ b/Tests/Tests/ViewTypes/TabViewWithPageStyleTests.swift @@ -1,23 +1,17 @@ #if !os(macOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing -@available(iOS 14, tvOS 14, *) @MainActor -final class TabViewWithPageStyleTests: XCTestCase { +@Suite +struct TabViewWithPageStyleTests { #if canImport(UIKit) typealias PlatformTabViewWithPageStyle = UICollectionView #endif - func testTabViewWithPageStyle() throws { - guard #available(iOS 14, tvOS 14, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformTabViewWithPageStyle.self) { spies in - let spy = spies[0] - + @Test func introspect() async throws { + try await introspection(of: PlatformTabViewWithPageStyle.self) { spy in TabView { Text("Page 1").frame(maxWidth: .infinity, maxHeight: .infinity).background(Color.red) Text("Page 2").frame(maxWidth: .infinity, maxHeight: .infinity).background(Color.blue) @@ -29,14 +23,8 @@ final class TabViewWithPageStyleTests: XCTestCase { } } - func testTabViewWithPageStyleAsAncestor() throws { - guard #available(iOS 14, tvOS 14, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformTabViewWithPageStyle.self) { spies in - let spy = spies[0] - + @Test func introspectAsAncestor() async throws { + try await introspection(of: PlatformTabViewWithPageStyle.self) { spy in TabView { Text("Page 1").frame(maxWidth: .infinity, maxHeight: .infinity).background(Color.red) #if os(iOS) || os(tvOS) || os(visionOS) diff --git a/Tests/Tests/ViewTypes/TableTests.swift b/Tests/Tests/ViewTypes/TableTests.swift index b0785a660..c9fdee063 100644 --- a/Tests/Tests/ViewTypes/TableTests.swift +++ b/Tests/Tests/ViewTypes/TableTests.swift @@ -1,118 +1,97 @@ #if !os(tvOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing -@available(iOS 16, macOS 12, *) @MainActor -final class TableTests: XCTestCase { +@Suite +struct TableTests { #if canImport(UIKit) typealias PlatformTable = UICollectionView #elseif canImport(AppKit) typealias PlatformTable = NSTableView #endif - func testTable() throws { - guard #available(iOS 16, macOS 12, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformTable.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] - + @available(iOS 16, macOS 12, *) + @Test func introspect() async throws { + try await introspection(of: PlatformTable.self) { spy1, spy2, spy3 in VStack { TipTable() #if os(iOS) || os(visionOS) - .introspect(.table, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy0) + .introspect(.table, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) #elseif os(macOS) - .introspect(.table, on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.table, on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy1) #endif TipTable() #if os(iOS) || os(visionOS) - .introspect(.table, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) + .introspect(.table, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) #elseif os(macOS) - .introspect(.table, on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy1) + .introspect(.table, on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy2) #endif TipTable() #if os(iOS) || os(visionOS) - .introspect(.table, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) + .introspect(.table, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy3) #elseif os(macOS) - .introspect(.table, on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy2) + .introspect(.table, on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy3) #endif } } } - func testTableWithInsetStyle() throws { - guard #available(iOS 16, macOS 12, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformTable.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] - + @available(iOS 16, macOS 12, *) + @Test func introspectWithInsetStyle() async throws { + try await introspection(of: PlatformTable.self) { spy1, spy2, spy3 in VStack { TipTable() .tableStyle(.inset) #if os(iOS) || os(visionOS) - .introspect(.table, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy0) + .introspect(.table, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) #elseif os(macOS) - .introspect(.table, on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.table, on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy1) #endif TipTable() .tableStyle(.inset) #if os(iOS) || os(visionOS) - .introspect(.table, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) + .introspect(.table, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) #elseif os(macOS) - .introspect(.table, on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy1) + .introspect(.table, on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy2) #endif TipTable() .tableStyle(.inset) #if os(iOS) || os(visionOS) - .introspect(.table, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) + .introspect(.table, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy3) #elseif os(macOS) - .introspect(.table, on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy2) + .introspect(.table, on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy3) #endif } } } #if os(macOS) - func testTableWithBorderedStyle() throws { - guard #available(macOS 12, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformTable.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] - + @available(macOS 12, *) + @Test func introspectWithBorderedStyle() async throws { + try await introspection(of: PlatformTable.self) { spy1, spy2, spy3 in VStack { TipTable() .tableStyle(.bordered) #if os(macOS) - .introspect(.table, on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.table, on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy1) #endif TipTable() .tableStyle(.bordered) #if os(macOS) - .introspect(.table, on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy1) + .introspect(.table, on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy2) #endif TipTable() .tableStyle(.bordered) #if os(macOS) - .introspect(.table, on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy2) + .introspect(.table, on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy3) #endif } } diff --git a/Tests/Tests/ViewTypes/TextEditorTests.swift b/Tests/Tests/ViewTypes/TextEditorTests.swift index 890124db3..8c32a3478 100644 --- a/Tests/Tests/ViewTypes/TextEditorTests.swift +++ b/Tests/Tests/ViewTypes/TextEditorTests.swift @@ -1,62 +1,53 @@ #if !os(tvOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing -@available(iOS 14, macOS 11, *) @MainActor -final class TextEditorTests: XCTestCase { +@Suite +struct TextEditorTests { #if canImport(UIKit) typealias PlatformTextEditor = UITextView #elseif canImport(AppKit) typealias PlatformTextEditor = NSTextView #endif - func testTextEditor() throws { - guard #available(iOS 14, macOS 11, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformTextEditor.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] - + @Test func introspect() async throws { + let (entity1, entity2, entity3) = try await introspection(of: PlatformTextEditor.self) { spy1, spy2, spy3 in VStack { TextEditor(text: .constant("Text Field 0")) #if os(iOS) || os(visionOS) - .introspect(.textEditor, on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy0) + .introspect(.textEditor, on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) #elseif os(macOS) - .introspect(.textEditor, on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.textEditor, on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) #endif .cornerRadius(8) TextEditor(text: .constant("Text Field 1")) #if os(iOS) || os(visionOS) - .introspect(.textEditor, on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) + .introspect(.textEditor, on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) #elseif os(macOS) - .introspect(.textEditor, on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) + .introspect(.textEditor, on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif .cornerRadius(8) TextEditor(text: .constant("Text Field 2")) #if os(iOS) || os(visionOS) - .introspect(.textEditor, on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) + .introspect(.textEditor, on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy3) #elseif os(macOS) - .introspect(.textEditor, on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) + .introspect(.textEditor, on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy3) #endif } - } extraAssertions: { - #if canImport(UIKit) - XCTAssertEqual($0[safe: 0]?.text, "Text Field 0") - XCTAssertEqual($0[safe: 1]?.text, "Text Field 1") - XCTAssertEqual($0[safe: 2]?.text, "Text Field 2") - #elseif canImport(AppKit) - XCTAssertEqual($0[safe: 0]?.string, "Text Field 0") - XCTAssertEqual($0[safe: 1]?.string, "Text Field 1") - XCTAssertEqual($0[safe: 2]?.string, "Text Field 2") - #endif } + #if canImport(UIKit) + #expect(entity1.text == "Text Field 0") + #expect(entity2.text == "Text Field 1") + #expect(entity3.text == "Text Field 2") + #elseif canImport(AppKit) + #expect(entity1.string == "Text Field 0") + #expect(entity2.string == "Text Field 1") + #expect(entity3.string == "Text Field 2") + #endif } } #endif diff --git a/Tests/Tests/ViewTypes/TextFieldTests.swift b/Tests/Tests/ViewTypes/TextFieldTests.swift index dd6232cfe..169c6573b 100644 --- a/Tests/Tests/ViewTypes/TextFieldTests.swift +++ b/Tests/Tests/ViewTypes/TextFieldTests.swift @@ -1,30 +1,19 @@ import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class TextFieldTests: XCTestCase { +@Suite +struct TextFieldTests { #if canImport(UIKit) typealias PlatformTextField = UITextField #elseif canImport(AppKit) typealias PlatformTextField = NSTextField #endif - func testTextField() { - XCTAssertViewIntrospection(of: PlatformTextField.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] - + @Test func introspect() async throws { + let (entity1, entity2, entity3) = try await introspection(of: PlatformTextField.self) { spy1, spy2, spy3 in VStack { - TextField("", text: .constant("Text Field 0")) - #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.textField, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy0) - #elseif os(macOS) - .introspect(.textField, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) - #endif - .cornerRadius(8) - TextField("", text: .constant("Text Field 1")) #if os(iOS) || os(tvOS) || os(visionOS) .introspect(.textField, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) @@ -39,34 +28,30 @@ final class TextFieldTests: XCTestCase { #elseif os(macOS) .introspect(.textField, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif - } - } extraAssertions: { - #if canImport(UIKit) - XCTAssertEqual($0[safe: 0]?.text, "Text Field 0") - XCTAssertEqual($0[safe: 1]?.text, "Text Field 1") - XCTAssertEqual($0[safe: 2]?.text, "Text Field 2") - #elseif canImport(AppKit) - XCTAssertEqual($0[safe: 0]?.stringValue, "Text Field 0") - XCTAssertEqual($0[safe: 1]?.stringValue, "Text Field 1") - XCTAssertEqual($0[safe: 2]?.stringValue, "Text Field 2") - #endif - } - } - - func testTextFieldsEmbeddedInList() { - XCTAssertViewIntrospection(of: PlatformTextField.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] + .cornerRadius(8) - List { - TextField("", text: .constant("Text Field 0")) + TextField("", text: .constant("Text Field 3")) #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.textField, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy0) + .introspect(.textField, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy3) #elseif os(macOS) - .introspect(.textField, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.textField, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy3) #endif + } + } + #if canImport(UIKit) + #expect(entity1.text == "Text Field 1") + #expect(entity2.text == "Text Field 2") + #expect(entity3.text == "Text Field 3") + #elseif canImport(AppKit) + #expect(entity1.stringValue == "Text Field 1") + #expect(entity2.stringValue == "Text Field 2") + #expect(entity3.stringValue == "Text Field 3") + #endif + } + @Test func introspectEmbeddedInList() async throws { + let (entity1, entity2, entity3) = try await introspection(of: PlatformTextField.self) { spy1, spy2, spy3 in + List { TextField("", text: .constant("Text Field 1")) #if os(iOS) || os(tvOS) || os(visionOS) .introspect(.textField, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) @@ -80,17 +65,23 @@ final class TextFieldTests: XCTestCase { #elseif os(macOS) .introspect(.textField, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif + + TextField("", text: .constant("Text Field 3")) + #if os(iOS) || os(tvOS) || os(visionOS) + .introspect(.textField, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy3) + #elseif os(macOS) + .introspect(.textField, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy3) + #endif } - } extraAssertions: { - #if canImport(UIKit) - XCTAssertEqual($0[safe: 0]?.text, "Text Field 0") - XCTAssertEqual($0[safe: 1]?.text, "Text Field 1") - XCTAssertEqual($0[safe: 2]?.text, "Text Field 2") - #elseif canImport(AppKit) - XCTAssertEqual($0[safe: 0]?.stringValue, "Text Field 0") - XCTAssertEqual($0[safe: 1]?.stringValue, "Text Field 1") - XCTAssertEqual($0[safe: 2]?.stringValue, "Text Field 2") - #endif } + #if canImport(UIKit) + #expect(entity1.text == "Text Field 1") + #expect(entity2.text == "Text Field 2") + #expect(entity3.text == "Text Field 3") + #elseif canImport(AppKit) + #expect(entity1.stringValue == "Text Field 1") + #expect(entity2.stringValue == "Text Field 2") + #expect(entity3.stringValue == "Text Field 3") + #endif } } diff --git a/Tests/Tests/ViewTypes/TextFieldWithVerticalAxisTests.swift b/Tests/Tests/ViewTypes/TextFieldWithVerticalAxisTests.swift index d03140d1a..c8078d4f3 100644 --- a/Tests/Tests/ViewTypes/TextFieldWithVerticalAxisTests.swift +++ b/Tests/Tests/ViewTypes/TextFieldWithVerticalAxisTests.swift @@ -1,10 +1,10 @@ import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing -@available(iOS 16, tvOS 16, macOS 13, *) @MainActor -final class TextFieldWithVerticalAxisTests: XCTestCase { +@Suite +struct TextFieldWithVerticalAxisTests { #if canImport(UIKit) && (os(iOS) || os(visionOS)) typealias PlatformTextField = UITextView #elseif canImport(UIKit) && os(tvOS) @@ -13,56 +13,48 @@ final class TextFieldWithVerticalAxisTests: XCTestCase { typealias PlatformTextField = NSTextField #endif - func testTextFieldWithVerticalAxis() throws { - guard #available(iOS 16, tvOS 16, macOS 13, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformTextField.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] - + @available(iOS 16, tvOS 16, macOS 13, *) + @Test func introspect() async throws { + let (entity1, entity2, entity3) = try await introspection(of: PlatformTextField.self) { spy1, spy2, spy3 in VStack { TextField("", text: .constant("Text Field 1"), axis: .vertical) #if os(iOS) || os(visionOS) - .introspect(.textField(axis: .vertical), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy0) + .introspect(.textField(axis: .vertical), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) #elseif os(tvOS) - .introspect(.textField(axis: .vertical), on: .tvOS(.v16, .v17, .v18, .v26), customize: spy0) + .introspect(.textField(axis: .vertical), on: .tvOS(.v16, .v17, .v18, .v26), customize: spy1) #elseif os(macOS) - .introspect(.textField(axis: .vertical), on: .macOS(.v13, .v14, .v15, .v26), customize: spy0) + .introspect(.textField(axis: .vertical), on: .macOS(.v13, .v14, .v15, .v26), customize: spy1) #endif .cornerRadius(8) TextField("", text: .constant("Text Field 2"), axis: .vertical) #if os(iOS) || os(visionOS) - .introspect(.textField(axis: .vertical), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) + .introspect(.textField(axis: .vertical), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) #elseif os(tvOS) - .introspect(.textField(axis: .vertical), on: .tvOS(.v16, .v17, .v18, .v26), customize: spy1) + .introspect(.textField(axis: .vertical), on: .tvOS(.v16, .v17, .v18, .v26), customize: spy2) #elseif os(macOS) - .introspect(.textField(axis: .vertical), on: .macOS(.v13, .v14, .v15, .v26), customize: spy1) + .introspect(.textField(axis: .vertical), on: .macOS(.v13, .v14, .v15, .v26), customize: spy2) #endif .cornerRadius(8) TextField("", text: .constant("Text Field 3"), axis: .vertical) #if os(iOS) || os(visionOS) - .introspect(.textField(axis: .vertical), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) + .introspect(.textField(axis: .vertical), on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy3) #elseif os(tvOS) - .introspect(.textField(axis: .vertical), on: .tvOS(.v16, .v17, .v18, .v26), customize: spy2) + .introspect(.textField(axis: .vertical), on: .tvOS(.v16, .v17, .v18, .v26), customize: spy3) #elseif os(macOS) - .introspect(.textField(axis: .vertical), on: .macOS(.v13, .v14, .v15, .v26), customize: spy2) + .introspect(.textField(axis: .vertical), on: .macOS(.v13, .v14, .v15, .v26), customize: spy3) #endif } - } extraAssertions: { - #if canImport(UIKit) - XCTAssertEqual($0[safe: 0]?.text, "Text Field 1") - XCTAssertEqual($0[safe: 1]?.text, "Text Field 2") - XCTAssertEqual($0[safe: 2]?.text, "Text Field 3") - #elseif canImport(AppKit) - XCTAssertEqual($0[safe: 0]?.stringValue, "Text Field 1") - XCTAssertEqual($0[safe: 1]?.stringValue, "Text Field 2") - XCTAssertEqual($0[safe: 2]?.stringValue, "Text Field 3") - #endif } + #if canImport(UIKit) + #expect(entity1.text == "Text Field 1") + #expect(entity2.text == "Text Field 2") + #expect(entity3.text == "Text Field 3") + #elseif canImport(AppKit) + #expect(entity1.stringValue == "Text Field 1") + #expect(entity2.stringValue == "Text Field 2") + #expect(entity3.stringValue == "Text Field 3") + #endif } } diff --git a/Tests/Tests/ViewTypes/ToggleTests.swift b/Tests/Tests/ViewTypes/ToggleTests.swift index cd122502e..c27dd0ca6 100644 --- a/Tests/Tests/ViewTypes/ToggleTests.swift +++ b/Tests/Tests/ViewTypes/ToggleTests.swift @@ -1,55 +1,51 @@ #if !os(tvOS) && !os(visionOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class ToggleTests: XCTestCase { +@Suite +struct ToggleTests { #if canImport(UIKit) typealias PlatformToggle = UISwitch #elseif canImport(AppKit) typealias PlatformToggle = NSButton #endif - func testToggle() { - XCTAssertViewIntrospection(of: PlatformToggle.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] - + @Test func introspect() async throws { + let (entity1, entity2, entity3) = try await introspection(of: PlatformToggle.self) { spy1, spy2, spy3 in VStack { Toggle("", isOn: .constant(true)) #if os(iOS) - .introspect(.toggle, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy0) + .introspect(.toggle, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy1) #elseif os(macOS) - .introspect(.toggle, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.toggle, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) #endif Toggle("", isOn: .constant(false)) #if os(iOS) - .introspect(.toggle, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy1) + .introspect(.toggle, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy2) #elseif os(macOS) - .introspect(.toggle, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) + .introspect(.toggle, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif Toggle("", isOn: .constant(true)) #if os(iOS) - .introspect(.toggle, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy2) + .introspect(.toggle, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy3) #elseif os(macOS) - .introspect(.toggle, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) + .introspect(.toggle, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy3) #endif } - } extraAssertions: { - #if canImport(UIKit) - XCTAssertEqual($0[safe: 0]?.isOn, true) - XCTAssertEqual($0[safe: 1]?.isOn, false) - XCTAssertEqual($0[safe: 2]?.isOn, true) - #elseif canImport(AppKit) - XCTAssertEqual($0[safe: 0]?.state, .on) - XCTAssertEqual($0[safe: 1]?.state, .off) - XCTAssertEqual($0[safe: 2]?.state, .on) - #endif } + #if canImport(UIKit) + #expect(entity1.isOn == true) + #expect(entity2.isOn == false) + #expect(entity3.isOn == true) + #elseif canImport(AppKit) + #expect(entity1.state == .on) + #expect(entity2.state == .off) + #expect(entity3.state == .on) + #endif } } #endif diff --git a/Tests/Tests/ViewTypes/ToggleWithButtonStyleTests.swift b/Tests/Tests/ViewTypes/ToggleWithButtonStyleTests.swift index 99972faf7..2d64afbbd 100644 --- a/Tests/Tests/ViewTypes/ToggleWithButtonStyleTests.swift +++ b/Tests/Tests/ViewTypes/ToggleWithButtonStyleTests.swift @@ -1,51 +1,43 @@ #if !os(iOS) && !os(tvOS) && !os(visionOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing -@available(macOS 12, *) @MainActor -final class ToggleWithButtonStyleTests: XCTestCase { +@Suite +struct ToggleWithButtonStyleTests { #if canImport(AppKit) && !targetEnvironment(macCatalyst) typealias PlatformToggleWithButtonStyle = NSButton #endif - func testToggleWithButtonStyle() throws { - guard #available(macOS 12, *) else { - throw XCTSkip() - } - - XCTAssertViewIntrospection(of: PlatformToggleWithButtonStyle.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] - + @available(macOS 12, *) + @Test func introspect() async throws { + let (entity1, entity2, entity3) = try await introspection(of: PlatformToggleWithButtonStyle.self) { spy1, spy2, spy3 in VStack { Toggle("", isOn: .constant(true)) .toggleStyle(.button) #if os(macOS) - .introspect(.toggle(style: .button), on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.toggle(style: .button), on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy1) #endif Toggle("", isOn: .constant(false)) .toggleStyle(.button) #if os(macOS) - .introspect(.toggle(style: .button), on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy1) + .introspect(.toggle(style: .button), on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy2) #endif Toggle("", isOn: .constant(true)) .toggleStyle(.button) #if os(macOS) - .introspect(.toggle(style: .button), on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy2) + .introspect(.toggle(style: .button), on: .macOS(.v12, .v13, .v14, .v15, .v26), customize: spy3) #endif } - } extraAssertions: { - #if canImport(AppKit) && !targetEnvironment(macCatalyst) - XCTAssertEqual($0[safe: 0]?.state, .on) - XCTAssertEqual($0[safe: 1]?.state, .off) - XCTAssertEqual($0[safe: 2]?.state, .on) - #endif } + #if canImport(AppKit) && !targetEnvironment(macCatalyst) + #expect(entity1.state == .on) + #expect(entity2.state == .off) + #expect(entity3.state == .on) + #endif } } #endif diff --git a/Tests/Tests/ViewTypes/ToggleWithCheckboxStyleTests.swift b/Tests/Tests/ViewTypes/ToggleWithCheckboxStyleTests.swift index 56deb0950..02899242b 100644 --- a/Tests/Tests/ViewTypes/ToggleWithCheckboxStyleTests.swift +++ b/Tests/Tests/ViewTypes/ToggleWithCheckboxStyleTests.swift @@ -1,46 +1,42 @@ #if !os(iOS) && !os(tvOS) && !os(visionOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class ToggleWithCheckboxStyleTests: XCTestCase { +@Suite +struct ToggleWithCheckboxStyleTests { #if canImport(AppKit) && !targetEnvironment(macCatalyst) typealias PlatformToggleWithCheckboxStyle = NSButton #endif - func testToggleWithCheckboxStyle() throws { - XCTAssertViewIntrospection(of: PlatformToggleWithCheckboxStyle.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] - + @Test func introspect() async throws { + let (entity1, entity2, entity3) = try await introspection(of: PlatformToggleWithCheckboxStyle.self) { spy1, spy2, spy3 in VStack { Toggle("", isOn: .constant(true)) .toggleStyle(.checkbox) #if os(macOS) - .introspect(.toggle(style: .checkbox), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.toggle(style: .checkbox), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) #endif Toggle("", isOn: .constant(false)) .toggleStyle(.checkbox) #if os(macOS) - .introspect(.toggle(style: .checkbox), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) + .introspect(.toggle(style: .checkbox), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif Toggle("", isOn: .constant(true)) .toggleStyle(.checkbox) #if os(macOS) - .introspect(.toggle(style: .checkbox), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) + .introspect(.toggle(style: .checkbox), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy3) #endif } - } extraAssertions: { - #if canImport(AppKit) && !targetEnvironment(macCatalyst) - XCTAssertEqual($0[safe: 0]?.state, .on) - XCTAssertEqual($0[safe: 1]?.state, .off) - XCTAssertEqual($0[safe: 2]?.state, .on) - #endif } + #if canImport(AppKit) && !targetEnvironment(macCatalyst) + #expect(entity1.state == .on) + #expect(entity2.state == .off) + #expect(entity3.state == .on) + #endif } } #endif diff --git a/Tests/Tests/ViewTypes/ToggleWithSwitchStyleTests.swift b/Tests/Tests/ViewTypes/ToggleWithSwitchStyleTests.swift index 2f1956216..bfd0365ea 100644 --- a/Tests/Tests/ViewTypes/ToggleWithSwitchStyleTests.swift +++ b/Tests/Tests/ViewTypes/ToggleWithSwitchStyleTests.swift @@ -1,58 +1,54 @@ #if !os(tvOS) && !os(visionOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class ToggleWithSwitchStyleTests: XCTestCase { +@Suite +struct ToggleWithSwitchStyleTests { #if canImport(UIKit) typealias PlatformToggleWithSwitchStyle = UISwitch #elseif canImport(AppKit) typealias PlatformToggleWithSwitchStyle = NSSwitch #endif - func testToggleWithSwitchStyle() { - XCTAssertViewIntrospection(of: PlatformToggleWithSwitchStyle.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] - + @Test func introspect() async throws { + let (entity1, entity2, entity3) = try await introspection(of: PlatformToggleWithSwitchStyle.self) { spy1, spy2, spy3 in VStack { Toggle("", isOn: .constant(true)) .toggleStyle(.switch) #if os(iOS) - .introspect(.toggle(style: .switch), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy0) + .introspect(.toggle(style: .switch), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy1) #elseif os(macOS) - .introspect(.toggle(style: .switch), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.toggle(style: .switch), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) #endif Toggle("", isOn: .constant(false)) .toggleStyle(.switch) #if os(iOS) - .introspect(.toggle(style: .switch), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy1) + .introspect(.toggle(style: .switch), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy2) #elseif os(macOS) - .introspect(.toggle(style: .switch), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) + .introspect(.toggle(style: .switch), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif Toggle("", isOn: .constant(true)) .toggleStyle(.switch) #if os(iOS) - .introspect(.toggle(style: .switch), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy2) + .introspect(.toggle(style: .switch), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy3) #elseif os(macOS) - .introspect(.toggle(style: .switch), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) + .introspect(.toggle(style: .switch), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy3) #endif } - } extraAssertions: { - #if canImport(UIKit) - XCTAssertEqual($0[safe: 0]?.isOn, true) - XCTAssertEqual($0[safe: 1]?.isOn, false) - XCTAssertEqual($0[safe: 2]?.isOn, true) - #elseif canImport(AppKit) - XCTAssertEqual($0[safe: 0]?.state, .on) - XCTAssertEqual($0[safe: 1]?.state, .off) - XCTAssertEqual($0[safe: 2]?.state, .on) - #endif } + #if canImport(UIKit) + #expect(entity1.isOn == true) + #expect(entity2.isOn == false) + #expect(entity3.isOn == true) + #elseif canImport(AppKit) + #expect(entity1.state == .on) + #expect(entity2.state == .off) + #expect(entity3.state == .on) + #endif } } #endif diff --git a/Tests/Tests/ViewTypes/VideoPlayerTests.swift b/Tests/Tests/ViewTypes/VideoPlayerTests.swift index ef8207613..552e0a7b0 100644 --- a/Tests/Tests/ViewTypes/VideoPlayerTests.swift +++ b/Tests/Tests/ViewTypes/VideoPlayerTests.swift @@ -2,39 +2,24 @@ import AVKit import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing -@available(iOS 14, tvOS 14, macOS 11, *) @MainActor -final class VideoPlayerTests: XCTestCase { +@Suite +struct VideoPlayerTests { #if canImport(UIKit) typealias PlatformVideoPlayer = AVPlayerViewController #elseif canImport(AppKit) typealias PlatformVideoPlayer = AVPlayerView #endif - func testVideoPlayer() throws { - guard #available(iOS 14, tvOS 14, macOS 11, *) else { - throw XCTSkip() - } - - let videoURL0 = URL(string: "https://bit.ly/swswift#1")! - let videoURL1 = URL(string: "https://bit.ly/swswift#2")! - let videoURL2 = URL(string: "https://bit.ly/swswift#3")! - - XCTAssertViewIntrospection(of: PlatformVideoPlayer.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] + @Test func introspect() async throws { + let videoURL1 = URL(string: "https://bit.ly/swswift#1")! + let videoURL2 = URL(string: "https://bit.ly/swswift#2")! + let videoURL3 = URL(string: "https://bit.ly/swswift#3")! + let (entity1, entity2, entity3) = try await introspection(of: PlatformVideoPlayer.self) { spy1, spy2, spy3 in VStack { - VideoPlayer(player: AVPlayer(url: videoURL0)) - #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.videoPlayer, on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy0) - #elseif os(macOS) - .introspect(.videoPlayer, on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) - #endif - VideoPlayer(player: AVPlayer(url: videoURL1)) #if os(iOS) || os(tvOS) || os(visionOS) .introspect(.videoPlayer, on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) @@ -48,12 +33,18 @@ final class VideoPlayerTests: XCTestCase { #elseif os(macOS) .introspect(.videoPlayer, on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif + + VideoPlayer(player: AVPlayer(url: videoURL3)) + #if os(iOS) || os(tvOS) || os(visionOS) + .introspect(.videoPlayer, on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy3) + #elseif os(macOS) + .introspect(.videoPlayer, on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26), customize: spy3) + #endif } - } extraAssertions: { - XCTAssertEqual(($0[safe: 0]?.player?.currentItem?.asset as? AVURLAsset)?.url, videoURL0) - XCTAssertEqual(($0[safe: 1]?.player?.currentItem?.asset as? AVURLAsset)?.url, videoURL1) - XCTAssertEqual(($0[safe: 2]?.player?.currentItem?.asset as? AVURLAsset)?.url, videoURL2) } + #expect((entity1.player?.currentItem?.asset as? AVURLAsset)?.url == videoURL1) + #expect((entity2.player?.currentItem?.asset as? AVURLAsset)?.url == videoURL2) + #expect((entity3.player?.currentItem?.asset as? AVURLAsset)?.url == videoURL3) } } #endif diff --git a/Tests/Tests/ViewTypes/ViewControllerTests.swift b/Tests/Tests/ViewTypes/ViewControllerTests.swift index eae5de8f3..78c279602 100644 --- a/Tests/Tests/ViewTypes/ViewControllerTests.swift +++ b/Tests/Tests/ViewTypes/ViewControllerTests.swift @@ -1,23 +1,20 @@ #if !os(macOS) import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class ViewControllerTests: XCTestCase { - func testViewController() { - XCTAssertViewIntrospection(of: PlatformViewController.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] - +@Suite +struct ViewControllerTests { + @Test func introspect() async throws { + let (entity1, entity2, entity3) = try await introspection(of: PlatformViewController.self) { spy1, spy2, spy3 in TabView { NavigationView { Text("Root").frame(maxWidth: .infinity, maxHeight: .infinity).background(Color.red) .introspect( .viewController, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), - customize: spy2 + customize: spy3 ) } .navigationViewStyle(.stack) @@ -28,22 +25,21 @@ final class ViewControllerTests: XCTestCase { .introspect( .viewController, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), - customize: spy1 + customize: spy2 ) } .introspect( .viewController, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), - customize: spy0 + customize: spy1 ) - } extraAssertions: { - #if !os(visionOS) - XCTAssert($0[safe: 0] is UITabBarController) - #endif - XCTAssert($0[safe: 1] is UINavigationController) - XCTAssert(String(describing: $0[safe: 2]).contains("UIHostingController")) - XCTAssert($0[safe: 1] === $0[safe: 2]?.parent) } + #if !os(visionOS) + #expect(entity1 is UITabBarController) + #endif + #expect(entity2 is UINavigationController) + #expect(String(describing: entity3).contains("UIHostingController")) + #expect(entity2 === entity3.parent) } } #endif diff --git a/Tests/Tests/ViewTypes/ViewTests.swift b/Tests/Tests/ViewTypes/ViewTests.swift index b5a475d13..12e425e67 100644 --- a/Tests/Tests/ViewTypes/ViewTests.swift +++ b/Tests/Tests/ViewTypes/ViewTests.swift @@ -1,34 +1,31 @@ import SwiftUI @testable import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class ViewTests: XCTestCase { - func testView() { - XCTAssertViewIntrospection(of: PlatformView.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - +@Suite +struct ViewTests { + @Test func introspect() async throws { + let (entity1, entity2) = try await introspection(of: PlatformView.self) { spy1, spy2 in VStack(spacing: 10) { SUTView().frame(height: 30) #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.view, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy0) + .introspect(.view, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) #elseif os(macOS) - .introspect(.view, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.view, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) #endif SUTView().frame(height: 40) #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.view, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) + .introspect(.view, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) #elseif os(macOS) - .introspect(.view, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) + .introspect(.view, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif } .padding(10) - } extraAssertions: { - XCTAssertEqual($0[safe: 0]?.frame.height, 30) - XCTAssertEqual($0[safe: 1]?.frame.height, 40) } + #expect(entity1.frame.height == 30) + #expect(entity2.frame.height == 40) } } diff --git a/Tests/Tests/ViewTypes/WebViewTests.swift b/Tests/Tests/ViewTypes/WebViewTests.swift index 98b02785d..dc7a1127d 100644 --- a/Tests/Tests/ViewTypes/WebViewTests.swift +++ b/Tests/Tests/ViewTypes/WebViewTests.swift @@ -8,39 +8,34 @@ import WebKit @Suite struct WebViewTests { @available(iOS 26, tvOS 26, macOS 26, visionOS 26, *) - @Test func webView() async throws { - XCTAssertViewIntrospection(of: WKWebView.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] - + @Test func introspect() async throws { + let (entity1, entity2, entity3) = try await introspection(of: WKWebView.self) { spy1, spy2, spy3 in VStack { WebView(url: nil) .introspect( .webView, on: .iOS(.v26), .tvOS(.v26), .macOS(.v26), .visionOS(.v26), - customize: spy0 + customize: spy1 ) WebView(url: nil) .introspect( .webView, on: .iOS(.v26), .tvOS(.v26), .macOS(.v26), .visionOS(.v26), - customize: spy1 + customize: spy2 ) WebView(url: nil) .introspect( .webView, on: .iOS(.v26), .tvOS(.v26), .macOS(.v26), .visionOS(.v26), - customize: spy2 + customize: spy3 ) } - } extraAssertions: { - #expect($0[safe: 0] !== $0[safe: 1]) - #expect($0[safe: 0] !== $0[safe: 2]) - #expect($0[safe: 1] !== $0[safe: 2]) } + #expect(entity1 !== entity2) + #expect(entity1 !== entity3) + #expect(entity2 !== entity3) } } #endif diff --git a/Tests/Tests/ViewTypes/WindowTests.swift b/Tests/Tests/ViewTypes/WindowTests.swift index ebe8787f7..7bb18c975 100644 --- a/Tests/Tests/ViewTypes/WindowTests.swift +++ b/Tests/Tests/ViewTypes/WindowTests.swift @@ -1,45 +1,41 @@ import SwiftUI import SwiftUIIntrospect -import XCTest +import Testing @MainActor -final class WindowTests: XCTestCase { +@Suite +struct WindowTests { #if canImport(UIKit) typealias PlatformWindow = UIWindow #elseif canImport(AppKit) typealias PlatformWindow = NSWindow #endif - func testWindow() { - XCTAssertViewIntrospection(of: PlatformWindow.self) { spies in - let spy0 = spies[0] - let spy1 = spies[1] - let spy2 = spies[2] - + @Test func introspect() async throws { + let (entity1, entity2, entity3) = try await introspection(of: PlatformWindow.self) { spy1, spy2, spy3 in VStack { Image(systemName: "scribble") #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.window, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy0) + .introspect(.window, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) #elseif os(macOS) - .introspect(.window, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy0) + .introspect(.window, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) #endif Text("Text") #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.window, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy1) + .introspect(.window, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) #elseif os(macOS) - .introspect(.window, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1) + .introspect(.window, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) #endif } #if os(iOS) || os(tvOS) || os(visionOS) - .introspect(.window, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy2) + .introspect(.window, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: spy3) #elseif os(macOS) - .introspect(.window, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2) + .introspect(.window, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy3) #endif - } extraAssertions: { - XCTAssertIdentical($0[safe: 0], $0[safe: 1]) - XCTAssertIdentical($0[safe: 0], $0[safe: 2]) - XCTAssertIdentical($0[safe: 1], $0[safe: 2]) } + #expect(entity1 === entity2) + #expect(entity1 === entity3) + #expect(entity2 === entity3) } } diff --git a/Tests/Tests/WeakTests.swift b/Tests/Tests/WeakTests.swift index a626b29d3..36bf5986d 100644 --- a/Tests/Tests/WeakTests.swift +++ b/Tests/Tests/WeakTests.swift @@ -1,56 +1,57 @@ @_spi(Advanced) import SwiftUIIntrospect -import XCTest +import Testing -final class WeakTests: XCTestCase { +@Suite +struct WeakTests { final class Foo {} var strongFoo: Foo? = Foo() - func testInit_nil() { + @Test func Init_nil() { @Weak var weakFoo: Foo? - XCTAssertNil(weakFoo) + #expect(weakFoo == nil) } - func testInit_nonNil() { + @Test func Init_nonNil() { @Weak var weakFoo: Foo? = strongFoo - XCTAssertIdentical(weakFoo, strongFoo) + #expect(weakFoo === strongFoo) } - func testAssignment_nilToNil() { + @Test func Assignment_nilToNil() { @Weak var weakFoo: Foo? weakFoo = nil - XCTAssertNil(weakFoo) + #expect(weakFoo == nil) } - func testAssignment_nilToNonNil() { + @Test func Assignment_nilToNonNil() { @Weak var weakFoo: Foo? let otherFoo = Foo() weakFoo = otherFoo - XCTAssertIdentical(weakFoo, otherFoo) + #expect(weakFoo === otherFoo) } - func testAssignment_nonNilToNil() { + @Test func Assignment_nonNilToNil() { @Weak var weakFoo: Foo? = strongFoo weakFoo = nil - XCTAssertNil(weakFoo) + #expect(weakFoo == nil) } - func testAssignment_nonNilToNonNil() { + @Test func Assignment_nonNilToNonNil() { @Weak var weakFoo: Foo? = strongFoo let otherFoo = Foo() weakFoo = otherFoo - XCTAssertIdentical(weakFoo, otherFoo) + #expect(weakFoo === otherFoo) } - func testIndirectAssignment_nonNilToNil() { + @Test mutating func IndirectAssignment_nonNilToNil() { @Weak var weakFoo: Foo? = strongFoo strongFoo = nil - XCTAssertNil(weakFoo) + #expect(weakFoo == nil) } - func testIndirectAssignment_nonNilToNonNil() { + @Test mutating func IndirectAssignment_nonNilToNonNil() { @Weak var weakFoo: Foo? = strongFoo strongFoo = Foo() - XCTAssertNil(weakFoo) + #expect(weakFoo == nil) } } diff --git a/Tests/UITests/StatusBarStyleUITests.swift b/Tests/UITests/StatusBarStyleUITests.swift deleted file mode 100644 index 0404986da..000000000 --- a/Tests/UITests/StatusBarStyleUITests.swift +++ /dev/null @@ -1,30 +0,0 @@ -import SnapshotTesting -import XCTest - -final class StatusBarStyleUITests: UITestCase { - override var testCase: TestCase { - .statusBarStyle - } - - func test() throws { - guard #unavailable(iOS 17) else { - throw XCTSkip("SimulatorStatusMagic stopped working in iOS 17, so we can no longer consistently compare status bar screenshots") - } - - app.buttons["Navigate To Detail"].tap() - app.buttons["Navigate To Detail"].tap() - app.buttons["Navigate Back"].tap() - - let iOSDevice = UIDevice.current.userInterfaceIdiom == .pad ? "ipad" : "iphone" - let iOSVersion = ProcessInfo().operatingSystemVersion - func screenshotName(_ number: Int) -> String { - "\(iOSDevice)-ios-\(iOSVersion.majorVersion)-screenshot-\(number)" - } - - assertSnapshot( - matching: app.windows.firstMatch.screenshot().image, - as: .image(perceptualPrecision: 0.95), - named: screenshotName(1) - ) - } -} diff --git a/Tests/UITests/UITestCase.swift b/Tests/UITests/UITestCase.swift deleted file mode 100644 index d99d199b1..000000000 --- a/Tests/UITests/UITestCase.swift +++ /dev/null @@ -1,21 +0,0 @@ -import SimulatorStatusMagic -import XCTest - -class UITestCase: XCTestCase { - var testCase: TestCase { - preconditionFailure("Please override this property") - } - - let app = XCUIApplication() - - override func invokeTest() { - SDStatusBarManager.sharedInstance().enableOverrides() - - continueAfterFailure = false - - app.launchEnvironment["testCase"] = testCase.rawValue - app.launch() - - super.invokeTest() - } -} diff --git a/Tests/UITests/UITests.xctestplan b/Tests/UITests/UITests.xctestplan deleted file mode 100644 index 403bcc61a..000000000 --- a/Tests/UITests/UITests.xctestplan +++ /dev/null @@ -1,24 +0,0 @@ -{ - "configurations" : [ - { - "id" : "DD0EEECD-4762-4A68-91A8-F7B5A2209B45", - "name" : "Test Scheme Action", - "options" : { - - } - } - ], - "defaultOptions" : { - - }, - "testTargets" : [ - { - "target" : { - "containerPath" : "container:Tests.xcodeproj", - "identifier" : "D58D832A2A66BDD500A203BE", - "name" : "UITests" - } - } - ], - "version" : 1 -} diff --git a/Tests/UITestsHostApp/Assets.xcassets/AccentColor.colorset/Contents.json b/Tests/UITestsHostApp/Assets.xcassets/AccentColor.colorset/Contents.json deleted file mode 100644 index eb8789700..000000000 --- a/Tests/UITestsHostApp/Assets.xcassets/AccentColor.colorset/Contents.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "colors" : [ - { - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Tests/UITestsHostApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/Tests/UITestsHostApp/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 13613e3ee..000000000 --- a/Tests/UITestsHostApp/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "platform" : "ios", - "size" : "1024x1024" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Tests/UITestsHostApp/Assets.xcassets/Contents.json b/Tests/UITestsHostApp/Assets.xcassets/Contents.json deleted file mode 100644 index 73c00596a..000000000 --- a/Tests/UITestsHostApp/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Tests/UITestsHostApp/Info.plist b/Tests/UITestsHostApp/Info.plist deleted file mode 100644 index 364d0f3ee..000000000 --- a/Tests/UITestsHostApp/Info.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - UIViewControllerBasedStatusBarAppearance - - - diff --git a/Tests/UITestsHostApp/LaunchScreen.storyboard b/Tests/UITestsHostApp/LaunchScreen.storyboard deleted file mode 100644 index 884987575..000000000 --- a/Tests/UITestsHostApp/LaunchScreen.storyboard +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Tests/UITestsHostApp/Preview Content/Preview Assets.xcassets/Contents.json b/Tests/UITestsHostApp/Preview Content/Preview Assets.xcassets/Contents.json deleted file mode 100644 index 73c00596a..000000000 --- a/Tests/UITestsHostApp/Preview Content/Preview Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Tests/UITestsHostApp/StatusBarStyle/HostingController.swift b/Tests/UITestsHostApp/StatusBarStyle/HostingController.swift deleted file mode 100644 index 1b13e8b13..000000000 --- a/Tests/UITestsHostApp/StatusBarStyle/HostingController.swift +++ /dev/null @@ -1,32 +0,0 @@ -// -// HostingController.swift -// Blago -// -// Created by Dmytro Chumakov on 04.05.2023. -// - -import SwiftUI - -final class HostingController: UIHostingController where ContentView: View { - - var statusBarStyle: UIStatusBarStyle = .darkContent - var isInteractivePopGestureEnabled = true - - override var preferredStatusBarStyle: UIStatusBarStyle { - statusBarStyle - } - - override func viewDidLoad() { - super.viewDidLoad() - navigationController?.interactivePopGestureRecognizer?.isEnabled = isInteractivePopGestureEnabled - } - - override func viewWillLayoutSubviews() { - super.viewWillLayoutSubviews() - - guard #available(iOS 16, *) else { - navigationController?.setNavigationBarHidden(true, animated: false) - return - } - } -} diff --git a/Tests/UITestsHostApp/StatusBarStyle/NavigationView.swift b/Tests/UITestsHostApp/StatusBarStyle/NavigationView.swift deleted file mode 100644 index 85e353547..000000000 --- a/Tests/UITestsHostApp/StatusBarStyle/NavigationView.swift +++ /dev/null @@ -1,44 +0,0 @@ - -// -// NavigationController.swift -// Blago -// -// Created by Dmytro Chumakov on 11.05.2023. -// - -import UIKit - -// MARK: - NavigationController - -final class NavigationController: UINavigationController { - - static var shared: UINavigationController? - - // MARK: Lifecycle - - override init(rootViewController: UIViewController) { - super.init(rootViewController: rootViewController) - setNavigationBarHidden(true, animated: false) - } - - required init?(coder _: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override var preferredStatusBarStyle: UIStatusBarStyle { - topViewController?.preferredStatusBarStyle ?? .default - } - - override func viewDidLoad() { - super.viewDidLoad() - interactivePopGestureRecognizer?.delegate = self - } -} - -// MARK: UIGestureRecognizerDelegate - -extension NavigationController: UIGestureRecognizerDelegate { - func gestureRecognizerShouldBegin(_: UIGestureRecognizer) -> Bool { - viewControllers.count > 1 - } -} diff --git a/Tests/UITestsHostApp/StatusBarStyle/RootView.swift b/Tests/UITestsHostApp/StatusBarStyle/RootView.swift deleted file mode 100644 index ed410cf86..000000000 --- a/Tests/UITestsHostApp/StatusBarStyle/RootView.swift +++ /dev/null @@ -1,54 +0,0 @@ -// -// RootView.swift -// Showcase -// -// Created by Orackle on 14.07.2023. -// - -import SwiftUI -import SwiftUIIntrospect - -struct RootView: View { - - var body: some View { - VStack { - Button("Navigate To Detail", action: navigateToDetail) - } - } - - @MainActor // for below Swift 6.0 - private func navigateToDetail() { - let controller = HostingController(rootView: DetailView()) - controller.statusBarStyle = .lightContent - NavigationController.shared?.pushViewController(controller, animated: true) - } -} - -struct DetailView: View { - @Environment(\.presentationMode) var dismiss - - var body: some View { - ZStack { - Color.red.edgesIgnoringSafeArea(.all) - - VStack { - Button("Navigate To Detail", action: navigateToDetail) - Button("Navigate Back", action: goBack) - } - } - .introspect(.viewController, on: .iOS(.v13, .v14, .v15, .v16)) { viewController in - /// some customizations there - } - } - - private func goBack() { - dismiss.wrappedValue.dismiss() - } - - @MainActor // for below Swift 6.0 - private func navigateToDetail() { - let controller = HostingController(rootView: DetailView()) - controller.statusBarStyle = .lightContent - NavigationController.shared?.pushViewController(controller, animated: true) - } -} diff --git a/Tests/UITestsHostApp/TestCases.swift b/Tests/UITestsHostApp/TestCases.swift deleted file mode 100644 index 64285580a..000000000 --- a/Tests/UITestsHostApp/TestCases.swift +++ /dev/null @@ -1,3 +0,0 @@ -public enum TestCase: String { - case statusBarStyle = "Status Bar Style" -} diff --git a/Tests/UITestsHostApp/UITestsHostApp.swift b/Tests/UITestsHostApp/UITestsHostApp.swift deleted file mode 100644 index 0069c252a..000000000 --- a/Tests/UITestsHostApp/UITestsHostApp.swift +++ /dev/null @@ -1,28 +0,0 @@ -import SwiftUI - -@main -final class AppDelegate: UIResponder, UIApplicationDelegate { - - var window: UIWindow? - - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - window = UIWindow(frame: UIScreen.main.bounds) - guard - let testCaseRawValue = ProcessInfo.processInfo.environment["testCase"], - let testCase = TestCase(rawValue: testCaseRawValue) - else { - preconditionFailure("entryViewController not set") - } - - window?.rootViewController = { - switch testCase { - case .statusBarStyle: - let navController = NavigationController(rootViewController: HostingController(rootView: RootView())) - NavigationController.shared = navController - return navController - } - }() - window?.makeKeyAndVisible() - return true - } -} diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 9a1187edf..c2780ff89 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -79,7 +79,7 @@ lane :test do |options| disable_concurrent_testing: true, ) else - unless ["SwiftUIIntrospectTests", "SwiftUIIntrospectUITests"].include?(scheme) + unless ["SwiftUIIntrospectTests"].include?(scheme) raise "Unsupported scheme: #{scheme}" end run_tests(