整理代码
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
local TEST={}
|
local TEST={}
|
||||||
|
|
||||||
--Wait for the scene swapping animation to finish
|
--Wait for the scene swapping animation to finish
|
||||||
function TEST.switchSCN()
|
function TEST.yieldUntilNextScene()
|
||||||
while SCN.swapping do YIELD()end
|
while SCN.swapping do YIELD()end
|
||||||
end
|
end
|
||||||
|
|
||||||
function TEST.wait(frames)
|
function TEST.yieldN(frames)
|
||||||
for _=1,frames do YIELD()end
|
for _=1,frames do YIELD()end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
11
main.lua
11
main.lua
@@ -589,6 +589,7 @@ table.insert(_LOADTIMELIST_,("Initialize Data: %.3fs"):format(TIME()-_LOADTIME_)
|
|||||||
|
|
||||||
for i=1,#_LOADTIMELIST_ do LOG(_LOADTIMELIST_[i])end
|
for i=1,#_LOADTIMELIST_ do LOG(_LOADTIMELIST_[i])end
|
||||||
|
|
||||||
|
--Launch testing task if launch param received
|
||||||
if TABLE.find(arg,'--test')then
|
if TABLE.find(arg,'--test')then
|
||||||
TASK.new(function()
|
TASK.new(function()
|
||||||
while not LOADED do YIELD()end
|
while not LOADED do YIELD()end
|
||||||
@@ -596,19 +597,19 @@ if TABLE.find(arg,'--test')then
|
|||||||
LOG("\27[92m\27[1mAutomatic Test Started\27[0m")
|
LOG("\27[92m\27[1mAutomatic Test Started\27[0m")
|
||||||
BGM.setVol(0)SFX.setVol(0)
|
BGM.setVol(0)SFX.setVol(0)
|
||||||
love.keypressed('space')
|
love.keypressed('space')
|
||||||
TEST.switchSCN()
|
TEST.yieldUntilNextScene()
|
||||||
|
|
||||||
for k,mode in next,MODES do
|
for k,mode in next,MODES do
|
||||||
if k~='netBattle'then
|
if k~='netBattle'then
|
||||||
LOG("Scanning mode: "..mode.name)
|
LOG("Scanning mode: "..mode.name)
|
||||||
loadGame(mode.name,true)
|
loadGame(mode.name,true)
|
||||||
TEST.switchSCN()
|
TEST.yieldUntilNextScene()
|
||||||
SCN.back()
|
SCN.back()
|
||||||
TEST.switchSCN()
|
TEST.yieldUntilNextScene()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
LOG("\27[92m\27[1mAutomatic Test Passed :)\27[0m")
|
LOG("\27[92m\27[1mAutomatic Test Passed :)\27[0m")
|
||||||
TEST.wait(60)
|
TEST.yieldN(60)
|
||||||
love.event.quit(0)
|
love.event.quit(0)
|
||||||
end)
|
end)
|
||||||
TASK.new(function()
|
TASK.new(function()
|
||||||
@@ -617,7 +618,7 @@ if TABLE.find(arg,'--test')then
|
|||||||
if ERRDATA[1]then break end
|
if ERRDATA[1]then break end
|
||||||
end
|
end
|
||||||
LOG("\27[91m\27[1mAutomatic Test Failed :(\27[0m\nThe error message is:\n"..table.concat(ERRDATA[1].mes,"\n").."\27[91m\nAborting\27[0m")
|
LOG("\27[91m\27[1mAutomatic Test Failed :(\27[0m\nThe error message is:\n"..table.concat(ERRDATA[1].mes,"\n").."\27[91m\nAborting\27[0m")
|
||||||
TEST.wait(60)
|
TEST.yieldN(60)
|
||||||
love.event.quit(1)
|
love.event.quit(1)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user