rubygame 2.3.0-x86-linux

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.
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
data/test/image.png ADDED
Binary file
@@ -0,0 +1,727 @@
1
+ require 'rubygame'
2
+ include Rubygame
3
+
4
+ samples_dir = File.join( File.dirname(__FILE__), "..", "samples", "")
5
+ test_dir = File.dirname(__FILE__)
6
+
7
+ song = samples_dir + "song.ogg"
8
+ whiff = samples_dir + "whiff.wav"
9
+ short = File.join( File.dirname(__FILE__), "short.ogg")
10
+ dne = samples_dir + "does_not_exist.ogg"
11
+ panda = samples_dir + "panda.png"
12
+
13
+ # value for testing nearness of volume
14
+ small = 0.00001
15
+
16
+ #########################
17
+ ## ##
18
+ ## INITIALIAZING ##
19
+ ## ##
20
+ #########################
21
+
22
+
23
+ describe Music, "(new)" do
24
+ it "should raise NotImplementedError" do
25
+ lambda{ Sound.new }.should raise_error(NotImplementedError)
26
+ end
27
+ end
28
+
29
+ describe Music, "(load)" do
30
+
31
+ before :each do
32
+ Rubygame.open_audio
33
+ @music = Music.load(song)
34
+ end
35
+
36
+ after :each do
37
+ Rubygame.close_audio
38
+ end
39
+
40
+ it "should have a volume of 1.0" do
41
+ @music.volume.should == 1.0
42
+ end
43
+
44
+ it { @music.should_not be_playing }
45
+ it { @music.should_not be_paused }
46
+ it { @music.should be_stopped }
47
+
48
+ end
49
+
50
+
51
+
52
+ describe Music, "(nonexistent file)" do
53
+
54
+ before :each do
55
+ Rubygame.open_audio
56
+ end
57
+
58
+ after :each do
59
+ Rubygame.close_audio
60
+ end
61
+
62
+ it "should raise SDLError" do
63
+ lambda { @music = Music.load(dne) }.should raise_error(SDLError)
64
+ end
65
+
66
+ end
67
+
68
+
69
+
70
+ describe Music, "(non-music file)" do
71
+
72
+ before :each do
73
+ Rubygame.open_audio
74
+ end
75
+
76
+ after :each do
77
+ Rubygame.close_audio
78
+ end
79
+
80
+ it "should raise SDLError" do
81
+ lambda { @music = Music.load(panda) }.should raise_error(SDLError)
82
+ end
83
+
84
+ end
85
+
86
+ describe Music, "(named resource)" do
87
+ before :each do
88
+ Music.autoload_dirs = [samples_dir]
89
+ end
90
+
91
+ after :each do
92
+ Music.autoload_dirs = []
93
+ Music.instance_eval { @resources = {} }
94
+ end
95
+
96
+ it "should include NamedResource" do
97
+ Music.included_modules.should include(NamedResource)
98
+ end
99
+
100
+ it "should respond to :[]" do
101
+ Music.should respond_to(:[])
102
+ end
103
+
104
+ it "should respond to :[]=" do
105
+ Music.should respond_to(:[]=)
106
+ end
107
+
108
+ it "should allow setting resources" do
109
+ s = Music.load(short)
110
+ Music["short"] = s
111
+ Music["short"].should == s
112
+ end
113
+
114
+ it "should reject non-Music resources" do
115
+ lambda { Music["foo"] = "bar" }.should raise_error(TypeError)
116
+ end
117
+
118
+ it "should autoload images as Music instances" do
119
+ unless( Rubygame::VERSIONS[:sdl_mixer] )
120
+ raise "Can't test sound loading, no SDL_mixer installed."
121
+ end
122
+
123
+ Music["song.ogg"].should be_instance_of(Music)
124
+ end
125
+
126
+ it "should return nil for nonexisting files" do
127
+ unless( Rubygame::VERSIONS[:sdl_mixer] )
128
+ raise "Can't test sound loading, no SDL_mixer installed."
129
+ end
130
+
131
+ Music["foobar.ogg"].should be_nil
132
+ end
133
+
134
+ it "should set names of autoload Musics" do
135
+ unless( Rubygame::VERSIONS[:sdl_mixer] )
136
+ raise "Can't test sound loading, no SDL_mixer installed."
137
+ end
138
+
139
+ Music["song.ogg"].name.should == "song.ogg"
140
+ end
141
+ end
142
+
143
+
144
+ #########################
145
+ ## ##
146
+ ## BASIC ##
147
+ ## ##
148
+ #########################
149
+
150
+
151
+ describe Music, "(playing)" do
152
+
153
+ before :each do
154
+ Rubygame.open_audio
155
+ @music = Music.load(song)
156
+ @music.volume = 0.1
157
+ @music.play
158
+ end
159
+
160
+ after :each do
161
+ Rubygame.close_audio
162
+ end
163
+
164
+ it { @music.should be_playing }
165
+ it { @music.should_not be_paused }
166
+ it { @music.should_not be_stopped }
167
+
168
+ it "should be the current music" do
169
+ Music.current_music.should == @music
170
+ end
171
+
172
+ it "should be playing after being played again" do
173
+ @music.play
174
+ @music.should be_playing
175
+ end
176
+
177
+ it "should be paused after being paused" do
178
+ @music.pause
179
+ @music.should be_paused
180
+ end
181
+
182
+ it "should be stopped after being stopped" do
183
+ @music.stop
184
+ @music.should be_stopped
185
+ end
186
+
187
+ it "should be able to change volume" do
188
+ @music.volume = 0.2
189
+ @music.volume.should be_close(0.2, small)
190
+ end
191
+
192
+ end
193
+
194
+
195
+ describe Music, "(playing without open audio)" do
196
+
197
+ before :each do
198
+ @music = Music.load(song)
199
+ @music.volume = 0.1
200
+ @music.play
201
+ end
202
+
203
+ after :each do
204
+ Rubygame.close_audio
205
+ end
206
+
207
+ it { @music.should be_playing }
208
+ it { @music.should_not be_paused }
209
+ it { @music.should_not be_stopped }
210
+
211
+ it "should be the current music" do
212
+ Music.current_music.should == @music
213
+ end
214
+
215
+ end
216
+
217
+
218
+
219
+ describe Music, "(paused)" do
220
+
221
+ before :each do
222
+ Rubygame.open_audio
223
+ @music = Music.load(song)
224
+ @music.volume = 0.1
225
+ @music.play
226
+ @music.pause
227
+ end
228
+
229
+ after :each do
230
+ Rubygame.close_audio
231
+ end
232
+
233
+ it { @music.should_not be_playing }
234
+ it { @music.should be_paused }
235
+ it { @music.should_not be_stopped }
236
+
237
+ it "should be the current music" do
238
+ Music.current_music.should == @music
239
+ end
240
+
241
+ it "should be playing after being played" do
242
+ @music.play
243
+ @music.should be_playing
244
+ end
245
+
246
+ it "should be playing after being unpaused" do
247
+ @music.unpause
248
+ @music.should be_playing
249
+ end
250
+
251
+ it "should still be paused after being paused again" do
252
+ @music.pause
253
+ @music.should be_paused
254
+ end
255
+
256
+ it "should be stopped after being stopped" do
257
+ @music.stop
258
+ @music.should be_stopped
259
+ end
260
+
261
+ it "should be able to change volume" do
262
+ @music.volume = 0.2
263
+ @music.volume.should be_close(0.2, small)
264
+ end
265
+
266
+ end
267
+
268
+
269
+
270
+ describe Music, "(stopped)" do
271
+
272
+ before :each do
273
+ Rubygame.open_audio
274
+ @music = Music.load(song)
275
+ @music.volume = 0.1
276
+ @music.play
277
+ @music.stop
278
+ end
279
+
280
+ after :each do
281
+ Rubygame.close_audio
282
+ end
283
+
284
+ it { @music.should_not be_playing }
285
+ it { @music.should_not be_paused }
286
+ it { @music.should be_stopped }
287
+
288
+ it "it should still be the current music" do
289
+ Music.current_music.should == @music
290
+ end
291
+
292
+ it "should not be paused after being paused" do
293
+ @music.pause
294
+ @music.should_not be_paused
295
+ end
296
+
297
+ it "should be stopped after being stopped" do
298
+ @music.stop
299
+ @music.should be_stopped
300
+ end
301
+
302
+ it "should be playing after being played" do
303
+ @music.play
304
+ @music.should be_playing
305
+ end
306
+
307
+ it "should be able to change volume" do
308
+ @music.volume = 0.2
309
+ @music.volume.should be_close(0.2, small)
310
+ end
311
+
312
+ end
313
+
314
+
315
+
316
+ #########################
317
+ ## ##
318
+ ## START AT ##
319
+ ## ##
320
+ #########################
321
+
322
+
323
+ describe Music, "(negative start at)" do
324
+ before :each do
325
+ Rubygame.open_audio
326
+ @music = Music.load(short)
327
+ @music.volume = 0.1 # for programmer sanity
328
+ end
329
+
330
+ after :each do
331
+ Rubygame.close_audio
332
+ end
333
+
334
+ it "should raise ArgumentError" do
335
+ lambda { @music.play(:start_at => -1) }.should raise_error(ArgumentError)
336
+ end
337
+ end
338
+
339
+ describe Music, "(start at)" do
340
+ before :each do
341
+ Rubygame.open_audio
342
+ @music = Music.load(song)
343
+ @music.volume = 0.1 # for programmer sanity
344
+ end
345
+
346
+ after :each do
347
+ Rubygame.close_audio
348
+ end
349
+
350
+ it "should be playing right away" do
351
+ @music.play( :start_at => 7 )
352
+ @music.should be_playing
353
+ end
354
+
355
+ it "should end sooner" do
356
+ @music.play( :start_at => 7.4 )
357
+ sleep 0.2
358
+ @music.should be_stopped
359
+ end
360
+ end
361
+
362
+
363
+ #########################
364
+ ## ##
365
+ ## REPEATING ##
366
+ ## ##
367
+ #########################
368
+
369
+
370
+ describe Music, "(negative repeats, except -1)" do
371
+
372
+ before :each do
373
+ Rubygame.open_audio
374
+ @music = Music.load(song)
375
+ @music.volume = 0.1 # for programmer sanity
376
+ end
377
+
378
+ after :each do
379
+ Rubygame.close_audio
380
+ end
381
+
382
+ it "should raise ArgumentError" do
383
+ lambda { @music.play(:repeats => -2) }.should raise_error(ArgumentError)
384
+ end
385
+ end
386
+
387
+
388
+ describe Music, "(repeats forever)" do
389
+
390
+ before :each do
391
+ Rubygame.open_audio
392
+ @music = Music.load(short)
393
+ @music.volume = 0.1 # for programmer sanity
394
+ @music.play( :repeats => -1 )
395
+ end
396
+
397
+ after :each do
398
+ Rubygame.close_audio
399
+ end
400
+
401
+ it "should still be playing after a while" do
402
+ sleep 0.3
403
+ @music.should be_playing
404
+ end
405
+
406
+ end
407
+
408
+
409
+ describe Music, "(repeats)" do
410
+
411
+ before :each do
412
+ Rubygame.open_audio
413
+ @music = Music.load(short)
414
+ @music.volume = 0.1 # for programmer sanity
415
+ @music.play( :repeats => 3 )
416
+ end
417
+
418
+ after :each do
419
+ Rubygame.close_audio
420
+ end
421
+
422
+ it "should be playing before its last repeat" do
423
+ sleep 0.1*3
424
+ @music.should be_playing
425
+ end
426
+
427
+ it "should not be stopped after its last repeat" do
428
+ sleep 0.1*4 + 0.05
429
+ @music.should be_stopped
430
+ end
431
+
432
+ end
433
+
434
+
435
+ #########################
436
+ ## ##
437
+ ## FADING ##
438
+ ## ##
439
+ #########################
440
+
441
+
442
+ describe Music, "(negative fade in)" do
443
+
444
+ before :each do
445
+ Rubygame.open_audio
446
+ @music = Music.load(song)
447
+ @music.volume = 0.1 # for programmer sanity
448
+ end
449
+
450
+ after :each do
451
+ Rubygame.close_audio
452
+ end
453
+
454
+ it "should raise ArgumentError" do
455
+ lambda { @music.play(:fade_in => -1) }.should raise_error(ArgumentError)
456
+ end
457
+ end
458
+
459
+ describe Music, "(fading in)" do
460
+
461
+ before :each do
462
+ Rubygame.open_audio
463
+ @music = Music.load(song)
464
+ @music.volume = 0.1 # for programmer sanity
465
+ end
466
+
467
+ after :each do
468
+ Rubygame.close_audio
469
+ end
470
+
471
+ it "should be playing right away" do
472
+ @music.play( :fade_in => 0.3 )
473
+ @music.should be_playing
474
+ end
475
+
476
+ it "should be fading in right away" do
477
+ @music.play( :fade_in => 0.3 )
478
+ @music.should be_fading
479
+ @music.fading?(:in).should be_true
480
+ end
481
+
482
+ it "should be fading in before it has faded in" do
483
+ @music.play( :fade_in => 0.3 )
484
+ sleep 0.2
485
+ @music.should be_fading
486
+ @music.fading?(:in).should be_true
487
+ end
488
+
489
+ it "should not be fading in after it has faded in" do
490
+ @music.play( :fade_in => 0.3 )
491
+ sleep 0.4
492
+ @music.should_not be_fading
493
+ @music.fading?(:in).should be_false
494
+ end
495
+
496
+ it "should still be playing after it has faded in" do
497
+ @music.play( :fade_in => 0.3 )
498
+ sleep 0.4
499
+ @music.should be_playing
500
+ end
501
+
502
+ it "should not allow changing volume" do
503
+ @music.play( :fade_in => 0.3 )
504
+ lambda { @music.volume = 0.2 }.should raise_error(SDLError)
505
+ @music.volume.should be_close(0.1, small)
506
+ end
507
+
508
+ end
509
+
510
+
511
+ describe Music, "(negative fade out)" do
512
+
513
+ before :each do
514
+ Rubygame.open_audio
515
+ @music = Music.load(song)
516
+ @music.volume = 0.1 # for programmer sanity
517
+ end
518
+
519
+ after :each do
520
+ Rubygame.close_audio
521
+ end
522
+
523
+ it "should be playing right away" do
524
+ @music.play
525
+ lambda { @music.fade_out( -1 ) }.should raise_error(ArgumentError)
526
+ end
527
+
528
+ end
529
+
530
+ describe Music, "(fading out)" do
531
+
532
+ before :each do
533
+ Rubygame.open_audio
534
+ @music = Music.load(song)
535
+ @music.volume = 0.1 # for programmer sanity
536
+ @music.play
537
+ end
538
+
539
+ after :each do
540
+ Rubygame.close_audio
541
+ end
542
+
543
+ it "should be playing right away" do
544
+ @music.fade_out( 0.3 )
545
+ @music.should be_playing
546
+ end
547
+
548
+ it "should be fading out right away" do
549
+ @music.fade_out( 0.3 )
550
+ @music.should be_fading
551
+ @music.fading?(:out).should be_true
552
+ end
553
+
554
+ it "should be fading out before it has faded out" do
555
+ @music.fade_out( 0.3 )
556
+ sleep 0.2
557
+ @music.should be_fading
558
+ @music.fading?(:out).should be_true
559
+ end
560
+
561
+ it "should not be fading out after it has faded out" do
562
+ @music.fade_out( 0.3 )
563
+ sleep 0.4
564
+ @music.should_not be_fading
565
+ @music.fading?(:out).should be_false
566
+ end
567
+
568
+ it "should be stopped after it has faded out" do
569
+ @music.fade_out( 0.3 )
570
+ sleep 0.4
571
+ @music.should be_stopped
572
+ end
573
+
574
+ it "should not allow changing volume" do
575
+ @music.fade_out( 0.3 )
576
+ lambda { @music.volume = 0.2 }.should raise_error(SDLError)
577
+ @music.volume.should be_close(0.1, small)
578
+ end
579
+
580
+ end
581
+
582
+
583
+
584
+ #########################
585
+ ## ##
586
+ ## REWIND ##
587
+ ## ##
588
+ #########################
589
+
590
+
591
+ describe Music, "(rewinding)" do
592
+
593
+ before :each do
594
+ Rubygame.open_audio
595
+ @music = Music.load(short)
596
+ @music.volume = 0.1 # for programmer sanity
597
+ end
598
+
599
+ after :each do
600
+ Rubygame.close_audio
601
+ end
602
+
603
+ it "should be playing if it was playing before" do
604
+ @music.play
605
+ @music.rewind
606
+ @music.should be_playing
607
+ end
608
+
609
+ it "should be paused if it was paused before" do
610
+ @music.play
611
+ @music.pause
612
+ @music.rewind
613
+ @music.should be_paused
614
+ end
615
+
616
+ it "should be stopped if it was stopped before" do
617
+ @music.play
618
+ @music.stop
619
+ @music.rewind
620
+ @music.should be_stopped
621
+ end
622
+
623
+ it "should repeat if it was repeating before" do
624
+ @music.play( :repeats => -1 )
625
+ @music.rewind
626
+ sleep 0.3
627
+ @music.should be_playing
628
+ end
629
+
630
+ it "should play again" do
631
+ @music.play
632
+ sleep 0.09
633
+ @music.rewind
634
+ sleep 0.09
635
+ @music.should be_playing
636
+ end
637
+ end
638
+
639
+
640
+ #########################
641
+ ## ##
642
+ ## JUMP TO ##
643
+ ## ##
644
+ #########################
645
+
646
+
647
+ describe Music, "(jump to)" do
648
+
649
+ before :each do
650
+ Rubygame.open_audio
651
+ @music = Music.load(song)
652
+ @music.volume = 0.1 # for programmer sanity
653
+ end
654
+
655
+ after :each do
656
+ Rubygame.close_audio
657
+ end
658
+
659
+ it "should still be playing if it was playing" do
660
+ @music.play
661
+ @music.jump_to(5)
662
+ @music.should be_playing
663
+ end
664
+
665
+ it "should end sooner if playing" do
666
+ @music.play
667
+ @music.jump_to(7.4)
668
+ sleep 0.2
669
+ @music.should be_stopped
670
+ end
671
+
672
+ it "should still be paused if it was paused" do
673
+ @music.play
674
+ @music.pause
675
+ @music.jump_to(5)
676
+ @music.should be_paused
677
+ end
678
+
679
+ it "should end sooner after being unpaused" do
680
+ @music.play
681
+ @music.pause
682
+ @music.jump_to(7.4)
683
+ @music.unpause
684
+ sleep 0.2
685
+ @music.should be_stopped
686
+ end
687
+ end
688
+
689
+
690
+ describe Music, "(jump to, unsupported format)" do
691
+
692
+ before :each do
693
+ Rubygame.open_audio
694
+ @music = Music.load(whiff)
695
+ @music.volume = 0.1 # for programmer sanity
696
+ end
697
+
698
+ after :each do
699
+ Rubygame.close_audio
700
+ end
701
+
702
+ it "should raise SDLError" do
703
+ @music.play
704
+ lambda { @music.jump_to(0.1) }.should raise_error(SDLError)
705
+ end
706
+
707
+ end
708
+
709
+
710
+ describe Music, "(jump to, negative time)" do
711
+
712
+ before :each do
713
+ Rubygame.open_audio
714
+ @music = Music.load(whiff)
715
+ @music.volume = 0.1 # for programmer sanity
716
+ end
717
+
718
+ after :each do
719
+ Rubygame.close_audio
720
+ end
721
+
722
+ it "should raise ArgumentError" do
723
+ @music.play
724
+ lambda { @music.jump_to }.should raise_error(ArgumentError)
725
+ end
726
+
727
+ end