mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-29 09:46:19 +01:00
Find Font: repeat the pump test's edit when the font generation changes
Another test thread that changes the font database between the two pump passes makes the second pass list the fonts again, so the one-listing assertion could fail. The test now repeats the edit until the generation stays the same across both passes, as kept_over_frames does.
This commit is contained in:
1 parent
d9d60d7f7f
commit
a1cdf0668a
1 file changed
+15
-6
@@ -687,12 +687,21 @@ mod tests {
|
||||
}
|
||||
assert_eq!(FONT_LISTS.get(), 0, "fonts listed with the dialog closed");
|
||||
open(&mut app);
|
||||
let opened_lists = FONT_LISTS.get();
|
||||
assert_eq!(opened_lists, 1, "opening lists the fonts once");
|
||||
app.session.execute("shape.rectangle", &json!({"x": 60, "y": 0, "width": 5, "height": 5})).unwrap();
|
||||
pump_now(&mut app);
|
||||
pump_now(&mut app);
|
||||
assert_eq!(FONT_LISTS.get(), opened_lists + 1, "an edit lists the fonts again once while the dialog is open");
|
||||
assert_eq!(FONT_LISTS.get(), 1, "opening lists the fonts once");
|
||||
// Another test thread that changes the available fonts during the two passes makes the
|
||||
// second pass list them again, so the edit is repeated until the generation stays the same.
|
||||
for i in 0..20 {
|
||||
let generation = vectorcraft_text::FontDb::global().generation();
|
||||
let before = FONT_LISTS.get();
|
||||
app.session.execute("shape.rectangle", &json!({"x": 60 + i, "y": 0, "width": 5, "height": 5})).unwrap();
|
||||
pump_now(&mut app);
|
||||
pump_now(&mut app);
|
||||
if vectorcraft_text::FontDb::global().generation() == generation {
|
||||
assert_eq!(FONT_LISTS.get(), before + 1, "an edit lists the fonts again once while the dialog is open");
|
||||
return;
|
||||
}
|
||||
}
|
||||
panic!("the available fonts kept changing")
|
||||
}
|
||||
|
||||
/// Find In passes Find the active artboard, or the selected layers (else the current
|
||||
|
||||
Reference in new issue
Block a user