import SwiftUI
import Testing
@testable import WebTerm

/// T-iOS-15 · Privacy-shade state mapping (plan §7 T-iOS-15, security-critical).
///
/// The rule under test is EXACT: the shade covers whenever
/// `scenePhase != .active` — NOT just `.inactive`. Entering the app switcher
/// is `.inactive`, but the moment iOS writes the switcher snapshot to disk is
/// `.background`; covering only one of the two leaks terminal content
/// (API keys / tokens / source) into the on-disk snapshot.
@MainActor
@Suite("PrivacyShadePolicy")
struct PrivacyShadeTests {
    @Test("scenePhase == .active → 遮罩隐藏（恢复终端）")
    func activeShowsTerminal() {
        #expect(!PrivacyShadePolicy.isShadeVisible(for: .active))
    }

    @Test("scenePhase == .inactive → 遮罩可见（切换器入口态）")
    func inactiveIsCovered() {
        #expect(PrivacyShadePolicy.isShadeVisible(for: .inactive))
    }

    @Test("scenePhase == .background → 遮罩可见（快照写盘时刻）")
    func backgroundIsCovered() {
        #expect(PrivacyShadePolicy.isShadeVisible(for: .background))
    }
}
