Image menu: scroll a long list; the test speaks English

With many images, the list now scrolls so Import... and the items after
it stay on screen. The UI test sets English, as a first run would speak
the system's language.
This commit is contained in:
bflatastic committed 2026-11-02 14:11:23 +07:00
1 parent 6d71d2fc38
commit 699596835e
2 files changed
+9 -4

No files matched your search

+7 -4
View File
@@ -849,11 +849,14 @@ pub(crate) fn texture_set_settings(app: &mut TextureCraftApp, ui: &mut Ui) {
fn image_menu(app: &mut TextureCraftApp, ui: &mut Ui) -> Option<String> {
ui.label(caption(tr("Images")));
let mut picked = None;
for name in app.session.doc.resources.keys() {
if ui.button(name.as_str()).clicked() {
picked = Some(name.clone());
// Bounded, so Import... and the items after it stay on screen with many images.
egui::ScrollArea::vertical().id_salt("image_menu").max_height(240.0).show(ui, |ui| {
for name in app.session.doc.resources.keys() {
if ui.button(name.as_str()).clicked() {
picked = Some(name.clone());
}
}
}
});
if ui.button(tr("Import...")).clicked() {
crate::menus::invoke(app, ui.ctx(), "resource.import");
ui.close();
@@ -15,6 +15,8 @@ fn a_fill_channel_takes_an_image_from_its_source_menu() {
let out = texturecraft_engine::execute(&mut session, "layer.add.fill", &json!({"roughness": 0.6})).unwrap();
let layer = LayerId(out["layer"].as_u64().unwrap());
let mut h = Harness::builder().with_size(egui::vec2(1600.0, 1400.0)).build_eframe(|cc| TextureCraftApp::new(cc, session));
// The labels below are English; a first run would speak the system's language.
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.