test: verify default audio lifecycle
This commit is contained in:
@@ -0,0 +1,39 @@
|
|||||||
|
extends SceneTree
|
||||||
|
|
||||||
|
const MainScene = preload("res://main.tscn")
|
||||||
|
|
||||||
|
var failures: Array[String] = []
|
||||||
|
|
||||||
|
|
||||||
|
func _initialize() -> void:
|
||||||
|
call_deferred("run_test")
|
||||||
|
|
||||||
|
|
||||||
|
func run_test() -> void:
|
||||||
|
var game := MainScene.instantiate()
|
||||||
|
game.auto_boot = false
|
||||||
|
root.add_child(game)
|
||||||
|
await settle(12)
|
||||||
|
expect(game.audio_enabled, "runtime audio remains enabled by default")
|
||||||
|
expect(game.audio_player != null, "default runtime creates the SFX player")
|
||||||
|
expect(game.audio_player != null and game.audio_player.playing, "default SFX stream is playing")
|
||||||
|
expect(game.sfx_playback != null, "default SFX stream exposes playback")
|
||||||
|
game.queue_free()
|
||||||
|
await settle(120)
|
||||||
|
if failures.is_empty():
|
||||||
|
print("ABG_P9_0R3_AUDIO_LIFECYCLE_OK default_enabled=true stream=true cleanup=true")
|
||||||
|
quit(0)
|
||||||
|
else:
|
||||||
|
for failure in failures:
|
||||||
|
push_error(failure)
|
||||||
|
quit(1)
|
||||||
|
|
||||||
|
|
||||||
|
func settle(frames: int) -> void:
|
||||||
|
for frame in range(frames):
|
||||||
|
await process_frame
|
||||||
|
|
||||||
|
|
||||||
|
func expect(condition: bool, message: String) -> void:
|
||||||
|
if not condition:
|
||||||
|
failures.append("P9.0R3 audio lifecycle: %s" % message)
|
||||||
Reference in New Issue
Block a user