-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added to_json() for other, lose condition, input replay
Added Utils.to_bool() utility as a workaround for Godot #27529 (godotengine/godot#27529).
- Loading branch information
Showing
12 changed files
with
339 additions
and
64 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
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
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
31 changes: 31 additions & 0 deletions
31
project/src/test/puzzle/level/test-lose-condition-rules.gd
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,31 @@ | ||
extends "res://addons/gut/test.gd" | ||
""" | ||
Tests for how the player loses. The player usually loses if they top out a certain number of times, but some levels | ||
might have different rules. | ||
""" | ||
|
||
var rules: LoseConditionRules | ||
|
||
func before_each() -> void: | ||
rules = LoseConditionRules.new() | ||
|
||
|
||
func test_is_default() -> void: | ||
assert_eq(rules.is_default(), true) | ||
rules.finish_on_lose = true | ||
assert_eq(rules.is_default(), false) | ||
|
||
|
||
func test_convert_settings_to_json_and_back() -> void: | ||
rules.finish_on_lose = true | ||
rules.top_out = 5 | ||
_convert_settings_to_json_and_back() | ||
|
||
assert_eq(rules.finish_on_lose, true) | ||
assert_eq(rules.top_out, 5) | ||
|
||
|
||
func _convert_settings_to_json_and_back() -> void: | ||
var json := rules.to_json_array() | ||
rules = LoseConditionRules.new() | ||
rules.from_json_array(json) |
Oops, something went wrong.