fix: resolve two coverage test failures on main (#8813)

- eps: restore linear-time memchr::memmem::find in lex::find so
  search_in_a_loop_runs_out_of_the_budget does not hit O(N*M) under
  craft_ps::read::lex::find.
- ui-egui: wait for FontDb background scan and ensure >20 font families
  in menu_access_stationary_pointer_repeat_and_rerun_do_not_retarget_or_double_invoke
  so coverage/minimal runners do not race or fall short of 20 families.
This commit is contained in:
Dylan M. Taylor
2026-11-20 02:32:03 -05:00
committed by GitHub
parent 54f58fff31
commit 2848526796
2 changed files with 18 additions and 1 deletions
+9 -1
View File
@@ -9,7 +9,15 @@ use craft_ps::read::lex::{LexError, Number, Token};
use super::obj::{Obj, PsError, Res};
pub(crate) use craft_ps::read::lex::{IMMEDIATE, find, hex_decode};
pub(crate) use craft_ps::read::lex::{IMMEDIATE, hex_decode};
/// Where `needle` first starts in `hay` (uses `memmem` so large inputs stay linear-time).
pub(crate) fn find(hay: &[u8], needle: &[u8]) -> Option<usize> {
if needle.is_empty() {
return Some(0);
}
memchr::memmem::find(hay, needle)
}
pub(crate) struct Lexer<'a> {
inner: craft_ps::read::lex::Lexer<'a>,
+9
View File
@@ -764,6 +764,15 @@ fn menu_access_stationary_pointer_repeat_and_rerun_do_not_retarget_or_double_inv
assert_eq!(s.app.ui.view.rulers, !before, "one Text/Key pair invokes exactly once across passes");
s.end_access();
// Wait for any background font scan and ensure > 20 families even on minimal runners.
let db = vectorcraft_text::FontDb::global();
let _ = db.families();
for i in 0..24 {
if db.menu_family_list_now().len() > 20 {
break;
}
db.add_font(vectorcraft_testkit::fonts::renamed(&format!("Menu Test Font {i:02}")));
}
let text = s.app.run("text.create", json!({"x": 250, "y": 200, "text": "Menu", "font": "Inter", "size": 12})).unwrap()["id"].clone();
s.app.run("select.set", json!({"ids": [text]})).unwrap();
let size = vec2(640.0, 420.0);