-
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🧪 simulate example scene in e2e test (#115)
- Loading branch information
Showing
5 changed files
with
52 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class_name ColorChangingSprite extends Sprite2D | ||
|
||
signal color_changed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# GdUnit generated TestSuite | ||
class_name E2ETest | ||
extends GdUnitTestSuite | ||
@warning_ignore("unused_parameter") | ||
@warning_ignore("return_value_discarded") | ||
|
||
# TestSuite generated from | ||
const __source = "res://examples/BeehaveTestScene.tscn" | ||
|
||
func create_scene() -> Node2D: | ||
return auto_free(load(__source).instantiate()) | ||
|
||
|
||
func test_changing_to_all_colours() -> void: | ||
var scene = create_scene() | ||
var runner := scene_runner(scene) | ||
# speed up the test | ||
runner.set_time_factor(100.0) | ||
scene.sprite.position = Vector2(200, 200) | ||
await runner.simulate_until_object_signal(scene.sprite, "color_changed") | ||
assert_that(scene.sprite.modulate).is_equal(Color.RED) | ||
scene.sprite.position = Vector2(-200, 200) | ||
await runner.simulate_until_object_signal(scene.sprite, "color_changed") | ||
assert_that(scene.sprite.modulate).is_equal(Color.WHITE) | ||
scene.sprite.position = Vector2(-200, -200) | ||
await runner.simulate_until_object_signal(scene.sprite, "color_changed") | ||
assert_that(scene.sprite.modulate).is_equal(Color.BLUE) | ||
scene.sprite.position = Vector2(200, -200) | ||
await runner.simulate_until_object_signal(scene.sprite, "color_changed") | ||
assert_that(scene.sprite.modulate).is_equal(Color.WHITE) |