mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 05:10:03 -04:00
Merge branch 'emilk:main' into main
This commit is contained in:
@@ -61,3 +61,17 @@ fn text_edit_rtl() {
|
||||
harness.snapshot(format!("text_edit_rtl_{i}"));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn combobox_should_have_value() {
|
||||
let harness = Harness::new_ui(|ui| {
|
||||
egui::ComboBox::from_label("Select an option")
|
||||
.selected_text("Option 1")
|
||||
.show_ui(ui, |_ui| {});
|
||||
});
|
||||
|
||||
assert_eq!(
|
||||
harness.get_by_label("Select an option").value().as_deref(),
|
||||
Some("Option 1")
|
||||
);
|
||||
}
|
||||
|
||||
3
tests/egui_tests/tests/snapshots/button_shortcut.png
Normal file
3
tests/egui_tests/tests/snapshots/button_shortcut.png
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5befd84158b582c79a968f36e43c7017187b364824eb4470b048d133e62f9360
|
||||
size 1600
|
||||
@@ -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
|
||||
@@ -108,3 +108,14 @@ fn test_intrinsic_size() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_button_shortcut_text() {
|
||||
let mut harness = HarnessBuilder::default().build_ui(|ui| {
|
||||
ui.add(egui::Button::new("Click me").shortcut_text(("1", "2", "3")));
|
||||
});
|
||||
harness.run();
|
||||
harness.fit_contents();
|
||||
|
||||
harness.snapshot("button_shortcut");
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ use egui::accesskit::Role;
|
||||
use egui::load::SizedTexture;
|
||||
use egui::{
|
||||
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,
|
||||
};
|
||||
use egui_kittest::kittest::{Queryable as _, by};
|
||||
@@ -84,6 +84,37 @@ fn widget_tests() {
|
||||
},
|
||||
&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(
|
||||
"slider",
|
||||
|
||||
Reference in New Issue
Block a user