mirror of
https://github.com/emilk/egui.git
synced 2026-09-03 07:10:04 -04:00
Add some more text edit tests (#7608)
Adds tests to text the clip option in text edits and how it behaves with a placeholder --------- Co-authored-by: lucasmerlin <8009393+lucasmerlin@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:0f107d95fee9a5fb5fbfd2422452e1820738a84c81774587dbfa8153e91e4c73
|
||||||
|
size 414552
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:6c1aebada9349f8cb4046469b0a6f9796a21f88b6724bd85cd832a40b8007409
|
||||||
|
size 540527
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:685de2e33ff26aafa87426bcda18bb9963c2deb2a811cd0aae4450af0e245a06
|
||||||
|
size 390735
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:cf4236b1a8f63d184cd780c334d9f996e4d47817a96a29f0d81658d2d897597f
|
||||||
|
size 10529
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:c7a63953853f526b83f80d63335b03e60258ea9a3416d19f8ed57d746b5c551d
|
||||||
|
size 21557
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:1f7d802a4de7e30f8d254cab6d9ca127866c104c1738103bc4a579917e8f42d3
|
||||||
|
size 9850
|
||||||
@@ -2,7 +2,7 @@ use egui::accesskit::Role;
|
|||||||
use egui::load::SizedTexture;
|
use egui::load::SizedTexture;
|
||||||
use egui::{
|
use egui::{
|
||||||
Align, AtomExt as _, AtomLayout, Button, Color32, ColorImage, Direction, DragValue, Event,
|
Align, AtomExt as _, AtomLayout, Button, Color32, ColorImage, Direction, DragValue, Event,
|
||||||
Grid, IntoAtoms as _, Layout, PointerButton, Response, Slider, Stroke, StrokeKind,
|
Grid, IntoAtoms as _, Layout, PointerButton, Response, Slider, Stroke, StrokeKind, TextEdit,
|
||||||
TextWrapMode, TextureHandle, TextureOptions, Ui, UiBuilder, Vec2, Widget as _, include_image,
|
TextWrapMode, TextureHandle, TextureOptions, Ui, UiBuilder, Vec2, Widget as _, include_image,
|
||||||
};
|
};
|
||||||
use egui_kittest::kittest::{Queryable as _, by};
|
use egui_kittest::kittest::{Queryable as _, by};
|
||||||
@@ -84,6 +84,37 @@ fn widget_tests() {
|
|||||||
},
|
},
|
||||||
&mut results,
|
&mut results,
|
||||||
);
|
);
|
||||||
|
test_widget(
|
||||||
|
"text_edit_clip",
|
||||||
|
|ui| {
|
||||||
|
ui.spacing_mut().text_edit_width = 45.0;
|
||||||
|
TextEdit::singleline(&mut "This is a very very long text".to_owned())
|
||||||
|
.clip_text(true)
|
||||||
|
.ui(ui)
|
||||||
|
},
|
||||||
|
&mut results,
|
||||||
|
);
|
||||||
|
test_widget(
|
||||||
|
"text_edit_no_clip",
|
||||||
|
|ui| {
|
||||||
|
ui.spacing_mut().text_edit_width = 45.0;
|
||||||
|
TextEdit::singleline(&mut "This is a very very long text".to_owned())
|
||||||
|
.clip_text(false)
|
||||||
|
.ui(ui)
|
||||||
|
},
|
||||||
|
&mut results,
|
||||||
|
);
|
||||||
|
test_widget(
|
||||||
|
"text_edit_placeholder_clip",
|
||||||
|
|ui| {
|
||||||
|
ui.spacing_mut().text_edit_width = 45.0;
|
||||||
|
TextEdit::singleline(&mut String::new())
|
||||||
|
.hint_text("This is a very very long placeholder")
|
||||||
|
.clip_text(true)
|
||||||
|
.ui(ui)
|
||||||
|
},
|
||||||
|
&mut results,
|
||||||
|
);
|
||||||
|
|
||||||
test_widget(
|
test_widget(
|
||||||
"slider",
|
"slider",
|
||||||
|
|||||||
Reference in New Issue
Block a user