Accept 13766 as a valid sound duration too (some liblame versions give that number...
[gnash.git] / testsuite / misc-swfc.all / sound.sc
blob848ca066c0c931b656398d3f79d62aeafb6ad9f6
1 .flash bbox=200x200 filename="sound_test.swf" version=6 fps=30
3 .box b1 100 100 color=yellow fill=red
5 .frame 1
7     .action:
8 #include "Dejagnu.sc"
9     .end
11 .sound audio MEDIA(sound1.wav)
14 .frame 2
15         .put b1 pin=center scale=0%
16         .action:
17                 var cubesize=0;
18                 snd=new Sound();
19                 snd.attachSound("audio");
21                 trace("Sound duration is: ");
22                 trace(snd.duration);
23                 trace("Correct value should be 13740 or 13766 " +
24                         "(depending on liblame version)");
25                 // fails when no media handler is compiled-in
26                 // TODO: handle that case
27                 if ( snd.duration != 13740 && snd.duration != 13766 )
28                 {
29                         Dejagnu.fail("snd.duration="+snd.duration +
30                                 ", expected 13740 or 13766 " + _INFO_);
31                 } else {
32                         Dejagnu.pass("snd.duration="+snd.duration + _INFO_);
33                 }
34         
35                 trace("Now I'll get the position before starting it");
36                 sndpos=snd.position;
37                 trace("Position is:");
38                 trace(sndpos);
39                 check_equals(snd.position, 0);
40                 snd.start(0,0);
41         .end
43 .frame 6
44         .action:
45                 cubesize+=1;
46                 b1._width=cubesize;
47                 b1._height=cubesize;
48                 if (cubesize==50) {
49                         cubesize=0;
50                 }
52                 if ((snd.position+100)<snd.duration) {
53                         gotoandPlay(5);
54                 } else {
55                         gotoandPlay(8);
56                 }
57         .end
59 .frame 8
60         .action:
61                 totals(2);
62                 snd.stop();
63         .end
64         .stop
65 .end