test: expand settings coverage

This commit is contained in:
Peter Steinberger
2025-12-24 17:42:14 +01:00
parent 7fafe54e16
commit deec315f6a
15 changed files with 766 additions and 32 deletions

View File

@@ -346,6 +346,102 @@ struct InstancesSettings: View {
}
#if DEBUG
extension InstancesSettings {
static func exerciseForTesting() {
let view = InstancesSettings(store: InstancesStore(isPreview: true))
let mac = InstanceInfo(
id: "mac",
host: "studio",
ip: "10.0.0.2",
version: "1.2.3",
platform: "macOS 14.2",
deviceFamily: "Mac",
modelIdentifier: "Mac14,10",
lastInputSeconds: 12,
mode: "local",
reason: "self",
text: "Mac Studio",
ts: 1_700_000_000_000)
let genericIOS = InstanceInfo(
id: "iphone",
host: "phone",
ip: "10.0.0.3",
version: "2.0.0",
platform: "iOS 17.2",
deviceFamily: "iPhone",
modelIdentifier: nil,
lastInputSeconds: 35,
mode: "node",
reason: "connect",
text: "iPhone node",
ts: 1_700_000_100_000)
let android = InstanceInfo(
id: "android",
host: "pixel",
ip: nil,
version: "3.1.0",
platform: "Android 14",
deviceFamily: "Android",
modelIdentifier: nil,
lastInputSeconds: 90,
mode: "node",
reason: "seq gap",
text: "Android node",
ts: 1_700_000_200_000)
let gateway = InstanceInfo(
id: "gateway",
host: "gateway",
ip: "10.0.0.9",
version: "4.0.0",
platform: "Linux",
deviceFamily: nil,
modelIdentifier: nil,
lastInputSeconds: nil,
mode: "gateway",
reason: "periodic",
text: "Gateway",
ts: 1_700_000_300_000)
_ = view.instanceRow(mac)
_ = view.instanceRow(genericIOS)
_ = view.instanceRow(android)
_ = view.instanceRow(gateway)
_ = view.leadingDeviceSymbol(
mac,
device: DevicePresentation(title: "Mac Studio", symbol: "macstudio"))
_ = view.leadingDeviceSymbol(
mac,
device: DevicePresentation(title: "MacBook Pro", symbol: "laptopcomputer"))
_ = view.leadingDeviceSymbol(android, device: nil)
_ = view.platformIcon("tvOS 17.1")
_ = view.platformIcon("watchOS 10")
_ = view.platformIcon("unknown 1.0")
_ = view.prettyPlatform("macOS 14.2")
_ = view.prettyPlatform("iOS 17")
_ = view.prettyPlatform("ipados 17.1")
_ = view.prettyPlatform("linux")
_ = view.prettyPlatform(" ")
_ = view.parsePlatform("macOS 14.1")
_ = view.parsePlatform(" ")
_ = view.presenceUpdateSourceShortText("self")
_ = view.presenceUpdateSourceShortText("instances-refresh")
_ = view.presenceUpdateSourceShortText("seq gap")
_ = view.presenceUpdateSourceShortText("custom")
_ = view.presenceUpdateSourceShortText(" ")
_ = view.updateSummaryText(mac, isGateway: false)
_ = view.updateSummaryText(gateway, isGateway: true)
_ = view.presenceUpdateSourceHelp("")
_ = view.presenceUpdateSourceHelp("connect")
_ = view.safeSystemSymbol("not-a-symbol", fallback: "cpu")
_ = view.isSystemSymbolAvailable("sparkles")
_ = view.label(icon: "android", text: "Android")
_ = view.label(icon: "sparkles", text: "Sparkles")
_ = view.label(icon: nil, text: "Plain")
_ = AndroidMark().body
}
}
struct InstancesSettings_Previews: PreviewProvider {
static var previews: some View {
InstancesSettings(store: .preview())