mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-11 00:12:24 +00:00
Tests: the Type › Font menu test waits for the installed fonts' scan (#5647)
type_font_menu_lists_every_available_family read Type › Font while the scan the app starts could still be running. The scan bumps the font generation a moment before it counts as done, so a read in that gap lists only the loaded fonts under the new generation, and the test's "generation held still" check let the comparison with the full list fail. The test now waits for the scan after making the app, as the native menu tests do since #5653.
This commit is contained in:
@@ -9,6 +9,10 @@ use crate::{VectorcraftApp, menus};
|
||||
#[test]
|
||||
fn type_font_menu_lists_every_available_family() {
|
||||
let mut app = VectorcraftApp::new(Session::new(), Default::default());
|
||||
// The app starts the installed fonts' scan, and until it ends Type › Font lists only the
|
||||
// loaded fonts (#5483). The scan changes the generation a moment before it counts as done, so
|
||||
// a read in between sees the old list under the new generation: wait for it to end first.
|
||||
FontDb::global().family_list();
|
||||
app.run("file.new", json!({})).unwrap();
|
||||
let fonts = |app: &VectorcraftApp| -> Vec<String> {
|
||||
menus::menu_entries(app).into_iter().filter(|e| e.path == ["Type", "Font"]).map(|e| e.label).collect()
|
||||
|
||||
Reference in New Issue
Block a user