From 228d879a1d2ac352c95d7d9bb2ef2d0645cd7739 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Mon, 2 Nov 2026 15:40:00 +0700 Subject: [PATCH] Fill channel image test: scroll the channel into view The projection rows push the Roughness channel below the Properties panel's edge, where a click on its menu button lands outside the panel. The test scrolls the channel into view and waits for the scroll. --- crates/ui-egui/tests/fill_channel_image.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/tests/fill_channel_image.rs b/crates/ui-egui/tests/fill_channel_image.rs index b87a0052..a57a66f6 100644 --- a/crates/ui-egui/tests/fill_channel_image.rs +++ b/crates/ui-egui/tests/fill_channel_image.rs @@ -6,6 +6,11 @@ use serde_json::json; use texturecraft_engine::core::{Channel, LayerId, LayerKind, Source}; use texturecraft_ui_egui::TextureCraftApp; +/// The Roughness channel's name in Properties (the rightmost "Roughness" label). +fn roughness<'a>(h: &'a Harness<'_, TextureCraftApp>) -> egui_kittest::Node<'a> { + h.get_all_by_label("Roughness").max_by(|a, b| a.rect().right().total_cmp(&b.rect().right())).unwrap() +} + #[test] fn a_fill_channel_takes_an_image_from_its_source_menu() { let mut session = texturecraft_engine::sample_session(256, 64).unwrap(); @@ -19,8 +24,11 @@ fn a_fill_channel_takes_an_image_from_its_source_menu() { h.state_mut().ui.prefs.language = "en".into(); h.run_steps(4); - // The source menu button sits in the row of the channel's name. - let row = h.get_all_by_label("Roughness").map(|n| n.rect()).max_by(|a, b| a.right().total_cmp(&b.right())).unwrap().center().y; + // The source menu button sits in the row of the channel's name, scrolled into view first. + roughness(&h).scroll_to_me(); + // The scroll animates for about twenty frames. + h.run_steps(30); + let row = roughness(&h).rect().center().y; let menu = h.get_all_by_label(egui_phosphor::regular::DOTS_THREE).find(|n| (n.rect().center().y - row).abs() < 6.0).unwrap(); menu.click(); h.run_steps(2);