File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,15 @@ impl<'a> Atoms<'a> {
42
42
}
43
43
}
44
44
}
45
+
46
+ // If there is no text, try to find an image with alt text.
47
+ if string. is_none ( ) {
48
+ string = self . iter ( ) . find_map ( |a| match & a. kind {
49
+ AtomKind :: Image ( image) => image. alt_text . as_deref ( ) . map ( Cow :: Borrowed ) ,
50
+ _ => None ,
51
+ } ) ;
52
+ }
53
+
45
54
string
46
55
}
47
56
Original file line number Diff line number Diff line change
1
+ use egui:: { include_image, Image } ;
2
+ use egui_kittest:: kittest:: Queryable as _;
3
+ use egui_kittest:: Harness ;
4
+
5
+ #[ test]
6
+ fn image_button_should_have_alt_text ( ) {
7
+ let harness = Harness :: new_ui ( |ui| {
8
+ _ = ui. button (
9
+ Image :: new ( include_image ! ( "../../../crates/eframe/data/icon.png" ) ) . alt_text ( "Egui" ) ,
10
+ ) ;
11
+ } ) ;
12
+
13
+ harness. get_by_label ( "Egui" ) ;
14
+ }
You can’t perform that action at this time.
0 commit comments