mirror of
https://github.com/storytold/figcraft.git
synced 2026-11-14 14:22:45 +00:00
Variables: fix the move order in the group rename collision test (#2353)
Both moves had names of the same length, so which one ran first came from the order of the variables. The first one now has a longer name, which the longest-first order always moves first, so the second one always collides after a move that has to be undone.
This commit is contained in:
1 file changed
+4
-3
@@ -405,11 +405,12 @@ 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() {
|
||||
// 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"]);
|
||||
// The longer name moves first, whatever the order of the variables: Orange/1000 moves, then
|
||||
// Orange/200 collides, and the move already made is undone.
|
||||
let mut u = named_window(&["Orange/1000", "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/200")), "{:?}", u.app.ui.last_error);
|
||||
assert_eq!(sorted_names(&u), ["Orange/100", "Orange/200", "Palette/Orange/200"]);
|
||||
assert_eq!(sorted_names(&u), ["Orange/1000", "Orange/200", "Palette/Orange/200"]);
|
||||
}
|
||||
|
||||
fn open_edit_variables(u: &mut Ui) -> Vec<egui::Shape> {
|
||||
|
||||
Reference in new issue
Block a user