diff --git a/apps/vectorcraft/src/control_server/tests.rs b/apps/vectorcraft/src/control_server/tests.rs index aad5d7d08..d991fd602 100644 --- a/apps/vectorcraft/src/control_server/tests.rs +++ b/apps/vectorcraft/src/control_server/tests.rs @@ -58,7 +58,12 @@ fn idle_control_socket_releases_its_worker() { fn idle_expiry_closes_without_writing_a_line() { let (mut client, done, worker) = socket_fixture(short_timeouts(), |_, _| panic!("no request expected")); let mut got = Vec::new(); - client.read_to_end(&mut got).unwrap(); + match client.read_to_end(&mut got) { + // On Windows the server's close can reach the client as a reset. + Err(e) if e.kind() == std::io::ErrorKind::ConnectionReset => {} + Ok(_) => {} + Err(e) => panic!("reading the idle connection: {e}"), + } assert_eq!(String::from_utf8_lossy(&got), "", "the app wrote to an idle connection"); expect_socket_deadline(client, done, worker); } diff --git a/crates/ui-egui/src/tests/fonts.rs b/crates/ui-egui/src/tests/fonts.rs index 182de9f0d..f8f019171 100644 --- a/crates/ui-egui/src/tests/fonts.rs +++ b/crates/ui-egui/src/tests/fonts.rs @@ -13,14 +13,26 @@ fn type_font_menu_lists_every_available_family() { let fonts = |app: &VectorcraftApp| -> Vec { menus::menu_entries(app).into_iter().filter(|e| e.path == ["Type", "Font"]).map(|e| e.label).collect() }; - let labels = fonts(&app); - assert_eq!(labels, *FontDb::global().menu_family_list()); let installed = FontDb::with_font_dirs(system_font_dirs()); installed.load_system_fonts(); - let missing: Vec = installed.menu_family_list().iter().filter(|f| !labels.contains(f)).cloned().collect(); - assert!(missing.is_empty(), "installed but not in Type › Font: {missing:?}"); - // The menu is built every frame, from a list built once. - assert_eq!(fonts(&app), labels); + // A test running alongside can add a font (and the installed fonts' scan can end), and the menu + // is then built again: judge a run in which the fonts held still. + for _ in 0..20 { + let generation = FontDb::global().generation(); + let labels = fonts(&app); + let listed = FontDb::global().menu_family_list(); + // The menu is built every frame, from a list built once. + let again = fonts(&app); + if FontDb::global().generation() != generation { + continue; + } + assert_eq!(labels, *listed); + let missing: Vec = installed.menu_family_list().iter().filter(|f| !labels.contains(f)).cloned().collect(); + assert!(missing.is_empty(), "installed but not in Type › Font: {missing:?}"); + assert_eq!(again, labels); + return; + } + panic!("the fonts kept changing"); } #[test]