Tests: native menu tests wait for the installed fonts' scan

VectorcraftApp::new starts the installed fonts' scan in the background,
and Type > Font lists only the loaded fonts until it ends (#5483). When
the scan ended between two reads of the menus, the second read had the
installed families too, and every_in_window_item_is_in_the_mac_menu_bar_once
and documents_and_selections_change_state_not_structure failed. The
tests' app() helper now waits for the scan after making the app.
This commit is contained in:
dotCooCoo
2026-11-04 23:44:55 +07:00
committed by bflatastic
parent 1c8772d670
commit 539195d68b
+4
View File
@@ -15,8 +15,12 @@ use crate::i18n::Lang;
use crate::native_menu::{self, Backend, MenuBar, MenuRole, NativeMenu, Node, Standard};
use crate::{VectorcraftApp, menus};
/// A new app, after the installed fonts' scan it starts has ended: until then Type › Font lists
/// only the loaded fonts (#5483), and a scan that ends part way through a test adds items between
/// two reads of the menus.
fn app(doc: bool) -> VectorcraftApp {
let mut app = VectorcraftApp::new(Session::new(), Default::default());
vectorcraft_text::FontDb::global().family_list();
if doc {
app.run("file.new", json!({"width": 400, "height": 300})).unwrap();
app.run("shape.rectangle", json!({"x": 20, "y": 20, "width": 37, "height": 40})).unwrap();