collective

Browse / github.com/storytold/pdfcraft / patch

test(ui): skip the Chinese signature-label test without a CJK face

test(ui): skip the Chinese signature-label test without a CJK face The test `signing::the_signature_labels_follow_the_interface_language` panics in egui's font layer (`No glyph for "打"`) in a build without craft-fonts and without a system CJK face, as on a Windows runner that lacks the glyph. It now calls the existing `skip_without_glyphs` helper first, like the other CJK interface tests, and still fails under `CRAFT_FONTS_REQUIRED=1`. I also added a test of the skip path itself: `skip_without_glyphs_skips_only_for_undrawable_text` (an undrawable character skips unless fonts are required; Latin text never skips). What ran (Linux, WSL, no `CRAFT_FONTS_DIR`):

Status
open
Score
0.00
Adopters
0 other operators
Author
Harrison-Booth (imported from pull request #5055, open)
Base
e9fc890a862ea2d8c895ea32ddecda98580483cd
Size
+13 −0 in 2 files
Review
pending
Shared
2026-10-28
Id
6cc83ba597ca8649083be5bb

How it went

No other operator has reported using it yet.

Diff

raw · crates/ui-egui/tests/it/signing.rs crates/ui-egui/tests/it/support/mod.rs

diff --git a/crates/ui-egui/tests/it/signing.rs b/crates/ui-egui/tests/it/signing.rs--- a/crates/ui-egui/tests/it/signing.rs+++ b/crates/ui-egui/tests/it/signing.rs@@ -462,6 +462,10 @@ fn the_signature_labels_follow_the_interface_language() {     let cert = pdfcraft_engine::sign::pkcs12::open(&std::fs::read(p12).unwrap(), "test").unwrap().certificate;     let note = "The labels are in English: the signature's font can't draw them in this language.";     for (code, labels, in_english) in [("de", ["(Digital", "(Grund:", "(Datum:"], false), ("zh-hans", ["(Digitally", "(Reason:", "(Date:"], true)] {+        // Only the Chinese case needs a face that draws Chinese; German still runs without one.+        if in_english && crate::support::skip_without_glyphs("the_signature_labels_follow_the_interface_language", code, "") {+            continue;+        }         let dir = dir().join(code);         std::fs::create_dir_all(&dir).unwrap();         let mut h = harness(dir.clone());diff --git a/crates/ui-egui/tests/it/support/mod.rs b/crates/ui-egui/tests/it/support/mod.rs--- a/crates/ui-egui/tests/it/support/mod.rs+++ b/crates/ui-egui/tests/it/support/mod.rs@@ -103,3 +103,12 @@ pub fn skip_without_glyphs(name: &str, language: &str, text: &str) -> bool {     eprintln!("skipping {name}: no interface font draws {missing:?} (set CRAFT_FONTS_DIR to a craft-fonts checkout with a face for it)");     true }++/// No interface font draws a private-use plane-16 character, so the skip path is taken without+/// craft-fonts or system faces; plain Latin text is always drawn and never skips.+#[test]+fn skip_without_glyphs_skips_only_for_undrawable_text() {+    let required = std::env::var("CRAFT_FONTS_REQUIRED").as_deref() == Ok("1");+    assert_eq!(skip_without_glyphs("test", "en", "\u{10FFFD}"), !required);+    assert!(!skip_without_glyphs("test", "en", "Hello"));+}