forked from lukakerr/Pine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNSColorTests.swift
76 lines (53 loc) · 1.41 KB
/
NSColorTests.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//
// NSColorTests.swift
// PineTests
//
// Created by Luka Kerr on 10/2/19.
// Copyright © 2019 Luka Kerr. All rights reserved.
//
import XCTest
@testable import Pine
class NSColorTests: XCTestCase {
func testIsDark() {
let color = NSColor.black
XCTAssertTrue(color.isDark)
}
func testIsNotDark() {
let color = NSColor.white
XCTAssertFalse(color.isDark)
}
func testGetHexWhite() {
let color = NSColor.white
let hex = color.hex
XCTAssertEqual(hex, "#FFFFFF")
}
func testGetHexRed() {
let color = NSColor.red
let hex = color.hex
XCTAssertEqual(hex, "#FF0000")
}
func testGetLighter() {
let color = NSColor.red
let lighter = color.lighter
let expected = NSColor(red: 1.0, green: 0.1, blue: 0.1, alpha: 0)
XCTAssertEqual(lighter, expected)
}
func testGetLighterWhite() {
let color = NSColor.white
let lighter = color.lighter
let expected = NSColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 0)
XCTAssertEqual(lighter, expected)
}
func testGetDarker() {
let color = NSColor.blue
let darker = color.darker
let expected = NSColor(red: 0.0, green: 0.0, blue: 0.975, alpha: 0)
XCTAssertEqual(darker, expected)
}
func testGetDarkerBlack() {
let color = NSColor.black
let darker = color.darker
let expected = NSColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 0)
XCTAssertEqual(darker, expected)
}
}