diff --git a/crates/ui-egui/src/export_window.rs b/crates/ui-egui/src/export_window.rs index 6772698d..3230c7cc 100644 --- a/crates/ui-egui/src/export_window.rs +++ b/crates/ui-egui/src/export_window.rs @@ -298,7 +298,7 @@ fn file_type_lists( let options = parsed.map(depth_options).unwrap_or_default(); let shown = if parsed.is_some() { depth_label(parsed, *bit_depth, *dithering) } else { String::new() }; if options.len() < 2 { - drawn::disabled_combo(ui, rects[1], &shown, tr("Bit depth")); + drawn::disabled_combo(ui, rects[1], ("bits", id), &shown, tr("Bit depth")); return; } diff --git a/crates/ui-egui/src/export_window/drawn.rs b/crates/ui-egui/src/export_window/drawn.rs index ad2604f9..9f92508f 100644 --- a/crates/ui-egui/src/export_window/drawn.rs +++ b/crates/ui-egui/src/export_window/drawn.rs @@ -235,10 +235,10 @@ pub(crate) fn field_button(ui: &mut Ui, rect: Rect, id: Id, text: &str) -> Respo response } -/// A dropdown that cannot be used: a step lighter than the others, its value and chevron dim -pub(crate) fn disabled_combo(ui: &mut Ui, rect: Rect, shown: &str, name: &str) -> Response { +/// A dropdown that cannot be used: a step lighter than the others, its value and chevron dim; `id` tells it from the rows' other ones +pub(crate) fn disabled_combo(ui: &mut Ui, rect: Rect, id: impl std::hash::Hash + std::fmt::Debug, shown: &str, name: &str) -> Response { let look = ExportLook::get(ui.ctx()); - let response = ui.interact(rect, ui.scope_id().with(("export_disabled_combo", name)), Sense::hover()); + let response = ui.interact(rect, ui.scope_id().with(("export_disabled_combo", id)), Sense::hover()); response.widget_info(|| { let mut info = WidgetInfo::labeled(Role::ComboBox, false, name); info.current_text_value = Some(shown.to_owned()); diff --git a/crates/ui-egui/tests/it/export_map_overrides.rs b/crates/ui-egui/tests/it/export_map_overrides.rs index 594c2916..2df31472 100644 --- a/crates/ui-egui/tests/it/export_map_overrides.rs +++ b/crates/ui-egui/tests/it/export_map_overrides.rs @@ -278,3 +278,22 @@ fn a_map_picks_its_own_size_and_the_export_writes_it_at_that_size() { assert_eq!(image::image_dimensions(&path).unwrap(), (side, side), "{}", path.display()); } } + +#[test] +fn rows_with_a_one_depth_file_type_each_have_their_own_bit_depth_list() { + let mut h = harness(); + let rows: Vec = plan(&mut h).iter().take(2).map(|file| file["map"].as_u64().unwrap() as usize).collect(); + let template = h.state().ui.export.preset.clone(); + let mut o = SetExport { maps_template: template, ..SetExport::default() }; + for map in &rows { + o.maps.insert(*map, MapExport { enabled: true, file_type: Some(FileType { format: "bmp".into(), bit_depth: 8, dithering: false }), size: None }); + } + h.state_mut().ui.export.sets.insert(0, o); + h.run_steps(4); + + let greyed: Vec<_> = h.get_all_by_role_and_label(egui::Role::ComboBox, "Bit depth").map(|node| node.accesskit_node().id()).collect(); + + assert_eq!(rows.len(), 2); + assert_eq!(greyed.len(), 2, "each row's greyed bit depth list is its own node"); + assert_ne!(greyed[0], greyed[1]); +}