Files
honeyDueKMP/iosApp/HoneyDueTests/ThemeIDTests.swift
Trey t 73dd440d7b Add honeycomb pattern toggle and make theme switching reactive
Adds a toggleable honeycomb hexagonal grid overlay (matching the website pattern)
that can be enabled independently of any theme via the Appearance screen. Uses a
cached tiled UIImage approach consistent with the existing grain texture system.

Replaces the destructive refreshID-based theme switching (which destroyed all
NavigationStacks and dismissed sheets) with @Observable AppThemeSource. Color
resolution now happens through Swift's Observation framework, so all views using
Color.appPrimary etc. automatically re-render when the theme changes — no view
identity reset needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 11:36:24 -06:00

58 lines
1.5 KiB
Swift

//
// ThemeIDTests.swift
// honeyDueTests
//
// Unit tests for ThemeID enum properties and round-tripping.
//
import Testing
@testable import honeyDue
// MARK: - ThemeID Enum Tests
struct ThemeIDTests {
@Test func allCasesCountIsEleven() {
#expect(ThemeID.allCases.count == 11)
}
@Test func allDisplayNamesAreNonEmpty() {
for theme in ThemeID.allCases {
#expect(!theme.displayName.isEmpty, "ThemeID.\(theme) has empty displayName")
}
}
@Test func allDescriptionsAreNonEmpty() {
for theme in ThemeID.allCases {
#expect(!theme.description.isEmpty, "ThemeID.\(theme) has empty description")
}
}
@Test func rawValueRoundTripsForAllCases() {
for theme in ThemeID.allCases {
let roundTripped = ThemeID(rawValue: theme.rawValue)
#expect(roundTripped == theme, "ThemeID.\(theme) failed rawValue round-trip")
}
}
@Test func allRawValuesAreUnique() {
let rawValues = ThemeID.allCases.map(\.rawValue)
#expect(Set(rawValues).count == rawValues.count)
}
@Test func brightDisplayNameIsDefault() {
#expect(ThemeID.bright.displayName == "Default")
}
@Test func oceanRawValueIsOcean() {
#expect(ThemeID.ocean.rawValue == "Ocean")
}
// MARK: - Honeycomb Setting Tests
@Test func honeycombDefaultsToDisabled() {
// HoneycombSetting reads from UserDefaults which defaults to false for unset Bool keys
#expect(HoneycombSetting.isEnabled == false)
}
}