The last version the About popup was shown for is saved as last_seen_version in settings.cfg. When the game starts with another version, About opens to show what is new.
59 lines
1.5 KiB
GDScript
59 lines
1.5 KiB
GDScript
extends MainWindowTestSuite
|
|
## The About popup opens by itself the first time a new version starts, to show what is
|
|
## new.
|
|
|
|
var _last_seen_before_start: String = "1.0.0"
|
|
|
|
|
|
func _before_window_starts() -> void:
|
|
Settings.last_seen_version = _last_seen_before_start
|
|
|
|
|
|
func _about() -> AboutPopup:
|
|
return _window.get_node("%AboutPopup")
|
|
|
|
|
|
func test_new_version_opens_about_at_start() -> void:
|
|
assert_bool(_about().visible).is_true()
|
|
|
|
|
|
func test_new_version_is_remembered_and_saved() -> void:
|
|
assert_str(Settings.last_seen_version).is_equal(Settings.version)
|
|
var saved: ConfigFile = ConfigFile.new()
|
|
assert_int(saved.load(Settings.saved_settings_path())).is_equal(OK)
|
|
assert_str(saved.get_value("app", "last_seen_version")).is_equal(Settings.version)
|
|
|
|
|
|
func test_about_opens_only_once_per_version() -> void:
|
|
_about().close()
|
|
|
|
_window.show_about_if_new_version()
|
|
|
|
assert_bool(_about().visible).is_false()
|
|
|
|
|
|
func test_about_can_be_closed_like_any_popup() -> void:
|
|
await _click_at(Vector2(5, 1075))
|
|
|
|
assert_bool(_about().visible).is_false()
|
|
|
|
|
|
@warning_ignore("unused_parameter")
|
|
func test_first_start_opens_about_too(
|
|
last_seen: String, test_parameters: Array = [[""], ["0.1.0"]]) -> void:
|
|
_about().close()
|
|
Settings.last_seen_version = last_seen
|
|
|
|
_window.show_about_if_new_version()
|
|
|
|
assert_bool(_about().visible).is_true()
|
|
|
|
|
|
func test_same_version_does_not_open_about() -> void:
|
|
_about().close()
|
|
Settings.last_seen_version = Settings.version
|
|
|
|
_window.show_about_if_new_version()
|
|
|
|
assert_bool(_about().visible).is_false()
|