Skip to content

Commit 47b51f4

Browse files
committed
Add text edit rtl regression test
1 parent 2afc43c commit 47b51f4

File tree

4 files changed

+38
-1
lines changed

4 files changed

+38
-1
lines changed

tests/egui_tests/tests/regression_tests.rs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use egui::{Color32, Image, Label, RichText, TextWrapMode, include_image};
1+
use egui::accesskit::Role;
2+
use egui::{Align, Color32, Image, Label, Layout, RichText, TextWrapMode, include_image};
23
use egui_kittest::Harness;
34
use egui_kittest::kittest::Queryable as _;
45

@@ -33,3 +34,30 @@ fn hovering_should_preserve_text_format() {
3334

3435
harness.snapshot("hovering_should_preserve_text_format");
3536
}
37+
38+
#[test]
39+
fn text_edit_rtl() {
40+
let mut text = "hello ".to_string();
41+
let mut harness = Harness::builder().with_size((300.0, 100.0)).build_ui(|ui| {
42+
ui.with_layout(Layout::right_to_left(Align::Min), |ui| {
43+
_ = ui.button("right");
44+
ui.add(
45+
egui::TextEdit::singleline(&mut text)
46+
.desired_width(10.0)
47+
.clip_text(false),
48+
);
49+
_ = ui.button("left");
50+
});
51+
});
52+
53+
harness.get_by_role(Role::TextInput).focus();
54+
harness.step();
55+
harness.snapshot("text_edit_rtl_0");
56+
57+
harness.get_by_role(Role::TextInput).type_text("world");
58+
59+
for i in 1..3 {
60+
harness.step();
61+
harness.snapshot(format!("text_edit_rtl_{}", i));
62+
}
63+
}
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)