From 3da4c4ba132b9a485484eecd4d9a766e6de2d68a Mon Sep 17 00:00:00 2001 From: bflatastic Date: Sat, 14 Nov 2026 10:06:23 +0700 Subject: [PATCH] Tests: warichu PDF check reads only text objects warichu_is_a_character_attribute_set_saved_and_exported looked for Tj or TJ anywhere in the exported PDF. The file ID in the trailer and the XMP is a base64 hash that changes each second and now and then spells one of them, so the test failed on main twice (bf3cf422e, 446bf59bc) while export outlines warichu type every time. It now counts text-object lines only, as the colour font PDF test already does. --- crates/engine/src/cmd/typecmd/area_tests.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/cmd/typecmd/area_tests.rs b/crates/engine/src/cmd/typecmd/area_tests.rs index c68334e2c0..db1712a7f8 100644 --- a/crates/engine/src/cmd/typecmd/area_tests.rs +++ b/crates/engine/src/cmd/typecmd/area_tests.rs @@ -1688,10 +1688,9 @@ fn warichu_is_a_character_attribute_set_saved_and_exported() { assert!(["warichu", "warichuLines", "warichuGap", "warichuScale", "warichuAlign"].iter().all(|k| saved.get(*k).is_none()), "{saved}"); let plain_svg = vectorcraft_svg::export(&s.doc().unwrap().doc, &Default::default()); let plain_pdf = vectorcraft_pdf::export(&s.doc().unwrap().doc, &vectorcraft_pdf::PdfOptions::uncompressed()).unwrap(); - let text_ops = |pdf: &[u8]| { - let s = String::from_utf8_lossy(pdf); - s.contains("Tj") || s.contains("TJ") - }; + // Only text objects count: the file ID in the trailer and the XMP is base64 that changes each + // second and now and then spells `Tj` or `TJ`. + let text_ops = |pdf: &[u8]| String::from_utf8_lossy(pdf).lines().any(|l| l.starts_with("BT ") && (l.contains("Tj") || l.contains("TJ"))); assert!(plain_svg.contains("