Files
room_glitch/tests/test_pixel_render.gd
T

26 lines
963 B
GDScript

extends SceneTree
func _initialize() -> void:
call_deferred("run")
func run() -> void:
var game = load("res://games/galaga/Galaga.tscn").instantiate()
root.add_child(game)
game.set_physics_process(false)
game.state="playing"
game.player.position=Vector2(112.1,256.1)
await process_frame
await process_frame
await RenderingServer.frame_post_draw
var first := root.get_texture().get_image().get_data()
game.player.position=Vector2(112.4,256.4)
await process_frame
await process_frame
await RenderingServer.frame_post_draw
assert(first==root.get_texture().get_image().get_data(),"Fractional positions within the same native pixel must render identically")
game.player.position=Vector2(112.7,256.7)
await process_frame
await process_frame
await RenderingServer.frame_post_draw
assert(first!=root.get_texture().get_image().get_data(),"Crossing a native pixel boundary must move the rendered sprite")
print("NATIVE PIXEL RENDER TEST PASS")
quit()