red-colors 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/test/test-hsl.rb ADDED
@@ -0,0 +1,267 @@
1
+ class ColorsHSLTest < Test::Unit::TestCase
2
+ include TestHelper
3
+
4
+ sub_test_case(".new") do
5
+ test("with integer values") do
6
+ c = Colors::HSL.new(1, 128, 255)
7
+ assert_equal(1r, c.hue)
8
+ assert_equal(128/255r, c.saturation)
9
+ assert_equal(255/255r, c.lightness)
10
+
11
+ c = Colors::HSL.new(-1, 128, 255)
12
+ assert_equal(359r, c.hue)
13
+
14
+ c = Colors::HSL.new(361, 128, 255)
15
+ assert_equal(1r, c.hue)
16
+
17
+ assert_raise(ArgumentError) do
18
+ Colors::HSL.new(0, 0x100, 0)
19
+ end
20
+
21
+ assert_raise(ArgumentError) do
22
+ Colors::HSL.new(0, 0, 0x100)
23
+ end
24
+
25
+ assert_raise(ArgumentError) do
26
+ Colors::HSL.new(0, -1, 0)
27
+ end
28
+
29
+ assert_raise(ArgumentError) do
30
+ Colors::HSL.new(0, 0, -1)
31
+ end
32
+ end
33
+
34
+ test("with float values") do
35
+ c = Colors::HSL.new(0.0.next_float, 0.55, 1)
36
+ assert_equal(0.0.next_float.to_r, c.hue)
37
+ assert_equal(0.55.to_r, c.saturation)
38
+ assert_equal(1.0.to_r, c.lightness)
39
+
40
+ c = Colors::HSL.new(-0.1, 0.55, 1)
41
+ assert_equal(360 - 0.1, c.hue)
42
+
43
+ c = Colors::HSL.new(360.1, 0.55, 1)
44
+ assert_equal(Rational(360.1) - 360, c.hue)
45
+
46
+ assert_raise(ArgumentError) do
47
+ Colors::HSL.new(0.0, 1.0.next_float, 0.0)
48
+ end
49
+
50
+ assert_raise(ArgumentError) do
51
+ Colors::HSL.new(0.0, 0.0, 1.0.next_float)
52
+ end
53
+
54
+ assert_raise(ArgumentError) do
55
+ Colors::HSL.new(0, -0.1, 0)
56
+ end
57
+
58
+ assert_raise(ArgumentError) do
59
+ Colors::HSL.new(0, 0, -0.1)
60
+ end
61
+ end
62
+
63
+ test("with rational values") do
64
+ c = Colors::HSL.new(1r, 500/1000r, 1)
65
+ assert_equal(1r, c.hue)
66
+ assert_equal(500/1000r, c.saturation)
67
+ assert_equal(1r, c.lightness)
68
+
69
+ c = Colors::HSL.new(-1r, 500/1000r, 1)
70
+ assert_equal(359r, c.hue)
71
+
72
+ c = Colors::HSL.new(361r, 500/1000r, 1)
73
+ assert_equal(1r, c.hue)
74
+
75
+ assert_raise(ArgumentError) do
76
+ Colors::HSL.new(0r, 1001/1000r, 0r)
77
+ end
78
+
79
+ assert_raise(ArgumentError) do
80
+ Colors::HSL.new(0r, 0r, 1001/1000r)
81
+ end
82
+
83
+ assert_raise(ArgumentError) do
84
+ Colors::HSL.new(0r, -1/1000r, 0r)
85
+ end
86
+
87
+ assert_raise(ArgumentError) do
88
+ Colors::HSL.new(0r, 0r, -1/1000r)
89
+ end
90
+ end
91
+ end
92
+
93
+ test("#hue=") do
94
+ c = Colors::HSL.new(0, 0, 0)
95
+ c.hue = 1r
96
+ assert_equal(1r, c.hue)
97
+ c.hue = 1.0r
98
+ assert_equal(1r, c.hue)
99
+ c.hue = 1
100
+ assert_equal(1r, c.hue)
101
+ c.hue = -1
102
+ assert_equal(359r, c.hue)
103
+ c.hue = 360
104
+ assert_equal(0r, c.hue)
105
+ c.hue = 361
106
+ assert_equal(1r, c.hue)
107
+ end
108
+
109
+ test("#saturation=") do
110
+ c = Colors::HSL.new(0, 0, 0)
111
+ c.saturation = 1r
112
+ assert_equal(1r, c.saturation)
113
+ c.saturation = 1.0r
114
+ assert_equal(1r, c.saturation)
115
+ c.saturation = 1
116
+ assert_equal(1/255r, c.saturation)
117
+ assert_raise(ArgumentError) do
118
+ c.saturation = 1001/1000r
119
+ end
120
+ assert_raise(ArgumentError) do
121
+ c.saturation = -1/1000r
122
+ end
123
+ assert_raise(ArgumentError) do
124
+ c.saturation = -0.1
125
+ end
126
+ assert_raise(ArgumentError) do
127
+ c.saturation = 1.0.next_float
128
+ end
129
+ assert_raise(ArgumentError) do
130
+ c.saturation = 256
131
+ end
132
+ assert_raise(ArgumentError) do
133
+ c.saturation = -1
134
+ end
135
+ end
136
+
137
+ test("#lightness=") do
138
+ c = Colors::HSL.new(0, 0, 0)
139
+ c.lightness = 1r
140
+ assert_equal(1r, c.lightness)
141
+ c.lightness = 1.0r
142
+ assert_equal(1r, c.lightness)
143
+ c.lightness = 1
144
+ assert_equal(1/255r, c.lightness)
145
+ assert_raise(ArgumentError) do
146
+ c.lightness = 1001/1000r
147
+ end
148
+ assert_raise(ArgumentError) do
149
+ c.lightness = -1/1000r
150
+ end
151
+ assert_raise(ArgumentError) do
152
+ c.lightness = -0.1
153
+ end
154
+ assert_raise(ArgumentError) do
155
+ c.lightness = 1.0.next_float
156
+ end
157
+ assert_raise(ArgumentError) do
158
+ c.lightness = 256
159
+ end
160
+ assert_raise(ArgumentError) do
161
+ c.lightness = -1
162
+ end
163
+ end
164
+
165
+ test("==") do
166
+ assert { Colors::HSL.new(0, 0, 0) == Colors::HSL.new(0, 0, 0) }
167
+ assert { Colors::HSL.new(0, 0, 0) == Colors::HSLA.new(0, 0, 0, 1r) }
168
+ end
169
+
170
+ test("!=") do
171
+ assert { Colors::HSL.new(0, 0, 0) != Colors::HSL.new(1, 0, 0) }
172
+ assert { Colors::HSL.new(0, 0, 0) != Colors::HSL.new(0, 1, 0) }
173
+ assert { Colors::HSL.new(0, 0, 0) != Colors::HSL.new(0, 0, 1) }
174
+ assert { Colors::HSL.new(0, 0, 0) != Colors::HSLA.new(0, 0, 0, 0) }
175
+ end
176
+
177
+ test("#desaturate") do
178
+ c = Colors::HSL.new(60r, 1r, 1r).desaturate(0.8)
179
+ assert_instance_of(Colors::HSL, c)
180
+ assert_near(Colors::HSL.new(60r, 0.8r, 1r), c)
181
+ end
182
+
183
+ test("to_hsl") do
184
+ black = Colors::HSL.new(0, 0, 0)
185
+ assert_same(black, black.to_hsl)
186
+ end
187
+
188
+ test("#to_hsla") do
189
+ black = Colors::HSL.new(0, 0, 0)
190
+ assert_equal(Colors::HSLA.new(0, 0, 0, 255),
191
+ black.to_hsla)
192
+ assert_equal(Colors::HSLA.new(0, 0, 0, 0),
193
+ black.to_hsla(alpha: 0))
194
+ assert_equal(Colors::HSLA.new(0, 0, 0, 0.5),
195
+ black.to_hsla(alpha: 0.5))
196
+
197
+ assert_raise(ArgumentError) do
198
+ black.to_hsla(alpha: nil)
199
+ end
200
+
201
+ assert_raise(ArgumentError) do
202
+ black.to_hsla(alpha: 256)
203
+ end
204
+
205
+ assert_raise(ArgumentError) do
206
+ black.to_hsla(alpha: -0.1)
207
+ end
208
+
209
+ assert_raise(ArgumentError) do
210
+ black.to_hsla(alpha: 1.0.next_float)
211
+ end
212
+ end
213
+
214
+ test("to_rgb") do
215
+ # black
216
+ assert_equal(Colors::RGB.new(0, 0, 0),
217
+ Colors::HSL.new(0, 0, 0).to_rgb)
218
+ # red
219
+ assert_equal(Colors::RGB.new(1r, 0r, 0r),
220
+ Colors::HSL.new(0r, 1r, 0.5r).to_rgb)
221
+ # yellow
222
+ assert_equal(Colors::RGB.new(1r, 1r, 0r),
223
+ Colors::HSL.new(60r, 1r, 0.5r).to_rgb)
224
+ # green
225
+ assert_equal(Colors::RGB.new(0r, 1r, 0r),
226
+ Colors::HSL.new(120r, 1r, 0.5r).to_rgb)
227
+ # cyan
228
+ assert_equal(Colors::RGB.new(0r, 1r, 1r),
229
+ Colors::HSL.new(180r, 1r, 0.5r).to_rgb)
230
+ # blue
231
+ assert_equal(Colors::RGB.new(0r, 0r, 1r),
232
+ Colors::HSL.new(240r, 1r, 0.5r).to_rgb)
233
+ # magenta
234
+ assert_equal(Colors::RGB.new(1r, 0r, 1r),
235
+ Colors::HSL.new(300r, 1r, 0.5r).to_rgb)
236
+ # white
237
+ assert_equal(Colors::RGB.new(1r, 1r, 1r),
238
+ Colors::HSL.new(0r, 1r, 1r).to_rgb)
239
+ end
240
+
241
+ test("to_rgba") do
242
+ # black
243
+ assert_equal(Colors::RGBA.new(0, 0, 0, 1r),
244
+ Colors::HSL.new(0, 0, 0).to_rgba)
245
+ # red
246
+ assert_equal(Colors::RGBA.new(1r, 0r, 0r, 1r),
247
+ Colors::HSL.new(0r, 1r, 0.5r).to_rgba)
248
+ # yellow
249
+ assert_equal(Colors::RGBA.new(1r, 1r, 0r, 1r),
250
+ Colors::HSL.new(60r, 1r, 0.5r).to_rgba)
251
+ # green
252
+ assert_equal(Colors::RGBA.new(0r, 1r, 0r, 1r),
253
+ Colors::HSL.new(120r, 1r, 0.5r).to_rgba)
254
+ # cyan
255
+ assert_equal(Colors::RGBA.new(0r, 1r, 1r, 1r),
256
+ Colors::HSL.new(180r, 1r, 0.5r).to_rgba)
257
+ # blue
258
+ assert_equal(Colors::RGBA.new(0r, 0r, 1r, 1r),
259
+ Colors::HSL.new(240r, 1r, 0.5r).to_rgba)
260
+ # magenta
261
+ assert_equal(Colors::RGBA.new(1r, 0r, 1r, 1r),
262
+ Colors::HSL.new(300r, 1r, 0.5r).to_rgba)
263
+ # white
264
+ assert_equal(Colors::RGBA.new(1r, 1r, 1r, 1r),
265
+ Colors::HSL.new(0r, 1r, 1r).to_rgba)
266
+ end
267
+ end
data/test/test-hsla.rb ADDED
@@ -0,0 +1,309 @@
1
+ class ColorsHSLATest < Test::Unit::TestCase
2
+ include TestHelper
3
+
4
+ sub_test_case(".new") do
5
+ test("with integer values") do
6
+ c = Colors::HSLA.new(1, 128, 0, 255)
7
+ assert_equal(1r, c.hue)
8
+ assert_equal(128/255r, c.saturation)
9
+ assert_equal(0r, c.lightness)
10
+ assert_equal(255/255r, c.alpha)
11
+
12
+ c = Colors::HSLA.new(-1, 128, 0, 255)
13
+ assert_equal(359r, c.hue)
14
+
15
+ c = Colors::HSLA.new(361, 128, 0, 255)
16
+ assert_equal(1r, c.hue)
17
+
18
+ assert_raise(ArgumentError) do
19
+ Colors::HSLA.new(0, 0x100, 0, 0)
20
+ end
21
+
22
+ assert_raise(ArgumentError) do
23
+ Colors::HSLA.new(0, 0, 0x100, 0)
24
+ end
25
+
26
+ assert_raise(ArgumentError) do
27
+ Colors::HSLA.new(0, 0, 0, 0x100)
28
+ end
29
+
30
+ assert_raise(ArgumentError) do
31
+ Colors::HSLA.new(0, -1, 0, 0)
32
+ end
33
+
34
+ assert_raise(ArgumentError) do
35
+ Colors::HSLA.new(0, 0, -1, 0)
36
+ end
37
+
38
+ assert_raise(ArgumentError) do
39
+ Colors::HSLA.new(0, 0, 0, -1)
40
+ end
41
+ end
42
+
43
+ test("with float values") do
44
+ c = Colors::HSLA.new(0.0.next_float, 0.55, 1, 0.8)
45
+ assert_equal(0.0.next_float.to_r, c.hue)
46
+ assert_equal(0.55.to_r, c.saturation)
47
+ assert_equal(1.0.to_r, c.lightness)
48
+ assert_equal(0.8.to_r, c.alpha)
49
+
50
+ c = Colors::HSLA.new(-0.1, 0.55, 1, 1)
51
+ assert_equal(360 - 0.1, c.hue)
52
+
53
+ c = Colors::HSLA.new(360.1, 0.55, 1, 1)
54
+ assert_equal(Rational(360.1) - 360, c.hue)
55
+
56
+ assert_raise(ArgumentError) do
57
+ Colors::HSLA.new(0.0, 1.0.next_float, 0.0, 0.0)
58
+ end
59
+
60
+ assert_raise(ArgumentError) do
61
+ Colors::HSLA.new(0.0, 0.0, 1.0.next_float, 0.0)
62
+ end
63
+
64
+ assert_raise(ArgumentError) do
65
+ Colors::HSLA.new(0.0, 0.0, 0.0, 1.0.next_float)
66
+ end
67
+
68
+ assert_raise(ArgumentError) do
69
+ Colors::HSLA.new(0, -0.1, 0, 0)
70
+ end
71
+
72
+ assert_raise(ArgumentError) do
73
+ Colors::HSLA.new(0, 0, -0.1, 0)
74
+ end
75
+
76
+ assert_raise(ArgumentError) do
77
+ Colors::HSLA.new(0, 0, 0, -0.1)
78
+ end
79
+ end
80
+
81
+ test("with rational values") do
82
+ c = Colors::HSLA.new(1r, 500/1000r, 1, 0.8r)
83
+ assert_equal(1r, c.hue)
84
+ assert_equal(500/1000r, c.saturation)
85
+ assert_equal(1r, c.lightness)
86
+ assert_equal(0.8r, c.alpha)
87
+
88
+ c = Colors::HSLA.new(-1r, 500/1000r, 1, 1)
89
+ assert_equal(359r, c.hue)
90
+
91
+ c = Colors::HSLA.new(361r, 500/1000r, 1, 1)
92
+ assert_equal(1r, c.hue)
93
+
94
+ assert_raise(ArgumentError) do
95
+ Colors::HSLA.new(0r, 1001/1000r, 0r, 0r)
96
+ end
97
+
98
+ assert_raise(ArgumentError) do
99
+ Colors::HSLA.new(0r, 0r, 1001/1000r, 0r)
100
+ end
101
+
102
+ assert_raise(ArgumentError) do
103
+ Colors::HSLA.new(0r, 0r, 0r, 1001/1000r)
104
+ end
105
+
106
+ assert_raise(ArgumentError) do
107
+ Colors::HSLA.new(0r, -1/1000r, 0r, 0r)
108
+ end
109
+
110
+ assert_raise(ArgumentError) do
111
+ Colors::HSLA.new(0r, 0r, -1/1000r, 0r)
112
+ end
113
+
114
+ assert_raise(ArgumentError) do
115
+ Colors::HSLA.new(0r, 0r, 0r, -1/1000r)
116
+ end
117
+ end
118
+ end
119
+
120
+ test("#hue=") do
121
+ c = Colors::HSLA.new(0, 0, 0, 0)
122
+ c.hue = 1r
123
+ assert_equal(1r, c.hue)
124
+ c.hue = 1.0r
125
+ assert_equal(1r, c.hue)
126
+ c.hue = 1
127
+ assert_equal(1r, c.hue)
128
+ c.hue = -1
129
+ assert_equal(359r, c.hue)
130
+ c.hue = 360
131
+ assert_equal(0r, c.hue)
132
+ c.hue = 361
133
+ assert_equal(1r, c.hue)
134
+ end
135
+
136
+ test("#saturation=") do
137
+ c = Colors::HSLA.new(0, 0, 0, 0)
138
+ c.saturation = 1r
139
+ assert_equal(1r, c.saturation)
140
+ c.saturation = 1.0r
141
+ assert_equal(1r, c.saturation)
142
+ c.saturation = 1
143
+ assert_equal(1/255r, c.saturation)
144
+ assert_raise(ArgumentError) do
145
+ c.saturation = 1001/1000r
146
+ end
147
+ assert_raise(ArgumentError) do
148
+ c.saturation = -1/1000r
149
+ end
150
+ assert_raise(ArgumentError) do
151
+ c.saturation = -0.1
152
+ end
153
+ assert_raise(ArgumentError) do
154
+ c.saturation = 1.0.next_float
155
+ end
156
+ assert_raise(ArgumentError) do
157
+ c.saturation = 256
158
+ end
159
+ assert_raise(ArgumentError) do
160
+ c.saturation = -1
161
+ end
162
+ end
163
+
164
+ test("#lightness=") do
165
+ c = Colors::HSLA.new(0, 0, 0, 0)
166
+ c.lightness = 1r
167
+ assert_equal(1r, c.lightness)
168
+ c.lightness = 1.0r
169
+ assert_equal(1r, c.lightness)
170
+ c.lightness = 1
171
+ assert_equal(1/255r, c.lightness)
172
+ assert_raise(ArgumentError) do
173
+ c.lightness = 1001/1000r
174
+ end
175
+ assert_raise(ArgumentError) do
176
+ c.lightness = -1/1000r
177
+ end
178
+ assert_raise(ArgumentError) do
179
+ c.lightness = -0.1
180
+ end
181
+ assert_raise(ArgumentError) do
182
+ c.lightness = 1.0.next_float
183
+ end
184
+ assert_raise(ArgumentError) do
185
+ c.lightness = 256
186
+ end
187
+ assert_raise(ArgumentError) do
188
+ c.lightness = -1
189
+ end
190
+ end
191
+
192
+ test("#alpha=") do
193
+ c = Colors::HSLA.new(0, 0, 0, 0)
194
+ c.alpha = 1r
195
+ assert_equal(1r, c.alpha)
196
+ c.alpha = 1.0r
197
+ assert_equal(1r, c.alpha)
198
+ c.alpha = 1
199
+ assert_equal(1/255r, c.alpha)
200
+ assert_raise(ArgumentError) do
201
+ c.alpha = 1001/1000r
202
+ end
203
+ assert_raise(ArgumentError) do
204
+ c.alpha = -1/1000r
205
+ end
206
+ assert_raise(ArgumentError) do
207
+ c.alpha = -0.1
208
+ end
209
+ assert_raise(ArgumentError) do
210
+ c.alpha = 1.0.next_float
211
+ end
212
+ assert_raise(ArgumentError) do
213
+ c.alpha = 256
214
+ end
215
+ assert_raise(ArgumentError) do
216
+ c.alpha = -1
217
+ end
218
+ end
219
+
220
+ test("==") do
221
+ assert { Colors::HSLA.new(0, 0, 0, 0) == Colors::HSLA.new(0, 0, 0, 0) }
222
+ assert { Colors::HSLA.new(0, 0, 0, 1r) == Colors::HSL.new(0, 0, 0) }
223
+ end
224
+
225
+ test("!=") do
226
+ assert { Colors::HSLA.new(0, 0, 0, 0) != Colors::HSLA.new(1, 0, 0, 0) }
227
+ assert { Colors::HSLA.new(0, 0, 0, 0) != Colors::HSLA.new(0, 1, 0, 0) }
228
+ assert { Colors::HSLA.new(0, 0, 0, 0) != Colors::HSLA.new(0, 0, 1, 0) }
229
+ assert { Colors::HSLA.new(0, 0, 0, 0) != Colors::HSL.new(0, 0, 0) }
230
+ end
231
+
232
+ test("#desaturate") do
233
+ c = Colors::HSLA.new(60r, 1r, 1r, 0.7r).desaturate(0.8)
234
+ assert_instance_of(Colors::HSLA, c)
235
+ assert_near(Colors::HSLA.new(60r, 0.8r, 1r, 0.7r), c)
236
+ end
237
+
238
+ test("to_hsla") do
239
+ black = Colors::HSLA.new(0, 0, 0, 0)
240
+ assert_same(black, black.to_hsla)
241
+ end
242
+
243
+ test("to_hsl") do
244
+ assert_equal(Colors::HSL.new(0, 0, 0),
245
+ Colors::HSLA.new(0, 0, 0, 1r).to_hsl)
246
+
247
+ assert_raise(NotImplementedError) do
248
+ Colors::HSLA.new(0, 0, 0, 0).to_hsl
249
+ end
250
+ end
251
+
252
+ test("to_rgb") do
253
+ # black
254
+ assert_equal(Colors::RGB.new(0, 0, 0),
255
+ Colors::HSLA.new(0, 0, 0, 1r).to_rgb)
256
+ # red
257
+ assert_equal(Colors::RGB.new(1r, 0r, 0r),
258
+ Colors::HSLA.new(0r, 1r, 0.5r, 1r).to_rgb)
259
+ # yellow
260
+ assert_equal(Colors::RGB.new(1r, 1r, 0r),
261
+ Colors::HSLA.new(60r, 1r, 0.5r, 1r).to_rgb)
262
+ # green
263
+ assert_equal(Colors::RGB.new(0r, 1r, 0r),
264
+ Colors::HSLA.new(120r, 1r, 0.5r, 1r).to_rgb)
265
+ # cyan
266
+ assert_equal(Colors::RGB.new(0r, 1r, 1r),
267
+ Colors::HSLA.new(180r, 1r, 0.5r, 1r).to_rgb)
268
+ # blue
269
+ assert_equal(Colors::RGB.new(0r, 0r, 1r),
270
+ Colors::HSLA.new(240r, 1r, 0.5r, 1r).to_rgb)
271
+ # magenta
272
+ assert_equal(Colors::RGB.new(1r, 0r, 1r),
273
+ Colors::HSLA.new(300r, 1r, 0.5r, 1r).to_rgb)
274
+ # white
275
+ assert_equal(Colors::RGB.new(1r, 1r, 1r),
276
+ Colors::HSLA.new(0r, 1r, 1r, 1r).to_rgb)
277
+
278
+ assert_raise(NotImplementedError) do
279
+ Colors::HSLA.new(0r, 1r, 1r, 0.8r).to_rgb
280
+ end
281
+ end
282
+
283
+ test("to_rgba") do
284
+ # black
285
+ assert_equal(Colors::RGBA.new(0, 0, 0, 0.8r),
286
+ Colors::HSLA.new(0, 0, 0, 0.8r).to_rgba)
287
+ # red
288
+ assert_equal(Colors::RGBA.new(1r, 0r, 0r, 0.8r),
289
+ Colors::HSLA.new(0r, 1r, 0.5r, 0.8r).to_rgba)
290
+ # yellow
291
+ assert_equal(Colors::RGBA.new(1r, 1r, 0r, 0.8r),
292
+ Colors::HSLA.new(60r, 1r, 0.5r, 0.8r).to_rgba)
293
+ # green
294
+ assert_equal(Colors::RGBA.new(0r, 1r, 0r, 0.8r),
295
+ Colors::HSLA.new(120r, 1r, 0.5r, 0.8r).to_rgba)
296
+ # cyan
297
+ assert_equal(Colors::RGBA.new(0r, 1r, 1r, 0.8r),
298
+ Colors::HSLA.new(180r, 1r, 0.5r, 0.8r).to_rgba)
299
+ # blue
300
+ assert_equal(Colors::RGBA.new(0r, 0r, 1r, 0.8r),
301
+ Colors::HSLA.new(240r, 1r, 0.5r, 0.8r).to_rgba)
302
+ # magenta
303
+ assert_equal(Colors::RGBA.new(1r, 0r, 1r, 0.8r),
304
+ Colors::HSLA.new(300r, 1r, 0.5r, 0.8r).to_rgba)
305
+ # white
306
+ assert_equal(Colors::RGBA.new(1r, 1r, 1r, 0.8r),
307
+ Colors::HSLA.new(0r, 1r, 1r, 0.8r).to_rgba)
308
+ end
309
+ end