mirror of
https://github.com/h3pdesign/Neon-Vision-Editor
synced 2026-04-21 21:37:17 +00:00
42 lines
1.2 KiB
Swift
42 lines
1.2 KiB
Swift
import XCTest
|
|
@testable import Neon_Vision_Editor
|
|
|
|
#if os(macOS)
|
|
import AppKit
|
|
|
|
@MainActor
|
|
|
|
|
|
/// MARK: - Tests
|
|
|
|
final class WindowTranslucencyTests: XCTestCase {
|
|
// Verifies that the translucency toggle updates AppKit window flags used by the toolbar/titlebar.
|
|
func testApplyWindowTranslucencyUpdatesMacWindowFlags() {
|
|
let testWindow = NSWindow(
|
|
contentRect: NSRect(x: 40, y: 40, width: 480, height: 320),
|
|
styleMask: [.titled, .closable, .resizable],
|
|
backing: .buffered,
|
|
defer: false
|
|
)
|
|
testWindow.isReleasedWhenClosed = false
|
|
testWindow.orderFront(nil)
|
|
|
|
defer {
|
|
testWindow.orderOut(nil)
|
|
testWindow.close()
|
|
}
|
|
|
|
let sut = ContentView()
|
|
|
|
sut.applyWindowTranslucency(true)
|
|
XCTAssertFalse(testWindow.isOpaque)
|
|
XCTAssertTrue(testWindow.titlebarAppearsTransparent)
|
|
XCTAssertEqual(testWindow.backgroundColor, .clear)
|
|
|
|
sut.applyWindowTranslucency(false)
|
|
XCTAssertTrue(testWindow.isOpaque)
|
|
XCTAssertFalse(testWindow.titlebarAppearsTransparent)
|
|
XCTAssertEqual(testWindow.backgroundColor, NSColor.windowBackgroundColor)
|
|
}
|
|
}
|
|
#endif
|