Skip to content

Commit 2d21b35

Browse files
committed
Add unit test
1 parent a2ac368 commit 2d21b35

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

epaint/src/text/text_layout.rs

+11
Original file line numberDiff line numberDiff line change
@@ -775,3 +775,14 @@ fn is_chinese(c: char) -> bool {
775775
|| ('\u{3400}' <= c && c <= '\u{4DBF}')
776776
|| ('\u{2B740}' <= c && c <= '\u{2B81F}')
777777
}
778+
779+
// ----------------------------------------------------------------------------
780+
781+
#[test]
782+
fn test_zero_max_width() {
783+
let mut fonts = FontsImpl::new(1.0, 1024, super::FontDefinitions::default());
784+
let mut layout_job = LayoutJob::single_section("W".into(), super::TextFormat::default());
785+
layout_job.wrap.max_width = 0.0;
786+
let galley = super::layout(&mut fonts, layout_job.into());
787+
assert_eq!(galley.rows.len(), 1);
788+
}

0 commit comments

Comments
 (0)