egui is an easy-to-use immediate mode GUI for Rust that runs on both web and native.
Try it now: https://www.egui.rs/
egui development is sponsored by Rerun, a startup building an SDK for visualizing streams of multimodal data.
egui_kittest
This release welcomes a new crate to the family: egui_kittest.
egui_kittest
is a testing framework for egui, allowing you to test both automation (simulated clicks and other events),
and also do screenshot testing (useful for regression tests).
egui_kittest
is built using kittest
, which is a general GUI testing framework that aims to work with any Rust GUI (not just egui!).
kittest
uses the accessibility library AccessKit
for automatation and to query the widget tree.
kittest
and egui_kittest
are written by @lucasmerlin.
Here's a quick example of how to use egui_kittest
to test a checkbox:
use egui::accesskit::Toggled;
use egui_kittest::{Harness, kittest::Queryable};
fn main() {
let mut checked = false;
let app = |ui: &mut egui::Ui| {
ui.checkbox(&mut checked, "Check me!");
};
let mut harness = egui_kittest::Harness::new_ui(app);
let checkbox = harness.get_by_label("Check me!");
assert_eq!(checkbox.toggled(), Some(Toggled::False));
checkbox.click();
harness.run();
let checkbox = harness.get_by_label("Check me!");
assert_eq!(checkbox.toggled(), Some(Toggled::True));
// You can even render the ui and do image snapshot tests
#[cfg(all(feature = "wgpu", feature = "snapshot"))]
harness.wgpu_snapshot("readme_example");
}
egui changelog
✨ Highlights
- Add
Modal
, a popup that blocks input to the rest of the application (#5358 by @lucasmerlin) - Improved support for transform layers (#5465, #5468, #5429)
⭐ Added
- Add
Modal
andMemory::set_modal_layer
#5358 by @lucasmerlin - Add
UiBuilder::layer_id
and removelayer_id
fromUi::new
#5195 by @emilk - Allow easier setting of background color for
TextEdit
#5203 by @bircni - Set
Response::intrinsic_size
forTextEdit
#5266 by @lucasmerlin - Expose center position in
MultiTouchInfo
#5247 by @lucasmerlin Context::add_font
#5228 by @frederik-uni- Impl from
Box<str>
forWidgetText
,RichText
#5309 by @dimtpap - Add
Window::scroll_bar_visibility
#5231 by @Zeenobit - Add
ComboBox::close_behavior
#5305 by @avalsch - Add
painter.line()
#5291 by @bircni - Allow attaching custom user data to a screenshot command #5416 by @emilk
- Add
Button::image_tint_follows_text_color
#5430 by @emilk - Consume escape keystroke when bailing out from a drag operation #5433 by @abey79
- Add
Context::layer_transform_to_global
&layer_transform_from_global
#5465 by @emilk
🔧 Changed
- Update MSRV to Rust 1.80 #5421, #5457 by @emilk
- Expand max font atlas size from 8k to 16k #5257 by @rustbasic
- Put font data into
Arc
to reduce memory consumption #5276 by @StarStarJ - Move
egui::util::cache
toegui::cache
; addFramePublisher
#5426 by @emilk - Remove
Order::PanelResizeLine
#5455 by @emilk - Drag-and-drop: keep cursor set by user, if any #5467 by @abey79
- Use
profiling
crate to support more profiler backends #5150 by @teddemunnik - Improve hit-test of thin widgets, and widgets across layers #5468 by @emilk
🐛 Fixed
- Update
ScrollArea
drag velocity when drag stopped #5175 by @valadaptive - Fix bug causing wrong-fire of
ViewportCommand::Visible
#5244 by @rustbasic - Fix:
Ui::new_child
does not consider thesizing_pass
field ofUiBuilder
#5262 by @zhatuokun - Fix Ctrl+Shift+Z redo shortcut #5258 by @YgorSouza
- Fix:
Window::default_pos
does not work #5315 by @rustbasic - Fix:
Sides
did not apply the layout position correctly #5303 by @zhatuokun - Respect
Style::override_font_id
inRichText
#5310 by @MStarha - Fix disabled widgets "eating" focus #5370 by @lucasmerlin
- Fix cursor clipping in
TextEdit
inside aScrollArea
#3660 by @juancampa - Make text cursor always appear on click #5420 by @juancampa
- Fix
on_hover_text_at_pointer
for transformed layers #5429 by @emilk - Fix: don't interact with
Area
outside itsconstrain_rect
#5459 by @MScottMcBee - Fix broken images on egui.rs (move from git lfs to normal git) #5480 by @emilk
- Fix:
ui.new_child
should now respectdisabled
#5483 by @emilk - Fix zero-width strokes still affecting the feathering color of boxes #5485 by @emilk
eframe changelog
BREAKING: you now need to enable the wayland
and/or x11
features to get Linux support, including getting it to work on most CI systems.
⭐ Added
- Support
ViewportCommand::Screenshot
on web #5438 by @lucasmerlin
🔧 Changed
- Android support #5318 by @parasyte
- Update MSRV to 1.80 #5457 by @emilk
- Use
profiling
crate to support more profiler backends #5150 by @teddemunnik - Update glow to 0.16 #5395 by @sagudev
- Forward
x11
andwayland
features toglutin
#5391 by @e00E
🐛 Fixed
- iOS: Support putting UI next to the dynamic island #5211 by @frederik-uni
- Prevent panic when copying text outside of a secure context #5326 by @YgorSouza
- Fix accidental change of
FallbackEgl
toPreferEgl
#5408 by @e00E