import XCTest
@testable import MastermindPOCCore

final class OverlaySettingsTests: XCTestCase {
    func testDefaultOpacityIsReadableHudDefault() {
        XCTAssertEqual(OverlaySettings.default.backgroundOpacity, 0.72, accuracy: 0.0001)
    }

    func testOpacityBelowMinimumClampsToMinimum() {
        let settings = OverlaySettings(backgroundOpacity: 0.1)

        XCTAssertEqual(settings.backgroundOpacity, 0.35, accuracy: 0.0001)
    }

    func testOpacityAboveMaximumClampsToMaximum() {
        let settings = OverlaySettings(backgroundOpacity: 1.0)

        XCTAssertEqual(settings.backgroundOpacity, 0.95, accuracy: 0.0001)
    }

    func testValidOpacityStaysUnchanged() {
        let settings = OverlaySettings(backgroundOpacity: 0.64)

        XCTAssertEqual(settings.backgroundOpacity, 0.64, accuracy: 0.0001)
    }
}
