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
@@ -26,6 +26,7 @@ const SAVED_SETTINGS: Dictionary[String, Array] = {
|
|||||||
&"inspiration_list_speed",
|
&"inspiration_list_speed",
|
||||||
],
|
],
|
||||||
"window": [&"fullscreen"],
|
"window": [&"fullscreen"],
|
||||||
|
"app": [&"last_seen_version"],
|
||||||
}
|
}
|
||||||
## When this environment variable is set, the settings files are kept in that folder
|
## When this environment variable is set, the settings files are kept in that folder
|
||||||
## instead of the user's config folder. The tests set it so they never touch the real files.
|
## instead of the user's config folder. The tests set it so they never touch the real files.
|
||||||
@@ -83,6 +84,9 @@ var character_select_open: bool = false
|
|||||||
## [code]MusicServerClient[/code]. Saved in the [code][queues][/code] section of
|
## [code]MusicServerClient[/code]. Saved in the [code][queues][/code] section of
|
||||||
## [method saved_settings_path], so the game goes on with the same queue after a restart.
|
## [method saved_settings_path], so the game goes on with the same queue after a restart.
|
||||||
var queue_ids: Dictionary[String, String] = {}
|
var queue_ids: Dictionary[String, String] = {}
|
||||||
|
## The version the game last showed the About popup for. When it is not [member version],
|
||||||
|
## this version is new and the main window opens the About popup to show what is new.
|
||||||
|
var last_seen_version: String = ""
|
||||||
|
|
||||||
## The game version, set in Project Settings > Application > Config > Version.
|
## The game version, set in Project Settings > Application > Config > Version.
|
||||||
## Releases are made from it, see RELEASING.md.
|
## Releases are made from it, see RELEASING.md.
|
||||||
|
|||||||
@@ -43,6 +43,16 @@ func _ready() -> void:
|
|||||||
statistics_view.soundtrack_selected.connect(soundtrack_stats_popup.show_soundtrack)
|
statistics_view.soundtrack_selected.connect(soundtrack_stats_popup.show_soundtrack)
|
||||||
|
|
||||||
search_popup.get_list_of_soundtracks()
|
search_popup.get_list_of_soundtracks()
|
||||||
|
show_about_if_new_version()
|
||||||
|
|
||||||
|
|
||||||
|
## Opens the About popup, with what is new, the first time this version starts.
|
||||||
|
func show_about_if_new_version() -> void:
|
||||||
|
if Settings.last_seen_version == Settings.version:
|
||||||
|
return
|
||||||
|
Settings.last_seen_version = Settings.version
|
||||||
|
Settings.save_settings()
|
||||||
|
show_about()
|
||||||
|
|
||||||
|
|
||||||
func _input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ func before_test() -> void:
|
|||||||
Settings.hide_next_track = true
|
Settings.hide_next_track = true
|
||||||
Settings.use_low_played_mode = false
|
Settings.use_low_played_mode = false
|
||||||
Settings.winning_score = 20
|
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()
|
_server = FakeHttpTransport.new().install()
|
||||||
var mp3: PackedByteArray = FileAccess.get_file_as_bytes("res://tests/data/short.mp3")
|
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.hide_next_track = true
|
||||||
Settings.use_low_played_mode = false
|
Settings.use_low_played_mode = false
|
||||||
Settings.winning_score = 20
|
Settings.winning_score = 20
|
||||||
|
Settings.last_seen_version = Settings.version
|
||||||
# The inspiration list scrolls by itself, which would make every picture different
|
# The inspiration list scrolls by itself, which would make every picture different
|
||||||
Settings.inspiration_list_speed = 0
|
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,
|
&"auto_repeat_song": false, &"stop_after_current": false, &"hide_next_track": false,
|
||||||
&"hide_beginning": true, &"hide_for_seconds": 7.0, &"hide_length": true,
|
&"hide_beginning": true, &"hide_for_seconds": 7.0, &"hide_length": true,
|
||||||
&"hide_ticks": true, &"winning_score": 13, &"inspiration_list_speed": 4,
|
&"hide_ticks": true, &"winning_score": 13, &"inspiration_list_speed": 4,
|
||||||
&"fullscreen": true,
|
&"fullscreen": true, &"last_seen_version": "1.2.3",
|
||||||
}
|
}
|
||||||
|
|
||||||
var _snapshot: AutoloadSnapshot
|
var _snapshot: AutoloadSnapshot
|
||||||
|
|||||||
Reference in new issue
Block a user