diff --git a/crates/ui-egui/src/workflows/combine_ui/table.rs b/crates/ui-egui/src/workflows/combine_ui/table.rs index 886393a274..216ba6f12c 100644 --- a/crates/ui-egui/src/workflows/combine_ui/table.rs +++ b/crates/ui-egui/src/workflows/combine_ui/table.rs @@ -1,7 +1,7 @@ use std::cell::RefCell; use std::time::SystemTime; -use craft::behavior::{Codec, ColumnKey, ColumnWidth, DisplayOrder, EditEvent, IconId, ItemSource, NotAValue, ReorderKeys}; +use craft::behavior::{ColumnKey, ColumnWidth, DisplayOrder, EditEvent, IconId, ItemSource, ReorderKeys}; use craft::theme::variant::Tone; use craft::ui::contract::{ Bind, CollectionEvent, ColumnEvent, ColumnLayout, ColumnSort, ColumnSpec, Entry, Props as _, ReorderMove, ReorderRule, ShowCollection as _, @@ -13,7 +13,7 @@ use craft::ui::table::Table; use craft::ui::text::TextField; // PLAN: assumed `CombineKey::{File(u64), Page(u64, usize)}` in `files` (pdf-workflows-w5) -use super::files::{CombineFile, CombineKey, Lock, RowAction, SortKey, takes_range}; +use super::files::{CombineFile, CombineKey, Lock, RowAction, SortKey}; use super::parts::utc_stamp; use crate::PdfCraftApp; @@ -67,26 +67,6 @@ pub(crate) fn columns_from_legacy(value: &serde_json::Value) -> Option String { - v.clone() - } - - fn parse(&self, text: &str, _: &String) -> Result { - // The row's Pages tip shows the reason (`range_tip`); the codec can only refuse. - takes_range(self.count, text).map(|_| text.to_owned()).map_err(|_| NotAValue) - } -} - /// The files as a collection source, keyed by id, in the order of the list. struct Files<'a> { ids: &'a [u64], @@ -120,9 +100,9 @@ impl ItemSource for Files<'_> {} struct RowData { name: String, range: String, - pages: usize, editable: bool, range_tip: String, + range_count: String, size: String, modified: Option<(u64, String)>, status: Option<(Tone, String, String)>, @@ -172,12 +152,18 @@ fn row_data(app: &mut PdfCraftApp, checks: &[Result]) -> Vec Option list.cell(MODIFIED, icx.env.relative_age(*age, craft::i18n::AgeStyle::Short)).cell_tip(MODIFIED, stamp.clone()), None => list.cell(MODIFIED, "—"), diff --git a/crates/ui-egui/tests/it/editing.rs b/crates/ui-egui/tests/it/editing.rs index 3563b664de..f7263ea2b1 100644 --- a/crates/ui-egui/tests/it/editing.rs +++ b/crates/ui-egui/tests/it/editing.rs @@ -1614,14 +1614,23 @@ fn column_headings_sort_the_list_and_flip_on_the_second_click() { #[test] fn ctrl_and_shift_clicks_select_several_files_that_move_and_go_together() { let mut h = combine_of(&[("a.pdf", 1), ("b.pdf", 1), ("c.pdf", 1), ("d.pdf", 1), ("e.pdf", 1)]); - // The rows, not their name cells. - h.get_by_role_and_label(Role::ListItem, "b.pdf").click(); - h.run_steps(1); - h.get_by_role_and_label(Role::ListItem, "d.pdf").click_modifiers(Modifiers::SHIFT); - h.run_steps(1); + // The widened Pages editor covers the row's center; click the row outside that editor. + let click_row = |h: &mut Harness<'static, PdfCraftApp>, label: &str, modifiers: Modifiers| { + let rect = h.get_by_role_and_label(Role::ListItem, label).rect(); + let at = egui::pos2(rect.left() + 20.0, rect.center().y); + h.input_mut().events.extend([ + egui::Event::PointerMoved(at), + egui::Event::ModifiersChanged(modifiers), + egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed: true, modifiers }, + egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed: false, modifiers }, + egui::Event::ModifiersChanged(Modifiers::NONE), + ]); + h.run_steps(2); + }; + click_row(&mut h, "b.pdf", Modifiers::NONE); + click_row(&mut h, "d.pdf", Modifiers::SHIFT); assert_eq!(h.state().combine_selection(), [1, 2, 3]); - h.get_by_role_and_label(Role::ListItem, "c.pdf").click_modifiers(Modifiers::COMMAND); - h.run_steps(1); + click_row(&mut h, "c.pdf", Modifiers::COMMAND); assert_eq!(h.state().combine_selection(), [1, 3], "Ctrl/⌘ toggles one file"); h.get_by_label("2 selected"); h.get_by_label("Move up").click();