From 3f27fbe21746992c6d09d59c4d26e1012f7b94cb Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Mon, 16 Nov 2026 09:18:04 +0100 Subject: [PATCH] test(pdf): check the PDFDocEncoding ActualText label end to end --- crates/pdf/src/tests.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/pdf/src/tests.rs b/crates/pdf/src/tests.rs index 9c606a611..c1f519595 100644 --- a/crates/pdf/src/tests.rs +++ b/crates/pdf/src/tests.rs @@ -98,6 +98,13 @@ fn pdf_actual_text_is_exposed_as_a_logical_group() { assert_eq!(shape_names(&doc), vec!["Text: Logical text"]); } +#[test] +fn pdf_actual_text_without_a_bom_is_pdfdocencoding_in_the_label() { + // 0x80 is a bullet in PDFDocEncoding, 0x92 a trade mark sign, not C1 control characters. + let data = page_pdf("/Span << /ActualText <80204192> >> BDC 1 0 0 rg 10 10 20 20 re f EMC", "", vec![]); + assert_eq!(shape_names(&parse(&data).unwrap()), vec!["Text: \u{2022} A\u{2122}"]); +} + #[test] fn pdf_forms_rotation_cmyk_and_alpha() { let content = "q 2 0 0 2 0 0 cm /Fm0 Do Q\n/GS0 gs 0 0 0 1 k 0 0 10 10 re f\n";