From e32872e41e2f9d847fc20f066270ea2e0f4e6ccb Mon Sep 17 00:00:00 2001 From: mtlcl410 <2368091+mtlcl410@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:34:12 +0800 Subject: [PATCH] M12: test that a caption font naming only a weight keeps its field's posture Review on #4664: the caption tests covered a size-only caption font, but not a caption that sets one posture property while its field sets the other. A bold caption on an italic field is now drawn bold and italic. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv --- crates/xfa/src/tests.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/xfa/src/tests.rs b/crates/xfa/src/tests.rs index 498cdf8fb3..6a5621b51f 100644 --- a/crates/xfa/src/tests.rs +++ b/crates/xfa/src/tests.rs @@ -3420,6 +3420,18 @@ fn a_caption_font_naming_only_a_size_takes_the_fields_weight_style_and_family() assert_eq!((face.family, face.bold, face.italic, face.size), (crate::text::Family::Times, true, true, 12.0)); } +/// A caption font that sets only the weight keeps its field's posture: bold from the caption, +/// italic from the field, both on the caption (XFA 3.3, "Formatting Text That Appears as Fixed or +/// Variable Content", p. 43). +#[test] +fn a_caption_font_naming_only_a_weight_keeps_the_fields_posture() { + let items = positioned( + r#"Name:"#, + ); + let face = items.iter().find_map(|i| if let Item::Text(s) = i { Some(s.face.clone()) } else { None }).expect("the caption"); + assert_eq!((face.family, face.bold, face.italic, face.size), (crate::text::Family::Helvetica, true, true, 8.0)); +} + /// A signature box the file already holds a signature for shows that signature, the file's own /// objects, and is locked; the other box stays unsigned. #[test]