Cover a second pdfTeX line-break fixture
This commit is contained in:
1 parent
cc9cdf1689
commit
812c9d89dc
1 file changed
+27
@@ -331,6 +331,33 @@ mod tests {
|
|||||||
assert!(paragraph.line_count() >= 2);
|
assert!(paragraph.line_count() >= 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn cmr10_breaks_match_pdftex_at_180pt() {
|
||||||
|
let font = crate::cmr10::Cmr10Metrics::new();
|
||||||
|
let style = ParagraphStyle {
|
||||||
|
line_width: 180 * 65_536,
|
||||||
|
..ParagraphStyle::default()
|
||||||
|
};
|
||||||
|
let paragraph = layout_paragraph_with_font(
|
||||||
|
"alpha beta gamma delta epsilon zeta eta theta iota kappa lambda mu nu xi omicron pi rho sigma tau upsilon phi chi psi omega",
|
||||||
|
&style,
|
||||||
|
&font,
|
||||||
|
);
|
||||||
|
let mut words: Vec<usize> = paragraph
|
||||||
|
.lines
|
||||||
|
.iter()
|
||||||
|
.map(|line| {
|
||||||
|
line.iter()
|
||||||
|
.filter(|item| matches!(item, HorizontalItem::Glue { .. }))
|
||||||
|
.count()
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
if let Some(last) = words.last_mut() {
|
||||||
|
*last += 1;
|
||||||
|
}
|
||||||
|
assert_eq!(words, vec![7, 7, 8]);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn cmr10_breaks_match_a_pdftex_fixture() {
|
fn cmr10_breaks_match_a_pdftex_fixture() {
|
||||||
let font = crate::cmr10::Cmr10Metrics::new();
|
let font = crate::cmr10::Cmr10Metrics::new();
|
||||||
|
|||||||
Reference in new issue
Block a user