mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-15 14:22:11 +08:00
raybillywig
This commit is contained in:
@@ -9,7 +9,6 @@ from typing import Protocol
|
||||
LONG_PITCH_KEY = "LongPitch"
|
||||
STEER_KP_KEY = "SteerKP"
|
||||
STEER_KP_STOCK_KEY = "SteerKPStock"
|
||||
TRY_RAYLIB_UI_KEY = "TryRaylibUI"
|
||||
USE_OLD_UI_KEY = "UseOldUI"
|
||||
|
||||
DEFAULT_STEER_KP = 0.6
|
||||
@@ -19,7 +18,7 @@ QT_STEER_KP_PLACEHOLDER = 1.0
|
||||
LAUNCH_PARAM_MIGRATION_MARKER = ".starpilot_launch_param_migrations_v2"
|
||||
BRANCH_DEFAULTS_MIGRATION_MARKER = ".starpilot_branch_defaults_migrations_v1"
|
||||
ACCELERATION_PROFILE_MIGRATION_MARKER = ".starpilot_acceleration_profile_default_v1"
|
||||
USE_OLD_UI_MIGRATION_MARKER = ".starpilot_use_old_ui_migration_v1"
|
||||
USE_OLD_UI_MIGRATION_MARKER = ".starpilot_use_old_ui_migration_v2"
|
||||
LATERAL_METHOD_REBRAND_MIGRATION_MARKER = ".starpilot_lateral_method_rebrand_v1"
|
||||
MARKER_DIRNAME = ".starpilot_param_migrations"
|
||||
|
||||
@@ -186,8 +185,7 @@ def _apply_use_old_ui_migration(params: ParamsLike, marker: Path) -> None:
|
||||
|
||||
marker.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
if _param_file_exists(params, TRY_RAYLIB_UI_KEY) and not _param_file_exists(params, USE_OLD_UI_KEY):
|
||||
params.put_bool(USE_OLD_UI_KEY, not params.get_bool(TRY_RAYLIB_UI_KEY))
|
||||
params.put_bool(USE_OLD_UI_KEY, False)
|
||||
|
||||
marker.touch()
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ def test_apply_launch_param_migrations_preserves_custom_acceleration_profile_wit
|
||||
assert params.get_int("AccelerationProfile") == 1
|
||||
|
||||
|
||||
def test_apply_launch_param_migrations_inverts_try_raylib_ui_enabled(tmp_path):
|
||||
def test_apply_launch_param_migrations_defaults_old_ui_off_from_try_raylib_enabled(tmp_path):
|
||||
params = FileBackedFakeParams(tmp_path / "params")
|
||||
params.put_bool("TryRaylibUI", True)
|
||||
|
||||
@@ -221,20 +221,19 @@ def test_apply_launch_param_migrations_inverts_try_raylib_ui_enabled(tmp_path):
|
||||
assert marker_path(tmp_path, USE_OLD_UI_MIGRATION_MARKER).is_file()
|
||||
|
||||
|
||||
def test_apply_launch_param_migrations_inverts_try_raylib_ui_disabled(tmp_path):
|
||||
def test_apply_launch_param_migrations_defaults_old_ui_off_from_try_raylib_disabled(tmp_path):
|
||||
params = FileBackedFakeParams(tmp_path / "params")
|
||||
params.put_bool("TryRaylibUI", False)
|
||||
|
||||
apply_launch_param_migrations(params)
|
||||
|
||||
assert params.get_bool("UseOldUI")
|
||||
assert not params.get_bool("UseOldUI")
|
||||
assert marker_path(tmp_path, USE_OLD_UI_MIGRATION_MARKER).is_file()
|
||||
|
||||
|
||||
def test_apply_launch_param_migrations_does_not_overwrite_use_old_ui(tmp_path):
|
||||
def test_apply_launch_param_migrations_resets_existing_use_old_ui(tmp_path):
|
||||
params = FileBackedFakeParams(tmp_path / "params")
|
||||
params.put_bool("TryRaylibUI", False)
|
||||
params.put_bool("UseOldUI", False)
|
||||
params.put_bool("UseOldUI", True)
|
||||
|
||||
apply_launch_param_migrations(params)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user