use super::extract_text_from_rtf;
#[test]
fn test_shptxt_survives_nested_ignorable_ancestor() {
let rtf = r"{\rtf1\ansi
{\*\shp{\*\shpinst{\sp{\sn shapeType}{\sv202}}{\shptxt Text box content}}}
Body text after the shape.\par
}";
let (text, _tables, _images, _para_metas, _fmt) = extract_text_from_rtf(rtf, false);
assert!(
text.contains("Text box content"),
"text-box content should be extracted, got: {text:?}"
);
assert!(
text.contains("Body text after the shape."),
"ordinary body text should be unaffected, got: {text:?}"
);
}
#[test]
fn test_annotation_and_atnid_are_extracted_as_labeled_comment() {
let rtf = r"{\rtf1\ansi
Body text.\par
{\annotation{\*\atnid7}Reviewer comment here}
}";
let (text, _tables, _images, _para_metas, _fmt) = extract_text_from_rtf(rtf, false);
assert!(
text.contains("[Comment 7]: Reviewer comment here"),
"comment should be extracted and labeled with its atnid, got: {text:?}"
);
assert!(
text.contains("Body text."),
"ordinary body text should be unaffected, got: {text:?}"
);
}
#[test]
fn test_annotation_without_atnid_falls_back_to_counter_label() {
let rtf = r"{\rtf1\ansi
{\annotation First comment}
{\annotation Second comment}
}";
let (text, _tables, _images, _para_metas, _fmt) = extract_text_from_rtf(rtf, false);
assert!(text.contains("[Comment 1]: First comment"), "got: {text:?}");
assert!(text.contains("[Comment 2]: Second comment"), "got: {text:?}");
}