macOS: add leading device icons in Instances

This commit is contained in:
Peter Steinberger
2025-12-18 09:15:50 +01:00
parent 97ec5d52c3
commit 2f8b75d86e
3 changed files with 145 additions and 46 deletions

View File

@@ -0,0 +1,34 @@
import Testing
@testable import Clawdis
@Suite
struct DeviceModelCatalogTests {
@Test
func symbolPrefersModelIdentifierPrefixes() {
#expect(DeviceModelCatalog.symbol(deviceFamily: "iPad", modelIdentifier: "iPad16,6", friendlyName: nil) == "ipad")
#expect(DeviceModelCatalog.symbol(deviceFamily: "iPhone", modelIdentifier: "iPhone17,3", friendlyName: nil) == "iphone")
}
@Test
func symbolUsesFriendlyNameForMacVariants() {
#expect(DeviceModelCatalog.symbol(
deviceFamily: "Mac",
modelIdentifier: "Mac99,1",
friendlyName: "Mac Studio (2025)") == "macstudio")
#expect(DeviceModelCatalog.symbol(
deviceFamily: "Mac",
modelIdentifier: "Mac99,2",
friendlyName: "Mac mini (2024)") == "macmini")
#expect(DeviceModelCatalog.symbol(
deviceFamily: "Mac",
modelIdentifier: "Mac99,3",
friendlyName: "MacBook Pro (14-inch, 2024)") == "laptopcomputer")
}
@Test
func symbolFallsBackToDeviceFamily() {
#expect(DeviceModelCatalog.symbol(deviceFamily: "Android", modelIdentifier: "", friendlyName: nil) == "logo.android")
#expect(DeviceModelCatalog.symbol(deviceFamily: "Linux", modelIdentifier: "", friendlyName: nil) == "cpu")
}
}