team-ljyzipelo

공개

Merge pull request #94 from Team-LJY/features/explorer-selection

파일 목록에 탐색기 방식 선택 적용
작성자
LeeJunyoung
작성 시각
커밋
606b59b62429a66110df2b94847818b71f38a59d
이 시점의 파일 보기

변경된 파일 10개

+1,445-124
수정experiments/rust-ui-memory-app/src/archive_screen.rs+370-121
@@ -11,6 +11,15 @@ use std::{
1111 path::{Path, PathBuf},
1212};
1313
14추가: struct Marquee {
15추가: // 스크롤 중에도 시작점을 목록 좌표로 유지함.
16추가: origin: egui::Pos2,
17추가: base: BTreeSet<u32>,
18추가: moved: bool,
19추가: }
20추가:
21추가: const LIST_ROW: f32 = 44.0;
22추가:
1423pub struct ArchiveApp {
1524 pub model: Model,
1625 factory: Box<dyn Factory>,
@@ -32,6 +41,11 @@ pub struct ArchiveApp {
3241 dialogs: Box<dyn Dialogs>,
3342 folder: String,
3443 search: String,
44추가: list_anchor: Option<usize>,
45추가: list_cursor: Option<usize>,
46추가: list_offset: f32,
47추가: list_focused: bool,
48추가: marquee: Option<Marquee>,
3549 last_request: Option<Start>,
3650 targets: Option<BTreeSet<String>>,
3751 directories: BTreeSet<String>,
@@ -65,6 +79,11 @@ impl ArchiveApp {
6579 dialogs: Box::new(NativeDialogs),
6680 folder: String::new(),
6781 search: String::new(),
82추가: list_anchor: None,
83추가: list_cursor: None,
84추가: list_offset: 0.0,
85추가: list_focused: false,
86추가: marquee: None,
6887 last_request: None,
6988 targets: None,
7089 directories: BTreeSet::new(),
@@ -87,6 +106,7 @@ impl ArchiveApp {
87106 pub fn browse_folder(&mut self, folder: &str) {
88107 self.folder = folder.trim_matches('/').to_owned();
89108 self.search.clear();
109추가: self.clear_list_selection();
90110 }
91111
92112 pub fn show_create(&mut self, encrypted: bool) {
@@ -116,6 +136,7 @@ impl ArchiveApp {
116136 self.selected_only = false;
117137 self.folder.clear();
118138 self.search.clear();
139추가: self.clear_list_selection();
119140 self.targets = None;
120141 self.directories.clear();
121142 self.start(Start::List { archive });
@@ -185,9 +206,26 @@ impl ArchiveApp {
185206 }
186207
187208 pub fn begin_extract(&mut self) -> bool {
188삭제: if !self.model.can_extract() || (self.selected_only && self.model.selected.is_empty()) {
209추가: self.selected_only = !self.model.selected.is_empty();
210추가: let selection = if self.selected_only {
211추가: Selection::EntryIds(
212추가: browser::expand_selection(&self.model.entries, &self.model.selected)
213추가: .into_iter()
214추가: .collect(),
215추가: )
216추가: } else {
217추가: Selection::All
218추가: };
219추가: self.extract_selection(selection)
220추가: }
221추가:
222추가: fn extract_selection(&mut self, selection: Selection) -> bool {
223추가: if !self.model.can_extract()
224추가: || matches!(&selection, Selection::EntryIds(ids) if ids.is_empty())
225추가: {
189226 return false;
190227 }
228추가: self.selected_only = matches!(&selection, Selection::EntryIds(_));
191229 match present::prepare_destination(&self.destination, self.automatic_destination) {
192230 Ok(true) => self.owned_destination = Some(self.destination.clone()),
193231 Ok(false) => self.owned_destination = None,
@@ -201,15 +239,6 @@ impl ArchiveApp {
201239 .list_id
202240 .as_ref()
203241 .is_some_and(|id| id.format == Format::Gzip);
204삭제: let selection = if self.selected_only {
205삭제: Selection::EntryIds(
206삭제: browser::expand_selection(&self.model.entries, &self.model.selected)
207삭제: .into_iter()
208삭제: .collect(),
209삭제: )
210삭제: } else {
211삭제: Selection::All
212삭제: };
213242 self.targets = present::target_files(
214243 &self.model.entries,
215244 &selection,
@@ -395,14 +424,10 @@ impl ArchiveApp {
395424 gzip_output_name,
396425 ..
397426 } => {
398삭제: self.selected_only = matches!(selection, Selection::EntryIds(_));
399삭제: if let Selection::EntryIds(ids) = selection {
400삭제: self.model.selected = ids.into_iter().collect();
401삭제: }
402427 if let Some(name) = gzip_output_name {
403428 self.gzip_name = name;
404429 }
405삭제: self.begin_extract();
430추가: self.extract_selection(selection);
406431 }
407432 Start::CreateZip { .. } => {
408433 self.create = true;
@@ -549,7 +574,14 @@ impl ArchiveApp {
549574 ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
550575 theme::bounded_text(
551576 ui,
552삭제: &format!("선택 {}개", self.model.selected.len()),
577추가: &format!(
578추가: "선택 {}개",
579추가: browser::rows(&self.model.entries, &self.folder, &self.search)
580추가: .iter()
581추가: .filter(|row| !row.ids.is_empty()
582추가: && row.ids.is_subset(&self.model.selected))
583추가: .count()
584추가: ),
553585 width,
554586 );
555587 });
@@ -697,86 +729,188 @@ impl ArchiveApp {
697729 .hint_text("파일 찾기"),
698730 );
699731 theme::focus(&search);
732추가: if search.changed() {
733추가: self.clear_list_selection();
734추가: }
700735 });
701736 });
702737 let rows = browser::rows(&self.model.entries, &self.folder, &self.search);
703삭제: let visible = rows
704삭제: .iter()
705삭제: .flat_map(|row| row.ids.iter().copied())
706삭제: .collect::<BTreeSet<_>>();
707삭제: let mut all = !visible.is_empty() && visible.is_subset(&self.model.selected);
708삭제: let name_width = (ui.available_width() - 32.0 - 96.0 - 64.0 - 64.0).max(160.0);
738추가:
739추가: let name_width = (ui.available_width() - 16.0 - 28.0 - 96.0 - 64.0 - 40.0).max(120.0);
709740 ui.horizontal(|ui| {
710삭제: ui.add_space(16.0);
711삭제: let check = ui
712삭제: .add_enabled(
713삭제: !self.model.busy() && !visible.is_empty(),
714삭제: egui::Checkbox::without_text(&mut all),
715삭제: )
716삭제: .on_hover_text("전체 선택");
717삭제: if check.changed() {
718삭제: if all {
719삭제: self.model.selected.extend(&visible);
720삭제: } else {
721삭제: browser::remove_selection(
722삭제: &self.model.entries,
723삭제: &mut self.model.selected,
724삭제: &visible,
725삭제: );
726삭제: }
727삭제: }
728삭제: theme::focus(&check);
741추가: ui.add_space(16.0 + 28.0);
729742 theme::column_label(ui, RichText::new("이름").strong(), name_width, Align::Min);
730743 theme::column_label(ui, "크기", 96.0, Align::Max);
731744 theme::column_label(ui, "암호", 64.0, Align::Min);
732745 });
733746 ui.separator();
734삭제: if rows.is_empty() {
735삭제: ui.centered_and_justified(|ui| {
736삭제: ui.label(if self.search.is_empty() {
737삭제: "이 폴더는 비어 있습니다"
738삭제: } else {
739삭제: "일치하는 항목이 없습니다"
740삭제: });
747추가: let active = !self.model.busy()
748추가: && !self.create
749추가: && self.model.challenge.is_none()
750추가: && self.model.close == Close::Open;
751추가: let list_id = egui::Id::unique("archive-list");
752추가: let background = ui.interact(
753추가: ui.available_rect_before_wrap(),
754추가: list_id,
755추가: if active {
756추가: egui::Sense::click_and_drag()
757추가: } else {
758추가: egui::Sense::hover()
759추가: },
760추가: );
761추가: background
762추가: .widget_info(|| egui::WidgetInfo::labeled(egui::Role::ListBox, active, "파일 목록"));
763추가: if background.has_focus() {
764추가: ui.ctx().memory_mut(|memory| {
765추가: memory.set_focus_lock_filter(
766추가: list_id,
767추가: egui::EventFilter {
768추가: vertical_arrows: true,
769추가: escape: true,
770추가: ..Default::default()
771추가: },
772추가: )
741773 });
742삭제: return;
743774 }
744삭제: egui::ScrollArea::vertical()
775추가: let mut focused = None;
776추가: let mut open = None;
777추가: let mut next_offset = None;
778추가: let output = egui::ScrollArea::vertical()
745779 .id_salt("archive-rows")
746780 .auto_shrink([false, false])
747삭제: .show_rows(ui, 38.0, rows.len(), |ui, range| {
748삭제: for index in range {
749삭제: let row = &rows[index];
750삭제: let mut selected =
751삭제: !row.ids.is_empty() && row.ids.is_subset(&self.model.selected);
752삭제: let response = ui
753삭제: .horizontal(|ui| {
754삭제: ui.set_min_height(36.0);
755삭제: ui.add_space(16.0);
756삭제: let check = ui.add_enabled(
757삭제: !self.model.busy() && !row.ids.is_empty(),
758삭제: egui::Checkbox::without_text(&mut selected),
759삭제: );
760삭제: check.widget_info(|| {
761삭제: egui::WidgetInfo::selected(
762삭제: egui::Role::CheckBox,
763삭제: !self.model.busy(),
764삭제: selected,
765삭제: &row.name,
766삭제: )
767삭제: });
768삭제: theme::focus(&check);
769삭제: if check.changed() {
770삭제: if selected {
781추가: .vertical_scroll_offset(self.list_offset)
782추가: .show_viewport(ui, |ui, viewport| {
783추가: let origin = ui.max_rect().min;
784추가: let clip = ui.clip_rect();
785추가: let width = (ui.available_width() - 24.0).max(0.0);
786추가: ui.set_min_height((rows.len() as f32 * LIST_ROW).max(viewport.height()));
787추가: let point = ui.input(|i| i.pointer.interact_pos());
788추가: if active && let Some(point) = point {
789추가: let press = ui.input(|i| i.pointer.press_origin()).unwrap_or(point);
790추가: let relative = press - origin;
791추가: let in_row = relative.x >= 0.0
792추가: && relative.x <= width
793추가: && relative.y >= 0.0
794추가: && relative.y < rows.len() as f32 * LIST_ROW;
795추가: if clip.contains(press) && !in_row && ui.input(|i| i.pointer.primary_pressed())
796추가: {
797추가: background.request_focus();
798추가: let ctrl = ui.input(|i| i.modifiers.ctrl || i.modifiers.command);
799추가: self.marquee = Some(Marquee {
800추가: origin: relative.to_pos2(),
801추가: base: if ctrl {
802추가: self.model.selected.clone()
803추가: } else {
804추가: BTreeSet::new()
805추가: },
806추가: moved: false,
807추가: });
808추가: if !ctrl {
809추가: self.model.selected.clear();
810추가: self.list_anchor = None;
811추가: self.list_cursor = None;
812추가: }
813추가: }
814추가: if let Some(drag) = &mut self.marquee {
815추가: let end = (point.clamp(clip.min, clip.max) - origin).to_pos2();
816추가: drag.moved |= drag.origin.distance(end) > 3.0;
817추가: if drag.moved {
818추가: let rect = egui::Rect::from_two_pos(drag.origin, end);
819추가: self.model.selected = drag.base.clone();
820추가: if rect.left() < width && rect.right() > 0.0 {
821추가: let first = (rect.top().max(0.0) / LIST_ROW).floor() as usize;
822추가: let last = ((rect.bottom().max(0.0) / LIST_ROW).ceil() as usize)
823추가: .min(rows.len());
824추가: for row in rows.iter().take(last).skip(first) {
771825 self.model.selected.extend(&row.ids);
772삭제: } else {
773삭제: browser::remove_selection(
774삭제: &self.model.entries,
775삭제: &mut self.model.selected,
776삭제: &row.ids,
777삭제: );
778826 }
827추가: if first < last {
828추가: self.list_anchor = Some(first);
829추가: self.list_cursor = Some(last - 1);
830추가: }
831추가: }
832추가: let speed = if point.y > clip.bottom() - 24.0 {
833추가: ((point.y - clip.bottom() + 24.0) / 24.0).clamp(0.0, 3.0)
834추가: } else if point.y < clip.top() + 24.0 {
835추가: -((clip.top() + 24.0 - point.y) / 24.0).clamp(0.0, 3.0)
836추가: } else {
837추가: 0.0
838추가: };
839추가: if ui.input(|i| i.pointer.primary_down()) && speed != 0.0 {
840추가: let dt = ui.input(|i| i.stable_dt).clamp(0.001, 0.05);
841추가: next_offset = Some((viewport.min.y + speed * 500.0 * dt).clamp(
842추가: 0.0,
843추가: (rows.len() as f32 * LIST_ROW - viewport.height()).max(0.0),
844추가: ));
845추가: ui.ctx().request_repaint();
779846 }
847추가: }
848추가: }
849추가: }
850추가: let first = (viewport.min.y / LIST_ROW).floor() as usize;
851추가: let last = ((viewport.max.y / LIST_ROW).ceil() as usize + 1).min(rows.len());
852추가: for index in first.min(rows.len())..last {
853추가: let row = &rows[index];
854추가: let rect = egui::Rect::from_min_size(
855추가: origin + egui::vec2(0.0, index as f32 * LIST_ROW),
856추가: egui::vec2(width, LIST_ROW),
857추가: );
858추가: let selected = !row.ids.is_empty() && row.ids.is_subset(&self.model.selected);
859추가: let response = ui
860추가: .interact(
861추가: rect,
862추가: egui::Id::unique(("archive-row", &row.path)),
863추가: if active {
864추가: egui::Sense::click()
865추가: } else {
866추가: egui::Sense::hover()
867추가: },
868추가: )
869추가: .on_hover_text(&row.name);
870추가: response.widget_info(|| {
871추가: egui::WidgetInfo::selected(
872추가: egui::Role::ListBoxOption,
873추가: active,
874추가: selected,
875추가: &row.name,
876추가: )
877추가: });
878추가: if response.has_focus() {
879추가: focused = Some(index);
880추가: ui.ctx().memory_mut(|memory| {
881추가: memory.set_focus_lock_filter(
882추가: response.id,
883추가: egui::EventFilter {
884추가: vertical_arrows: true,
885추가: escape: true,
886추가: ..Default::default()
887추가: },
888추가: )
889추가: });
890추가: }
891추가: if selected {
892추가: ui.painter().rect_filled(rect, 0, theme::SELECTED);
893추가: }
894추가: if response.clicked() {
895추가: background.request_focus();
896추가: let modifiers = ui.input(|i| i.modifiers);
897추가: self.select_row(
898추가: &rows,
899추가: index,
900추가: modifiers.ctrl || modifiers.command,
901추가: modifiers.shift,
902추가: );
903추가: }
904추가: if row.directory && response.double_clicked() {
905추가: open = Some(row.path.clone());
906추가: }
907추가: ui.scope_builder(
908추가: egui::UiBuilder::new()
909추가: .max_rect(rect.shrink2(egui::vec2(0.0, 4.0)))
910추가: .layout(Layout::left_to_right(Align::Center)),
911추가: |ui| {
912추가: ui.style_mut().interaction.selectable_labels = false;
913추가: ui.add_space(16.0);
780914 theme::icon(
781915 ui,
782916 if row.directory {
@@ -786,41 +920,7 @@ impl ArchiveApp {
786920 },
787921 20.0,
788922 );
789삭제: let label = ui
790삭제: .allocate_ui_with_layout(
791삭제: egui::vec2((name_width - 28.0).max(0.0), 34.0),
792삭제: Layout::left_to_right(Align::Center),
793삭제: |ui| {
794삭제: ui.set_min_width((name_width - 28.0).max(0.0));
795삭제: ui.set_max_width((name_width - 28.0).max(0.0));
796삭제: ui.add_enabled(
797삭제: !self.model.busy(),
798삭제: egui::Button::new(&row.name)
799삭제: .truncate()
800삭제: .selected(selected)
801삭제: .frame(false)
802삭제: .min_size(egui::vec2(0.0, 34.0)),
803삭제: )
804삭제: },
805삭제: )
806삭제: .inner
807삭제: .on_hover_text(&row.name);
808삭제: theme::focus(&label);
809삭제: let enter =
810삭제: label.has_focus() && ui.input(|i| i.key_pressed(egui::Key::Enter));
811삭제: if row.directory && (label.double_clicked() || enter) {
812삭제: self.browse_folder(&row.path);
813삭제: } else if !row.directory && label.clicked() {
814삭제: if selected {
815삭제: browser::remove_selection(
816삭제: &self.model.entries,
817삭제: &mut self.model.selected,
818삭제: &row.ids,
819삭제: );
820삭제: } else {
821삭제: self.model.selected.extend(&row.ids);
822삭제: }
823삭제: }
923추가: theme::bounded_text(ui, &row.name, name_width);
824924 theme::column_label(
825925 ui,
826926 if row.directory {
@@ -836,15 +936,164 @@ impl ArchiveApp {
836936 if row.encrypted {
837937 theme::icon(ui, Icon::Lock, 16.0);
838938 }
839삭제: })
840삭제: .response;
841삭제: ui.painter().hline(
842삭제: response.rect.x_range(),
843삭제: response.rect.bottom(),
844삭제: egui::Stroke::new(1.0, theme::BORDER),
939추가: },
940추가: );
941추가: if active
942추가: && self.list_cursor == Some(index)
943추가: && (response.has_focus() || background.has_focus())
944추가: {
945추가: ui.painter().rect_stroke(
946추가: rect.shrink(1.0),
947추가: 0,
948추가: egui::Stroke::new(1.0, theme::BLUE),
949추가: egui::StrokeKind::Inside,
950추가: );
951추가: }
952추가: }
953추가: if rows.is_empty() {
954추가: ui.scope_builder(egui::UiBuilder::new().max_rect(clip), |ui| {
955추가: ui.centered_and_justified(|ui| {
956추가: ui.label(if self.search.is_empty() {
957추가: "이 폴더는 비어 있습니다"
958추가: } else {
959추가: "일치하는 항목이 없습니다"
960추가: })
961추가: });
962추가: });
963추가: }
964추가: if let Some(drag) = &self.marquee
965추가: && drag.moved
966추가: && let Some(point) = point
967추가: {
968추가: let rect = egui::Rect::from_two_pos(
969추가: origin + drag.origin.to_vec2(),
970추가: point.clamp(clip.min, clip.max),
971추가: );
972추가: ui.painter().with_clip_rect(clip).rect(
973추가: rect,
974추가: 0,
975추가: theme::BLUE.gamma_multiply(0.16),
976추가: egui::Stroke::new(1.0, theme::BLUE),
977추가: egui::StrokeKind::Inside,
845978 );
846979 }
847980 });
981추가: self.list_offset = next_offset.unwrap_or(output.state.clamped_offset().y);
982추가: if ui.input(|i| i.pointer.primary_released() || !i.pointer.primary_down()) {
983추가: self.marquee = None;
984추가: }
985추가: let escape_from_list = self.list_focused
986추가: && ui.ctx().memory(|memory| memory.focused()).is_none()
987추가: && ui.input(|i| i.key_pressed(egui::Key::Escape));
988추가: self.list_focused =
989추가: active && (background.has_focus() || focused.is_some() || escape_from_list);
990추가: if self.list_focused {
991추가: if let Some(index) = focused {
992추가: self.list_cursor = Some(index);
993추가: }
994추가: let modifiers = ui.input(|i| i.modifiers);
995추가: let ctrl = modifiers.ctrl || modifiers.command;
996추가: if ui.input(|i| i.key_pressed(egui::Key::Escape)) {
997추가: self.model.selected.clear();
998추가: self.marquee = None;
999추가: background.request_focus();
1000추가: }
1001추가: if ctrl && ui.input(|i| i.key_pressed(egui::Key::A)) {
1002추가: self.model.selected = rows
1003추가: .iter()
1004추가: .flat_map(|row| row.ids.iter().copied())
1005추가: .collect();
1006추가: self.list_cursor = (!rows.is_empty()).then_some(0);
1007추가: self.list_anchor = self.list_cursor;
1008추가: }
1009추가: if !rows.is_empty() {
1010추가: let direction = if ui.input(|i| i.key_pressed(egui::Key::ArrowDown)) {
1011추가: Some(1isize)
1012추가: } else if ui.input(|i| i.key_pressed(egui::Key::ArrowUp)) {
1013추가: Some(-1)
1014추가: } else {
1015추가: None
1016추가: };
1017추가: if let Some(direction) = direction {
1018추가: let index = self.list_cursor.map_or(0, |index| {
1019추가: index.saturating_add_signed(direction).min(rows.len() - 1)
1020추가: });
1021추가: if ctrl && !modifiers.shift {
1022추가: self.list_cursor = Some(index);
1023추가: } else {
1024추가: self.select_row(&rows, index, ctrl, modifiers.shift);
1025추가: }
1026추가: background.request_focus();
1027추가: let top = index as f32 * LIST_ROW;
1028추가: if top < self.list_offset {
1029추가: self.list_offset = top;
1030추가: } else if top + LIST_ROW > self.list_offset + output.inner_rect.height() {
1031추가: self.list_offset = top + LIST_ROW - output.inner_rect.height();
1032추가: }
1033추가: ui.ctx().request_repaint();
1034추가: }
1035추가: if ui.input(|i| i.key_pressed(egui::Key::Enter)) {
1036추가: let index = self
1037추가: .list_cursor
1038추가: .or(focused)
1039추가: .unwrap_or(0)
1040추가: .min(rows.len() - 1);
1041추가: if rows[index].directory {
1042추가: open = Some(rows[index].path.clone());
1043추가: }
1044추가: }
1045추가: }
1046추가: if ui.input(|i| i.key_pressed(egui::Key::Backspace)) && !self.folder.is_empty() {
1047추가: open = Some(
1048추가: self.folder
1049추가: .rsplit_once('/')
1050추가: .map_or("", |(parent, _)| parent)
1051추가: .to_owned(),
1052추가: );
1053추가: }
1054추가: }
1055추가: if let Some(folder) = open {
1056추가: self.browse_folder(&folder);
1057추가: background.request_focus();
1058추가: }
1059추가: }
1060추가:
1061추가: fn clear_list_selection(&mut self) {
1062추가: self.model.selected.clear();
1063추가: self.list_anchor = None;
1064추가: self.list_cursor = None;
1065추가: self.list_offset = 0.0;
1066추가: self.marquee = None;
1067추가: }
1068추가:
1069추가: fn select_row(&mut self, rows: &[browser::Row], index: usize, ctrl: bool, shift: bool) {
1070추가: if shift {
1071추가: let anchor = self
1072추가: .list_anchor
1073추가: .unwrap_or(self.list_cursor.unwrap_or(index))
1074추가: .min(rows.len() - 1);
1075추가: if !ctrl {
1076추가: self.model.selected.clear();
1077추가: }
1078추가: for row in &rows[anchor.min(index)..=anchor.max(index)] {
1079추가: self.model.selected.extend(&row.ids);
1080추가: }
1081추가: self.list_anchor = Some(anchor);
1082추가: } else {
1083추가: if !ctrl {
1084추가: self.model.selected.clear();
1085추가: }
1086추가: if ctrl && rows[index].ids.is_subset(&self.model.selected) {
1087추가: // 폴더 이동 시 선택을 지우므로 현재 행의 ID만 제거함.
1088추가: self.model
1089추가: .selected
1090추가: .retain(|id| !rows[index].ids.contains(id));
1091추가: } else {
1092추가: self.model.selected.extend(&rows[index].ids);
1093추가: }
1094추가: self.list_anchor = Some(index);
1095추가: }
1096추가: self.list_cursor = Some(index);
8481097 }
8491098
8501099 fn result_visible(&self) -> bool {
수정tests/rust-app-real-worker/selection_flows.rs+59-0
@@ -228,3 +228,62 @@ fn auto_destination_is_private_under_desktop_umask() {
228228 );
229229 assert_reaped(&observed);
230230}
231추가:
232추가: #[test]
233추가: fn explorer_folder_click_and_escape_control_actual_extraction_scope() {
234추가: let scratch = Scratch::new();
235추가: let folder = make_directory(&scratch.path("docs"));
236추가: fs::write(folder.join("child.txt"), b"selected subtree").unwrap();
237추가: let outside = scratch.path("outside.txt");
238추가: fs::write(&outside, b"outside subtree").unwrap();
239추가: let archive = scratch.path("picked.zip");
240추가: let selected_output = make_directory(&scratch.path("selected-output"));
241추가: let all_output = make_directory(&scratch.path("all-output"));
242추가: let (factory, observed) = observed_factory();
243추가: let mut screen = Screen::new(factory);
244추가: screen.app.add_sources(vec![folder, outside]);
245추가: screen.render(vec![]);
246추가: screen.set_text("zip-name", "picked.zip");
247추가: screen.click("압축하기");
248추가: screen.settle();
249추가: screen.open(&archive);
250추가: screen.click("docs");
251추가: assert!(!screen.app.model.selected.is_empty());
252추가: screen.extract(&selected_output);
253추가: assert_eq!(
254추가: fs::read(selected_output.join("docs/child.txt")).unwrap(),
255추가: b"selected subtree"
256추가: );
257추가: assert!(!selected_output.join("outside.txt").exists());
258추가: assert!(matches!(
259추가: observed.borrow().starts.last(),
260추가: Some(Start::Extract {
261추가: selection: Selection::EntryIds(_),
262추가: ..
263추가: })
264추가: ));
265추가: screen.click("확인");
266추가: screen
267추가: .context
268추가: .memory_mut(|memory| memory.request_focus(egui::Id::unique("archive-list")));
269추가: screen.render(vec![]);
270추가: screen.escape();
271추가: assert!(screen.app.model.selected.is_empty());
272추가: screen.extract(&all_output);
273추가: assert_eq!(
274추가: fs::read(all_output.join("outside.txt")).unwrap(),
275추가: b"outside subtree"
276추가: );
277추가: assert_eq!(
278추가: fs::read(all_output.join("docs/child.txt")).unwrap(),
279추가: b"selected subtree"
280추가: );
281추가: assert!(matches!(
282추가: observed.borrow().starts.last(),
283추가: Some(Start::Extract {
284추가: selection: Selection::All,
285추가: ..
286추가: })
287추가: ));
288추가: assert_reaped(&observed);
289추가: }
추가tests/rust-app-ui/explorer_selection.rs+518-0
@@ -0,0 +1,518 @@
1추가: struct Explorer {
2추가: app: ArchiveApp,
3추가: ctx: egui::Context,
4추가: factory: FakeFactory,
5추가: time: f64,
6추가: }
7추가: impl Explorer {
8추가: fn new(scratch: &Folder) -> Self {
9추가: let factory = FakeFactory::default();
10추가: let mut app = loaded(scratch, &factory);
11추가: app.model.entries = [
12추가: (0, "docs/child.txt", Kind::File),
13추가: (1, "alpha.txt", Kind::File),
14추가: (2, "beta.txt", Kind::File),
15추가: (3, "gamma.txt", Kind::File),
16추가: (4, "omega.txt", Kind::File),
17추가: (5, "docs", Kind::Directory),
18추가: ]
19추가: .map(|(id, name, kind)| Entry {
20추가: id,
21추가: name: name.into(),
22추가: kind,
23추가: bytes: Some(7),
24추가: packed: None,
25추가: encrypted: false,
26추가: })
27추가: .into();
28추가: let mut screen = Self {
29추가: app,
30추가: ctx: egui::Context::default(),
31추가: factory,
32추가: time: 0.0,
33추가: };
34추가: screen.frame(egui::Modifiers::NONE, vec![]);
35추가: screen.frame(egui::Modifiers::NONE, vec![]);
36추가: screen
37추가: }
38추가: fn frame(&mut self, modifiers: egui::Modifiers, events: Vec<egui::Event>) -> egui::FullOutput {
39추가: self.time += 0.05;
40추가: let mut events = events;
41추가: events.insert(0, egui::Event::ModifiersChanged(modifiers));
42추가: let mut output = self.ctx.run_ui(
43추가: egui::RawInput {
44추가: screen_rect: Some(egui::Rect::from_min_size(
45추가: egui::Pos2::ZERO,
46추가: egui::vec2(760.0, 540.0),
47추가: )),
48추가: time: Some(self.time),
49추가: events,
50추가: ..Default::default()
51추가: },
52추가: |ui| self.app.show(ui),
53추가: );
54추가: output.textures_delta.clear();
55추가: output
56추가: }
57추가: fn row(&mut self, path: &str) -> egui::Rect {
58추가: self.frame(egui::Modifiers::NONE, vec![]);
59추가: self.ctx
60추가: .read_response(egui::Id::unique(("archive-row", path)))
61추가: .unwrap()
62추가: .rect
63추가: }
64추가: fn body(&self) -> egui::Rect {
65추가: self.ctx
66추가: .read_response(egui::Id::unique("archive-list"))
67추가: .unwrap()
68추가: .rect
69추가: }
70추가: fn pointer(
71추가: &mut self,
72추가: point: egui::Pos2,
73추가: pressed: bool,
74추가: modifiers: egui::Modifiers,
75추가: ) -> egui::FullOutput {
76추가: self.frame(
77추가: modifiers,
78추가: vec![
79추가: egui::Event::PointerMoved(point),
80추가: egui::Event::PointerButton {
81추가: pos: point,
82추가: button: egui::PointerButton::Primary,
83추가: pressed,
84추가: modifiers,
85추가: },
86추가: ],
87추가: )
88추가: }
89추가: fn click(&mut self, path: &str, modifiers: egui::Modifiers) {
90추가: self.time += 1.0;
91추가: let point = self.row(path).center();
92추가: self.pointer(point, true, modifiers);
93추가: self.pointer(point, false, modifiers);
94추가: self.frame(egui::Modifiers::NONE, vec![]);
95추가: }
96추가: fn key(&mut self, key: egui::Key, modifiers: egui::Modifiers) {
97추가: self.frame(
98추가: modifiers,
99추가: vec![egui::Event::Key {
100추가: key,
101추가: physical_key: None,
102추가: pressed: true,
103추가: repeat: false,
104추가: modifiers,
105추가: }],
106추가: );
107추가: self.frame(
108추가: modifiers,
109추가: vec![egui::Event::Key {
110추가: key,
111추가: physical_key: None,
112추가: pressed: false,
113추가: repeat: false,
114추가: modifiers,
115추가: }],
116추가: );
117추가: }
118추가: #[track_caller]
119추가: fn selected(&self, ids: &[u32]) {
120추가: assert_eq!(self.app.model.selected, ids.iter().copied().collect());
121추가: }
122추가: }
123추가: fn explorer_ctrl() -> egui::Modifiers {
124추가: egui::Modifiers {
125추가: ctrl: true,
126추가: ..egui::Modifiers::NONE
127추가: }
128추가: }
129추가: fn explorer_shift() -> egui::Modifiers {
130추가: egui::Modifiers {
131추가: shift: true,
132추가: ..egui::Modifiers::NONE
133추가: }
134추가: }
135추가:
136추가: #[test]
137추가: fn explorer_click_ctrl_shift_and_blank_match_visible_selection_count() {
138추가: let scratch = Folder::new();
139추가: let mut s = Explorer::new(&scratch);
140추가: s.click("alpha.txt", egui::Modifiers::NONE);
141추가: s.selected(&[1]);
142추가: s.click("beta.txt", explorer_ctrl());
143추가: s.selected(&[1, 2]);
144추가: s.click("alpha.txt", explorer_ctrl());
145추가: s.selected(&[2]);
146추가: s.click("alpha.txt", egui::Modifiers::NONE);
147추가: s.click("gamma.txt", explorer_shift());
148추가: s.selected(&[1, 2, 3]);
149추가: let output = s.frame(egui::Modifiers::NONE, vec![]);
150추가: assert!(
151추가: layout_text(&output)
152추가: .iter()
153추가: .any(|(text, _, _)| text == "선택 3개")
154추가: );
155추가: s.click(
156추가: "omega.txt",
157추가: egui::Modifiers {
158추가: ctrl: true,
159추가: shift: true,
160추가: ..egui::Modifiers::NONE
161추가: },
162추가: );
163추가: s.selected(&[1, 2, 3, 4]);
164추가: s.click("docs", egui::Modifiers::NONE);
165추가: s.selected(&[0, 5]);
166추가: let output = s.frame(egui::Modifiers::NONE, vec![]);
167추가: assert!(
168추가: layout_text(&output)
169추가: .iter()
170추가: .any(|(text, _, _)| text == "선택 1개")
171추가: );
172추가: let point = egui::pos2(100.0, s.body().bottom() - 4.0);
173추가: s.pointer(point, true, explorer_ctrl());
174추가: s.pointer(point, false, explorer_ctrl());
175추가: s.selected(&[0, 5]);
176추가: s.pointer(point, true, egui::Modifiers::NONE);
177추가: s.pointer(point, false, egui::Modifiers::NONE);
178추가: s.selected(&[]);
179추가: }
180추가:
181추가: #[test]
182추가: fn explorer_keyboard_ranges_enter_backspace_and_escape_are_scoped_to_the_list() {
183추가: let scratch = Folder::new();
184추가: let mut s = Explorer::new(&scratch);
185추가: s.ctx
186추가: .memory_mut(|m| m.request_focus(egui::Id::unique("archive-list")));
187추가: s.frame(egui::Modifiers::NONE, vec![]);
188추가: s.key(egui::Key::ArrowDown, egui::Modifiers::NONE);
189추가: s.selected(&[0, 5]);
190추가: s.key(egui::Key::ArrowDown, explorer_shift());
191추가: s.selected(&[0, 1, 5]);
192추가: s.key(egui::Key::ArrowUp, explorer_shift());
193추가: s.selected(&[0, 5]);
194추가: s.key(egui::Key::ArrowDown, explorer_shift());
195추가: s.selected(&[0, 1, 5]);
196추가: s.key(egui::Key::A, explorer_ctrl());
197추가: s.selected(&[0, 1, 2, 3, 4, 5]);
198추가: s.key(egui::Key::Escape, egui::Modifiers::NONE);
199추가: s.selected(&[]);
200추가: s.key(egui::Key::ArrowUp, egui::Modifiers::NONE);
201추가: s.selected(&[0, 5]);
202추가: s.key(egui::Key::Enter, egui::Modifiers::NONE);
203추가: s.selected(&[]);
204추가: assert!(
205추가: layout_text(&s.frame(egui::Modifiers::NONE, vec![]))
206추가: .iter()
207추가: .any(|(text, _, _)| text == "child.txt")
208추가: );
209추가: s.key(egui::Key::Backspace, egui::Modifiers::NONE);
210추가: s.selected(&[]);
211추가: assert!(
212추가: layout_text(&s.frame(egui::Modifiers::NONE, vec![]))
213추가: .iter()
214추가: .any(|(text, _, _)| text == "alpha.txt")
215추가: );
216추가: s.ctx
217추가: .memory_mut(|m| m.request_focus(egui::Id::unique("archive-search")));
218추가: s.key(egui::Key::A, explorer_ctrl());
219추가: s.selected(&[]);
220추가: s.key(egui::Key::Enter, egui::Modifiers::NONE);
221추가: assert_eq!(s.factory.state.borrow().starts.len(), 1);
222추가: }
223추가:
224추가: #[test]
225추가: fn explorer_double_click_opens_only_folders_and_resets_selection() {
226추가: let scratch = Folder::new();
227추가: let mut s = Explorer::new(&scratch);
228추가: let point = s.row("alpha.txt").center();
229추가: for _ in 0..2 {
230추가: s.pointer(point, true, egui::Modifiers::NONE);
231추가: s.pointer(point, false, egui::Modifiers::NONE);
232추가: }
233추가: s.selected(&[1]);
234추가: assert_eq!(s.factory.state.borrow().starts.len(), 1);
235추가: s.time += 1.0;
236추가: let point = s.row("docs").center();
237추가: for _ in 0..2 {
238추가: s.pointer(point, true, egui::Modifiers::NONE);
239추가: s.pointer(point, false, egui::Modifiers::NONE);
240추가: }
241추가: s.selected(&[]);
242추가: assert!(
243추가: layout_text(&s.frame(egui::Modifiers::NONE, vec![]))
244추가: .iter()
245추가: .any(|(text, _, _)| text == "child.txt")
246추가: );
247추가: }
248추가:
249추가: #[test]
250추가: fn explorer_marquee_selects_intersections_and_ctrl_adds_with_a_translucent_blue_rectangle() {
251추가: let scratch = Folder::new();
252추가: let mut s = Explorer::new(&scratch);
253추가: s.click("docs", egui::Modifiers::NONE);
254추가: let row = s.row("alpha.txt");
255추가: let start = egui::pos2(row.right() + 8.0, s.body().bottom() - 5.0);
256추가: let end = egui::pos2(150.0, row.top() + 2.0);
257추가: s.pointer(start, true, explorer_ctrl());
258추가: let output = s.frame(explorer_ctrl(), vec![egui::Event::PointerMoved(end)]);
259추가: s.selected(&[0, 1, 2, 3, 4, 5]);
260추가: assert!(output.shapes.iter().any(|shape| matches!(
261추가: &shape.shape,
262추가: Shape::Rect(rect)
263추가: if rect.fill == zipelo_ui_memory_app::archive_theme::BLUE.gamma_multiply(0.16)
264추가: && rect.rect.height() > 100.0
265추가: && rect.fill.a() > 0
266추가: && rect.fill.a() < 255
267추가: && rect.stroke == egui::Stroke::new(1.0, zipelo_ui_memory_app::archive_theme::BLUE)
268추가: && rect.stroke_kind == egui::StrokeKind::Inside
269추가: )));
270추가: s.pointer(end, false, explorer_ctrl());
271추가: s.selected(&[0, 1, 2, 3, 4, 5]);
272추가: let start = egui::pos2(row.right() + 8.0, s.body().bottom() - 5.0);
273추가: s.pointer(start, true, egui::Modifiers::NONE);
274추가: s.frame(egui::Modifiers::NONE, vec![egui::Event::PointerMoved(end)]);
275추가: s.pointer(end, false, egui::Modifiers::NONE);
276추가: s.selected(&[1, 2, 3, 4]);
277추가: }
278추가:
279추가: #[test]
280추가: fn explorer_marquee_autoscrolls_thousands_of_rows_without_rendering_them_all() {
281추가: let scratch = Folder::new();
282추가: let mut s = Explorer::new(&scratch);
283추가: s.app.model.entries = (0..5000)
284추가: .map(|id| Entry {
285추가: id,
286추가: name: format!("item-{id:05}.txt"),
287추가: kind: Kind::File,
288추가: bytes: Some(1),
289추가: packed: None,
290추가: encrypted: false,
291추가: })
292추가: .collect();
293추가: s.frame(egui::Modifiers::NONE, vec![]);
294추가: let row = s.row("item-00000.txt");
295추가: let start = egui::pos2(row.right() + 8.0, row.center().y);
296추가: s.pointer(start, true, egui::Modifiers::NONE);
297추가: let end = egui::pos2(100.0, s.body().bottom() + 45.0);
298추가: s.frame(egui::Modifiers::NONE, vec![egui::Event::PointerMoved(end)]);
299추가: let started = std::time::Instant::now();
300추가: let mut output = s.frame(egui::Modifiers::NONE, vec![]);
301추가: for _ in 0..40 {
302추가: output = s.frame(egui::Modifiers::NONE, vec![]);
303추가: }
304추가: assert!(started.elapsed() < std::time::Duration::from_secs(5));
305추가: assert!(
306추가: s.app.model.selected.len() > 20,
307추가: "{:?}",
308추가: s.app.model.selected
309추가: );
310추가: assert!(
311추가: layout_text(&output)
312추가: .iter()
313추가: .filter(|(text, _, _)| text.starts_with("item-"))
314추가: .count()
315추가: < 30
316추가: );
317추가: assert!(
318추가: layout_text(&output)
319추가: .iter()
320추가: .filter(|(text, _, _)| text.starts_with("item-"))
321추가: .all(|(text, _, _)| text != "item-00000.txt")
322추가: );
323추가: let first_visible = |output: &egui::FullOutput| {
324추가: layout_text(output)
325추가: .into_iter()
326추가: .filter_map(|(text, _, _)| {
327추가: text.strip_prefix("item-")
328추가: .and_then(|name| name.strip_suffix(".txt"))
329추가: .and_then(|number| number.parse::<u32>().ok())
330추가: })
331추가: .min()
332추가: .unwrap()
333추가: };
334추가: let down = first_visible(&output);
335추가: let up = egui::pos2(100.0, s.body().top() - 45.0);
336추가: s.frame(egui::Modifiers::NONE, vec![egui::Event::PointerMoved(up)]);
337추가: for _ in 0..12 {
338추가: output = s.frame(egui::Modifiers::NONE, vec![]);
339추가: }
340추가: assert!(first_visible(&output) < down);
341추가: s.pointer(up, false, egui::Modifiers::NONE);
342추가: let selected = s.app.model.selected.clone();
343추가: s.frame(egui::Modifiers::NONE, vec![egui::Event::PointerMoved(end)]);
344추가: assert_eq!(s.app.model.selected, selected);
345추가: }
346추가:
347추가: #[test]
348추가: fn explorer_selected_folder_and_empty_selection_reach_the_exact_extraction_request() {
349추가: let scratch = Folder::new();
350추가: let mut s = Explorer::new(&scratch);
351추가: s.click("docs", egui::Modifiers::NONE);
352추가: s.app.choose_destination(scratch.0.clone());
353추가: assert!(s.app.begin_extract());
354추가: assert!(
355추가: matches!(s.factory.state.borrow().starts.last(), Some(Start::Extract { selection: Selection::EntryIds(ids), .. }) if ids.iter().copied().collect::<BTreeSet<_>>() == [0,5].into_iter().collect())
356추가: );
357추가: for _ in 0..30 {
358추가: s.frame(egui::Modifiers::NONE, vec![]);
359추가: }
360추가: s.app.model.selected.clear();
361추가: assert!(s.app.begin_extract());
362추가: assert!(matches!(
363추가: s.factory.state.borrow().starts.last(),
364추가: Some(Start::Extract {
365추가: selection: Selection::All,
366추가: ..
367추가: })
368추가: ));
369추가: }
370추가:
371추가: #[test]
372추가: fn explorer_fast_forward_marquee_uses_the_original_press_position() {
373추가: let scratch = Folder::new();
374추가: let mut s = Explorer::new(&scratch);
375추가: let first = s.row("docs");
376추가: let last = s.row("beta.txt");
377추가: let start = egui::pos2(first.right() + 8.0, first.top() + 2.0);
378추가: let end = egui::pos2(100.0, last.bottom() - 1.0);
379추가: s.frame(
380추가: egui::Modifiers::NONE,
381추가: vec![
382추가: egui::Event::PointerMoved(start),
383추가: egui::Event::PointerButton {
384추가: pos: start,
385추가: button: egui::PointerButton::Primary,
386추가: pressed: true,
387추가: modifiers: egui::Modifiers::NONE,
388추가: },
389추가: egui::Event::PointerMoved(end),
390추가: ],
391추가: );
392추가: s.selected(&[0, 1, 2, 5]);
393추가: s.pointer(end, false, egui::Modifiers::NONE);
394추가: s.selected(&[0, 1, 2, 5]);
395추가: }
396추가:
397추가: #[test]
398추가: fn explorer_ctrl_removes_a_large_directory_subtree_without_ancestor_rescans() {
399추가: let scratch = Folder::new();
400추가: let mut s = Explorer::new(&scratch);
401추가: s.app.model.entries = (0..5001)
402추가: .map(|id| Entry {
403추가: id,
404추가: name: if id == 0 {
405추가: "docs".into()
406추가: } else {
407추가: format!("docs/child-{id:05}")
408추가: },
409추가: kind: Kind::Directory,
410추가: bytes: None,
411추가: packed: None,
412추가: encrypted: false,
413추가: })
414추가: .collect();
415추가: s.frame(egui::Modifiers::NONE, vec![]);
416추가: s.click("docs", egui::Modifiers::NONE);
417추가: assert_eq!(s.app.model.selected.len(), 5001);
418추가: let started = std::time::Instant::now();
419추가: s.click("docs", explorer_ctrl());
420추가: assert!(s.app.model.selected.is_empty());
421추가: assert!(started.elapsed() < std::time::Duration::from_secs(2));
422추가: }
423추가:
424추가: #[test]
425추가: fn explorer_mouse_click_gives_list_focus_for_keyboard_selection_and_navigation() {
426추가: let scratch = Folder::new();
427추가: let mut s = Explorer::new(&scratch);
428추가: assert!(s.ctx.memory(|memory| memory.focused()).is_none());
429추가: s.click("alpha.txt", egui::Modifiers::NONE);
430추가: assert!(s.ctx.memory(|memory| memory.focused()).is_some());
431추가: s.key(egui::Key::ArrowDown, egui::Modifiers::NONE);
432추가: s.selected(&[2]);
433추가: s.key(egui::Key::ArrowDown, explorer_shift());
434추가: s.selected(&[2, 3]);
435추가: s.key(egui::Key::A, explorer_ctrl());
436추가: s.selected(&[0, 1, 2, 3, 4, 5]);
437추가: s.click("docs", egui::Modifiers::NONE);
438추가: s.key(egui::Key::Enter, egui::Modifiers::NONE);
439추가: assert!(
440추가: layout_text(&s.frame(egui::Modifiers::NONE, vec![]))
441추가: .iter()
442추가: .any(|(text, _, _)| text == "child.txt")
443추가: );
444추가: s.key(egui::Key::Backspace, egui::Modifiers::NONE);
445추가: assert!(
446추가: layout_text(&s.frame(egui::Modifiers::NONE, vec![]))
447추가: .iter()
448추가: .any(|(text, _, _)| text == "alpha.txt")
449추가: );
450추가: s.click("alpha.txt", egui::Modifiers::NONE);
451추가: s.key(egui::Key::Escape, egui::Modifiers::NONE);
452추가: s.selected(&[]);
453추가: }
454추가:
455추가: #[test]
456추가: fn explorer_retry_preserves_original_scope_after_selection_changes_and_conflicts() {
457추가: for selected in [false, true] {
458추가: for conflict in [false, true] {
459추가: let scratch = Folder::new();
460추가: let mut s = Explorer::new(&scratch);
461추가: s.factory.state.borrow_mut().manual = true;
462추가: if selected {
463추가: s.click("docs", egui::Modifiers::NONE);
464추가: }
465추가: assert!(s.app.begin_extract());
466추가: let original = match s.factory.state.borrow().starts.last().unwrap() {
467추가: Start::Extract { selection, .. } => selection.clone(),
468추가: _ => panic!("추출 요청이 필요함"),
469추가: };
470추가: {
471추가: let mut worker = s.factory.state.borrow_mut();
472추가: worker.frame(Event::Accepted { encryption: false });
473추가: worker.finish(Outcome::Failed, Publication::None);
474추가: for event in &mut worker.queue {
475추가: if let HostEvent::Frame {
476추가: event: Event::Terminal(t),
477추가: ..
478추가: } = event
479추가: {
480추가: t.error = Some(if conflict {
481추가: ErrorCode::Conflict
482추가: } else {
483추가: ErrorCode::Io
484추가: });
485추가: }
486추가: }
487추가: }
488추가: for _ in 0..30 {
489추가: s.frame(egui::Modifiers::NONE, vec![]);
490추가: }
491추가: s.click("alpha.txt", egui::Modifiers::NONE);
492추가: s.selected(&[1]);
493추가: let chosen = scratch.0.join("retry-output");
494추가: if conflict {
495추가: fs::create_dir(&chosen).unwrap();
496추가: let dialogs = TestDialogs::default();
497추가: dialogs
498추가: .0
499추가: .borrow_mut()
500추가: .answers
501추가: .push_back(Some(vec![chosen.clone()]));
502추가: s.app.set_dialogs(Box::new(dialogs));
503추가: }
504추가: policy_click(
505추가: &s.ctx,
506추가: &mut s.app,
507추가: if conflict {
508추가: "다른 폴더에 풀기"
509추가: } else {
510추가: "다시 시도"
511추가: },
512추가: );
513추가: assert!(matches!(s.factory.state.borrow().starts.last(),
514추가: Some(Start::Extract { selection, destination, .. })
515추가: if selection == &original && (!conflict || destination == &chosen)));
516추가: }
517추가: }
518추가: }
수정tests/rust-app-ui/presentation.rs+1-0
@@ -908,6 +908,7 @@ mod widgets {
908908 }
909909 include!("toolbar.rs");
910910 include!("long_layout.rs");
911추가: include!("explorer_selection.rs");
911912}
912913
913914#[cfg(feature = "ui")]
수정tests/rust-app-ui/toolbar.rs+3-2
@@ -295,7 +295,7 @@ fn conflict_native_dialog_cancel_and_retry_preserve_selection_and_existing_files
295295}
296296
297297#[test]
298삭제: fn excluding_a_child_after_folder_selection_does_not_restore_it_during_extraction() {
298추가: fn folder_navigation_clears_parent_selection_and_extracts_only_new_selection() {
299299 let scratch = Folder::new();
300300 let factory = FakeFactory::default();
301301 let mut app = loaded(&scratch, &factory);
@@ -315,6 +315,7 @@ fn excluding_a_child_after_folder_selection_does_not_restore_it_during_extractio
315315 .to_vec();
316316 app.model.selected = [0, 1, 2].into_iter().collect();
317317 app.browse_folder("docs");
318추가: assert!(app.model.selected.is_empty());
318319 let dialogs = TestDialogs::default();
319320 dialogs
320321 .0
@@ -323,7 +324,7 @@ fn excluding_a_child_after_folder_selection_does_not_restore_it_during_extractio
323324 .push_back(Some(vec![scratch.0.clone()]));
324325 app.set_dialogs(Box::new(dialogs));
325326 let ctx = egui::Context::default();
326삭제: policy_click(&ctx, &mut app, "excluded.txt");
327추가: policy_click(&ctx, &mut app, "retained.txt");
327328 assert_eq!(app.model.selected, [2].into_iter().collect());
328329 policy_click(&ctx, &mut app, "압축해제");
329330 assert!(matches!(
수정tests/ui-redesign/capture.py+14-1
@@ -37,6 +37,8 @@ def capture(binary, variant, state, output, environment, width, height):
3737 environment["DBUS_SESSION_BUS_ADDRESS"] = f"unix:path={endpoint}"
3838 environment.pop("DBUS_STARTER_ADDRESS", None)
3939 mode = {
40추가: "explorer-selected": "toolbar-folder",
41추가: "explorer-marquee": "toolbar-folder",
4042 "picker": "opened",
4143 "selected-empty": "opened",
4244 "dialog-unavailable": "toolbar-root",
@@ -93,12 +95,23 @@ def capture(binary, variant, state, output, environment, width, height):
9395 command(["xdotool", "type", "--clearmodifiers", "--delay", "0", "fixture-password"], environment)
9496 command(["xdotool", "key", "Tab", "Tab"], environment)
9597 command(["xdotool", "type", "--clearmodifiers", "--delay", "0", "different"], environment)
96삭제: command(["xdotool", "mousemove", "--window", window, "2", "2"], environment)
98추가: if state == "explorer-selected":
99추가: click(150, 235)
100추가: command(["xdotool", "keydown", "ctrl"], environment)
101추가: click(150, 323)
102추가: command(["xdotool", "keyup", "ctrl"], environment)
103추가: if state == "explorer-marquee":
104추가: command(["xdotool", "mousemove", "--window", window, str(width - 20), str(height - 80), "mousedown", "1"], environment)
105추가: time.sleep(0.2)
106추가: command(["xdotool", "mousemove", "--window", window, "250", "300"], environment)
107추가: else:
108추가: command(["xdotool", "mousemove", "--window", window, "2", "2"], environment)
97109 time.sleep(0.3)
98110 destination = output / f"{state}.png"
99111 command(["import", "-window", window, str(destination)], environment)
100112 return {"state": state, "path": str(destination.relative_to(ROOT)), "width": width, "height": height}
101113 finally:
114추가: subprocess.run(["xdotool", "mouseup", "1"], env=environment, check=False)
102115 stop(app)
103116
104117
추가tests/ui-redesign/explorer-selection-validation.json+466-0
@@ -0,0 +1,466 @@
1추가: {
2추가: "recorded_at_utc": "2026-11-12T09:47:36.513186+00:00",
3추가: "tested_local_commit": "06be6c55dff1325e7f36b8da8e5671e5ef862c3c",
4추가: "tested_source_tree": "b71f33571add276ed179fe0cc19fe312cd40c79f",
5추가: "equivalent_remote_source_commit": "80adfd9a1d596b86e141453f0605ff4d632d9df1",
6추가: "command": "python3 tests/ci/run_rust.py local",
7추가: "exit_code": 0,
8추가: "rust_tests_passed": 1027,
9추가: "runner_tests_passed": 34,
10추가: "ui_suite_tests_passed": 79,
11추가: "actual_worker_ui_tests_passed": 27,
12추가: "local_log_sha256": "4e0ebe7800ce3ac5204ff729a65f5af90e085f807368003babe6f713f2f1bab1",
13추가: "local_results": {
14추가: "head": "06be6c55dff1325e7f36b8da8e5671e5ef862c3c",
15추가: "platform": "linux",
16추가: "windows_cross_target": "x86_64-pc-windows-gnu",
17추가: "windows_runtime_tested": false,
18추가: "results": [
19추가: {
20추가: "phase": "build",
21추가: "manifest": "experiments/rust-app-core-memory/Cargo.toml",
22추가: "status": "passed",
23추가: "exit_code": 0
24추가: },
25추가: {
26추가: "phase": "build",
27추가: "manifest": "experiments/rust-archive-worker/Cargo.toml",
28추가: "status": "passed",
29추가: "exit_code": 0
30추가: },
31추가: {
32추가: "phase": "build",
33추가: "manifest": "experiments/rust-file-publication/Cargo.toml",
34추가: "status": "passed",
35추가: "exit_code": 0
36추가: },
37추가: {
38추가: "phase": "build",
39추가: "manifest": "experiments/rust-file-snapshot/Cargo.toml",
40추가: "status": "passed",
41추가: "exit_code": 0
42추가: },
43추가: {
44추가: "phase": "build",
45추가: "manifest": "experiments/rust-gzip-file-job/Cargo.toml",
46추가: "status": "passed",
47추가: "exit_code": 0
48추가: },
49추가: {
50추가: "phase": "build",
51추가: "manifest": "experiments/rust-memory-gzip-reader/Cargo.toml",
52추가: "status": "passed",
53추가: "exit_code": 0
54추가: },
55추가: {
56추가: "phase": "build",
57추가: "manifest": "experiments/rust-memory-ustar-reader/Cargo.toml",
58추가: "status": "passed",
59추가: "exit_code": 0
60추가: },
61추가: {
62추가: "phase": "build",
63추가: "manifest": "experiments/rust-memory-zip-create/Cargo.toml",
64추가: "status": "passed",
65추가: "exit_code": 0
66추가: },
67추가: {
68추가: "phase": "build",
69추가: "manifest": "experiments/rust-ui-memory-app/Cargo.toml",
70추가: "status": "passed",
71추가: "exit_code": 0
72추가: },
73추가: {
74추가: "phase": "build",
75추가: "manifest": "tests/rust-app-core-memory/Cargo.toml",
76추가: "status": "passed",
77추가: "exit_code": 0
78추가: },
79추가: {
80추가: "phase": "build",
81추가: "manifest": "tests/rust-app-real-worker/Cargo.toml",
82추가: "status": "passed",
83추가: "exit_code": 0
84추가: },
85추가: {
86추가: "phase": "build",
87추가: "manifest": "tests/rust-file-publication/Cargo.toml",
88추가: "status": "passed",
89추가: "exit_code": 0
90추가: },
91추가: {
92추가: "phase": "build",
93추가: "manifest": "tests/rust-file-snapshot/Cargo.toml",
94추가: "status": "passed",
95추가: "exit_code": 0
96추가: },
97추가: {
98추가: "phase": "build",
99추가: "manifest": "tests/rust-gzip-file-job/Cargo.toml",
100추가: "status": "passed",
101추가: "exit_code": 0
102추가: },
103추가: {
104추가: "phase": "build",
105추가: "manifest": "tests/rust-large-archive-fixtures/Cargo.toml",
106추가: "status": "passed",
107추가: "exit_code": 0
108추가: },
109추가: {
110추가: "phase": "build",
111추가: "manifest": "tests/rust-memory-gzip-reader/Cargo.toml",
112추가: "status": "passed",
113추가: "exit_code": 0
114추가: },
115추가: {
116추가: "phase": "build",
117추가: "manifest": "tests/rust-memory-ustar-reader/Cargo.toml",
118추가: "status": "passed",
119추가: "exit_code": 0
120추가: },
121추가: {
122추가: "phase": "build",
123추가: "manifest": "tests/rust-ui-memory-gui-races/Cargo.toml",
124추가: "status": "passed",
125추가: "exit_code": 0
126추가: },
127추가: {
128추가: "phase": "build",
129추가: "manifest": "tests/rust-ui-memory-races/Cargo.toml",
130추가: "status": "passed",
131추가: "exit_code": 0
132추가: },
133추가: {
134추가: "phase": "build",
135추가: "manifest": "tests/rust-ui-system-font-regressions/Cargo.toml",
136추가: "status": "passed",
137추가: "exit_code": 0
138추가: },
139추가: {
140추가: "phase": "build",
141추가: "manifest": "tests/rust-zip64-compat/Cargo.toml",
142추가: "status": "passed",
143추가: "exit_code": 0
144추가: },
145추가: {
146추가: "phase": "test",
147추가: "manifest": "experiments/rust-app-core-memory/Cargo.toml",
148추가: "status": "passed",
149추가: "exit_code": 0
150추가: },
151추가: {
152추가: "phase": "test",
153추가: "manifest": "experiments/rust-archive-worker/Cargo.toml",
154추가: "status": "passed",
155추가: "exit_code": 0
156추가: },
157추가: {
158추가: "phase": "test",
159추가: "manifest": "experiments/rust-file-publication/Cargo.toml",
160추가: "status": "passed",
161추가: "exit_code": 0
162추가: },
163추가: {
164추가: "phase": "test",
165추가: "manifest": "experiments/rust-file-snapshot/Cargo.toml",
166추가: "status": "passed",
167추가: "exit_code": 0
168추가: },
169추가: {
170추가: "phase": "test",
171추가: "manifest": "experiments/rust-gzip-file-job/Cargo.toml",
172추가: "status": "passed",
173추가: "exit_code": 0
174추가: },
175추가: {
176추가: "phase": "test",
177추가: "manifest": "experiments/rust-memory-gzip-reader/Cargo.toml",
178추가: "status": "passed",
179추가: "exit_code": 0
180추가: },
181추가: {
182추가: "phase": "test",
183추가: "manifest": "experiments/rust-memory-ustar-reader/Cargo.toml",
184추가: "status": "passed",
185추가: "exit_code": 0
186추가: },
187추가: {
188추가: "phase": "test",
189추가: "manifest": "experiments/rust-memory-zip-create/Cargo.toml",
190추가: "status": "passed",
191추가: "exit_code": 0
192추가: },
193추가: {
194추가: "phase": "test",
195추가: "manifest": "experiments/rust-ui-memory-app/Cargo.toml",
196추가: "status": "passed",
197추가: "exit_code": 0
198추가: },
199추가: {
200추가: "phase": "test",
201추가: "manifest": "tests/rust-app-core-memory/Cargo.toml",
202추가: "status": "passed",
203추가: "exit_code": 0
204추가: },
205추가: {
206추가: "phase": "test",
207추가: "manifest": "tests/rust-app-real-worker/Cargo.toml",
208추가: "status": "passed",
209추가: "exit_code": 0
210추가: },
211추가: {
212추가: "phase": "test",
213추가: "manifest": "tests/rust-file-publication/Cargo.toml",
214추가: "status": "passed",
215추가: "exit_code": 0
216추가: },
217추가: {
218추가: "phase": "test",
219추가: "manifest": "tests/rust-file-snapshot/Cargo.toml",
220추가: "status": "passed",
221추가: "exit_code": 0
222추가: },
223추가: {
224추가: "phase": "test",
225추가: "manifest": "tests/rust-gzip-file-job/Cargo.toml",
226추가: "status": "passed",
227추가: "exit_code": 0
228추가: },
229추가: {
230추가: "phase": "test",
231추가: "manifest": "tests/rust-large-archive-fixtures/Cargo.toml",
232추가: "status": "passed",
233추가: "exit_code": 0
234추가: },
235추가: {
236추가: "phase": "test",
237추가: "manifest": "tests/rust-memory-gzip-reader/Cargo.toml",
238추가: "status": "passed",
239추가: "exit_code": 0
240추가: },
241추가: {
242추가: "phase": "test",
243추가: "manifest": "tests/rust-memory-ustar-reader/Cargo.toml",
244추가: "status": "passed",
245추가: "exit_code": 0
246추가: },
247추가: {
248추가: "phase": "test",
249추가: "manifest": "tests/rust-ui-memory-gui-races/Cargo.toml",
250추가: "status": "passed",
251추가: "exit_code": 0
252추가: },
253추가: {
254추가: "phase": "test",
255추가: "manifest": "tests/rust-ui-memory-races/Cargo.toml",
256추가: "status": "passed",
257추가: "exit_code": 0
258추가: },
259추가: {
260추가: "phase": "test",
261추가: "manifest": "tests/rust-ui-system-font-regressions/Cargo.toml",
262추가: "status": "passed",
263추가: "exit_code": 0
264추가: },
265추가: {
266추가: "phase": "test",
267추가: "manifest": "tests/rust-zip64-compat/Cargo.toml",
268추가: "status": "passed",
269추가: "exit_code": 0
270추가: },
271추가: {
272추가: "phase": "cross-build",
273추가: "manifest": "experiments/rust-app-core-memory/Cargo.toml",
274추가: "status": "passed",
275추가: "exit_code": 0
276추가: },
277추가: {
278추가: "phase": "cross-build",
279추가: "manifest": "experiments/rust-archive-worker/Cargo.toml",
280추가: "status": "passed",
281추가: "exit_code": 0
282추가: },
283추가: {
284추가: "phase": "cross-build",
285추가: "manifest": "experiments/rust-file-publication/Cargo.toml",
286추가: "status": "passed",
287추가: "exit_code": 0
288추가: },
289추가: {
290추가: "phase": "cross-build",
291추가: "manifest": "experiments/rust-file-snapshot/Cargo.toml",
292추가: "status": "passed",
293추가: "exit_code": 0
294추가: },
295추가: {
296추가: "phase": "cross-build",
297추가: "manifest": "experiments/rust-gzip-file-job/Cargo.toml",
298추가: "status": "passed",
299추가: "exit_code": 0
300추가: },
301추가: {
302추가: "phase": "cross-build",
303추가: "manifest": "experiments/rust-memory-gzip-reader/Cargo.toml",
304추가: "status": "passed",
305추가: "exit_code": 0
306추가: },
307추가: {
308추가: "phase": "cross-build",
309추가: "manifest": "experiments/rust-memory-ustar-reader/Cargo.toml",
310추가: "status": "passed",
311추가: "exit_code": 0
312추가: },
313추가: {
314추가: "phase": "cross-build",
315추가: "manifest": "experiments/rust-memory-zip-create/Cargo.toml",
316추가: "status": "passed",
317추가: "exit_code": 0
318추가: },
319추가: {
320추가: "phase": "cross-build",
321추가: "manifest": "experiments/rust-ui-memory-app/Cargo.toml",
322추가: "status": "passed",
323추가: "exit_code": 0
324추가: },
325추가: {
326추가: "phase": "cross-build",
327추가: "manifest": "tests/rust-app-core-memory/Cargo.toml",
328추가: "status": "passed",
329추가: "exit_code": 0
330추가: },
331추가: {
332추가: "phase": "cross-build",
333추가: "manifest": "tests/rust-app-real-worker/Cargo.toml",
334추가: "status": "passed",
335추가: "exit_code": 0
336추가: },
337추가: {
338추가: "phase": "cross-build",
339추가: "manifest": "tests/rust-file-publication/Cargo.toml",
340추가: "status": "passed",
341추가: "exit_code": 0
342추가: },
343추가: {
344추가: "phase": "cross-build",
345추가: "manifest": "tests/rust-file-snapshot/Cargo.toml",
346추가: "status": "passed",
347추가: "exit_code": 0
348추가: },
349추가: {
350추가: "phase": "cross-build",
351추가: "manifest": "tests/rust-gzip-file-job/Cargo.toml",
352추가: "status": "passed",
353추가: "exit_code": 0
354추가: },
355추가: {
356추가: "phase": "cross-build",
357추가: "manifest": "tests/rust-large-archive-fixtures/Cargo.toml",
358추가: "status": "passed",
359추가: "exit_code": 0
360추가: },
361추가: {
362추가: "phase": "cross-build",
363추가: "manifest": "tests/rust-memory-gzip-reader/Cargo.toml",
364추가: "status": "passed",
365추가: "exit_code": 0
366추가: },
367추가: {
368추가: "phase": "cross-build",
369추가: "manifest": "tests/rust-memory-ustar-reader/Cargo.toml",
370추가: "status": "passed",
371추가: "exit_code": 0
372추가: },
373추가: {
374추가: "phase": "cross-build",
375추가: "manifest": "tests/rust-ui-memory-gui-races/Cargo.toml",
376추가: "status": "passed",
377추가: "exit_code": 0
378추가: },
379추가: {
380추가: "phase": "cross-build",
381추가: "manifest": "tests/rust-ui-memory-races/Cargo.toml",
382추가: "status": "passed",
383추가: "exit_code": 0
384추가: },
385추가: {
386추가: "phase": "cross-build",
387추가: "manifest": "tests/rust-ui-system-font-regressions/Cargo.toml",
388추가: "status": "passed",
389추가: "exit_code": 0
390추가: },
391추가: {
392추가: "phase": "cross-build",
393추가: "manifest": "tests/rust-zip64-compat/Cargo.toml",
394추가: "status": "passed",
395추가: "exit_code": 0
396추가: }
397추가: ]
398추가: },
399추가: "coverage": [
400추가: "explorer_click_ctrl_shift_and_blank_match_visible_selection_count",
401추가: "explorer_keyboard_ranges_enter_backspace_and_escape_are_scoped_to_the_list",
402추가: "explorer_double_click_opens_only_folders_and_resets_selection",
403추가: "explorer_marquee_selects_intersections_and_ctrl_adds_with_a_translucent_blue_rectangle",
404추가: "explorer_marquee_autoscrolls_thousands_of_rows_without_rendering_them_all",
405추가: "explorer_selected_folder_and_empty_selection_reach_the_exact_extraction_request",
406추가: "explorer_fast_forward_marquee_uses_the_original_press_position",
407추가: "explorer_ctrl_removes_a_large_directory_subtree_without_ancestor_rescans",
408추가: "explorer_folder_click_and_escape_control_actual_extraction_scope",
409추가: "folder_navigation_clears_parent_selection_and_extracts_only_new_selection"
410추가: ],
411추가: "selection_rules": {
412추가: "mouse": "Single click replaces, Ctrl toggles, Shift selects from anchor, Ctrl+Shift adds a range. Blank click clears; Ctrl+blank preserves.",
413추가: "marquee": "Starts in blank list space, uses the original press position even for batched events, selects row intersections, Ctrl adds. Fill is #2563eb at 16% opacity with an opaque #2563eb 1px inside border; underlying file names and sizes remain readable.",
414추가: "keyboard": "List-scoped arrows, Shift+arrows, Ctrl+A, Enter, Backspace and Esc. Other focused buttons and search retain their own Enter behavior. Mouse row clicks explicitly focus the list.",
415추가: "scope": "Folder navigation and search changes clear selection and reset the anchor. Selected folders contribute descendant entry IDs to extraction; no selection requests the full archive. Retries retain the original confirmed selection independently of current list selection.",
416추가: "count": "Status counts fully selected visible rows, not descendant entry IDs."
417추가: },
418추가: "performance_cases": {
419추가: "flat_entries": 5000,
420추가: "rendered_name_widgets": "fewer than 30",
421추가: "drag_scrolling": "both directions and release stops selection changes",
422추가: "large_directory_entries": 5001,
423추가: "ctrl_removal": "removes the row ID set without ancestor rescans",
424추가: "timing_scope": "Debug test budgets on linux-desktop-2; not general device benchmarks."
425추가: },
426추가: "screenshot_source_remote_commit": "4e086b435ff1a64cf73088c18832266601dc17a0",
427추가: "screenshots": [
428추가: {
429추가: "state": "explorer-selected",
430추가: "path": "tests/ui-redesign/screenshots/explorer-selection/explorer-selected.png",
431추가: "width": 1060,
432추가: "height": 720,
433추가: "sha256": "f1d01ed47fc3c0635c84278f594eed03398498b451295c85ccf231fb1f5b97e2"
434추가: },
435추가: {
436추가: "state": "explorer-marquee",
437추가: "path": "tests/ui-redesign/screenshots/explorer-selection/explorer-marquee.png",
438추가: "width": 1060,
439추가: "height": 720,
440추가: "sha256": "3909ee09be2207f00a5a58286544d7ab03951b8c164241d330aa303a7bcdd204"
441추가: }
442추가: ],
443추가: "screenshot_scope": "Actual eframe application in isolated Linux Xvfb with xdotool input and synthetic archive listing; images visually inspected.",
444추가: "worker_contract_revision": 2,
445추가: "dependencies_changed": false,
446추가: "related_prs": {
447추가: "p1_path_fix": 92,
448추가: "selection_design": 93
449추가: },
450추가: "limitations": [
451추가: "Windows all-target cross-build passed, but native Windows interaction for this feature was not executed.",
452추가: "Screenshots use synthetic data; extraction scope is separately checked with actual worker output content."
453추가: ],
454추가: "notes": [
455추가: "The complete local command passed after both P2 fixes. Only this evidence file changed afterwards. Existing screenshots remain visually applicable; the translucent appearance did not change."
456추가: ],
457추가: "review_regressions": {
458추가: "tests": [
459추가: "explorer_mouse_click_gives_list_focus_for_keyboard_selection_and_navigation",
460추가: "explorer_retry_preserves_original_scope_after_selection_changes_and_conflicts"
461추가: ],
462추가: "before": "Both tests failed before the fix.",
463추가: "after": "79 UI tests passed; full local command passed.",
464추가: "scope": "Mouse click without manually injected focus followed by arrows, Shift+arrow, Ctrl+A, Enter, Backspace and Esc. Original All/EntryIds selection retained after list selection changes for Io retry and Conflict destination reselection."
465추가: }
466추가: }
추가tests/ui-redesign/screenshots/explorer-selection/capture.json+14-0
@@ -0,0 +1,14 @@
1추가: [
2추가: {
3추가: "state": "explorer-selected",
4추가: "path": "tests/ui-redesign/screenshots/explorer-selection/explorer-selected.png",
5추가: "width": 1060,
6추가: "height": 720
7추가: },
8추가: {
9추가: "state": "explorer-marquee",
10추가: "path": "tests/ui-redesign/screenshots/explorer-selection/explorer-marquee.png",
11추가: "width": 1060,
12추가: "height": 720
13추가: }
14추가: ]
추가tests/ui-redesign/screenshots/explorer-selection/explorer-marquee.png

바이너리 파일이라 Diff를 표시하지 않아요.

파일 내려받기
추가tests/ui-redesign/screenshots/explorer-selection/explorer-selected.png

바이너리 파일이라 Diff를 표시하지 않아요.

파일 내려받기