mirror of
https://github.com/storytold/designcraft.git
synced 2026-12-02 20:21:15 -05:00
Merge pull request #3479
This commit is contained in:
commit
a5653118fb
1 file changed
+25
-2
@@ -1418,6 +1418,24 @@ mod scripts_shelf_workflow_tests {
|
||||
);
|
||||
}
|
||||
|
||||
/// Whether this build has the interface's Devanagari, Arabic and CJK faces. They come from craft-fonts,
|
||||
/// an optional build input: without it the glyph check is skipped and missing glyphs draw as boxes, so
|
||||
/// the rest of the shelf test still runs. `CRAFT_FONTS_REQUIRED=1` (set where CI provides the fonts)
|
||||
/// turns the skip into a failure.
|
||||
fn script_glyph_fonts_embedded() -> bool {
|
||||
if !designcraft_fonts::CRAFT_FONTS.is_empty() {
|
||||
return true;
|
||||
}
|
||||
match std::env::var("CRAFT_FONTS_REQUIRED").as_deref() {
|
||||
Err(_) | Ok("") => {
|
||||
eprintln!("skipped (craft-fonts): the script glyph check needs the Devanagari, Arabic and CJK interface faces");
|
||||
false
|
||||
}
|
||||
Ok("1") => panic!("CRAFT_FONTS_REQUIRED=1, but this build embeds no craft-fonts (set CRAFT_FONTS_DIR)"),
|
||||
Ok(other) => panic!("CRAFT_FONTS_REQUIRED is {other:?}; the accepted value is 1"),
|
||||
}
|
||||
}
|
||||
|
||||
/// Assert all original Hindi/Arabic/CJK/name/filename/caption glyphs through the actual active app families.
|
||||
fn assert_original_script_glyphs(ctx: &egui::Context, texts: &[String]) {
|
||||
let families: Vec<_> = ctx.fonts(|fonts| fonts.definitions().families.keys().cloned().collect());
|
||||
@@ -1442,8 +1460,13 @@ mod scripts_shelf_workflow_tests {
|
||||
app.raw_input_hook(&ctx, &mut egui::RawInput::default());
|
||||
let mut fonts = false;
|
||||
let mut original_face_ready = false;
|
||||
let mut original_glyphs_ready = false;
|
||||
let mut h = Harness::builder().with_context(ctx).with_size(vec2(width, 640.0)).build_ui_state(
|
||||
// Without the script faces there is nothing to check: the glyph check counts as done.
|
||||
let mut original_glyphs_ready = !script_glyph_fonts_embedded();
|
||||
let mut builder = Harness::builder().with_context(ctx).with_size(vec2(width, 640.0));
|
||||
if original_glyphs_ready {
|
||||
builder = builder.allow_missing_glyphs();
|
||||
}
|
||||
let mut h = builder.build_ui_state(
|
||||
move |ui, w: &mut Window| {
|
||||
if !fonts {
|
||||
crate::theme::install_fonts(ui.ctx(), &w.app.ui.language);
|
||||
|
||||
Reference in new issue
Block a user