Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Integration: #8190 test that the theme swatch star badge on hover does not move the next swatch

aiongg7da9c62e4ade
diff --git a/crates/ui-egui/src/prefs_ui.rs b/crates/ui-egui/src/prefs_ui.rs
index 12ae9e960..af0574ba0 100644
--- a/crates/ui-egui/src/prefs_ui.rs
+++ b/crates/ui-egui/src/prefs_ui.rs
@@ -3120,6 +3120,27 @@ mod tests {
assert_eq!(dark, vec![ThemeKind::Studio]);
}
+ /// The favourite star badge overhangs its swatch; showing it on hover must not move the swatches
+ /// after it, or the row would shift under the pointer.
+ #[test]
+ fn theme_star_badge_on_hover_does_not_move_the_next_swatch() {
+ use egui_kittest::{Harness, kittest::Queryable};
+ let (mut app, _) = app_with_store();
+ open_preferences(&mut app, "interface");
+ let mut h = Harness::builder().with_size(vec2(1280.0, 800.0)).build_eframe(move |cc| {
+ PhotocraftApp::setup_context(&cc.egui_ctx, Default::default());
+ app
+ });
+ h.run_steps(4);
+ let first = h.get_by_label("Classic").rect();
+ let next = h.get_by_label("Adwaita").rect();
+ h.hover_at(first.right_top() + vec2(-3.0, 3.0));
+ h.run_steps(3);
+ assert!(h.query_by_label("Add to favorites: Classic").is_some(), "the badge shows while the swatch is hovered");
+ assert_eq!(h.get_by_label("Classic").rect(), first);
+ assert_eq!(h.get_by_label("Adwaita").rect(), next);
+ }
+
#[test]
fn preferences_interface_shows_language_without_scrolling() {
// #2532: in a small window the theme cards filled the page and Language sat out of view