Skip to content

Commit a31a34c

Browse files
committed
tests: some stuff
- added basic GetPlaybackRate tests - adjusted SetPlaybackRate tests
1 parent 2c54256 commit a31a34c

File tree

2 files changed

+41
-19
lines changed

2 files changed

+41
-19
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
return {
2+
groupName = "IGModAudioChannel:GetPlaybackRate",
3+
4+
cases = {
5+
{
6+
name = "Function exists when module enabled",
7+
when = HolyLib_IsModuleEnabled( "bass" ),
8+
func = function()
9+
expect( FindMetaTable( "IGModAudioChannel" ).GetPlaybackRate ).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+
}

gluatests/lua/tests/modules/bass/igmodaudiochannel/SetPlaybackrate.lua

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,5 @@ return {
3737
end )
3838
end
3939
},
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-
}
5940
}
6041
}

0 commit comments

Comments
 (0)