1+ return {
2+ groupName = " IGModAudioChannel:SetPlaybackRate" ,
3+
4+ cases = {
5+ {
6+ name = " Function exists when module enabled" ,
7+ when = HolyLib_IsModuleEnabled ( " bass" ),
8+ func = function ()
9+ expect ( FindMetaTable ( " IGModAudioChannel" ).SetPlaybackRate ).to .beA ( " function" )
10+ end
11+ },
12+ {
13+ name = " Function is nil when module disabled" ,
14+ when = not HolyLib_IsModuleEnabled ( " bass" ),
15+ func = function ()
16+ expect ( bass ).to .beA ( " nil" )
17+ end
18+ },
19+ {
20+ name = " Valid call sets the playback rate correctly" ,
21+ when = HolyLib_IsModuleEnabled ( " bass" ),
22+ async = true ,
23+ timeout = 2 ,
24+ func = function ()
25+ local filePath = " sound/bass_testsound.wav"
26+ local flags = " "
27+
28+ bass .PlayFile ( filePath , flags , function ( channel , errorCode , errorMsg )
29+ expect ( channel ).to .beValid ()
30+ expect ( errorCode ).to .equal ( 0 )
31+ expect ( errorMsg ).to .beNil ()
32+
33+ channel :SetPlaybackRate ( 2 )
34+ expect ( channel :GetPlaybackRate () ).to .equal ( 2 )
35+
36+ done ()
37+ end )
38+ end
39+ },
40+ {
41+ name = " SetPlaybackRate works after pausing or stopping the channel" ,
42+ when = HolyLib_IsModuleEnabled (" bass" ),
43+ async = true ,
44+ func = function ()
45+ local filePath = " sound/bass_testsound.wav"
46+ local flags = " "
47+
48+ bass .PlayFile (filePath , flags , function ( channel )
49+ channel :Pause ()
50+ expect ( channel :SetPlaybackRate , 1 ).toNot .err ()
51+
52+ channel :Stop ()
53+ expect ( channel :SetPlaybackRate , 1.2 ).to .err ()
54+
55+ done ()
56+ end )
57+ end
58+ }
59+ }
60+ }
0 commit comments