rubygame 2.3.0-x86-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/CREDITS +60 -0
  2. data/LICENSE +504 -0
  3. data/NEWS +252 -0
  4. data/README +123 -0
  5. data/ROADMAP +109 -0
  6. data/Rakefile +438 -0
  7. data/doc/extended_readme.rdoc +49 -0
  8. data/doc/getting_started.rdoc +47 -0
  9. data/doc/macosx_install.rdoc +70 -0
  10. data/doc/windows_install.rdoc +123 -0
  11. data/ext/rubygame/rubygame_core.so +0 -0
  12. data/ext/rubygame/rubygame_event.c +644 -0
  13. data/ext/rubygame/rubygame_event.h +48 -0
  14. data/ext/rubygame/rubygame_event.o +0 -0
  15. data/ext/rubygame/rubygame_gfx.c +942 -0
  16. data/ext/rubygame/rubygame_gfx.h +101 -0
  17. data/ext/rubygame/rubygame_gfx.o +0 -0
  18. data/ext/rubygame/rubygame_gfx.so +0 -0
  19. data/ext/rubygame/rubygame_gl.c +154 -0
  20. data/ext/rubygame/rubygame_gl.h +32 -0
  21. data/ext/rubygame/rubygame_gl.o +0 -0
  22. data/ext/rubygame/rubygame_image.c +252 -0
  23. data/ext/rubygame/rubygame_image.h +41 -0
  24. data/ext/rubygame/rubygame_image.o +0 -0
  25. data/ext/rubygame/rubygame_image.so +0 -0
  26. data/ext/rubygame/rubygame_joystick.c +247 -0
  27. data/ext/rubygame/rubygame_joystick.h +41 -0
  28. data/ext/rubygame/rubygame_joystick.o +0 -0
  29. data/ext/rubygame/rubygame_main.c +155 -0
  30. data/ext/rubygame/rubygame_main.h +36 -0
  31. data/ext/rubygame/rubygame_main.o +0 -0
  32. data/ext/rubygame/rubygame_mixer.c +1024 -0
  33. data/ext/rubygame/rubygame_mixer.h +36 -0
  34. data/ext/rubygame/rubygame_mixer.o +0 -0
  35. data/ext/rubygame/rubygame_mixer.so +0 -0
  36. data/ext/rubygame/rubygame_music.c +1017 -0
  37. data/ext/rubygame/rubygame_music.h +29 -0
  38. data/ext/rubygame/rubygame_music.o +0 -0
  39. data/ext/rubygame/rubygame_screen.c +448 -0
  40. data/ext/rubygame/rubygame_screen.h +43 -0
  41. data/ext/rubygame/rubygame_screen.o +0 -0
  42. data/ext/rubygame/rubygame_shared.c +272 -0
  43. data/ext/rubygame/rubygame_shared.h +68 -0
  44. data/ext/rubygame/rubygame_shared.o +0 -0
  45. data/ext/rubygame/rubygame_sound.c +863 -0
  46. data/ext/rubygame/rubygame_sound.h +29 -0
  47. data/ext/rubygame/rubygame_sound.o +0 -0
  48. data/ext/rubygame/rubygame_surface.c +1151 -0
  49. data/ext/rubygame/rubygame_surface.h +62 -0
  50. data/ext/rubygame/rubygame_surface.o +0 -0
  51. data/ext/rubygame/rubygame_time.c +183 -0
  52. data/ext/rubygame/rubygame_time.h +32 -0
  53. data/ext/rubygame/rubygame_time.o +0 -0
  54. data/ext/rubygame/rubygame_ttf.c +599 -0
  55. data/ext/rubygame/rubygame_ttf.h +69 -0
  56. data/ext/rubygame/rubygame_ttf.o +0 -0
  57. data/ext/rubygame/rubygame_ttf.so +0 -0
  58. data/lib/rubygame.rb +41 -0
  59. data/lib/rubygame/clock.rb +128 -0
  60. data/lib/rubygame/color.rb +79 -0
  61. data/lib/rubygame/color/models/base.rb +111 -0
  62. data/lib/rubygame/color/models/hsl.rb +153 -0
  63. data/lib/rubygame/color/models/hsv.rb +149 -0
  64. data/lib/rubygame/color/models/rgb.rb +78 -0
  65. data/lib/rubygame/color/palettes/css.rb +49 -0
  66. data/lib/rubygame/color/palettes/palette.rb +100 -0
  67. data/lib/rubygame/color/palettes/x11.rb +177 -0
  68. data/lib/rubygame/constants.rb +238 -0
  69. data/lib/rubygame/event.rb +313 -0
  70. data/lib/rubygame/ftor.rb +370 -0
  71. data/lib/rubygame/hotspot.rb +265 -0
  72. data/lib/rubygame/keyconstants.rb +237 -0
  73. data/lib/rubygame/mediabag.rb +94 -0
  74. data/lib/rubygame/named_resource.rb +254 -0
  75. data/lib/rubygame/queue.rb +288 -0
  76. data/lib/rubygame/rect.rb +612 -0
  77. data/lib/rubygame/sfont.rb +223 -0
  78. data/lib/rubygame/sprite.rb +511 -0
  79. data/samples/FreeSans.ttf +0 -0
  80. data/samples/GPL.txt +340 -0
  81. data/samples/README +40 -0
  82. data/samples/chimp.bmp +0 -0
  83. data/samples/chimp.rb +302 -0
  84. data/samples/demo_gl.rb +151 -0
  85. data/samples/demo_gl_tex.rb +197 -0
  86. data/samples/demo_music.rb +77 -0
  87. data/samples/demo_rubygame.rb +296 -0
  88. data/samples/demo_sfont.rb +52 -0
  89. data/samples/demo_ttf.rb +193 -0
  90. data/samples/demo_utf8.rb +53 -0
  91. data/samples/fist.bmp +0 -0
  92. data/samples/load_and_blit.rb +22 -0
  93. data/samples/panda.png +0 -0
  94. data/samples/punch.wav +0 -0
  95. data/samples/ruby.png +0 -0
  96. data/samples/song.ogg +0 -0
  97. data/samples/term16.png +0 -0
  98. data/samples/whiff.wav +0 -0
  99. data/test/audio_spec.rb +236 -0
  100. data/test/color_spec.rb +544 -0
  101. data/test/image.png +0 -0
  102. data/test/music_spec.rb +727 -0
  103. data/test/named_resource_spec.rb +211 -0
  104. data/test/short.ogg +0 -0
  105. data/test/sound_spec.rb +564 -0
  106. data/test/surface_spec.rb +219 -0
  107. data/test/test_crop.rb +45 -0
  108. data/test/test_rect.rb +841 -0
  109. metadata +174 -0
@@ -0,0 +1,544 @@
1
+ require 'rubygame/color'
2
+ include Rubygame::Color
3
+
4
+ DELTA = 0.01
5
+
6
+ # Some sample colors in RGB, HSV, and HSL forms
7
+ $colors = {
8
+ :ruby => { :rgb => [0.44, 0.0625, 0.0625], :hsv => [ 0, 0.86, 0.44], :hsl => [ 0, 0.75, 0.25] },
9
+ :skyblue => { :rgb => [0.50, 0.7500, 1.0000], :hsv => [0.56, 0.50, 1.00], :hsl => [0.56, 1.00, 0.75] },
10
+ :chocolate => { :rgb => [0.38, 0.2500, 0.1300], :hsv => [0.08, 0.67, 0.38], :hsl => [0.83, 0.50, 0.25] }
11
+ }
12
+
13
+ ##############################
14
+ ## SHARED SPECS ##
15
+ ##############################
16
+
17
+ describe "Color with RGBA array (shared)", :shared => true do
18
+ it "should have an RGBA array with 4 components" do
19
+ @color.should respond_to(:to_rgba_ary)
20
+ @color.to_rgba_ary.should be_instance_of( Array )
21
+ @color.to_rgba_ary.should have_exactly(4).components
22
+ end
23
+
24
+ it "should have the expected red component" do
25
+ @color.to_rgba_ary.at(0).should be_close( @r.to_f, DELTA )
26
+ end
27
+
28
+ it "should have the expected green component" do
29
+ @color.to_rgba_ary.at(1).should be_close( @g.to_f, DELTA )
30
+ end
31
+
32
+ it "should have the expected blue component" do
33
+ @color.to_rgba_ary.at(2).should be_close( @b.to_f, DELTA )
34
+ end
35
+
36
+ it "should have the expected alpha compenent" do
37
+ @color.to_rgba_ary.at(3).should be_close( @a.to_f, DELTA )
38
+ end
39
+ end
40
+
41
+ ##############################
42
+ ## RGB SHARED SPECS ##
43
+ ##############################
44
+
45
+ describe "ColorRGB (shared)", :shared => true do
46
+ it "should have a 'r' (red) component which is a Float" do
47
+ @color.should respond_to(:r)
48
+ @color.r.should be_instance_of( Float )
49
+ end
50
+
51
+ it "should have a 'g' (green) component which is a Float" do
52
+ @color.should respond_to(:g)
53
+ @color.g.should be_instance_of( Float )
54
+ end
55
+
56
+ it "should have a 'b' (blue) component which is a Float" do
57
+ @color.should respond_to(:b)
58
+ @color.b.should be_instance_of( Float )
59
+ end
60
+
61
+ it "should have an 'a' (alpha) component which is a Float" do
62
+ @color.should respond_to(:a)
63
+ @color.a.should be_instance_of( Float )
64
+ end
65
+
66
+ it "should have the expected red component" do
67
+ @color.r.should be_close( @r.to_f, DELTA )
68
+ end
69
+
70
+ it "should have the expected green component" do
71
+ @color.g.should be_close( @g.to_f, DELTA )
72
+ end
73
+
74
+ it "should have the expected blue component" do
75
+ @color.b.should be_close( @b.to_f, DELTA )
76
+ end
77
+
78
+ it "should have the expected alpha component" do
79
+ @color.a.should be_close( @a.to_f, DELTA )
80
+ end
81
+
82
+ end
83
+
84
+ ##############################
85
+ ## RGB INITIALIZATION ##
86
+ ##############################
87
+
88
+ describe "ColorRGB initialized from a 3-Array" do
89
+ before(:each) do
90
+ @r, @g, @b = $colors[:ruby][:rgb]
91
+ @a = 1.0
92
+ @color = ColorRGB.new( [@r, @g, @b] )
93
+ end
94
+
95
+ it "should have full opacity" do
96
+ @color.a.should == 1.0
97
+ end
98
+
99
+ it_should_behave_like "ColorRGB (shared)"
100
+ it_should_behave_like "Color with RGBA array (shared)"
101
+
102
+ end
103
+
104
+ describe "ColorRGB initialized from a 4-Array" do
105
+ before(:each) do
106
+ @r, @g, @b = $colors[:ruby][:rgb]
107
+ @a = 0.5
108
+ @color = ColorRGB.new( [@r, @g, @b, @a] )
109
+ end
110
+
111
+ it_should_behave_like "ColorRGB (shared)"
112
+ it_should_behave_like "Color with RGBA array (shared)"
113
+
114
+ end
115
+
116
+ describe "ColorRGB initialized from an Array of integers" do
117
+ before(:each) do
118
+ @r, @g, @b = $colors[:ruby][:rgb]
119
+ @a = 1.0
120
+ @r, @g, @b, @a = [@r, @g, @b, @a].collect { |c| c.to_i }
121
+ @color = ColorRGB.new( [@r, @g, @b, @a] )
122
+ end
123
+
124
+ it_should_behave_like "ColorRGB (shared)"
125
+ it_should_behave_like "Color with RGBA array (shared)"
126
+
127
+ end
128
+
129
+ describe "ColorRGB initialized from a ColorRGB" do
130
+ before(:each) do
131
+ @r, @g, @b = $colors[:ruby][:rgb]
132
+ @a = 0.5
133
+ @source = ColorRGB.new( [@r, @g, @b, @a] )
134
+ @color = ColorRGB.new( @source )
135
+ end
136
+
137
+ it_should_behave_like "ColorRGB (shared)"
138
+ it_should_behave_like "Color with RGBA array (shared)"
139
+
140
+ end
141
+
142
+ describe "ColorRGB initialized from a ColorHSV" do
143
+ before(:each) do
144
+ @r, @g, @b = $colors[:ruby][:rgb]
145
+ @a = 0.5
146
+ @source = ColorHSV.new( $colors[:ruby][:hsv] + [@a] )
147
+ @color = ColorRGB.new( @source )
148
+ end
149
+
150
+ it_should_behave_like "ColorRGB (shared)"
151
+ it_should_behave_like "Color with RGBA array (shared)"
152
+
153
+ end
154
+
155
+ describe "ColorRGB initialized from a ColorHSL" do
156
+ before(:each) do
157
+ @r, @g, @b = $colors[:ruby][:rgb]
158
+ @a = 0.5
159
+ @source = ColorHSL.new( $colors[:ruby][:hsl] + [@a] )
160
+ @color = ColorRGB.new( @source )
161
+ end
162
+
163
+ it_should_behave_like "ColorRGB (shared)"
164
+ it_should_behave_like "Color with RGBA array (shared)"
165
+
166
+ end
167
+
168
+ ##############################
169
+ # RGB MATHS #
170
+ ##############################
171
+
172
+ describe "ColorRGB added with another ColorRGB" do
173
+ before(:each) do
174
+ @color1 = ColorRGB.new( [0.5, 0.5, 0.5, 0.5] )
175
+ @color2 = ColorRGB.new( [0.1, 0.2, 0.3, 0.4] )
176
+
177
+ @color = @color1 + @color2
178
+
179
+ @r, @g, @b, @a = 0.29, 0.33, 0.37, 0.5
180
+ end
181
+
182
+ it_should_behave_like "ColorRGB (shared)"
183
+ it_should_behave_like "Color with RGBA array (shared)"
184
+
185
+ end
186
+
187
+ describe "ColorRGB subtracted with another ColorRGB" do
188
+ before(:each) do
189
+ @color1 = ColorRGB.new( [0.5, 0.5, 0.5, 0.5] )
190
+ @color2 = ColorRGB.new( [0.1, 0.2, 0.3, 0.4] )
191
+
192
+ @color = @color1 - @color2
193
+
194
+ @r, @g, @b, @a = 0.21, 0.17, 0.13, 0.5
195
+ end
196
+
197
+ it_should_behave_like "ColorRGB (shared)"
198
+ it_should_behave_like "Color with RGBA array (shared)"
199
+
200
+ end
201
+
202
+ describe "ColorRGB multiplied with another ColorRGB" do
203
+ before(:each) do
204
+ @color1 = ColorRGB.new( [0.5, 0.5, 0.5, 0.5] )
205
+ @color2 = ColorRGB.new( [0.1, 0.2, 0.3, 0.4] )
206
+
207
+ @color = @color1 * @color2
208
+
209
+ @r, @g, @b, @a = 0.01, 0.02, 0.03, 0.5
210
+ end
211
+
212
+ it_should_behave_like "ColorRGB (shared)"
213
+ it_should_behave_like "Color with RGBA array (shared)"
214
+
215
+ end
216
+
217
+ describe "ColorRGB divided with another ColorRGB" do
218
+ before(:each) do
219
+ @color1 = ColorRGB.new( [0.1, 0.1, 0.1, 0.5] )
220
+ @color2 = ColorRGB.new( [0.1, 0.2, 0.4, 0.4] )
221
+
222
+ @color = @color1 / @color2
223
+
224
+ @r, @g, @b, @a = 1.0, 0.625, 0.3125, 0.5
225
+ end
226
+
227
+ it_should_behave_like "ColorRGB (shared)"
228
+ it_should_behave_like "Color with RGBA array (shared)"
229
+
230
+ end
231
+
232
+ describe "ColorRGB over another ColorRGB" do
233
+ before(:each) do
234
+ @color1 = ColorRGB.new( [0.5, 0.5, 0.5, 0.5] )
235
+ @color2 = ColorRGB.new( [0.1, 0.2, 0.4, 0.4] )
236
+
237
+ @color = @color1.over(@color2)
238
+
239
+ @r, @g, @b, @a = 0.27, 0.29, 0.33, 0.7
240
+ end
241
+
242
+ it_should_behave_like "ColorRGB (shared)"
243
+ it_should_behave_like "Color with RGBA array (shared)"
244
+
245
+ end
246
+
247
+ describe "ColorRGB averaged with another ColorRGB" do
248
+ before(:each) do
249
+ @color1 = ColorRGB.new( [0.5, 0.5, 0.5, 0.5] )
250
+ @color2 = ColorRGB.new( [0.1, 0.2, 0.4, 0.4] )
251
+
252
+ @color = @color1.average(@color2)
253
+
254
+ @r, @g, @b, @a = 0.3, 0.35, 0.45, 0.45
255
+ end
256
+
257
+ it_should_behave_like "ColorRGB (shared)"
258
+ it_should_behave_like "Color with RGBA array (shared)"
259
+
260
+ end
261
+
262
+ describe "ColorRGB weighted-averaged with another ColorRGB" do
263
+ before(:each) do
264
+ @color1 = ColorRGB.new( [0.5, 0.5, 0.5, 0.5] )
265
+ @color2 = ColorRGB.new( [0.1, 0.2, 0.4, 0.4] )
266
+
267
+ @color = @color1.average(@color2, 0.9)
268
+
269
+ @r, @g, @b, @a = 0.46, 0.47, 0.49, 0.49
270
+ end
271
+
272
+ it_should_behave_like "ColorRGB (shared)"
273
+ it_should_behave_like "Color with RGBA array (shared)"
274
+
275
+ end
276
+
277
+
278
+ ##############################
279
+ ## HSV SHARED SPECS ##
280
+ ##############################
281
+
282
+ describe "ColorHSV (shared)", :shared => true do
283
+ it "should have a 'h' (hue) component which is a Float" do
284
+ @color.should respond_to(:h)
285
+ @color.h.should be_instance_of( Float )
286
+ end
287
+
288
+ it "should have a 's' (saturation) component which is a Float" do
289
+ @color.should respond_to(:s)
290
+ @color.s.should be_instance_of( Float )
291
+ end
292
+
293
+ it "should have a 'v' (value) component which is a Float" do
294
+ @color.should respond_to(:v)
295
+ @color.v.should be_instance_of( Float )
296
+ end
297
+
298
+ it "should have an 'a' (alpha) component which is a Float" do
299
+ @color.should respond_to(:a)
300
+ @color.a.should be_instance_of( Float )
301
+ end
302
+
303
+ it "should have the expected hue component" do
304
+ @color.h.should be_close( @h.to_f, DELTA )
305
+ end
306
+
307
+ it "should have the expected saturation component" do
308
+ @color.s.should be_close( @s.to_f, DELTA )
309
+ end
310
+
311
+ it "should have the expected value component" do
312
+ @color.v.should be_close( @v.to_f, DELTA )
313
+ end
314
+
315
+ it "should have the expected alpha component" do
316
+ @color.a.should be_close( @a.to_f, DELTA )
317
+ end
318
+ end
319
+
320
+ ##############################
321
+ ## HSV INITIALIZATION ##
322
+ ##############################
323
+
324
+ describe "ColorHSV initialized from a 3-Array" do
325
+ before(:each) do
326
+ @h, @s, @v = $colors[:ruby][:hsv]
327
+ @r, @g, @b = $colors[:ruby][:rgb]
328
+ @a = 1.0
329
+ @color = ColorHSV.new( [@h, @s, @v] )
330
+ end
331
+
332
+ it "should have full opacity" do
333
+ @color.a.should == 1.0
334
+ end
335
+
336
+ it_should_behave_like "ColorHSV (shared)"
337
+ it_should_behave_like "Color with RGBA array (shared)"
338
+
339
+ end
340
+
341
+ describe "ColorHSV initialized from a 4-Array" do
342
+ before(:each) do
343
+ @h, @s, @v = $colors[:ruby][:hsv]
344
+ @r, @g, @b = $colors[:ruby][:rgb]
345
+ @a = 0.5
346
+ @color = ColorHSV.new( [@h, @s, @v, @a] )
347
+ end
348
+
349
+ it_should_behave_like "ColorHSV (shared)"
350
+ it_should_behave_like "Color with RGBA array (shared)"
351
+
352
+ end
353
+
354
+ # describe "ColorHSV initialized from an Array of integers" do
355
+ # before(:each) do
356
+ # @h, @s, @v = $colors[:ruby][:hsv]
357
+ # @a = 1.0
358
+ # @color = ColorHSV.new( [@h, @s, @v, @a] )
359
+ # end
360
+ #
361
+ # it_should_behave_like "ColorHSV (shared)"
362
+ # it_should_behave_like "Color with RGBA array (shared)"
363
+ #
364
+ # end
365
+
366
+ describe "ColorHSV initialized from a ColorRGB" do
367
+ before(:each) do
368
+ @h, @s, @v = $colors[:ruby][:hsv]
369
+ @r, @g, @b = $colors[:ruby][:rgb]
370
+ @a = 0.5
371
+
372
+ @source = ColorRGB.new( $colors[:ruby][:rgb] + [@a] )
373
+ @color = ColorHSV.new( @source )
374
+ end
375
+
376
+ it_should_behave_like "ColorHSV (shared)"
377
+ it_should_behave_like "Color with RGBA array (shared)"
378
+
379
+ end
380
+
381
+ describe "ColorHSV initialized from a ColorHSV" do
382
+ before(:each) do
383
+ @h, @s, @v = $colors[:ruby][:hsv]
384
+ @r, @g, @b = $colors[:ruby][:rgb]
385
+ @a = 0.5
386
+
387
+
388
+ @source = ColorHSV.new( $colors[:ruby][:hsv] + [@a] )
389
+ @color = ColorHSV.new( @source )
390
+ end
391
+
392
+ it_should_behave_like "ColorHSV (shared)"
393
+ it_should_behave_like "Color with RGBA array (shared)"
394
+
395
+ end
396
+
397
+ describe "ColorHSV initialized from a ColorHSL" do
398
+ before(:each) do
399
+ @h, @s, @v = $colors[:ruby][:hsv]
400
+ @r, @g, @b = $colors[:ruby][:rgb]
401
+ @a = 0.5
402
+
403
+ @source = ColorHSL.new( $colors[:ruby][:hsl] + [@a] )
404
+ @color = ColorHSV.new( @source )
405
+ end
406
+
407
+ it_should_behave_like "ColorHSV (shared)"
408
+ it_should_behave_like "Color with RGBA array (shared)"
409
+
410
+ end
411
+
412
+ ##############################
413
+ ## HSV SHARED SPECS ##
414
+ ##############################
415
+
416
+ describe "ColorHSL (shared)", :shared => true do
417
+ it "should have a 'h' (hue) component which is a Float" do
418
+ @color.should respond_to(:h)
419
+ @color.h.should be_instance_of( Float )
420
+ end
421
+
422
+ it "should have a 's' (saturation) component which is a Float" do
423
+ @color.should respond_to(:s)
424
+ @color.s.should be_instance_of( Float )
425
+ end
426
+
427
+ it "should have a 'l' (luminosity) component which is a Float" do
428
+ @color.should respond_to(:l)
429
+ @color.l.should be_instance_of( Float )
430
+ end
431
+
432
+ it "should have an 'a' (alpha) component which is a Float" do
433
+ @color.should respond_to(:a)
434
+ @color.a.should be_instance_of( Float )
435
+ end
436
+
437
+ it "should have the expected hue component" do
438
+ @color.h.should be_close( @h.to_f, DELTA )
439
+ end
440
+
441
+ it "should have the expected saturation component" do
442
+ @color.s.should be_close( @s.to_f, DELTA )
443
+ end
444
+
445
+ it "should have the expected luminosity component" do
446
+ @color.l.should be_close( @l.to_f, DELTA )
447
+ end
448
+
449
+ it "should have the expected alpha component" do
450
+ @color.a.should be_close( @a.to_f, DELTA )
451
+ end
452
+ end
453
+
454
+ ##############################
455
+ ## HSL INITIALIZATION ##
456
+ ##############################
457
+
458
+ describe "ColorHSL initialized from a 3-Array" do
459
+ before(:each) do
460
+ @h, @s, @l = $colors[:ruby][:hsl]
461
+ @r, @g, @b = $colors[:ruby][:rgb]
462
+ @a = 1.0
463
+ @color = ColorHSL.new( [@h, @s, @l] )
464
+ end
465
+
466
+ it "should have full opacity" do
467
+ @color.a.should == 1.0
468
+ end
469
+
470
+ it_should_behave_like "ColorHSL (shared)"
471
+ it_should_behave_like "Color with RGBA array (shared)"
472
+
473
+ end
474
+
475
+ describe "ColorHSL initialized from a 4-Array" do
476
+ before(:each) do
477
+ @h, @s, @l = $colors[:ruby][:hsl]
478
+ @r, @g, @b = $colors[:ruby][:rgb]
479
+ @a = 0.5
480
+ @color = ColorHSL.new( [@h, @s, @l, @a] )
481
+ end
482
+
483
+ it_should_behave_like "ColorHSL (shared)"
484
+ it_should_behave_like "Color with RGBA array (shared)"
485
+
486
+ end
487
+
488
+ # describe "ColorHSL initialized from an Array of integers" do
489
+ # before(:each) do
490
+ # @h, @s, @l = $colors[:ruby][:hsl]
491
+ # @a = 1.0
492
+ # @color = ColorHSL.new( [@h, @s, @l, @a] )
493
+ # end
494
+ #
495
+ # it_should_behave_like "ColorHSL (shared)"
496
+ # it_should_behave_like "Color with RGBA array (shared)"
497
+ #
498
+ # end
499
+
500
+ describe "ColorHSL initialized from a ColorRGB" do
501
+ before(:each) do
502
+ @h, @s, @l = $colors[:ruby][:hsl]
503
+ @r, @g, @b = $colors[:ruby][:rgb]
504
+ @a = 0.5
505
+
506
+ @source = ColorRGB.new( $colors[:ruby][:rgb] + [@a] )
507
+ @color = ColorHSL.new( @source )
508
+ end
509
+
510
+ it_should_behave_like "ColorHSL (shared)"
511
+ it_should_behave_like "Color with RGBA array (shared)"
512
+
513
+ end
514
+
515
+ describe "ColorHSL initialized from a ColorHSV" do
516
+ before(:each) do
517
+ @h, @s, @l = $colors[:ruby][:hsl]
518
+ @r, @g, @b = $colors[:ruby][:rgb]
519
+ @a = 0.5
520
+
521
+
522
+ @source = ColorHSV.new( $colors[:ruby][:hsv] + [@a] )
523
+ @color = ColorHSL.new( @source )
524
+ end
525
+
526
+ it_should_behave_like "ColorHSL (shared)"
527
+ it_should_behave_like "Color with RGBA array (shared)"
528
+
529
+ end
530
+
531
+ describe "ColorHSL initialized from a ColorHSL" do
532
+ before(:each) do
533
+ @h, @s, @l = $colors[:ruby][:hsl]
534
+ @r, @g, @b = $colors[:ruby][:rgb]
535
+ @a = 0.5
536
+
537
+ @source = ColorHSL.new( $colors[:ruby][:hsl] + [@a] )
538
+ @color = ColorHSL.new( @source )
539
+ end
540
+
541
+ it_should_behave_like "ColorHSL (shared)"
542
+ it_should_behave_like "Color with RGBA array (shared)"
543
+
544
+ end