Files
Diabolo/Demon_v0.19/runtime_burn_tests.gd
T

39 lines
2.3 KiB
GDScript

extends RefCounted
var failures=0
func check(ok,label):
if not ok:failures+=1;push_error("RUNTIME BURN QA: "+label)
func shot(g,name):
await RenderingServer.frame_post_draw
g.get_viewport().get_texture().get_image().save_png("res://captures/runtime-burn/"+name+".png")
func run(g):
await g.get_tree().create_timer(.3).timeout
g.start_game();g.reset_shift();g.game_started=true;g.paused=false;g.hud.show();g.menu.show_page("")
DirAccess.make_dir_recursive_absolute("res://captures/runtime-burn")
var w=g.workshop;var d=w.add_station(0,Vector3(3,0,0));w.spawn();var soul=g.souls.back();var id=soul.id;var root=soul.node
soul.entering=false;soul.entry_time=1;g.set_soul_reveal(soul.visual,1);w.attach(soul,0)
w.add_station(1,Vector3(-1,0,-1));w.rebuild_nav()
g.player.position=w.approach(d);g.avatar.reset_gait();g.camera.size=10
g.orbit.pan=Vector3(3,1,0)-g.CAMERA_TARGET-g.player.position*.1
var imp_start=g.life.imps[0].root.position
await g.get_tree().create_timer(.7).timeout
check(d.placement==0,"assembly advances through normal game frames")
for i in range(5):
var point=g.camera.unproject_position(soul.node.position+Vector3(0,1,0))
await preload("res://workshop_tests.gd").new().click_world(g,point)
check(d.hits==i+1,"actual mouse hit %d"%(i+1))
check(not w.context.visible,"no title panel required")
if i<4:await g.get_tree().create_timer(.5).timeout
check(g.done==1 and d.soul==-1 and g.index_of(id)<0,"five clicks complete and reward soul")
check(g.life.burns.size()==1,"burn starts in real game loop")
await shot(g,"just-finished")
await g.get_tree().create_timer(.65).timeout
check(not g.life.burns.is_empty() and g.life.burns[0].t>.5,"burn clock advances with hidden context panel")
await shot(g,"burning")
await g.get_tree().create_timer(1.8).timeout
check(not is_instance_valid(root) and g.life.burns.is_empty(),"body cloth and fire disappear without manually advancing life")
check(g.life.imps[0].root.position.distance_to(imp_start)>.1,"imps also update with hidden context")
check(g.done==1,"completion reward not duplicated")
await shot(g,"gone")
print("RUNTIME BURN QA ","PASSED" if failures==0 else "FAILED",": normal process frames, five real mouse hits, hidden UI, two stations, animated burn, body/cloth cleanup and imp movement")
g.get_tree().quit(1 if failures else 0)