feat(input): make double-tap placement the default
New saves start in double-tap mode. Version 1 saves migrate once to double-tap and are rewritten as version 2, while the settings toggle still persists a later choice. Smoke tests now force hold mode for their hold checks; UI tests cover the fresh default and the migration.
This commit is contained in:
1 parent
15e79ae38c
commit
82c5691d2e
3 files changed
+47
-4
No files matched your search
+25
-2
@@ -33,6 +33,7 @@ func _run() -> void:
|
||||
quit(1)
|
||||
return
|
||||
|
||||
_test_save_defaults(save)
|
||||
save.reset_progress()
|
||||
|
||||
main.game.start_level(0)
|
||||
@@ -100,12 +101,34 @@ func _run() -> void:
|
||||
save.set_setting("show_timer", true)
|
||||
save.set_setting("reduce_motion", false)
|
||||
save.set_setting("hold_seconds", 0.35)
|
||||
save.set_setting("double_tap_place", false)
|
||||
save.set_setting("double_tap_place", true)
|
||||
|
||||
print("UI TEST: ", "PASS" if failures == 0 else "FAIL (%d)" % failures)
|
||||
quit(0 if failures == 0 else 1)
|
||||
|
||||
|
||||
func _test_save_defaults(save) -> void:
|
||||
# A fresh save starts in double-tap mode at version 2.
|
||||
var abs_path := ProjectSettings.globalize_path(save.PATH)
|
||||
if FileAccess.file_exists(save.PATH):
|
||||
DirAccess.remove_absolute(abs_path)
|
||||
save.load_game()
|
||||
_check(int(save.data.get("version", 0)) == 2, "fresh saves should be version 2")
|
||||
_check(bool(save.get_setting("double_tap_place")), "fresh saves should default to double-tap")
|
||||
|
||||
# A version 1 save with hold selected migrates to double-tap once.
|
||||
var old: Dictionary = save._default_data()
|
||||
old["version"] = 1
|
||||
old["settings"]["double_tap_place"] = false
|
||||
var file := FileAccess.open(save.PATH, FileAccess.WRITE)
|
||||
file.store_string(JSON.stringify(old, "\t"))
|
||||
file.close()
|
||||
|
||||
save.load_game()
|
||||
_check(int(save.data.get("version", 0)) == 2, "version 1 saves should migrate to version 2")
|
||||
_check(bool(save.get_setting("double_tap_place")), "version 1 saves should migrate to double-tap")
|
||||
|
||||
|
||||
func _find_empty(board: Board) -> Vector2i:
|
||||
for r in board.n:
|
||||
for c in board.n:
|
||||
@@ -182,7 +205,7 @@ func _test_placement_modes(save, board: Board) -> void:
|
||||
save.set_setting("double_tap_place", true)
|
||||
save.load_game()
|
||||
_check(bool(save.get_setting("double_tap_place")), "double_tap_place should persist")
|
||||
save.set_setting("double_tap_place", false)
|
||||
save.set_setting("double_tap_place", true)
|
||||
board.restart()
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user