Skip to content

Commit 4816f7f

Browse files
authored
[TwoLineTitleViewDemoController] Fix demo crash for iOS 26.* and macCatalyst 26.* (#2240)
* Fix up demo inputs * Add macCatalyst as well * Add XCUITests * PR Comments and Vision build * [TEST] Bump xcode version to see if test flakiness goes away
1 parent 98f0f2b commit 4816f7f

File tree

4 files changed

+36
-1
lines changed

4 files changed

+36
-1
lines changed

Demos/FluentUIDemo_iOS/FluentUI.Demo.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
92E977B726C7144F008E10A8 /* UIResponder+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92E977B526C713F3008E10A8 /* UIResponder+Extensions.swift */; };
100100
92E977B826C7144F008E10A8 /* DemoControllerScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92E977B426C713F3008E10A8 /* DemoControllerScrollView.swift */; };
101101
92EFD3E42BDA28F100DB35F2 /* TooltipDemoController_SwiftUI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92EFD3E32BDA28F100DB35F2 /* TooltipDemoController_SwiftUI.swift */; };
102+
94F99E762F22D39800E4C4B0 /* TwoLineTitleViewTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94F99E752F22D39800E4C4B0 /* TwoLineTitleViewTest.swift */; };
102103
A589F856211BA71000471C23 /* LabelDemoController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A589F855211BA71000471C23 /* LabelDemoController.swift */; };
103104
A591A3F420F429EB001ED23B /* Demos.swift in Sources */ = {isa = PBXBuildFile; fileRef = A591A3F320F429EB001ED23B /* Demos.swift */; };
104105
A5CEC21020E436F10016922A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5CEC20F20E436F10016922A /* AppDelegate.swift */; };
@@ -240,6 +241,7 @@
240241
92E977B426C713F3008E10A8 /* DemoControllerScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoControllerScrollView.swift; sourceTree = "<group>"; };
241242
92E977B526C713F3008E10A8 /* UIResponder+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIResponder+Extensions.swift"; sourceTree = "<group>"; };
242243
92EFD3E32BDA28F100DB35F2 /* TooltipDemoController_SwiftUI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TooltipDemoController_SwiftUI.swift; sourceTree = "<group>"; };
244+
94F99E752F22D39800E4C4B0 /* TwoLineTitleViewTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TwoLineTitleViewTest.swift; sourceTree = "<group>"; };
243245
A589F855211BA71000471C23 /* LabelDemoController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelDemoController.swift; sourceTree = "<group>"; };
244246
A591A3F320F429EB001ED23B /* Demos.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Demos.swift; sourceTree = "<group>"; };
245247
A5961FA8218A61BB00E2A506 /* PopupMenuDemoController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PopupMenuDemoController.swift; sourceTree = "<group>"; };
@@ -405,6 +407,7 @@
405407
3A83F90A2953BB2700EF6629 /* TableViewHeaderFooterViewTest.swift */,
406408
EC0A83E3299ED3630010ED3E /* TextFieldTest.swift */,
407409
3A83F90C2953BB3500EF6629 /* TooltipTest.swift */,
410+
94F99E752F22D39800E4C4B0 /* TwoLineTitleViewTest.swift */,
408411
3A83F90E2953BB4000EF6629 /* TypographyTokensTest.swift */,
409412
);
410413
path = FluentUIDemoTests;
@@ -797,6 +800,7 @@
797800
3A83F8D52953B92D00EF6629 /* GlobalColorTokensTest.swift in Sources */,
798801
3A83F8F32953BA9500EF6629 /* PersonaListViewTest.swift in Sources */,
799802
3A83F8D32953B91900EF6629 /* CardNudgeTest.swift in Sources */,
803+
94F99E762F22D39800E4C4B0 /* TwoLineTitleViewTest.swift in Sources */,
800804
3AA92B69298DD958001C0464 /* AliasColorTokensTest.swift in Sources */,
801805
3A83F90D2953BB3500EF6629 /* TooltipTest.swift in Sources */,
802806
3A83F8D92953B94D00EF6629 /* DateTimePickerTest.swift in Sources */,

Demos/FluentUIDemo_iOS/FluentUI.Demo/Demos/TwoLineTitleViewDemoController.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,15 @@ class TwoLineTitleViewDemoController: DemoController {
107107
makeExampleNavigationItem {
108108
$0.title = "Centered Title"
109109
$0.fluentConfiguration.titleStyle = .system
110+
#if os(visionOS)
110111
$0.fluentConfiguration.subtitle = "Custom icon"
112+
#else
113+
if #available(iOS 26.0, macCatalyst 26, *) {
114+
$0.subtitle = "Custom icon"
115+
} else {
116+
$0.fluentConfiguration.subtitle = "Custom icon"
117+
}
118+
#endif
111119
$0.fluentConfiguration.titleImage = UIImage(named: "ic_fluent_star_24_regular")
112120
$0.fluentConfiguration.customSubtitleTrailingImage = UIImage(named: "ic_fluent_star_16_regular")
113121
$0.fluentConfiguration.titleAccessory = .init(location: .subtitle, style: .custom)
@@ -116,7 +124,15 @@ class TwoLineTitleViewDemoController: DemoController {
116124
makeExampleNavigationItem {
117125
$0.title = "Leading Title"
118126
$0.fluentConfiguration.titleStyle = .leading
127+
#if os(visionOS)
119128
$0.fluentConfiguration.subtitle = "Subtitle"
129+
#else
130+
if #available(iOS 26.0, macCatalyst 26, *) {
131+
$0.subtitle = "Subtitle"
132+
} else {
133+
$0.fluentConfiguration.subtitle = "Subtitle"
134+
}
135+
#endif
120136
$0.fluentConfiguration.titleImage = UIImage(named: "ic_fluent_star_24_regular")
121137
$0.fluentConfiguration.customSubtitleTrailingImage = UIImage(named: "ic_fluent_star_16_regular")
122138
$0.fluentConfiguration.titleAccessory = .init(location: .title, style: .downArrow)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// Copyright (c) Microsoft Corporation. All rights reserved.
3+
// Licensed under the MIT License.
4+
//
5+
6+
import XCTest
7+
8+
class TwoLineTitleViewTest: BaseTest {
9+
override var controlName: String { "TwoLineTitleView" }
10+
11+
// launch test that ensures the demo app does not crash and is on the correct control page
12+
func testLaunch() throws {
13+
XCTAssert(app.navigationBars[controlName].exists)
14+
}
15+
}

scripts/xcode_select_current_version.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
if [ -n "$XCODE_PATH_OVERRIDE" ]; then # If someone calls this with the XCODE_PATH_OVERRIDE variable set to a path to a developer dir, use it instead
44
XCODE_PATH="$XCODE_PATH_OVERRIDE"
55
else
6-
XCODE_PATH='/Applications/Xcode_26.0.app/Contents/Developer'
6+
XCODE_PATH='/Applications/Xcode_26.2.app/Contents/Developer'
77
fi
88

99
echo "Running command: sudo xcode-select --switch $XCODE_PATH"

0 commit comments

Comments
 (0)