Skip to content

Commit 2650994

Browse files
committed
tests: experimenting SetTime
1 parent fb815f6 commit 2650994

File tree

1 file changed

+18
-9
lines changed
  • gluatests/lua/tests/modules/bass/igmodaudiochannel

1 file changed

+18
-9
lines changed

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

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
return {
22
groupName = "IGModAudioChannel:SetTime",
33

4+
beforeEach = function( state )
5+
state.filePath = "sound/bass_testsound.wav"
6+
state.flags = "noplay"
7+
end,
8+
9+
afterEach = function( state )
10+
if IsValid( state.channel ) then
11+
state.channel:Stop()
12+
state.channel = nil
13+
end
14+
end,
15+
416
cases = {
517
{
618
name = "Function exists when module enabled",
@@ -17,23 +29,20 @@ return {
1729
end
1830
},
1931
{
20-
name = "Valid call sets the time correctly",
32+
name = "SetTime moves playback postion",
2133
when = HolyLib_IsModuleEnabled( "bass" ),
2234
async = true,
2335
timeout = 2,
2436
func = function()
25-
local filePath = "sound/bass_testsound.wav"
26-
local flags = ""
27-
28-
bass.PlayFile( filePath, flags, function( channel, errorCode, errorMsg )
37+
bass.PlayFile( st, flags, function( channel, errorCode, errorMsg )
2938
expect( channel ).to.beValid()
30-
expect( errorCode ).to.equal( 0 )
31-
expect( errorMsg ).to.beNil()
3239

33-
channel:SetTime( 0.5 )
40+
state.channel = channel
41+
42+
channel:SetTime(1.5)
3443
local time = channel:GetTime()
3544
expect( time ).to.beA( "number" )
36-
expect( math.abs( time - 0.5 ) < 0.05).to.beTrue()
45+
expect( time ).to.aboutEqual(1.5, 0.05)
3746

3847
done()
3948
end )

0 commit comments

Comments
 (0)