mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 04:40:03 -04:00
Add text edit rtl regression test (#7524)
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
use egui::{Color32, Image, Label, RichText, TextWrapMode, include_image};
|
use egui::accesskit::Role;
|
||||||
|
use egui::{Align, Color32, Image, Label, Layout, RichText, TextWrapMode, include_image};
|
||||||
use egui_kittest::Harness;
|
use egui_kittest::Harness;
|
||||||
use egui_kittest::kittest::Queryable as _;
|
use egui_kittest::kittest::Queryable as _;
|
||||||
|
|
||||||
@@ -33,3 +34,30 @@ fn hovering_should_preserve_text_format() {
|
|||||||
|
|
||||||
harness.snapshot("hovering_should_preserve_text_format");
|
harness.snapshot("hovering_should_preserve_text_format");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn text_edit_rtl() {
|
||||||
|
let mut text = "hello ".to_owned();
|
||||||
|
let mut harness = Harness::builder().with_size((200.0, 50.0)).build_ui(|ui| {
|
||||||
|
ui.with_layout(Layout::right_to_left(Align::Min), |ui| {
|
||||||
|
_ = ui.button("right");
|
||||||
|
ui.add(
|
||||||
|
egui::TextEdit::singleline(&mut text)
|
||||||
|
.desired_width(10.0)
|
||||||
|
.clip_text(false),
|
||||||
|
);
|
||||||
|
_ = ui.button("left");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
harness.get_by_role(Role::TextInput).focus();
|
||||||
|
harness.step();
|
||||||
|
harness.snapshot("text_edit_rtl_0");
|
||||||
|
|
||||||
|
harness.get_by_role(Role::TextInput).type_text("world");
|
||||||
|
|
||||||
|
for i in 1..3 {
|
||||||
|
harness.step();
|
||||||
|
harness.snapshot(format!("text_edit_rtl_{i}"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
3
tests/egui_tests/tests/snapshots/text_edit_rtl_0.png
Normal file
3
tests/egui_tests/tests/snapshots/text_edit_rtl_0.png
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:336581facb1ec989a43291ed76bd8ddb552c46137a75601f466e6dc4dae77278
|
||||||
|
size 2395
|
||||||
3
tests/egui_tests/tests/snapshots/text_edit_rtl_1.png
Normal file
3
tests/egui_tests/tests/snapshots/text_edit_rtl_1.png
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:3b0684c53a20eaa90a9dccef8ac3eaa2a6eede7c770e7bbbba6d995f43584d99
|
||||||
|
size 2353
|
||||||
3
tests/egui_tests/tests/snapshots/text_edit_rtl_2.png
Normal file
3
tests/egui_tests/tests/snapshots/text_edit_rtl_2.png
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:38f325f2e741f18f897502c176f9a7efe276e9adab41a144511121dd8b8a3073
|
||||||
|
size 3079
|
||||||
Reference in New Issue
Block a user