파일 충돌 선택 화면과 클라이언트 상태를 준비함
- 작성자
- 호시노 히나타
- 작성 시각
- 커밋
64ada4bb3553636297a916c948d874bb828fecb8- 부모
- 6ee2815
변경된 파일 12개
+720-4| @@ -93,3 +93,12 @@ python3 tests/ci/run_rust.py local | ||
| 93 | 93 | |
| 94 | 94 | 화면에 새 창, 버튼, 메시지, 상태 또는 오류를 추가하거나 바꾸면 같은 PR에서 상황, 시험과 이 가이드를 갱신한다. 화면 변화가 없으면 PR 본문에 "UI 변경 없음"이라고 적는다. 사용자가 직접 올린 UI 변경에서 빠진 상황은 병합 뒤 프론트엔드 담당이 보완한다. |
| 95 | 95 | |
| 96 | 추가: | |
| 97 | 추가: ## 파일 충돌 선택과 결과 | |
| 98 | 추가: | |
| 99 | 추가: - conflict-choice: 파일 경로와 기존 크기, 새 크기 및 덮어쓰기, 건너뛰기, 이름 바꿔 저장을 확인합니다. Tab으로 이동하고 Space로 선택할 수 있으며 Escape 또는 작업 취소는 전체 작업을 취소합니다. | |
| 100 | 추가: - conflict-apply: "나머지 파일에도 같게 적용"이 켜진 상태입니다. 현재 작업의 남은 일반 파일 충돌에만 적용하며 이름 바꿔 저장은 같은 폴더에 번호를 붙입니다. | |
| 101 | 추가: - extract-skipped: 모든 파일을 건너뛴 정상 완료입니다. 생성된 파일이 없으며 저장 실패 경고가 없어야 합니다. | |
| 102 | 추가: - extract-renamed: 실제 저장된 새 이름을 표시합니다. 이름 변경 결과만으로 저장 성공을 판정하지 않고 별도의 생성 보고와 완료 집계가 일치해야 합니다. | |
| 103 | 추가: | |
| 104 | 추가: 현재 충돌 화면과 클라이언트 연동은 준비 단계입니다. 작업자 런타임이 완성되기 전에는 실제 추출 요청을 기존 Start로 유지하며 StartInteractive를 보내지 않습니다. 위 명령은 실제 파일을 쓰지 않는 개발용 화면 미리보기입니다. |
| @@ -130,6 +130,32 @@ pub fn target_files( | ||
| 130 | 130 | Some(names) |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 추가: pub fn resolved_targets( | |
| 134 | 추가: targets: Option<&BTreeSet<String>>, | |
| 135 | 추가: entries: &[Entry], | |
| 136 | 추가: gzip: Option<&str>, | |
| 137 | 추가: resolutions: &[Resolution], | |
| 138 | 추가: ) -> Option<BTreeSet<String>> { | |
| 139 | 추가: let mut names = targets?.clone(); | |
| 140 | 추가: for resolution in resolutions { | |
| 141 | 추가: let entry = entries | |
| 142 | 추가: .iter() | |
| 143 | 추가: .find(|entry| entry.id == resolution.entry_id)?; | |
| 144 | 추가: let original = gzip.unwrap_or(&entry.name).replace('\\', "/"); | |
| 145 | 추가: if !names.remove(&original) { | |
| 146 | 추가: return None; | |
| 147 | 추가: } | |
| 148 | 추가: } | |
| 149 | 추가: for resolution in resolutions { | |
| 150 | 추가: if resolution.choice != ConflictChoice::Skip | |
| 151 | 추가: && !names.insert(resolution.relative_name.replace('\\', "/")) | |
| 152 | 추가: { | |
| 153 | 추가: return None; | |
| 154 | 추가: } | |
| 155 | 추가: } | |
| 156 | 추가: Some(names) | |
| 157 | 추가: } | |
| 158 | 추가: | |
| 133 | 159 | pub fn target_directories(entries: &[Entry], selection: &Selection) -> BTreeSet<String> { |
| 134 | 160 | let mut directories = BTreeSet::new(); |
| 135 | 161 | for entry in entries.iter().filter(|entry| { |
| @@ -352,6 +378,8 @@ pub fn activity_text(model: &Model, creating: bool) -> &'static str { | ||
| 352 | 378 | "마무리하는 중" |
| 353 | 379 | } else if model.cancellation_requested() || model.cancel.is_some() { |
| 354 | 380 | "취소하는 중..." |
| 381 | 추가: } else if model.conflict.is_some() { | |
| 382 | 추가: "파일 충돌 선택 대기 중" | |
| 355 | 383 | } else if model.challenge.is_some() { |
| 356 | 384 | "암호를 입력하세요" |
| 357 | 385 | } else { |
| @@ -114,6 +114,22 @@ convert_enum!( | ||
| 114 | 114 | TooLate, |
| 115 | 115 | Finished |
| 116 | 116 | ); |
| 117 | 추가: convert_enum!( | |
| 118 | 추가: conflict_to_wire, | |
| 119 | 추가: ui::ConflictChoice, | |
| 120 | 추가: wire::ConflictChoice, | |
| 121 | 추가: Overwrite, | |
| 122 | 추가: Skip, | |
| 123 | 추가: Rename | |
| 124 | 추가: ); | |
| 125 | 추가: convert_enum!( | |
| 126 | 추가: conflict_to_ui, | |
| 127 | 추가: wire::ConflictChoice, | |
| 128 | 추가: ui::ConflictChoice, | |
| 129 | 추가: Overwrite, | |
| 130 | 추가: Skip, | |
| 131 | 추가: Rename | |
| 132 | 추가: ); | |
| 117 | 133 | fn list_to_wire(id: ui::ListId) -> wire::ListId { |
| 118 | 134 | wire::ListId { |
| 119 | 135 | catalog_version: id.catalog_version, |
| @@ -252,6 +268,32 @@ fn event_to_ui( | ||
| 252 | 268 | attempt, |
| 253 | 269 | encrypt: purpose == wire::PasswordPurpose::Encrypt, |
| 254 | 270 | }, |
| 271 | 추가: wire::Message::ConflictRequired { | |
| 272 | 추가: challenge_id, | |
| 273 | 추가: entry_id, | |
| 274 | 추가: relative_name, | |
| 275 | 추가: incoming_size, | |
| 276 | 추가: existing_size, | |
| 277 | 추가: } if expected == Some(wire::ActionKind::Extract) => { | |
| 278 | 추가: ui::Event::ConflictRequired(ui::Conflict { | |
| 279 | 추가: challenge_id, | |
| 280 | 추가: entry_id, | |
| 281 | 추가: relative_name, | |
| 282 | 추가: incoming_size, | |
| 283 | 추가: existing_size, | |
| 284 | 추가: }) | |
| 285 | 추가: } | |
| 286 | 추가: wire::Message::ConflictResolved { | |
| 287 | 추가: entry_id, | |
| 288 | 추가: relative_name, | |
| 289 | 추가: choice, | |
| 290 | 추가: } if expected == Some(wire::ActionKind::Extract) => { | |
| 291 | 추가: ui::Event::ConflictResolved(ui::Resolution { | |
| 292 | 추가: entry_id, | |
| 293 | 추가: relative_name, | |
| 294 | 추가: choice: conflict_to_ui(choice), | |
| 295 | 추가: }) | |
| 296 | 추가: } | |
| 255 | 297 | wire::Message::Progress { |
| 256 | 298 | stage, |
| 257 | 299 | processed_bytes, |
| @@ -460,6 +502,15 @@ impl ui::Connection for ProcessConnection { | ||
| 460 | 502 | })? = Some(start.action.kind()); |
| 461 | 503 | wire::Message::Start(start) |
| 462 | 504 | } |
| 505 | 추가: ui::Command::ConflictReply { | |
| 506 | 추가: challenge_id, | |
| 507 | 추가: choice, | |
| 508 | 추가: apply_to_remaining, | |
| 509 | 추가: } => wire::Message::ConflictReply { | |
| 510 | 추가: challenge_id, | |
| 511 | 추가: choice: conflict_to_wire(choice), | |
| 512 | 추가: apply_to_remaining, | |
| 513 | 추가: }, | |
| 463 | 514 | ui::Command::Cancel => wire::Message::Cancel, |
| 464 | 515 | ui::Command::Password { |
| 465 | 516 | challenge_id, |
| @@ -680,3 +731,7 @@ fn supervise( | ||
| 680 | 731 | ); |
| 681 | 732 | } |
| 682 | 733 | } |
| 734 | 추가: | |
| 735 | 추가: #[cfg(test)] | |
| 736 | 추가: #[path = "../../../tests/rust-app-ui/conflict_codec.rs"] | |
| 737 | 추가: mod conflict_codec_tests; |
| @@ -202,6 +202,8 @@ pub struct ArchiveApp { | ||
| 202 | 202 | password_confirm: String, |
| 203 | 203 | password_visible: bool, |
| 204 | 204 | password_challenge: Option<u64>, |
| 205 | 추가: conflict_challenge: Option<(u64, u64)>, | |
| 206 | 추가: conflict_apply: bool, | |
| 205 | 207 | aes256: bool, |
| 206 | 208 | create: bool, |
| 207 | 209 | selected_only: bool, |
| @@ -263,6 +265,8 @@ impl ArchiveApp { | ||
| 263 | 265 | password_confirm: String::new(), |
| 264 | 266 | password_visible: false, |
| 265 | 267 | password_challenge: None, |
| 268 | 추가: conflict_challenge: None, | |
| 269 | 추가: conflict_apply: false, | |
| 266 | 270 | aes256: false, |
| 267 | 271 | create: false, |
| 268 | 272 | selected_only: false, |
| @@ -1012,6 +1016,9 @@ impl ArchiveApp { | ||
| 1012 | 1016 | if self.model.challenge.is_some() { |
| 1013 | 1017 | self.password_dialog(&ctx, new_challenge); |
| 1014 | 1018 | } |
| 1019 | 추가: if self.model.conflict.is_some() && self.model.close == Close::Open { | |
| 1020 | 추가: self.conflict_dialog(&ctx); | |
| 1021 | 추가: } | |
| 1015 | 1022 | self.close_dialog(&ctx); |
| 1016 | 1023 | self.picker_notice(&ctx); |
| 1017 | 1024 | if self.custom_frame { |
| @@ -1593,6 +1600,7 @@ impl ArchiveApp { | ||
| 1593 | 1600 | (self.create && !self.model.busy()) |
| 1594 | 1601 | || self.picker.is_some() |
| 1595 | 1602 | || self.model.challenge.is_some() |
| 1603 | 추가: || self.model.conflict.is_some() | |
| 1596 | 1604 | || self.model.close != Close::Open |
| 1597 | 1605 | } |
| 1598 | 1606 | |
| @@ -1776,13 +1784,32 @@ impl ArchiveApp { | ||
| 1776 | 1784 | let t = self.model.terminal.clone(); |
| 1777 | 1785 | let listing = matches!(self.last_request, Some(Start::List { .. })); |
| 1778 | 1786 | let creating = matches!(self.last_request, Some(Start::CreateZip { .. })); |
| 1787 | 추가: let resolved_targets = present::resolved_targets( | |
| 1788 | 추가: self.targets.as_ref(), | |
| 1789 | 추가: &self.model.entries, | |
| 1790 | 추가: matches!( | |
| 1791 | 추가: self.last_request, | |
| 1792 | 추가: Some(Start::Extract { | |
| 1793 | 추가: gzip_output_name: Some(_), | |
| 1794 | 추가: .. | |
| 1795 | 추가: }) | |
| 1796 | 추가: ) | |
| 1797 | 추가: .then_some(self.gzip_name.as_str()), | |
| 1798 | 추가: &self.model.resolutions, | |
| 1799 | 추가: ); | |
| 1800 | 추가: let skipped = self | |
| 1801 | 추가: .model | |
| 1802 | 추가: .resolutions | |
| 1803 | 추가: .iter() | |
| 1804 | 추가: .filter(|r| r.choice == ConflictChoice::Skip) | |
| 1805 | 추가: .count(); | |
| 1779 | 1806 | let warnings = if listing { |
| 1780 | 1807 | Vec::new() |
| 1781 | 1808 | } else { |
| 1782 | 1809 | present::publication_warnings( |
| 1783 | 1810 | t.as_ref(), |
| 1784 | 1811 | self.model.confirmed, |
| 1785 | 삭제: self.targets.as_ref(), | |
| 1812 | 추가: resolved_targets.as_ref(), | |
| 1786 | 1813 | &self.directories, |
| 1787 | 1814 | &self.model.outputs, |
| 1788 | 1815 | ) |
| @@ -1803,6 +1830,8 @@ impl ArchiveApp { | ||
| 1803 | 1830 | let title = if success { |
| 1804 | 1831 | if creating { |
| 1805 | 1832 | "ZIP 파일을 만들었습니다" |
| 1833 | 추가: } else if skipped > 0 && t.as_ref().is_some_and(|t| t.created_count == 0) { | |
| 1834 | 추가: "모든 파일을 건너뛰었습니다" | |
| 1806 | 1835 | } else { |
| 1807 | 1836 | "압축을 풀었습니다" |
| 1808 | 1837 | } |
| @@ -1846,7 +1875,7 @@ impl ArchiveApp { | ||
| 1846 | 1875 | .id_salt("result-message") |
| 1847 | 1876 | .max_height(max_height) |
| 1848 | 1877 | .show(ui, |ui| { |
| 1849 | 삭제: if success { | |
| 1878 | 추가: if success && t.as_ref().is_some_and(|t| t.created_count > 0) { | |
| 1850 | 1879 | let path = match self.last_request.as_ref() { |
| 1851 | 1880 | Some(Start::CreateZip { output_file, .. }) => { |
| 1852 | 1881 | output_file.display().to_string() |
| @@ -1866,6 +1895,21 @@ impl ArchiveApp { | ||
| 1866 | 1895 | creating, |
| 1867 | 1896 | )); |
| 1868 | 1897 | } |
| 1898 | 추가: if skipped > 0 { | |
| 1899 | 추가: ui.label(format!("건너뛴 파일 {skipped}개")); | |
| 1900 | 추가: } | |
| 1901 | 추가: for resolution in self | |
| 1902 | 추가: .model | |
| 1903 | 추가: .resolutions | |
| 1904 | 추가: .iter() | |
| 1905 | 추가: .filter(|r| r.choice == ConflictChoice::Rename) | |
| 1906 | 추가: { | |
| 1907 | 추가: theme::bounded_text( | |
| 1908 | 추가: ui, | |
| 1909 | 추가: &format!("이름 바꿔 저장: {}", resolution.relative_name), | |
| 1910 | 추가: ui.available_width(), | |
| 1911 | 추가: ); | |
| 1912 | 추가: } | |
| 1869 | 1913 | for warning in warnings |
| 1870 | 1914 | .iter() |
| 1871 | 1915 | .copied() |
| @@ -2383,6 +2427,57 @@ impl ArchiveApp { | ||
| 2383 | 2427 | cancel |
| 2384 | 2428 | } |
| 2385 | 2429 | |
| 2430 | 추가: fn conflict_dialog(&mut self, ctx: &egui::Context) { | |
| 2431 | 추가: let conflict = self.model.conflict.clone().unwrap(); | |
| 2432 | 추가: let question = (self.model.job_id().unwrap_or(0), conflict.challenge_id); | |
| 2433 | 추가: if self.conflict_challenge != Some(question) { | |
| 2434 | 추가: self.conflict_challenge = Some(question); | |
| 2435 | 추가: self.conflict_apply = false; | |
| 2436 | 추가: } | |
| 2437 | 추가: let mut choice = None; | |
| 2438 | 추가: let mut cancel = false; | |
| 2439 | 추가: let modal = egui::Modal::new(egui::Id::unique("archive-conflict")).show(ctx, |ui| { | |
| 2440 | 추가: ui.set_width((ctx.content_rect().width() - 64.0).min(460.0)); | |
| 2441 | 추가: ui.heading("같은 이름의 파일이 있습니다"); | |
| 2442 | 추가: theme::bounded_text(ui, &conflict.relative_name, ui.available_width()); | |
| 2443 | 추가: ui.add_space(theme::SPACE); | |
| 2444 | 추가: egui::Grid::new("conflict-sizes") | |
| 2445 | 추가: .spacing([24.0, 8.0]) | |
| 2446 | 추가: .show(ui, |ui| { | |
| 2447 | 추가: ui.label("기존 파일"); | |
| 2448 | 추가: ui.label(present::bytes_text(conflict.existing_size)); | |
| 2449 | 추가: ui.end_row(); | |
| 2450 | 추가: ui.label("압축파일 안의 파일"); | |
| 2451 | 추가: ui.label(present::bytes_text(conflict.incoming_size)); | |
| 2452 | 추가: ui.end_row(); | |
| 2453 | 추가: }); | |
| 2454 | 추가: ui.add_space(theme::SPACE); | |
| 2455 | 추가: ui.checkbox(&mut self.conflict_apply, "나머지 파일에도 같게 적용"); | |
| 2456 | 추가: ui.add_space(theme::SPACE); | |
| 2457 | 추가: ui.horizontal_wrapped(|ui| { | |
| 2458 | 추가: for (label, value) in [ | |
| 2459 | 추가: ("덮어쓰기", ConflictChoice::Overwrite), | |
| 2460 | 추가: ("건너뛰기", ConflictChoice::Skip), | |
| 2461 | 추가: ("이름 바꿔 저장", ConflictChoice::Rename), | |
| 2462 | 추가: ] { | |
| 2463 | 추가: if theme::action(ui, label, false, self.model.error.is_none()).clicked() { | |
| 2464 | 추가: choice = Some(value); | |
| 2465 | 추가: } | |
| 2466 | 추가: } | |
| 2467 | 추가: }); | |
| 2468 | 추가: ui.label("이름 바꿔 저장하면 같은 폴더에 번호를 붙입니다."); | |
| 2469 | 추가: if let Some(error) = &self.model.error { | |
| 2470 | 추가: Self::error_notice(ui, present::client_error_text(error)); | |
| 2471 | 추가: } | |
| 2472 | 추가: cancel = theme::action(ui, "작업 취소", false, true).clicked(); | |
| 2473 | 추가: }); | |
| 2474 | 추가: if modal.should_close() || cancel { | |
| 2475 | 추가: self.model.cancel(); | |
| 2476 | 추가: } else if let Some(choice) = choice { | |
| 2477 | 추가: self.model.resolve_conflict(choice, self.conflict_apply); | |
| 2478 | 추가: } | |
| 2479 | 추가: } | |
| 2480 | 추가: | |
| 2386 | 2481 | fn password_dialog(&mut self, ctx: &egui::Context, new_challenge: bool) { |
| 2387 | 2482 | let (_, attempt, encrypt) = self.model.challenge.unwrap(); |
| 2388 | 2483 | let mut submit = false; |
| @@ -70,9 +70,37 @@ impl Drop for Secret { | ||
| 70 | 70 | self.0.fill(0); |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 추가: #[derive(Clone, Copy, Debug, Eq, PartialEq)] | |
| 74 | 추가: pub enum ConflictChoice { | |
| 75 | 추가: Overwrite, | |
| 76 | 추가: Skip, | |
| 77 | 추가: Rename, | |
| 78 | 추가: } | |
| 79 | 추가: #[derive(Clone, Debug, Eq, PartialEq)] | |
| 80 | 추가: pub struct Conflict { | |
| 81 | 추가: pub challenge_id: u64, | |
| 82 | 추가: pub entry_id: u32, | |
| 83 | 추가: pub relative_name: String, | |
| 84 | 추가: pub incoming_size: u64, | |
| 85 | 추가: pub existing_size: u64, | |
| 86 | 추가: } | |
| 87 | 추가: #[derive(Clone, Debug, Eq, PartialEq)] | |
| 88 | 추가: pub struct Resolution { | |
| 89 | 추가: pub entry_id: u32, | |
| 90 | 추가: pub relative_name: String, | |
| 91 | 추가: pub choice: ConflictChoice, | |
| 92 | 추가: } | |
| 73 | 93 | pub enum Command { |
| 74 | 94 | Start(Start), |
| 75 | 삭제: Password { challenge_id: u64, secret: Secret }, | |
| 95 | 추가: Password { | |
| 96 | 추가: challenge_id: u64, | |
| 97 | 추가: secret: Secret, | |
| 98 | 추가: }, | |
| 99 | 추가: ConflictReply { | |
| 100 | 추가: challenge_id: u64, | |
| 101 | 추가: choice: ConflictChoice, | |
| 102 | 추가: apply_to_remaining: bool, | |
| 103 | 추가: }, | |
| 76 | 104 | Cancel, |
| 77 | 105 | } |
| 78 | 106 | pub struct Request { |
| @@ -186,6 +214,8 @@ pub enum Event { | ||
| 186 | 214 | attempt: u32, |
| 187 | 215 | encrypt: bool, |
| 188 | 216 | }, |
| 217 | 추가: ConflictRequired(Conflict), | |
| 218 | 추가: ConflictResolved(Resolution), | |
| 189 | 219 | Progress { |
| 190 | 220 | stage: Stage, |
| 191 | 221 | processed: u64, |
| @@ -247,6 +277,7 @@ struct Running { | ||
| 247 | 277 | stderr_eof: bool, |
| 248 | 278 | exit: Option<bool>, |
| 249 | 279 | cancel_sequence: Option<u64>, |
| 280 | 추가: conflict_ids: BTreeSet<u64>, | |
| 250 | 281 | } |
| 251 | 282 | #[derive(Clone, Copy, Debug, Default, Eq, PartialEq)] |
| 252 | 283 | pub enum Close { |
| @@ -267,6 +298,8 @@ pub struct Model { | ||
| 267 | 298 | pub selected: BTreeSet<u32>, |
| 268 | 299 | pub terminal: Option<Terminal>, |
| 269 | 300 | pub challenge: Option<(u64, u32, bool)>, |
| 301 | 추가: pub conflict: Option<Conflict>, | |
| 302 | 추가: pub resolutions: Vec<Resolution>, | |
| 270 | 303 | pub progress: Option<(Stage, u64, Option<u64>, u64)>, |
| 271 | 304 | pub outputs: Vec<(String, Disposition)>, |
| 272 | 305 | pub cancel: Option<CancelStatus>, |
| @@ -375,6 +408,8 @@ impl Model { | ||
| 375 | 408 | self.next_id = id; |
| 376 | 409 | self.terminal = None; |
| 377 | 410 | self.challenge = None; |
| 411 | 추가: self.conflict = None; | |
| 412 | 추가: self.resolutions.clear(); | |
| 378 | 413 | self.progress = None; |
| 379 | 414 | self.outputs.clear(); |
| 380 | 415 | self.cancel = None; |
| @@ -396,6 +431,7 @@ impl Model { | ||
| 396 | 431 | stderr_eof: false, |
| 397 | 432 | exit: None, |
| 398 | 433 | cancel_sequence: None, |
| 434 | 추가: conflict_ids: BTreeSet::new(), | |
| 399 | 435 | }); |
| 400 | 436 | started |
| 401 | 437 | } |
| @@ -443,6 +479,29 @@ impl Model { | ||
| 443 | 479 | .is_some() |
| 444 | 480 | { |
| 445 | 481 | self.challenge = None; |
| 482 | 추가: self.conflict = None; | |
| 483 | 추가: self.input_error = None; | |
| 484 | 추가: true | |
| 485 | 추가: } else { | |
| 486 | 추가: false | |
| 487 | 추가: } | |
| 488 | 추가: } | |
| 489 | 추가: pub fn resolve_conflict(&mut self, choice: ConflictChoice, apply_to_remaining: bool) -> bool { | |
| 490 | 추가: let Some(conflict) = &self.conflict else { | |
| 491 | 추가: return false; | |
| 492 | 추가: }; | |
| 493 | 추가: if self.cancellation_requested() || self.error.is_some() || self.close != Close::Open { | |
| 494 | 추가: return false; | |
| 495 | 추가: } | |
| 496 | 추가: if self | |
| 497 | 추가: .send(Command::ConflictReply { | |
| 498 | 추가: challenge_id: conflict.challenge_id, | |
| 499 | 추가: choice, | |
| 500 | 추가: apply_to_remaining, | |
| 501 | 추가: }) | |
| 502 | 추가: .is_some() | |
| 503 | 추가: { | |
| 504 | 추가: self.conflict = None; | |
| 446 | 505 | self.input_error = None; |
| 447 | 506 | true |
| 448 | 507 | } else { |
| @@ -483,6 +542,7 @@ impl Model { | ||
| 483 | 542 | if let Some(seq) = self.send(Command::Cancel) { |
| 484 | 543 | self.running.as_mut().unwrap().cancel_sequence = Some(seq); |
| 485 | 544 | self.challenge = None; |
| 545 | 추가: self.conflict = None; | |
| 486 | 546 | self.input_error = None; |
| 487 | 547 | } |
| 488 | 548 | } |
| @@ -565,6 +625,7 @@ impl Model { | ||
| 565 | 625 | self.selected.clear(); |
| 566 | 626 | } |
| 567 | 627 | self.challenge = None; |
| 628 | 추가: self.conflict = None; | |
| 568 | 629 | self.input_error = None; |
| 569 | 630 | if matches!(self.close, Close::Waiting | Close::Confirm) { |
| 570 | 631 | self.close = Close::Review; |
| @@ -636,12 +697,51 @@ impl Model { | ||
| 636 | 697 | attempt, |
| 637 | 698 | encrypt, |
| 638 | 699 | } => { |
| 639 | 삭제: if self.challenge.is_some() || challenge_id == 0 { | |
| 700 | 추가: if self.challenge.is_some() || self.conflict.is_some() || challenge_id == 0 | |
| 701 | 추가: { | |
| 640 | 702 | self.error = Some("암호 요청이 유효하지 않습니다".into()); |
| 641 | 703 | } else { |
| 642 | 704 | self.challenge = Some((challenge_id, attempt, encrypt)); |
| 643 | 705 | } |
| 644 | 706 | } |
| 707 | 추가: Event::ConflictRequired(conflict) => { | |
| 708 | 추가: let valid_entry = self | |
| 709 | 추가: .entries | |
| 710 | 추가: .iter() | |
| 711 | 추가: .any(|entry| entry.id == conflict.entry_id && entry.kind == Kind::File); | |
| 712 | 추가: if !matches!(run.start, Start::Extract { .. }) | |
| 713 | 추가: || !valid_entry | |
| 714 | 추가: || conflict.challenge_id == 0 | |
| 715 | 추가: || self.challenge.is_some() | |
| 716 | 추가: || self.conflict.is_some() | |
| 717 | 추가: || run.conflict_ids.len() >= 100_000 | |
| 718 | 추가: || !valid_relative(&conflict.relative_name) | |
| 719 | 추가: || conflict.relative_name.len() > 4096 | |
| 720 | 추가: || !run.conflict_ids.insert(conflict.challenge_id) | |
| 721 | 추가: { | |
| 722 | 추가: self.error = Some("파일 충돌 요청이 유효하지 않습니다".into()); | |
| 723 | 추가: } else if run.cancel_sequence.is_none() { | |
| 724 | 추가: self.conflict = Some(conflict); | |
| 725 | 추가: } | |
| 726 | 추가: } | |
| 727 | 추가: Event::ConflictResolved(resolution) => { | |
| 728 | 추가: if !matches!(run.start, Start::Extract { .. }) | |
| 729 | 추가: || !self.entries.iter().any(|entry| { | |
| 730 | 추가: entry.id == resolution.entry_id && entry.kind == Kind::File | |
| 731 | 추가: }) | |
| 732 | 추가: || self.resolutions.len() >= 100_000 | |
| 733 | 추가: || self | |
| 734 | 추가: .resolutions | |
| 735 | 추가: .iter() | |
| 736 | 추가: .any(|r| r.entry_id == resolution.entry_id) | |
| 737 | 추가: || !valid_relative(&resolution.relative_name) | |
| 738 | 추가: || resolution.relative_name.len() > 4096 | |
| 739 | 추가: { | |
| 740 | 추가: self.error = Some("파일 충돌 결과가 유효하지 않습니다".into()); | |
| 741 | 추가: } else { | |
| 742 | 추가: self.resolutions.push(resolution); | |
| 743 | 추가: } | |
| 744 | 추가: } | |
| 645 | 745 | Event::Progress { |
| 646 | 746 | stage, |
| 647 | 747 | processed, |
| @@ -671,6 +771,7 @@ impl Model { | ||
| 671 | 771 | } |
| 672 | 772 | Event::Terminal(t) => { |
| 673 | 773 | self.challenge = None; |
| 774 | 추가: self.conflict = None; | |
| 674 | 775 | self.terminal = Some(t); |
| 675 | 776 | } |
| 676 | 777 | } |
| @@ -685,6 +786,9 @@ impl Model { | ||
| 685 | 786 | if self.terminal.is_some() { |
| 686 | 787 | return "작업 결과 수신 / 프로세스 종료 확인 중".into(); |
| 687 | 788 | } |
| 789 | 추가: if self.conflict.is_some() { | |
| 790 | 추가: return "같은 이름의 파일을 처리할 방법을 선택하세요".into(); | |
| 791 | 추가: } | |
| 688 | 792 | if self.challenge.is_some() { |
| 689 | 793 | return "암호를 입력하세요".into(); |
| 690 | 794 | } |
| @@ -246,6 +246,7 @@ impl Connection for CaptureConnection { | ||
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 추가: Command::ConflictReply { .. } => return Err("충돌 선택은 상황 명령으로 확인함".into()), | |
| 249 | 250 | Command::Password { .. } => self.finish(false), |
| 250 | 251 | Command::Cancel => { |
| 251 | 252 | self.event(Event::CancelAck { |
| @@ -0,0 +1,52 @@ | ||
| 1 | 추가: use super::*; | |
| 2 | 추가: | |
| 3 | 추가: #[test] | |
| 4 | 추가: fn conflict_adapter_preserves_sizes_names_ids_and_choices() { | |
| 5 | 추가: let required = || wire::Message::ConflictRequired { | |
| 6 | 추가: challenge_id: 53, | |
| 7 | 추가: entry_id: 7, | |
| 8 | 추가: relative_name: "사진/기록.txt".into(), | |
| 9 | 추가: incoming_size: u64::MAX, | |
| 10 | 추가: existing_size: 1 << 34, | |
| 11 | 추가: }; | |
| 12 | 추가: match event_to_ui(required(), Some(wire::ActionKind::Extract)).unwrap() { | |
| 13 | 추가: ui::Event::ConflictRequired(c) => { | |
| 14 | 추가: assert_eq!(c.challenge_id, 53); | |
| 15 | 추가: assert_eq!(c.entry_id, 7); | |
| 16 | 추가: assert_eq!(c.relative_name, "사진/기록.txt"); | |
| 17 | 추가: assert_eq!(c.incoming_size, u64::MAX); | |
| 18 | 추가: assert_eq!(c.existing_size, 1 << 34); | |
| 19 | 추가: } | |
| 20 | 추가: _ => panic!("충돌 요청 변환 누락"), | |
| 21 | 추가: } | |
| 22 | 추가: for expected in [ | |
| 23 | 추가: None, | |
| 24 | 추가: Some(wire::ActionKind::List), | |
| 25 | 추가: Some(wire::ActionKind::CreateZip), | |
| 26 | 추가: ] { | |
| 27 | 추가: assert!(event_to_ui(required(), expected).is_err()); | |
| 28 | 추가: } | |
| 29 | 추가: for choice in [ | |
| 30 | 추가: ui::ConflictChoice::Overwrite, | |
| 31 | 추가: ui::ConflictChoice::Skip, | |
| 32 | 추가: ui::ConflictChoice::Rename, | |
| 33 | 추가: ] { | |
| 34 | 추가: match event_to_ui( | |
| 35 | 추가: wire::Message::ConflictResolved { | |
| 36 | 추가: entry_id: 7, | |
| 37 | 추가: relative_name: "사진/기록 (1).txt".into(), | |
| 38 | 추가: choice: conflict_to_wire(choice), | |
| 39 | 추가: }, | |
| 40 | 추가: Some(wire::ActionKind::Extract), | |
| 41 | 추가: ) | |
| 42 | 추가: .unwrap() | |
| 43 | 추가: { | |
| 44 | 추가: ui::Event::ConflictResolved(r) => { | |
| 45 | 추가: assert_eq!(r.choice, choice); | |
| 46 | 추가: assert_eq!(r.entry_id, 7); | |
| 47 | 추가: assert_eq!(r.relative_name, "사진/기록 (1).txt"); | |
| 48 | 추가: } | |
| 49 | 추가: _ => panic!("충돌 결과 변환 누락"), | |
| 50 | 추가: } | |
| 51 | 추가: } | |
| 52 | 추가: } |
| @@ -0,0 +1,291 @@ | ||
| 1 | 추가: use super::*; | |
| 2 | 추가: use std::collections::BTreeSet; | |
| 3 | 추가: use zipelo_ui_memory_app::archive_present as present; | |
| 4 | 추가: | |
| 5 | 추가: fn waiting() -> (Model, FakeFactory) { | |
| 6 | 추가: let mut factory = FakeFactory::default(); | |
| 7 | 추가: let mut model = Model::default(); | |
| 8 | 추가: list(&mut model, &mut factory); | |
| 9 | 추가: factory.state.borrow_mut().manual = true; | |
| 10 | 추가: assert!(model.extract(path("output"), false, None, &mut factory)); | |
| 11 | 추가: factory | |
| 12 | 추가: .state | |
| 13 | 추가: .borrow_mut() | |
| 14 | 추가: .frame(Event::Accepted { encryption: false }); | |
| 15 | 추가: ask(&mut model, &factory, 29); | |
| 16 | 추가: (model, factory) | |
| 17 | 추가: } | |
| 18 | 추가: | |
| 19 | 추가: fn ask(model: &mut Model, factory: &FakeFactory, challenge_id: u64) { | |
| 20 | 추가: factory | |
| 21 | 추가: .state | |
| 22 | 추가: .borrow_mut() | |
| 23 | 추가: .frame(Event::ConflictRequired(Conflict { | |
| 24 | 추가: challenge_id, | |
| 25 | 추가: entry_id: 0, | |
| 26 | 추가: relative_name: "읽어주세요.txt".into(), | |
| 27 | 추가: incoming_size: 31, | |
| 28 | 추가: existing_size: 128, | |
| 29 | 추가: })); | |
| 30 | 추가: for _ in 0..8 { | |
| 31 | 추가: model.poll(); | |
| 32 | 추가: } | |
| 33 | 추가: } | |
| 34 | 추가: | |
| 35 | 추가: #[test] | |
| 36 | 추가: fn each_choice_sends_one_scoped_reply_and_does_not_claim_a_saved_file() { | |
| 37 | 추가: for choice in [ | |
| 38 | 추가: ConflictChoice::Overwrite, | |
| 39 | 추가: ConflictChoice::Skip, | |
| 40 | 추가: ConflictChoice::Rename, | |
| 41 | 추가: ] { | |
| 42 | 추가: for apply in [false, true] { | |
| 43 | 추가: let (mut model, factory) = waiting(); | |
| 44 | 추가: assert_eq!(model.conflict.as_ref().unwrap().existing_size, 128); | |
| 45 | 추가: assert!(model.resolve_conflict(choice, apply)); | |
| 46 | 추가: assert!(model.conflict.is_none()); | |
| 47 | 추가: assert!(model.outputs.is_empty()); | |
| 48 | 추가: assert!(!model.resolve_conflict(choice, apply)); | |
| 49 | 추가: assert_eq!( | |
| 50 | 추가: factory.state.borrow().conflict_replies, | |
| 51 | 추가: vec![(29, choice, apply)] | |
| 52 | 추가: ); | |
| 53 | 추가: assert_eq!( | |
| 54 | 추가: factory.state.borrow().requests.last(), | |
| 55 | 추가: Some(&(1, "conflict")) | |
| 56 | 추가: ); | |
| 57 | 추가: } | |
| 58 | 추가: } | |
| 59 | 추가: } | |
| 60 | 추가: | |
| 61 | 추가: #[test] | |
| 62 | 추가: fn cancellation_clears_question_and_rejects_a_late_click() { | |
| 63 | 추가: let (mut model, factory) = waiting(); | |
| 64 | 추가: model.cancel(); | |
| 65 | 추가: assert!(model.conflict.is_none()); | |
| 66 | 추가: assert!(!model.resolve_conflict(ConflictChoice::Overwrite, true)); | |
| 67 | 추가: ask(&mut model, &factory, 30); | |
| 68 | 추가: assert!(model.conflict.is_none()); | |
| 69 | 추가: assert!(factory.state.borrow().conflict_replies.is_empty()); | |
| 70 | 추가: } | |
| 71 | 추가: | |
| 72 | 추가: #[test] | |
| 73 | 추가: fn duplicate_challenge_and_duplicate_resolution_are_rejected() { | |
| 74 | 추가: let (mut model, factory) = waiting(); | |
| 75 | 추가: assert!(model.resolve_conflict(ConflictChoice::Skip, false)); | |
| 76 | 추가: ask(&mut model, &factory, 29); | |
| 77 | 추가: assert!(model.error.is_some()); | |
| 78 | 추가: let (mut model, factory) = waiting(); | |
| 79 | 추가: let resolution = Resolution { | |
| 80 | 추가: entry_id: 0, | |
| 81 | 추가: relative_name: "읽어주세요.txt".into(), | |
| 82 | 추가: choice: ConflictChoice::Skip, | |
| 83 | 추가: }; | |
| 84 | 추가: for _ in 0..2 { | |
| 85 | 추가: factory | |
| 86 | 추가: .state | |
| 87 | 추가: .borrow_mut() | |
| 88 | 추가: .frame(Event::ConflictResolved(resolution.clone())); | |
| 89 | 추가: } | |
| 90 | 추가: for _ in 0..8 { | |
| 91 | 추가: model.poll(); | |
| 92 | 추가: } | |
| 93 | 추가: assert!(model.error.is_some()); | |
| 94 | 추가: } | |
| 95 | 추가: | |
| 96 | 추가: fn completed(created_count: u64) -> Terminal { | |
| 97 | 추가: Terminal { | |
| 98 | 추가: outcome: Outcome::Completed, | |
| 99 | 추가: error: None, | |
| 100 | 추가: publication: if created_count == 0 { | |
| 101 | 추가: Publication::None | |
| 102 | 추가: } else { | |
| 103 | 추가: Publication::Complete | |
| 104 | 추가: }, | |
| 105 | 추가: created_count, | |
| 106 | 추가: retained_partial_count: 0, | |
| 107 | 추가: durability: if created_count == 0 { | |
| 108 | 추가: Durability::NotApplicable | |
| 109 | 추가: } else { | |
| 110 | 추가: Durability::Synced | |
| 111 | 추가: }, | |
| 112 | 추가: cleanup: Cleanup::Complete, | |
| 113 | 추가: } | |
| 114 | 추가: } | |
| 115 | 추가: | |
| 116 | 추가: #[test] | |
| 117 | 추가: fn auto_applied_results_adjust_targets_but_created_reports_confirm_saves() { | |
| 118 | 추가: for choice in [ | |
| 119 | 추가: ConflictChoice::Overwrite, | |
| 120 | 추가: ConflictChoice::Skip, | |
| 121 | 추가: ConflictChoice::Rename, | |
| 122 | 추가: ] { | |
| 123 | 추가: let (mut model, factory) = waiting(); | |
| 124 | 추가: assert!(model.resolve_conflict(choice, true)); | |
| 125 | 추가: let name = if choice == ConflictChoice::Rename { | |
| 126 | 추가: "읽어주세요 (1).txt" | |
| 127 | 추가: } else { | |
| 128 | 추가: "읽어주세요.txt" | |
| 129 | 추가: }; | |
| 130 | 추가: factory | |
| 131 | 추가: .state | |
| 132 | 추가: .borrow_mut() | |
| 133 | 추가: .frame(Event::ConflictResolved(Resolution { | |
| 134 | 추가: entry_id: 0, | |
| 135 | 추가: relative_name: name.into(), | |
| 136 | 추가: choice, | |
| 137 | 추가: })); | |
| 138 | 추가: for _ in 0..8 { | |
| 139 | 추가: model.poll(); | |
| 140 | 추가: } | |
| 141 | 추가: assert!(model.outputs.is_empty()); | |
| 142 | 추가: let targets = ["읽어주세요.txt".to_owned()].into_iter().collect(); | |
| 143 | 추가: let targets = | |
| 144 | 추가: present::resolved_targets(Some(&targets), &model.entries, None, &model.resolutions) | |
| 145 | 추가: .unwrap(); | |
| 146 | 추가: assert_eq!(targets.len(), usize::from(choice != ConflictChoice::Skip)); | |
| 147 | 추가: let count = u64::from(choice != ConflictChoice::Skip); | |
| 148 | 추가: let terminal = completed(count); | |
| 149 | 추가: if count != 0 { | |
| 150 | 추가: assert!( | |
| 151 | 추가: present::publication_warnings( | |
| 152 | 추가: Some(&terminal), | |
| 153 | 추가: true, | |
| 154 | 추가: Some(&targets), | |
| 155 | 추가: &BTreeSet::new(), | |
| 156 | 추가: &[] | |
| 157 | 추가: ) | |
| 158 | 추가: .contains(&present::UNCERTAIN) | |
| 159 | 추가: ); | |
| 160 | 추가: factory.state.borrow_mut().frame(Event::Output { | |
| 161 | 추가: entry_id: Some(0), | |
| 162 | 추가: relative_name: name.into(), | |
| 163 | 추가: disposition: Disposition::Created, | |
| 164 | 추가: }); | |
| 165 | 추가: } | |
| 166 | 추가: factory | |
| 167 | 추가: .state | |
| 168 | 추가: .borrow_mut() | |
| 169 | 추가: .frame(Event::Terminal(terminal.clone())); | |
| 170 | 추가: factory.state.borrow_mut().queue.extend([ | |
| 171 | 추가: HostEvent::StdoutEof, | |
| 172 | 추가: HostEvent::StderrEof, | |
| 173 | 추가: HostEvent::Exited { success: true }, | |
| 174 | 추가: ]); | |
| 175 | 추가: pump(&mut model); | |
| 176 | 추가: assert!(model.confirmed); | |
| 177 | 추가: assert!(model.conflict.is_none()); | |
| 178 | 추가: assert!( | |
| 179 | 추가: present::publication_warnings( | |
| 180 | 추가: Some(&terminal), | |
| 181 | 추가: model.confirmed, | |
| 182 | 추가: Some(&targets), | |
| 183 | 추가: &BTreeSet::new(), | |
| 184 | 추가: &model.outputs | |
| 185 | 추가: ) | |
| 186 | 추가: .is_empty() | |
| 187 | 추가: ); | |
| 188 | 추가: } | |
| 189 | 추가: } | |
| 190 | 추가: | |
| 191 | 추가: #[test] | |
| 192 | 추가: fn skipped_files_still_allow_created_directories_to_be_counted() { | |
| 193 | 추가: let terminal = completed(1); | |
| 194 | 추가: assert!( | |
| 195 | 추가: present::publication_warnings( | |
| 196 | 추가: Some(&terminal), | |
| 197 | 추가: true, | |
| 198 | 추가: Some(&BTreeSet::new()), | |
| 199 | 추가: &["사진".into()].into_iter().collect(), | |
| 200 | 추가: &[("사진".into(), Disposition::Created)], | |
| 201 | 추가: ) | |
| 202 | 추가: .is_empty() | |
| 203 | 추가: ); | |
| 204 | 추가: } | |
| 205 | 추가: | |
| 206 | 추가: #[cfg(all(feature = "ui-fixture", debug_assertions))] | |
| 207 | 추가: #[test] | |
| 208 | 추가: fn conflict_modal_buttons_and_escape_use_the_pending_question() { | |
| 209 | 추가: use eframe::egui::{self, epaint::Shape}; | |
| 210 | 추가: use zipelo_ui_memory_app::archive_screen::{ArchiveApp, scenarios}; | |
| 211 | 추가: for label in [ | |
| 212 | 추가: "덮어쓰기", | |
| 213 | 추가: "건너뛰기", | |
| 214 | 추가: "이름 바꿔 저장", | |
| 215 | 추가: "작업 취소", | |
| 216 | 추가: "escape", | |
| 217 | 추가: ] { | |
| 218 | 추가: let ctx = egui::Context::default(); | |
| 219 | 추가: let mut app = scenarios::parse("conflict-choice").unwrap().build(); | |
| 220 | 추가: let frame = |app: &mut ArchiveApp, events| { | |
| 221 | 추가: let mut output = ctx.run_ui( | |
| 222 | 추가: egui::RawInput { | |
| 223 | 추가: screen_rect: Some(egui::Rect::from_min_size( | |
| 224 | 추가: egui::Pos2::ZERO, | |
| 225 | 추가: egui::vec2(760.0, 540.0), | |
| 226 | 추가: )), | |
| 227 | 추가: events, | |
| 228 | 추가: ..Default::default() | |
| 229 | 추가: }, | |
| 230 | 추가: |ui| app.show(ui), | |
| 231 | 추가: ); | |
| 232 | 추가: output.textures_delta.clear(); | |
| 233 | 추가: output | |
| 234 | 추가: }; | |
| 235 | 추가: fn labels(shape: &Shape, output: &mut Vec<(String, egui::Pos2)>) { | |
| 236 | 추가: match shape { | |
| 237 | 추가: Shape::Text(t) => { | |
| 238 | 추가: output.push((t.galley.text().into(), t.pos + t.galley.rect.size() / 2.0)) | |
| 239 | 추가: } | |
| 240 | 추가: Shape::Vec(shapes) => { | |
| 241 | 추가: for shape in shapes { | |
| 242 | 추가: labels(shape, output); | |
| 243 | 추가: } | |
| 244 | 추가: } | |
| 245 | 추가: _ => {} | |
| 246 | 추가: } | |
| 247 | 추가: } | |
| 248 | 추가: let mut texts = Vec::new(); | |
| 249 | 추가: for _ in 0..3 { | |
| 250 | 추가: texts.clear(); | |
| 251 | 추가: for shape in frame(&mut app, vec![]).shapes { | |
| 252 | 추가: labels(&shape.shape, &mut texts); | |
| 253 | 추가: } | |
| 254 | 추가: } | |
| 255 | 추가: if label == "escape" { | |
| 256 | 추가: frame( | |
| 257 | 추가: &mut app, | |
| 258 | 추가: vec![egui::Event::Key { | |
| 259 | 추가: key: egui::Key::Escape, | |
| 260 | 추가: physical_key: None, | |
| 261 | 추가: pressed: true, | |
| 262 | 추가: repeat: false, | |
| 263 | 추가: modifiers: egui::Modifiers::NONE, | |
| 264 | 추가: }], | |
| 265 | 추가: ); | |
| 266 | 추가: } else { | |
| 267 | 추가: let point = texts.iter().find(|(text, _)| text == label).unwrap().1; | |
| 268 | 추가: for pressed in [true, false] { | |
| 269 | 추가: frame( | |
| 270 | 추가: &mut app, | |
| 271 | 추가: vec![ | |
| 272 | 추가: egui::Event::PointerMoved(point), | |
| 273 | 추가: egui::Event::PointerButton { | |
| 274 | 추가: pos: point, | |
| 275 | 추가: button: egui::PointerButton::Primary, | |
| 276 | 추가: pressed, | |
| 277 | 추가: modifiers: egui::Modifiers::NONE, | |
| 278 | 추가: }, | |
| 279 | 추가: ], | |
| 280 | 추가: ); | |
| 281 | 추가: } | |
| 282 | 추가: } | |
| 283 | 추가: assert!(app.model.conflict.is_none(), "{label}"); | |
| 284 | 추가: assert!(app.model.busy()); | |
| 285 | 추가: assert!(app.model.outputs.is_empty()); | |
| 286 | 추가: assert_eq!( | |
| 287 | 추가: app.model.cancellation_requested(), | |
| 288 | 추가: matches!(label, "작업 취소" | "escape") | |
| 289 | 추가: ); | |
| 290 | 추가: } | |
| 291 | 추가: } |
| @@ -6,6 +6,7 @@ pub struct State { | ||
| 6 | 6 | pub requests: Vec<(u64, &'static str)>, |
| 7 | 7 | pub starts: Vec<Start>, |
| 8 | 8 | pub password_seen: bool, |
| 9 | 추가: pub conflict_replies: Vec<(u64, ConflictChoice, bool)>, | |
| 9 | 10 | /// 마지막으로 받은 암호 원문. 화면에서 입력한 암호가 그대로 전달됐는지 확인할 때 씀. |
| 10 | 11 | pub password: Vec<u8>, |
| 11 | 12 | pub job: u64, |
| @@ -184,6 +185,15 @@ impl Connection for FakeConnection { | ||
| 184 | 185 | s.complete_action(); |
| 185 | 186 | } |
| 186 | 187 | } |
| 188 | 추가: Command::ConflictReply { | |
| 189 | 추가: challenge_id, | |
| 190 | 추가: choice, | |
| 191 | 추가: apply_to_remaining, | |
| 192 | 추가: } => { | |
| 193 | 추가: s.requests.push((request.sequence, "conflict")); | |
| 194 | 추가: s.conflict_replies | |
| 195 | 추가: .push((challenge_id, choice, apply_to_remaining)); | |
| 196 | 추가: } | |
| 187 | 197 | Command::Cancel => { |
| 188 | 198 | s.requests.push((request.sequence, "cancel")); |
| 189 | 199 | if !s.manual { |
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | #[cfg(feature = "ui")] |
| 2 | 2 | mod dialogs; |
| 3 | 3 | mod fake; |
| 4 | 추가: mod conflicts; | |
| 4 | 5 | #[cfg(feature = "ui")] |
| 5 | 6 | mod native_dialogs; |
| 6 | 7 | use fake::*; |
| @@ -96,6 +96,9 @@ fn every_listed_scenario_draws_and_keeps_its_expected_screen() { | ||
| 96 | 96 | ); |
| 97 | 97 | assert!(app.model.input_error.is_none(), "{}", scenario.name); |
| 98 | 98 | let expected = match scenario.name { |
| 99 | 추가: "conflict-choice" | "conflict-apply" => "나머지 파일에도 같게 적용", | |
| 100 | 추가: "extract-skipped" => "모든 파일을 건너뛰었습니다", | |
| 101 | 추가: "extract-renamed" => "이름 바꿔 저장: 읽어주세요 (1).txt", | |
| 99 | 102 | "empty" => "압축파일", |
| 100 | 103 | "folder-empty" => "이 폴더는 비어 있습니다", |
| 101 | 104 | "dialog-error" => "파일 선택 창을 열 수 없습니다", |
| @@ -21,6 +21,10 @@ macro_rules! catalog { | ||
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | catalog! { |
| 24 | 추가: "conflict-choice" => "같은 이름 파일의 세 가지 처리 선택", | |
| 25 | 추가: "conflict-apply" => "남은 충돌에 같은 선택 적용", | |
| 26 | 추가: "extract-skipped" => "모든 파일을 건너뛴 정상 완료", | |
| 27 | 추가: "extract-renamed" => "이름을 바꿔 저장한 완료 결과", | |
| 24 | 28 | "empty" => "빈 첫 화면", |
| 25 | 29 | "archive" => "폴더와 파일이 있는 압축파일", |
| 26 | 30 | "folder" => "사진 하위 폴더", |
| @@ -273,11 +277,70 @@ impl Scenario { | ||
| 273 | 277 | "사진/풍경.jpg".into(), |
| 274 | 278 | ]) |
| 275 | 279 | }); |
| 280 | 추가: if matches!(self.name, "extract-skipped" | "extract-renamed") { | |
| 281 | 추가: app.targets = Some(["읽어주세요.txt".into()].into_iter().collect()); | |
| 282 | 추가: app.directories.clear(); | |
| 283 | 추가: } | |
| 276 | 284 | assert!(app.start(request)); |
| 277 | 285 | { |
| 278 | 286 | let mut state = state.borrow_mut(); |
| 279 | 287 | state.frame(Event::Accepted { encryption: true }); |
| 280 | 288 | match self.name { |
| 289 | 추가: "conflict-choice" | "conflict-apply" => { | |
| 290 | 추가: state.frame(Event::ConflictRequired(Conflict { | |
| 291 | 추가: challenge_id: 29, | |
| 292 | 추가: entry_id: 1, | |
| 293 | 추가: relative_name: "읽어주세요.txt".into(), | |
| 294 | 추가: incoming_size: 1_287_952, | |
| 295 | 추가: existing_size: 2048, | |
| 296 | 추가: })); | |
| 297 | 추가: } | |
| 298 | 추가: "extract-skipped" | "extract-renamed" => { | |
| 299 | 추가: let skip = self.name == "extract-skipped"; | |
| 300 | 추가: let name = if skip { | |
| 301 | 추가: "읽어주세요.txt" | |
| 302 | 추가: } else { | |
| 303 | 추가: "읽어주세요 (1).txt" | |
| 304 | 추가: }; | |
| 305 | 추가: state.frame(Event::ConflictResolved(Resolution { | |
| 306 | 추가: entry_id: 1, | |
| 307 | 추가: relative_name: name.into(), | |
| 308 | 추가: choice: if skip { | |
| 309 | 추가: ConflictChoice::Skip | |
| 310 | 추가: } else { | |
| 311 | 추가: ConflictChoice::Rename | |
| 312 | 추가: }, | |
| 313 | 추가: })); | |
| 314 | 추가: if !skip { | |
| 315 | 추가: state.frame(Event::Output { | |
| 316 | 추가: entry_id: Some(1), | |
| 317 | 추가: relative_name: name.into(), | |
| 318 | 추가: disposition: Disposition::Created, | |
| 319 | 추가: }); | |
| 320 | 추가: } | |
| 321 | 추가: state.frame(Event::Terminal(Terminal { | |
| 322 | 추가: outcome: Outcome::Completed, | |
| 323 | 추가: error: None, | |
| 324 | 추가: publication: if skip { | |
| 325 | 추가: Publication::None | |
| 326 | 추가: } else { | |
| 327 | 추가: Publication::Complete | |
| 328 | 추가: }, | |
| 329 | 추가: created_count: u64::from(!skip), | |
| 330 | 추가: retained_partial_count: 0, | |
| 331 | 추가: durability: if skip { | |
| 332 | 추가: Durability::NotApplicable | |
| 333 | 추가: } else { | |
| 334 | 추가: Durability::Synced | |
| 335 | 추가: }, | |
| 336 | 추가: cleanup: Cleanup::Complete, | |
| 337 | 추가: })); | |
| 338 | 추가: state.queue.extend([ | |
| 339 | 추가: HostEvent::StdoutEof, | |
| 340 | 추가: HostEvent::StderrEof, | |
| 341 | 추가: HostEvent::Exited { success: true }, | |
| 342 | 추가: ]); | |
| 343 | 추가: } | |
| 281 | 344 | "password" | "password-retry" | "password-create" => { |
| 282 | 345 | state.frame(Event::PasswordRequired { |
| 283 | 346 | challenge_id: 17, |
| @@ -380,6 +443,10 @@ impl Scenario { | ||
| 380 | 443 | for _ in 0..64 { |
| 381 | 444 | app.model.poll(); |
| 382 | 445 | } |
| 446 | 추가: if self.name == "conflict-apply" { | |
| 447 | 추가: app.conflict_challenge = Some((app.model.job_id().unwrap(), 29)); | |
| 448 | 추가: app.conflict_apply = true; | |
| 449 | 추가: } | |
| 383 | 450 | if self.name == "extract-unsynced" { |
| 384 | 451 | app.details = true; |
| 385 | 452 | } |