Skip to content

Commit 2d210e9

Browse files
committed
Add RTL test
1 parent 5238fff commit 2d210e9

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

parley/src/tests/test_basic.rs

+22
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,28 @@ fn content_widths() {
236236
env.with_name("max").check_layout_snapshot(&layout);
237237
}
238238

239+
#[test]
240+
fn content_widths_rtl() {
241+
let mut env = testenv!();
242+
243+
let text = "بببب ااااا";
244+
let mut builder = env.ranged_builder(text);
245+
246+
let mut layout = builder.build(text);
247+
248+
layout.break_all_lines(Some(layout.min_content_width()));
249+
layout.align(None, Alignment::Start, false);
250+
env.with_name("min").check_layout_snapshot(&layout);
251+
252+
layout.break_all_lines(Some(layout.max_content_width()));
253+
layout.align(None, Alignment::Start, false);
254+
assert!(
255+
layout.width() <= layout.max_content_width(),
256+
"Layout should never be wider than the max content width"
257+
);
258+
env.with_name("max").check_layout_snapshot(&layout);
259+
}
260+
239261
#[test]
240262
fn inbox_content_width() {
241263
let mut env = testenv!();
Loading
Loading

0 commit comments

Comments
 (0)