feat: add in-TUI settings editors

This commit is contained in:
objz committed 2026-09-03 20:44:44 +02:00
1 parent 8c94e126c3
commit c95f2d17ff
47 files changed
+2574 -741

No files matched your search

+23
View File
@@ -57,6 +57,8 @@ fn build_game_args_renders_upstream_arguments() {
launcher_version: "test",
clientid: "0",
quick_play_singleplayer: None,
resolution_width: None,
resolution_height: None,
version_type: "release",
};
let features = FeatureSet::default();
@@ -89,6 +91,27 @@ fn build_game_args_renders_upstream_arguments() {
assert_eq!(game_args, vec!["--username", "Player"]);
}
#[test]
fn custom_resolution_is_added_once() {
let mut args = vec!["--username".to_owned(), "Player".to_owned()];
apply_custom_resolution(&mut args, Some((1920, 1080)));
assert_eq!(
args,
[
"--username",
"Player",
"--width",
"1920",
"--height",
"1080"
]
);
apply_custom_resolution(&mut args, Some((1280, 720)));
assert_eq!(args.iter().filter(|arg| *arg == "--width").count(), 1);
assert_eq!(args.iter().filter(|arg| *arg == "--height").count(), 1);
}
// exercises the early-return branch of migrate_legacy_meta_if_needed.
// a profile with either arguments or minecraftArguments is not legacy
// and must produce Ok(None) without touching the network. covers both
+13
View File
@@ -84,3 +84,16 @@ fn normalize_memory_value_rejects_invalid_values() {
assert_eq!(normalize_memory_value("8GB"), None);
assert_eq!(normalize_memory_value("banana"), None);
}
#[test]
fn parse_resolution_accepts_common_separators() {
assert_eq!(parse_resolution("1920x1080"), Ok((1920, 1080)));
assert_eq!(parse_resolution(" 1280X720 "), Ok((1280, 720)));
}
#[test]
fn parse_resolution_rejects_invalid_values() {
assert!(parse_resolution("1920").is_err());
assert!(parse_resolution("0x1080").is_err());
assert!(parse_resolution("wide x tall").is_err());
}
+8
View File
@@ -41,6 +41,14 @@ fn crashed_state_stores_exit_code() {
assert_eq!(get("run_test_crash"), Some(RunState::Crashed(Some(1))));
}
#[test]
fn crashed_instances_are_not_active() {
set_state("run_test_inactive_crash", RunState::Crashed(Some(1)));
assert!(!is_active("run_test_inactive_crash"));
set_state("run_test_active_start", RunState::Starting);
assert!(is_active("run_test_active_start"));
}
#[test]
fn push_and_drain_last_played() {
let time = Utc::now();