Open the About popup the first time a new version starts
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.
This commit is contained in:
1 parent
41974ea5e3
commit
b120440404
7 files changed
+77
-1
No files matched your search
@@ -24,6 +24,8 @@ func before_test() -> void:
|
||||
Settings.hide_next_track = true
|
||||
Settings.use_low_played_mode = false
|
||||
Settings.winning_score = 20
|
||||
# Otherwise the About popup opens at start, as for a new version
|
||||
Settings.last_seen_version = Settings.version
|
||||
|
||||
_server = FakeHttpTransport.new().install()
|
||||
var mp3: PackedByteArray = FileAccess.get_file_as_bytes("res://tests/data/short.mp3")
|
||||
|
||||
@@ -170,6 +170,7 @@ static func prepare_autoloads() -> void:
|
||||
Settings.hide_next_track = true
|
||||
Settings.use_low_played_mode = false
|
||||
Settings.winning_score = 20
|
||||
Settings.last_seen_version = Settings.version
|
||||
# The inspiration list scrolls by itself, which would make every picture different
|
||||
Settings.inspiration_list_speed = 0
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
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()
|
||||
@@ -0,0 +1 @@
|
||||
uid://davke6pxkvvw3
|
||||
@@ -6,7 +6,7 @@ const SAVED_VALUES: Dictionary = {
|
||||
&"auto_repeat_song": false, &"stop_after_current": false, &"hide_next_track": false,
|
||||
&"hide_beginning": true, &"hide_for_seconds": 7.0, &"hide_length": true,
|
||||
&"hide_ticks": true, &"winning_score": 13, &"inspiration_list_speed": 4,
|
||||
&"fullscreen": true,
|
||||
&"fullscreen": true, &"last_seen_version": "1.2.3",
|
||||
}
|
||||
|
||||
var _snapshot: AutoloadSnapshot
|
||||
|
||||
Reference in new issue
Block a user