Skip to content

Commit af708e6

Browse files
authored
test(ios): trim duplicate root shell mirrors (#121272)
1 parent 055a2dc commit af708e6

4 files changed

Lines changed: 9 additions & 78 deletions

File tree

‎apps/ios/Sources/RootTabs.swift‎

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,39 +1253,39 @@ private struct RootCameraFlashOverlay: View {
12531253
traits: .fixedLayout(width: 393, height: 852),
12541254
.portrait)
12551255
{
1256-
RootTabsPreviewHost(idiom: .phone)
1256+
RootTabsPreviewHost()
12571257
}
12581258

12591259
#Preview(
12601260
"Shell iPhone drawer open",
12611261
traits: .fixedLayout(width: 393, height: 852),
12621262
.portrait)
12631263
{
1264-
RootTabsPreviewHost(idiom: .phone, sidebarVisible: true)
1264+
RootTabsPreviewHost(sidebarVisible: true)
12651265
}
12661266

12671267
#Preview(
12681268
"Shell iPhone connected",
12691269
traits: .fixedLayout(width: 393, height: 852),
12701270
.portrait)
12711271
{
1272-
RootTabsPreviewHost(idiom: .phone, gatewayState: .connected)
1272+
RootTabsPreviewHost(gatewayState: .connected)
12731273
}
12741274

12751275
#Preview(
12761276
"Shell iPhone gateway error",
12771277
traits: .fixedLayout(width: 393, height: 852),
12781278
.portrait)
12791279
{
1280-
RootTabsPreviewHost(idiom: .phone, gatewayState: .error)
1280+
RootTabsPreviewHost(gatewayState: .error)
12811281
}
12821282

12831283
#Preview(
12841284
"Shell iPhone landscape",
12851285
traits: .fixedLayout(width: 852, height: 393),
12861286
.landscapeLeft)
12871287
{
1288-
RootTabsPreviewHost(idiom: .phone)
1288+
RootTabsPreviewHost()
12891289
.environment(\.horizontalSizeClass, .regular)
12901290
.environment(\.verticalSizeClass, .compact)
12911291
}
@@ -1295,48 +1295,45 @@ private struct RootCameraFlashOverlay: View {
12951295
traits: .fixedLayout(width: 1024, height: 1366),
12961296
.portrait)
12971297
{
1298-
RootTabsPreviewHost(idiom: .pad)
1298+
RootTabsPreviewHost()
12991299
}
13001300

13011301
#Preview(
13021302
"Shell iPad landscape split",
13031303
traits: .fixedLayout(width: 1366, height: 1024),
13041304
.landscapeLeft)
13051305
{
1306-
RootTabsPreviewHost(idiom: .pad, gatewayState: .connected)
1306+
RootTabsPreviewHost(gatewayState: .connected)
13071307
}
13081308

13091309
#Preview(
13101310
"Shell iPad connecting",
13111311
traits: .fixedLayout(width: 1366, height: 1024),
13121312
.landscapeLeft)
13131313
{
1314-
RootTabsPreviewHost(idiom: .pad, gatewayState: .connecting)
1314+
RootTabsPreviewHost(gatewayState: .connecting)
13151315
}
13161316

13171317
#Preview(
13181318
"Shell iPad gateway error",
13191319
traits: .fixedLayout(width: 1366, height: 1024),
13201320
.landscapeLeft)
13211321
{
1322-
RootTabsPreviewHost(idiom: .pad, gatewayState: .error)
1322+
RootTabsPreviewHost(gatewayState: .error)
13231323
}
13241324

13251325
private struct RootTabsPreviewHost: View {
13261326
@State private var appearanceModel = AppAppearanceModel()
13271327
@State private var appModel: NodeAppModel
13281328
@State private var gatewayController: GatewayConnectionController
1329-
private let idiom: UIUserInterfaceIdiom
13301329
private let sidebarVisible: Bool?
13311330

13321331
init(
1333-
idiom: UIUserInterfaceIdiom,
13341332
gatewayState: RootTabsPreviewGatewayState = .offline,
13351333
sidebarVisible: Bool? = nil)
13361334
{
13371335
let appModel = NodeAppModel()
13381336
gatewayState.apply(to: appModel)
1339-
self.idiom = idiom
13401337
self.sidebarVisible = sidebarVisible
13411338
_appModel = State(initialValue: appModel)
13421339
_gatewayController = State(

‎apps/ios/Tests/RootTabsSidebarRegressionTests.swift‎

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,6 @@ import Foundation
22
import Testing
33

44
struct RootTabsSidebarRegressionTests {
5-
@Test func `i pad split hidden sidebar uses header reveal instead of reserved rail`() throws {
6-
let source = try String(contentsOf: Self.rootTabsSourceURL(), encoding: .utf8)
7-
let navigationSource = try String(contentsOf: Self.rootTabsNavigationSourceURL(), encoding: .utf8)
8-
let splitContent = try Self.extract(
9-
source,
10-
from: "private func sidebarNavigationSplitContent(sidebarWidth: CGFloat) -> some View",
11-
to: "private func sidebarDrawerContent(")
12-
13-
#expect(splitContent.contains("HStack(spacing: 0)"))
14-
#expect(splitContent.contains("self.sidebarColumn"))
15-
#expect(splitContent.contains(".frame(width: sidebarWidth, alignment: .topLeading)"))
16-
#expect(splitContent.contains(".overlay(alignment: .trailing)"))
17-
#expect(!splitContent.contains("self.syncSidebarVisibility(from: visibility)"))
18-
#expect(!source.contains("NavigationSplitViewVisibility"))
19-
#expect(!source.contains("@State private var splitColumnVisibility: NavigationSplitViewVisibility"))
20-
#expect(!splitContent.contains("NavigationSplitView"))
21-
#expect(!splitContent.contains("self.collapsedSidebarRail"))
22-
#expect(!source.contains("private var collapsedSidebarRail: some View"))
23-
#expect(!source.contains("Self.sidebarCollapsedRailWidth"))
24-
#expect(source.contains("shouldShowSidebarRevealInDestinationHeader"))
25-
#expect(!navigationSource.contains("static let sidebarCollapsedRailWidth"))
26-
#expect(!navigationSource.contains("static func sidebarSplitColumnVisibility(isSidebarVisible: Bool)"))
27-
#expect(!navigationSource
28-
.contains("static func sidebarIsVisible(splitColumnVisibility: NavigationSplitViewVisibility)"))
29-
}
30-
315
@Test func `initial sidebar visibility survives first layout measurement`() throws {
326
let source = try String(contentsOf: Self.rootTabsSourceURL(), encoding: .utf8)
337
let layoutUpdate = try Self.extract(
@@ -217,13 +191,6 @@ struct RootTabsSidebarRegressionTests {
217191
.appendingPathComponent("Sources/RootSidebar.swift")
218192
}
219193

220-
private static func rootTabsNavigationSourceURL() -> URL {
221-
URL(fileURLWithPath: #filePath)
222-
.deletingLastPathComponent()
223-
.deletingLastPathComponent()
224-
.appendingPathComponent("Sources/RootTabsNavigation.swift")
225-
}
226-
227194
private static func commandCenterSourceURL() -> URL {
228195
URL(fileURLWithPath: #filePath)
229196
.deletingLastPathComponent()

‎apps/ios/Tests/RootTabsSourceGuardTests.swift‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -528,20 +528,6 @@ struct RootTabsSourceGuardTests {
528528
#expect(!source.contains(".background(Color(uiColor: .systemBackground))"))
529529
}
530530

531-
@Test func `root shell preview matrix covers phone and I pad states`() throws {
532-
let source = try String(contentsOf: Self.rootTabsSourceURL(), encoding: .utf8)
533-
534-
#expect(source.contains("#Preview(\n \"Shell iPhone portrait\""))
535-
#expect(source.contains("#Preview(\n \"Shell iPhone drawer open\""))
536-
#expect(source.contains("#Preview(\n \"Shell iPhone landscape\""))
537-
#expect(source.contains("#Preview(\n \"Shell iPhone connected\""))
538-
#expect(source.contains("#Preview(\n \"Shell iPhone gateway error\""))
539-
#expect(source.contains("#Preview(\n \"Shell iPad portrait drawer\""))
540-
#expect(source.contains("#Preview(\n \"Shell iPad landscape split\""))
541-
#expect(source.contains("#Preview(\n \"Shell iPad connecting\""))
542-
#expect(source.contains("#Preview(\n \"Shell iPad gateway error\""))
543-
}
544-
545531
@Test func `shared chat preview matrix covers connection states`() throws {
546532
let source = try String(contentsOf: Self.sharedChatPreviewSourceURL(), encoding: .utf8)
547533

‎apps/ios/Tests/SwiftUIRenderSmokeTests.swift‎

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,6 @@ struct SwiftUIRenderSmokeTests {
1616
return window
1717
}
1818

19-
@Test @MainActor func `settings pro tab builds A view hierarchy`() {
20-
let appModel = NodeAppModel()
21-
let gatewayController = GatewayConnectionController(appModel: appModel, startDiscovery: false)
22-
23-
let root = SettingsProTab()
24-
.environment(AppAppearanceModel())
25-
.environment(appModel)
26-
.environment(appModel.voiceWake)
27-
.environment(gatewayController)
28-
29-
_ = Self.host(root)
30-
}
31-
3219
@Test @MainActor func `settings pro tab builds in light and dark mode`() {
3320
for scheme in [ColorScheme.light, ColorScheme.dark] {
3421
let appModel = NodeAppModel()
@@ -765,31 +752,26 @@ struct SwiftUIRenderSmokeTests {
765752
private static func rootTabsShellScenarios() -> [RootTabsShellScenario] {
766753
[
767754
RootTabsShellScenario(
768-
idiom: .phone,
769755
size: CGSize(width: 393, height: 852),
770756
horizontalSizeClass: .compact,
771757
verticalSizeClass: .regular,
772758
sidebarVisible: false),
773759
RootTabsShellScenario(
774-
idiom: .phone,
775760
size: CGSize(width: 393, height: 852),
776761
horizontalSizeClass: .compact,
777762
verticalSizeClass: .regular,
778763
sidebarVisible: true),
779764
RootTabsShellScenario(
780-
idiom: .phone,
781765
size: CGSize(width: 852, height: 393),
782766
horizontalSizeClass: .regular,
783767
verticalSizeClass: .compact,
784768
sidebarVisible: false),
785769
RootTabsShellScenario(
786-
idiom: .pad,
787770
size: CGSize(width: 1024, height: 1366),
788771
horizontalSizeClass: .regular,
789772
verticalSizeClass: .regular,
790773
sidebarVisible: true),
791774
RootTabsShellScenario(
792-
idiom: .pad,
793775
size: CGSize(width: 1366, height: 1024),
794776
horizontalSizeClass: .regular,
795777
verticalSizeClass: .regular,
@@ -798,7 +780,6 @@ struct SwiftUIRenderSmokeTests {
798780
}
799781

800782
private struct RootTabsShellScenario {
801-
let idiom: UIUserInterfaceIdiom
802783
let size: CGSize
803784
let horizontalSizeClass: UserInterfaceSizeClass
804785
let verticalSizeClass: UserInterfaceSizeClass

0 commit comments

Comments
 (0)