From 70aeeee941a20cf232c883fd2369da5fd8c1cddb Mon Sep 17 00:00:00 2001 From: Zinadin Zidan Date: Sat, 14 Nov 2026 04:05:13 +0600 Subject: [PATCH] Variables: test that a refused group rename undoes the moves already made (#2353) The collision test's two moves had names of the same length, so the first one already collided and nothing was left to undo. With the existing name on the second move, the first moves, the second collides, and the test checks that the batch puts the first one back. --- crates/ui-egui/src/variables_select_tests.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/variables_select_tests.rs b/crates/ui-egui/src/variables_select_tests.rs index c2b699eb8..2d5bd3342 100644 --- a/crates/ui-egui/src/variables_select_tests.rs +++ b/crates/ui-egui/src/variables_select_tests.rs @@ -405,10 +405,11 @@ fn renaming_a_group_into_its_own_new_subgroup_moves_the_deeper_names_first() { #[test] fn a_group_rename_onto_a_variable_name_that_stays_changes_nothing() { - let mut u = named_window(&["Orange/100", "Orange/200", "Palette/Orange/100"]); + // Orange/100 moves first; Orange/200 then collides, and the move already made is undone. + let mut u = named_window(&["Orange/100", "Orange/200", "Palette/Orange/200"]); rename_group(&mut u, "Orange", "Palette/Orange"); - assert!(u.app.ui.last_error.as_deref().is_some_and(|e| e.contains("Palette/Orange/100")), "{:?}", u.app.ui.last_error); - assert_eq!(sorted_names(&u), ["Orange/100", "Orange/200", "Palette/Orange/100"]); + assert!(u.app.ui.last_error.as_deref().is_some_and(|e| e.contains("Palette/Orange/200")), "{:?}", u.app.ui.last_error); + assert_eq!(sorted_names(&u), ["Orange/100", "Orange/200", "Palette/Orange/200"]); } fn open_edit_variables(u: &mut Ui) -> Vec {