mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 14:49:06 -04:00
Add container_labelled_by test
This commit is contained in:
13
Cargo.lock
13
Cargo.lock
@@ -2558,11 +2558,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "kurbo"
|
||||
version = "0.11.1"
|
||||
version = "0.11.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89234b2cc610a7dd927ebde6b41dd1a5d4214cffaef4cf1fb2195d592f92518f"
|
||||
checksum = "c62026ae44756f8a599ba21140f350303d4f08dcdcc71b5ad9c9bb8128c13c62"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"euclid",
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
@@ -4327,7 +4328,7 @@ version = "0.15.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68c7541fff44b35860c1a7a47a7cadf3e4a304c457b58f9870d9706ece028afc"
|
||||
dependencies = [
|
||||
"kurbo 0.11.1",
|
||||
"kurbo 0.11.3",
|
||||
"siphasher",
|
||||
]
|
||||
|
||||
@@ -4663,9 +4664,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ttf-parser"
|
||||
version = "0.25.0"
|
||||
version = "0.25.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5902c5d130972a0000f60860bfbf46f7ca3db5391eddfedd1b8728bd9dc96c0e"
|
||||
checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31"
|
||||
dependencies = [
|
||||
"core_maths",
|
||||
]
|
||||
@@ -4829,7 +4830,7 @@ dependencies = [
|
||||
"flate2",
|
||||
"fontdb",
|
||||
"imagesize",
|
||||
"kurbo 0.11.1",
|
||||
"kurbo 0.11.3",
|
||||
"log",
|
||||
"pico-args",
|
||||
"roxmltree",
|
||||
|
||||
@@ -695,8 +695,8 @@ impl<State> Harness<'_, State> {
|
||||
|
||||
/// Render a snapshot, save it to a temp file and open it in the default image viewer.
|
||||
///
|
||||
/// This method is marked as deprecated to trigger errors in CI (so that it's not accidentally
|
||||
/// committed).
|
||||
/// This method is marked as deprecated to trigger errors in CI (so that it's usages are not
|
||||
/// accidentally committed). It's fine to use it for debugging.
|
||||
#[deprecated = "Only for debugging, don't commit this."]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub fn debug_open_snapshot(&mut self) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use egui::{Modifiers, ScrollArea, Vec2, include_image};
|
||||
use egui::{include_image, Modifiers, ScrollArea, Vec2};
|
||||
use egui_kittest::{Harness, SnapshotResults};
|
||||
use kittest::Queryable as _;
|
||||
use kittest::{NodeT, Queryable as _};
|
||||
|
||||
#[test]
|
||||
fn test_shrink() {
|
||||
@@ -214,3 +214,31 @@ fn test_remove_cursor() {
|
||||
"The button appearance should change"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_container_labelled_by() {
|
||||
let mut harness = Harness::new_ui(|ui| {
|
||||
_ = ui.button("Duplicate");
|
||||
|
||||
_ = ui.group(|ui| {
|
||||
let group_label = ui.label("Labelled inside");
|
||||
ui.response().labelled_by(group_label.id);
|
||||
ui.label("Duplicate");
|
||||
});
|
||||
|
||||
let group_label = ui.label("Labelled outside");
|
||||
_ = ui
|
||||
.group(|ui| {
|
||||
ui.label("Duplicate");
|
||||
})
|
||||
.response
|
||||
.labelled_by(group_label.id);
|
||||
});
|
||||
|
||||
let group = harness.get_by_role_and_label(egui::accesskit::Role::GenericContainer, "Labelled inside");
|
||||
group.get_by_label("Duplicate");
|
||||
|
||||
// TODO: This panics, we should make it work somehow
|
||||
let group = harness.get_by_role_and_label(egui::accesskit::Role::GenericContainer, "Labelled outside");
|
||||
group.get_by_label("Duplicate");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user