team-ljyzipelo

공개

7z 생성 화면과 상황 시험을 연동함

작성자
호시노 히나타
작성 시각
커밋
41ac7e4dd6b6bf7de8c72c57fe2c3e1769be1da1
부모
a079705
이 시점의 파일 보기

변경된 파일 12개

+422-59
수정docs/ui-scenario-guide.md+11-0
@@ -181,3 +181,14 @@ Ubuntu 제거 안내는 패키지 관리자 터미널 출력입니다. 이전
181181- split-source-changed: 목록 이후 조각 변경 시 다시 열기 안내.
182182
183183운영체제 기본 열기 창에서 같은 폴더의 첫 조각 `.7z.001`을 선택한다. 분할 묶음은 최대 999개이며 목록 열람 성공은 전체 데이터 무결성 검증 완료를 뜻하지 않는다. 실제 분할 파일 처리는 작업자 구현 후 독립 도구 표본으로 확인한다. Windows와 Wayland에서 첫 조각 선택, 누락 이름, .001 재시도 안내와 닫기를 확인하며, 위 디자인 상황은 실제 파일 검증을 대신하지 않는다.
184추가:
185추가: ## 7z 만들기 상황
186추가:
187추가: - create-sevenzip: 기존 만들기 창의 ZIP/7z 선택, LZMA2 고정과 암호 미지원 안내.
188추가: - create-sevenzip-progress: 7z 생성 진행과 취소 버튼.
189추가: - create-sevenzip-complete: 7z 파일의 저장 완료와 실제 저장 경로.
190추가: - create-sevenzip-error: 7z 저장 실패와 재시도.
191추가: - create-sevenzip-cancelled: 게시 전 취소 완료와 출력 없음.
192추가: - create-sevenzip-resource: 7z 생성의 큰 작업 허용 질문.
193추가:
194추가: 7z를 선택하면 입력한 ZIP 암호와 실행 취소 기록을 지우며, ZIP으로 돌아와도 암호를 복원하지 않는다. 기본 저장 창은 .7z를 제안하며 암호가 필요하면 ZIP을 선택한다. 이 상황들은 가짜 작업자로 화면을 구성하므로 실제 7z 생성과 독립 도구 호환 시험을 대신하지 않는다.
수정experiments/rust-ui-memory-app/src/archive_dialog.rs+24-12
@@ -8,6 +8,7 @@ pub enum Purpose {
88 Destination,
99 Retry,
1010 SaveZip,
11추가: SaveSevenZip,
1112 SaveGzip,
1213 RetryGzip,
1314}
@@ -110,6 +111,7 @@ fn choose_portal(request: DialogRequest) -> Result<Option<Vec<PathBuf>>, String>
110111 let filters = match request.purpose {
111112 Purpose::Open => archive_filters(),
112113 Purpose::SaveZip => vec![("ZIP 압축파일", vec!["zip".into()])],
114추가: Purpose::SaveSevenZip => vec![("7z 압축파일", vec!["7z".into()])],
113115 _ => Vec::new(),
114116 }
115117 .into_iter()
@@ -128,18 +130,22 @@ fn choose_portal(request: DialogRequest) -> Result<Option<Vec<PathBuf>>, String>
128130 .collect::<Vec<_>>();
129131 portal_response(pollster::block_on(async move {
130132 let selected = match request.purpose {
131삭제: Purpose::SaveZip | Purpose::SaveGzip | Purpose::RetryGzip => SaveFileRequest::default()
132삭제: .title(if request.purpose == Purpose::SaveZip {
133삭제: "ZIP 파일 저장"
134삭제: } else {
135삭제: "압축 해제 파일 저장"
136삭제: })
137삭제: .current_name(Some(request.file_name.as_str()))
138삭제: .filters(filters)
139삭제: .current_folder::<&PathBuf>(Some(&request.directory))?
140삭제: .send()
141삭제: .await?
142삭제: .response()?,
133추가: Purpose::SaveZip | Purpose::SaveSevenZip | Purpose::SaveGzip | Purpose::RetryGzip => {
134추가: SaveFileRequest::default()
135추가: .title(if request.purpose == Purpose::SaveSevenZip {
136추가: "7z 파일 저장"
137추가: } else if request.purpose == Purpose::SaveZip {
138추가: "ZIP 파일 저장"
139추가: } else {
140추가: "압축 해제 파일 저장"
141추가: })
142추가: .current_name(Some(request.file_name.as_str()))
143추가: .filters(filters)
144추가: .current_folder::<&PathBuf>(Some(&request.directory))?
145추가: .send()
146추가: .await?
147추가: .response()?
148추가: }
143149 purpose => OpenFileRequest::default()
144150 .title(match purpose {
145151 Purpose::Open => "압축파일 열기",
@@ -194,6 +200,12 @@ fn choose_native(request: DialogRequest) -> Result<Option<Vec<PathBuf>>, String>
194200 .set_file_name(request.file_name)
195201 .save_file()
196202 .map(|path| vec![path]),
203추가: Purpose::SaveSevenZip => dialog
204추가: .set_title("7z 파일 저장")
205추가: .set_file_name(request.file_name)
206추가: .add_filter("7z 압축파일", &["7z"])
207추가: .save_file()
208추가: .map(|path| vec![path]),
197209 Purpose::SaveZip => dialog
198210 .set_title("ZIP 파일 저장")
199211 .set_file_name(request.file_name)
수정experiments/rust-ui-memory-app/src/archive_process.rs+18-0
@@ -201,6 +201,24 @@ fn start_to_wire(start: ui::Start) -> wire::Start {
201201 entry_id,
202202 list_id: list_to_wire(list_id),
203203 },
204추가: ui::Start::CreateSevenZip {
205추가: sources,
206추가: output_file,
207추가: } => wire::Action::CreateSevenZip {
208추가: sources: sources
209추가: .into_iter()
210추가: .map(|(path, archive_name)| wire::Source {
211추가: path: wire::NativePath::from_path(&crate::archive_path::worker_path(&path)),
212추가: archive_name,
213추가: })
214추가: .collect(),
215추가: output_file: wire::NativePath::from_path(&crate::archive_path::worker_path(
216추가: &output_file,
217추가: )),
218추가: method: wire::SevenZipMethod::Lzma2,
219추가: solid: false,
220추가: encryption: wire::Encryption::None,
221추가: },
204222 ui::Start::CreateZip {
205223 sources,
206224 output_file,
수정experiments/rust-ui-memory-app/src/archive_screen.rs+135-31
@@ -22,7 +22,7 @@ use std::{
2222const WORK_WIDTH: f32 = 480.0;
2323const CREATE_WIDTH: f32 = 560.0;
2424/// 처음 열 때의 높이. 그다음부터는 내용 높이에 맞춤.
25삭제: const CREATE_MIN_HEIGHT: f32 = 300.0;
25추가: const CREATE_MIN_HEIGHT: f32 = 560.0;
2626const CREATE_LIST_HEIGHT: f32 = 288.0;
2727
2828/// ZIP 만들기 창 목록의 한 행. 디스크에서 읽은 파일이나 폴더임.
@@ -208,6 +208,7 @@ pub struct ArchiveApp {
208208 create: bool,
209209 selected_only: bool,
210210 method: Method,
211추가: seven_zip: bool,
211212 dialogs: Box<dyn Dialogs>,
212213 picker: Option<(Purpose, std::sync::mpsc::Receiver<DialogAnswer>)>,
213214 preview_open: bool,
@@ -277,6 +278,7 @@ impl ArchiveApp {
277278 create: false,
278279 selected_only: false,
279280 method: Method::Deflate,
281추가: seven_zip: false,
280282 dialogs: Box::new(NativeDialogs),
281283 picker: None,
282284 preview_open: false,
@@ -342,7 +344,7 @@ impl ArchiveApp {
342344 pub fn show_create(&mut self, encrypted: bool) {
343345 if !self.model.busy() {
344346 self.create = true;
345삭제: self.aes256 = encrypted;
347추가: self.aes256 = encrypted && !self.seven_zip;
346348 self.ui_error = None;
347349 }
348350 }
@@ -517,7 +519,11 @@ impl ArchiveApp {
517519 } else {
518520 first.file_stem()
519521 };
520삭제: self.zip_name = format!("{}.zip", name.unwrap_or_default().to_string_lossy());
522추가: self.zip_name = format!(
523추가: "{}.{}",
524추가: name.unwrap_or_default().to_string_lossy(),
525추가: if self.seven_zip { "7z" } else { "zip" }
526추가: );
521527 }
522528 }
523529 for path in paths {
@@ -596,11 +602,12 @@ impl ArchiveApp {
596602 if self.sources.is_empty() {
597603 return;
598604 }
599삭제: if !self.zip_name.to_ascii_lowercase().ends_with(".zip") {
600삭제: self.zip_name.push_str(".zip");
605추가: let extension = if self.seven_zip { ".7z" } else { ".zip" };
606추가: if !self.zip_name.to_ascii_lowercase().ends_with(extension) {
607추가: self.zip_name.push_str(extension);
601608 }
602609 if !valid_leaf(&self.zip_name) {
603삭제: self.ui_error = Some("ZIP 파일 이름을 확인하세요".into());
610추가: self.ui_error = Some("압축파일 이름을 확인하세요".into());
604611 return;
605612 }
606613 let output_file = self.zip_folder.join(&self.zip_name);
@@ -619,6 +626,15 @@ impl ArchiveApp {
619626 };
620627 sources.push((path.clone(), name.to_owned()));
621628 }
629추가: if self.seven_zip
630추가: && (self.aes256
631추가: || !self.zip_password.is_empty()
632추가: || !self.zip_password_confirm.is_empty())
633추가: {
634추가: self.ui_error =
635추가: Some("7z는 암호를 지원하지 않습니다. 암호가 필요하면 ZIP을 선택하세요".into());
636추가: return;
637추가: }
622638 if !self.zip_password_ready() {
623639 self.ui_error = Some("두 암호가 같은지 확인하세요".into());
624640 return;
@@ -627,12 +643,20 @@ impl ArchiveApp {
627643 self.directories.clear();
628644 // 암호는 ZIP 만들기 창에서 받아 두었다가 작업자가 요청하면 넘김.
629645 let password = self.aes256.then(|| std::mem::take(&mut self.zip_password));
630삭제: if self.start(Start::CreateZip {
631삭제: sources,
632삭제: output_file,
633삭제: method: self.method,
634삭제: aes256: self.aes256,
635삭제: }) {
646추가: let request = if self.seven_zip {
647추가: Start::CreateSevenZip {
648추가: sources,
649추가: output_file,
650추가: }
651추가: } else {
652추가: Start::CreateZip {
653추가: sources,
654추가: output_file,
655추가: method: self.method,
656추가: aes256: self.aes256,
657추가: }
658추가: };
659추가: if self.start(request) {
636660 self.create = false;
637661 self.create_win = WorkWindow::default();
638662 self.clear_zip_password();
@@ -657,7 +681,7 @@ impl ArchiveApp {
657681 _ => purpose,
658682 };
659683 let directory = match purpose {
660삭제: Purpose::SaveZip => self.zip_folder.clone(),
684추가: Purpose::SaveZip | Purpose::SaveSevenZip => self.zip_folder.clone(),
661685 Purpose::Destination | Purpose::SaveGzip => self
662686 .model
663687 .archive
@@ -769,8 +793,8 @@ impl ArchiveApp {
769793 }
770794 }
771795 // 저장 위치를 고르는 사이 ZIP 만들기 창을 닫았으면 아무 작업도 시작하지 않음.
772삭제: Purpose::SaveZip if !self.create => {}
773삭제: Purpose::SaveZip => {
796추가: Purpose::SaveZip | Purpose::SaveSevenZip if !self.create => {}
797추가: Purpose::SaveZip | Purpose::SaveSevenZip => {
774798 if let Some(name) = path.file_name().and_then(|name| name.to_str()) {
775799 self.zip_name = name.to_owned();
776800 self.zip_folder = path.parent().unwrap_or(Path::new("/")).to_path_buf();
@@ -799,7 +823,13 @@ impl ArchiveApp {
799823 }
800824 self.extract_selection(selection);
801825 }
826추가: Start::CreateSevenZip { .. } => {
827추가: self.set_seven_zip(true);
828추가: self.create = true;
829추가: self.begin_zip();
830추가: }
802831 Start::CreateZip { aes256, .. } => {
832추가: self.set_seven_zip(false);
803833 self.create = true;
804834 if aes256 {
805835 // 암호는 보관하지 않으므로 ZIP 만들기 창에서 다시 받음.
@@ -1867,7 +1897,10 @@ impl ArchiveApp {
18671897 let title = if self.model.busy() {
18681898 present::activity_text(
18691899 &self.model,
1870삭제: matches!(self.last_request, Some(Start::CreateZip { .. })),
1900추가: matches!(
1901추가: self.last_request,
1902추가: Some(Start::CreateZip { .. } | Start::CreateSevenZip { .. })
1903추가: ),
18711904 )
18721905 .to_owned()
18731906 } else {
@@ -1959,7 +1992,10 @@ impl ArchiveApp {
19591992 if error.starts_with("암호는") {
19601993 error.as_str()
19611994 } else {
1962삭제: if matches!(self.last_request, Some(Start::CreateZip { .. })) {
1995추가: if matches!(
1996추가: self.last_request,
1997추가: Some(Start::CreateZip { .. } | Start::CreateSevenZip { .. })
1998추가: ) {
19631999 "저장 위치와 추가한 항목을 확인하세요"
19642000 } else {
19652001 "풀 위치와 선택한 항목을 확인하세요"
@@ -1977,7 +2013,10 @@ impl ArchiveApp {
19772013 });
19782014 return;
19792015 }
1980삭제: let creating = matches!(self.last_request, Some(Start::CreateZip { .. }));
2016추가: let creating = matches!(
2017추가: self.last_request,
2018추가: Some(Start::CreateZip { .. } | Start::CreateSevenZip { .. })
2019추가: );
19812020 let cancelling = self.model.cancellation_requested() || self.model.cancel.is_some();
19822021 let title = present::activity_text(&self.model, creating);
19832022 ui.strong(title);
@@ -2034,7 +2073,10 @@ impl ArchiveApp {
20342073 fn result(&mut self, ui: &mut egui::Ui) {
20352074 let t = self.model.terminal.clone();
20362075 let listing = matches!(self.last_request, Some(Start::List { .. }));
2037삭제: let creating = matches!(self.last_request, Some(Start::CreateZip { .. }));
2076추가: let creating = matches!(
2077추가: self.last_request,
2078추가: Some(Start::CreateZip { .. } | Start::CreateSevenZip { .. })
2079추가: );
20382080 let resolved_targets = present::resolved_targets(
20392081 self.targets.as_ref(),
20402082 &self.model.entries,
@@ -2087,7 +2129,11 @@ impl ArchiveApp {
20872129 self.model.confirmed && t.as_ref().is_some_and(|t| t.outcome == Outcome::Cancelled);
20882130 let title = if success {
20892131 if creating {
2090삭제: "ZIP 파일을 만들었습니다"
2132추가: if matches!(self.last_request, Some(Start::CreateSevenZip { .. })) {
2133추가: "7z 파일을 만들었습니다"
2134추가: } else {
2135추가: "ZIP 파일을 만들었습니다"
2136추가: }
20912137 } else if skipped > 0 && t.as_ref().is_some_and(|t| t.created_count == 0) {
20922138 "모든 파일을 건너뛰었습니다"
20932139 } else {
@@ -2098,7 +2144,11 @@ impl ArchiveApp {
20982144 } else if listing {
20992145 "압축파일을 열지 못했습니다"
21002146 } else if creating {
2101삭제: "ZIP 파일을 만들지 못했습니다"
2147추가: if matches!(self.last_request, Some(Start::CreateSevenZip { .. })) {
2148추가: "7z 파일을 만들지 못했습니다"
2149추가: } else {
2150추가: "ZIP 파일을 만들지 못했습니다"
2151추가: }
21022152 } else {
21032153 "압축을 풀지 못했습니다"
21042154 };
@@ -2136,9 +2186,10 @@ impl ArchiveApp {
21362186 .show(ui, |ui| {
21372187 if success && t.as_ref().is_some_and(|t| t.created_count > 0) {
21382188 let path = match self.last_request.as_ref() {
2139삭제: Some(Start::CreateZip { output_file, .. }) => {
2140삭제: output_file.display().to_string()
2141삭제: }
2189추가: Some(
2190추가: Start::CreateZip { output_file, .. }
2191추가: | Start::CreateSevenZip { output_file, .. },
2192추가: ) => output_file.display().to_string(),
21422193 _ => format!("{} 폴더에 저장했습니다.", self.destination.display()),
21432194 };
21442195 theme::bounded_text(ui, &path, ui.available_width());
@@ -2204,7 +2255,11 @@ impl ArchiveApp {
22042255 )
22052256 {
22062257 ui.label(if creating {
2207삭제: "ZIP 파일을 만들지 않았습니다"
2258추가: if matches!(self.last_request, Some(Start::CreateSevenZip { .. })) {
2259추가: "7z 파일을 만들지 않았습니다"
2260추가: } else {
2261추가: "ZIP 파일을 만들지 않았습니다"
2262추가: }
22082263 } else {
22092264 "아무 파일도 풀지 않았습니다"
22102265 });
@@ -2376,9 +2431,10 @@ impl ArchiveApp {
23762431 }
23772432 if folder {
23782433 let path = match self.last_request.as_ref() {
2379삭제: Some(Start::CreateZip { output_file, .. }) => {
2380삭제: output_file.parent().unwrap_or(Path::new("/"))
2381삭제: }
2434추가: Some(
2435추가: Start::CreateZip { output_file, .. }
2436추가: | Start::CreateSevenZip { output_file, .. },
2437추가: ) => output_file.parent().unwrap_or(Path::new("/")),
23822438 _ => self.destination.as_path(),
23832439 };
23842440 match present::folder_command(path).spawn() {
@@ -2432,7 +2488,11 @@ impl ArchiveApp {
24322488 let modal = egui::Modal::new(egui::Id::unique("create-zip")).show(ctx, |ui| {
24332489 ui.set_width((ctx.content_rect().width() - 64.0).min(CREATE_WIDTH));
24342490 ui.horizontal(|ui| {
2435삭제: ui.heading("ZIP 만들기");
2491추가: ui.heading(if self.seven_zip {
2492추가: "7z 만들기"
2493추가: } else {
2494추가: "ZIP 만들기"
2495추가: });
24362496 ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
24372497 let button = theme::icon_button(ui, "닫기", theme::CLOSE, true);
24382498 close = button.clicked();
@@ -2448,7 +2508,11 @@ impl ArchiveApp {
24482508 return;
24492509 }
24502510 let id = egui::ViewportId::from_hash_of("archive-create");
2451삭제: let title = "ZIP 만들기 — Zipelo";
2511추가: let title = if self.seven_zip {
2512추가: "7z 만들기 — Zipelo"
2513추가: } else {
2514추가: "ZIP 만들기 — Zipelo"
2515추가: };
24522516 let custom_frame = self.custom_frame;
24532517 if !self.create_win.open {
24542518 self.create_win.height = self.create_win.height.max(CREATE_MIN_HEIGHT);
@@ -2531,7 +2595,38 @@ impl ArchiveApp {
25312595 .inner
25322596 }
25332597
2598추가: fn set_seven_zip(&mut self, selected: bool) {
2599추가: if self.seven_zip == selected {
2600추가: return;
2601추가: }
2602추가: self.seven_zip = selected;
2603추가: self.aes256 = false;
2604추가: self.clear_zip_password();
2605추가: self.ui_error = None;
2606추가: let name = self.zip_name.clone();
2607추가: let lower = name.to_ascii_lowercase();
2608추가: let stem = if lower.ends_with(".zip") {
2609추가: &name[..name.len() - 4]
2610추가: } else if lower.ends_with(".7z") {
2611추가: &name[..name.len() - 3]
2612추가: } else {
2613추가: &name
2614추가: };
2615추가: self.zip_name = format!("{stem}{}", if selected { ".7z" } else { ".zip" });
2616추가: }
2617추가:
25342618 fn create_contents(&mut self, ui: &mut egui::Ui) -> bool {
2619추가: let mut selected = self.seven_zip;
2620추가: ui.horizontal(|ui| {
2621추가: ui.label("형식");
2622추가: ui.selectable_value(&mut selected, false, "ZIP");
2623추가: ui.selectable_value(&mut selected, true, "7z");
2624추가: if selected {
2625추가: ui.label("LZMA2");
2626추가: }
2627추가: });
2628추가: self.set_seven_zip(selected);
2629추가:
25352630 let rows = self.create_rows();
25362631 let root = self.create_root();
25372632
@@ -2670,6 +2765,10 @@ impl ArchiveApp {
26702765 }
26712766
26722767 // 암호: 체크하면 바로 아래에 암호와 암호 확인 칸을 보여 줌.
2768추가: if self.seven_zip {
2769추가: ui.label("7z는 암호를 지원하지 않습니다. 암호가 필요하면 ZIP을 선택하세요");
2770추가: return false;
2771추가: }
26732772 let check = ui.checkbox(&mut self.aes256, "암호로 보호하기");
26742773 theme::pointer(&check);
26752774 theme::focus(&check);
@@ -2743,7 +2842,11 @@ impl ArchiveApp {
27432842 })
27442843 .inner;
27452844 if compress {
2746삭제: self.open_picker(Purpose::SaveZip);
2845추가: self.open_picker(if self.seven_zip {
2846추가: Purpose::SaveSevenZip
2847추가: } else {
2848추가: Purpose::SaveZip
2849추가: });
27472850 }
27482851 cancel
27492852 }
@@ -2769,6 +2872,7 @@ impl ArchiveApp {
27692872 ActionKind::List => "압축파일 목록 열기",
27702873 ActionKind::Extract => "압축 해제",
27712874 ActionKind::CreateZip => "ZIP 만들기",
2875추가: ActionKind::CreateSevenZip => "7z 만들기",
27722876 ActionKind::Preview => "파일 미리보기",
27732877 });
27742878 if question.scope.ratio {
수정experiments/rust-ui-memory-app/src/archive_ui.rs+17-3
@@ -69,6 +69,10 @@ pub enum Start {
6969 entry_id: u32,
7070 list_id: ListId,
7171 },
72추가: CreateSevenZip {
73추가: sources: Vec<(PathBuf, String)>,
74추가: output_file: PathBuf,
75추가: },
7276 CreateZip {
7377 sources: Vec<(PathBuf, String)>,
7478 output_file: PathBuf,
@@ -476,7 +480,8 @@ impl Model {
476480 }
477481 }
478482 pub fn begin(&mut self, start: Start, factory: &mut dyn Factory) -> bool {
479삭제: let expanded = self.needs_expansion(&start);
483추가: let expanded =
484추가: matches!(start, Start::CreateSevenZip { .. }) || self.needs_expansion(&start);
480485 self.begin_with_limits(start, factory, expanded)
481486 }
482487 pub fn estimated_usage(&self) -> ResourceUsage {
@@ -513,7 +518,7 @@ impl Model {
513518 .iter()
514519 .try_fold(0u64, |sum, e| sum.checked_add(e.bytes?));
515520 }
516삭제: Start::CreateZip { sources, .. } => {
521추가: Start::CreateZip { sources, .. } | Start::CreateSevenZip { sources, .. } => {
517522 usage.estimated_bytes = sources.iter().try_fold(0u64, |sum, (path, _)| {
518523 let m = std::fs::symlink_metadata(path).ok()?;
519524 if !m.is_file() {
@@ -643,6 +648,10 @@ impl Model {
643648 sources,
644649 output_file,
645650 ..
651추가: }
652추가: | Start::CreateSevenZip {
653추가: sources,
654추가: output_file,
646655 } => {
647656 !sources.is_empty()
648657 && output_file.is_absolute()
@@ -1100,6 +1109,9 @@ impl Model {
11001109 }
11011110 }
11021111 Event::Accepted { encryption } => {
1112추가: if matches!(run.start, Start::CreateSevenZip { .. }) && encryption {
1113추가: self.error = Some("7z 생성의 암호 응답이 유효하지 않습니다".into());
1114추가: }
11031115 if run.accepted {
11041116 self.error = Some("작업 승인 중복".into());
11051117 }
@@ -1144,7 +1156,8 @@ impl Model {
11441156 if run.cancel_sequence.is_some() {
11451157 return;
11461158 }
1147삭제: if self.challenge.is_some()
1159추가: if matches!(run.start, Start::CreateSevenZip { .. })
1160추가: || self.challenge.is_some()
11481161 || self.resource.is_some()
11491162 || challenge_id <= run.last_challenge
11501163 || self.conflict.is_some()
@@ -1163,6 +1176,7 @@ impl Model {
11631176 Start::List { .. } => ActionKind::List,
11641177 Start::Extract { .. } => ActionKind::Extract,
11651178 Start::CreateZip { .. } => ActionKind::CreateZip,
1179추가: Start::CreateSevenZip { .. } => ActionKind::CreateSevenZip,
11661180 Start::Preview { .. } => ActionKind::Preview,
11671181 };
11681182 let hard = Limits {
수정tests/rust-app-ui/capture.rs+5-0
@@ -236,6 +236,11 @@ impl Connection for CaptureConnection {
236236 durability: Durability::NotApplicable,
237237 cleanup: Cleanup::Complete,
238238 }),
239추가: Start::CreateSevenZip { output_file, .. } => {
240추가: self.create_name =
241추가: Some(output_file.file_name().unwrap().to_string_lossy().into());
242추가: self.finish(false);
243추가: }
239244 Start::CreateZip {
240245 output_file,
241246 aes256,
수정tests/rust-app-ui/conflict_codec.rs+33-0
@@ -107,3 +107,36 @@ fn volume_problem_adapter_preserves_native_filename_and_rejects_other_actions()
107107 Some(ui::ErrorCode::MissingVolume)
108108 );
109109}
110추가:
111추가: #[test]
112추가: fn sevenzip_creation_adapter_preserves_paths_and_fixed_options() {
113추가: let source = std::env::current_dir().unwrap().join("원본");
114추가: let output = source.with_file_name("결과.7z");
115추가: let converted = start_to_wire(ui::Start::CreateSevenZip {
116추가: sources: vec![(source.clone(), "원본".into())],
117추가: output_file: output.clone(),
118추가: });
119추가: match converted.action {
120추가: wire::Action::CreateSevenZip {
121추가: sources,
122추가: output_file,
123추가: method,
124추가: solid,
125추가: encryption,
126추가: } => {
127추가: assert_eq!(sources[0].archive_name, "원본");
128추가: assert_eq!(
129추가: sources[0].path,
130추가: wire::NativePath::from_path(&crate::archive_path::worker_path(&source))
131추가: );
132추가: assert_eq!(
133추가: output_file,
134추가: wire::NativePath::from_path(&crate::archive_path::worker_path(&output))
135추가: );
136추가: assert_eq!(method, wire::SevenZipMethod::Lzma2);
137추가: assert!(!solid);
138추가: assert_eq!(encryption, wire::Encryption::None);
139추가: }
140추가: other => panic!("잘못된 생성 형식: {other:?}"),
141추가: }
142추가: }
수정tests/rust-app-ui/create_window.rs+46-0
@@ -636,3 +636,49 @@ fn native_picker_lowers_child_windows_and_restores_their_position_and_level() {
636636 }
637637 }
638638}
639추가:
640추가: #[test]
641추가: fn sevenzip_selection_clears_zip_password_and_sends_only_supported_options() {
642추가: let scratch = Folder::new();
643추가: let factory = FakeFactory::default();
644추가: let (mut app, ctx) = create_from_folder(&scratch, &factory);
645추가: policy_click(&ctx, &mut app, "암호로 보호하기");
646추가: text(&ctx, &mut app, "zip-password-input", "previous-secret");
647추가: text(&ctx, &mut app, "zip-password-confirm", "previous-secret");
648추가: policy_click(&ctx, &mut app, "7z");
649추가: let shown = policy_render(&ctx, &mut app, vec![]);
650추가: assert!(shown.iter().any(|(s, _)| s == "LZMA2"));
651추가: assert!(!shown.iter().any(|(s, _)| s == "암호 확인"));
652추가: policy_click(&ctx, &mut app, "ZIP");
653추가: policy_click(&ctx, &mut app, "암호로 보호하기");
654추가: policy_click(&ctx, &mut app, "압축하기");
655추가: assert_eq!(factory.state.borrow().starts.len(), 1);
656추가: policy_click(&ctx, &mut app, "7z");
657추가: let dialogs = TestDialogs::default();
658추가: app.set_dialogs(Box::new(dialogs.clone()));
659추가: policy_click(&ctx, &mut app, "압축하기");
660추가: let state = dialogs.0.borrow();
661추가: let save = state.requests.last().unwrap();
662추가: assert_eq!(save.purpose, Purpose::SaveSevenZip);
663추가: assert_eq!(save.file_name, "photos.7z");
664추가: assert!(matches!(factory.state.borrow().starts.last(),
665추가: Some(Start::CreateSevenZip { sources, output_file })
666추가: if sources.len() == 1 && sources[0].1 == "photos" && output_file.ends_with("photos.7z")));
667추가: assert!(!factory.state.borrow().password_seen);
668추가: }
669추가:
670추가: #[test]
671추가: fn cancelling_sevenzip_save_keeps_selected_format_without_starting() {
672추가: let scratch = Folder::new();
673추가: let factory = FakeFactory::default();
674추가: let (mut app, ctx) = create_from_folder(&scratch, &factory);
675추가: policy_click(&ctx, &mut app, "7z");
676추가: let dialogs = TestDialogs::default();
677추가: dialogs.0.borrow_mut().cancel_save = true;
678추가: app.set_dialogs(Box::new(dialogs));
679추가: policy_click(&ctx, &mut app, "압축하기");
680추가: assert_eq!(factory.state.borrow().starts.len(), 1);
681추가: let shown = policy_render(&ctx, &mut app, vec![]);
682추가: assert!(shown.iter().any(|(s, _)| s == "7z 만들기"));
683추가: assert!(shown.iter().any(|(s, _)| s == "LZMA2"));
684추가: }
수정tests/rust-app-ui/dialogs.rs+2-1
@@ -23,7 +23,8 @@ impl Dialogs for TestDialogs {
2323 if let Some(answer) = state.answers.pop_front() {
2424 return Ok(answer);
2525 }
26삭제: if request.purpose == Purpose::SaveZip && !state.cancel_save {
26추가: if matches!(request.purpose, Purpose::SaveZip | Purpose::SaveSevenZip) && !state.cancel_save
27추가: {
2728 let name = state.save_name.take().unwrap_or(request.file_name);
2829 return Ok(Some(vec![request.directory.join(name)]));
2930 }
수정tests/rust-app-ui/regressions.rs+78-0
@@ -875,3 +875,81 @@ mod presentation;
875875mod windows_paths;
876876
877877mod guarded;
878추가:
879추가: #[test]
880추가: fn sevenzip_creation_rejects_password_prompts_and_encrypted_acceptance() {
881추가: for encrypted in [false, true] {
882추가: let mut f = FakeFactory::default();
883추가: f.state.borrow_mut().manual = true;
884추가: let mut m = Model::default();
885추가: assert!(m.begin(
886추가: Start::CreateSevenZip {
887추가: sources: vec![(path("source"), "source".into())],
888추가: output_file: path("output.7z"),
889추가: },
890추가: &mut f
891추가: ));
892추가: f.state.borrow_mut().frame(Event::Accepted {
893추가: encryption: encrypted,
894추가: });
895추가: if !encrypted {
896추가: f.state.borrow_mut().frame(Event::PasswordRequired {
897추가: challenge_id: 1,
898추가: attempt: 1,
899추가: encrypt: true,
900추가: });
901추가: }
902추가: for _ in 0..10 {
903추가: m.poll();
904추가: }
905추가: assert!(m.error.is_some());
906추가: assert!(m.challenge.is_none());
907추가: }
908추가: }
909추가:
910추가: #[test]
911추가: fn sevenzip_creation_waits_for_both_eofs_and_child_reap() {
912추가: let mut f = FakeFactory::default();
913추가: f.state.borrow_mut().manual = true;
914추가: let mut m = Model::default();
915추가: assert!(m.begin(
916추가: Start::CreateSevenZip {
917추가: sources: vec![(path("source"), "source".into())],
918추가: output_file: path("output.7z"),
919추가: },
920추가: &mut f
921추가: ));
922추가: {
923추가: let mut s = f.state.borrow_mut();
924추가: s.frame(Event::Accepted { encryption: false });
925추가: s.frame(Event::Output {
926추가: entry_id: None,
927추가: relative_name: "output.7z".into(),
928추가: disposition: Disposition::Created,
929추가: });
930추가: s.frame(Event::Terminal(Terminal {
931추가: outcome: Outcome::Completed,
932추가: error: None,
933추가: publication: Publication::Complete,
934추가: created_count: 1,
935추가: retained_partial_count: 0,
936추가: durability: Durability::Synced,
937추가: cleanup: Cleanup::Complete,
938추가: }));
939추가: }
940추가: m.poll();
941추가: assert!(!m.confirmed);
942추가: f.state.borrow_mut().queue.push_back(HostEvent::StdoutEof);
943추가: m.poll();
944추가: assert!(!m.confirmed);
945추가: f.state.borrow_mut().queue.push_back(HostEvent::StderrEof);
946추가: m.poll();
947추가: assert!(!m.confirmed);
948추가: f.state
949추가: .borrow_mut()
950추가: .queue
951추가: .push_back(HostEvent::Exited { success: true });
952추가: pump(&mut m);
953추가: assert!(m.confirmed);
954추가: assert!(m.error.is_none());
955추가: }
수정tests/rust-app-ui/scenario_tests.rs+6-0
@@ -140,6 +140,12 @@ fn every_listed_scenario_draws_and_keeps_its_expected_screen() {
140140 "extract-unsynced" => "파일을 디스크에 완전히 저장했는지 확인하지 못했습니다",
141141 "source-changed" => "압축파일 다시 열기",
142142 "gzip-conflict" => "다른 이름으로 저장",
143추가: "create-sevenzip" => "7z는 암호를 지원하지 않습니다",
144추가: "create-sevenzip-progress" => "파일을 저장하는 중",
145추가: "create-sevenzip-complete" => "7z 파일을 만들었습니다",
146추가: "create-sevenzip-error" => "7z 파일을 만들지 못했습니다",
147추가: "create-sevenzip-cancelled" => "작업을 취소했습니다",
148추가: "create-sevenzip-resource" => "큰 작업을 허용할까요?",
143149 "create-error" => "ZIP 파일을 만들지 못했습니다",
144150 "password-create" => "암호 확인",
145151 "folder" => "바다.jpg",
수정tests/rust-app-ui/scenarios.rs+47-12
@@ -21,6 +21,13 @@ macro_rules! catalog {
2121}
2222
2323catalog! {
24추가: "create-sevenzip" => "7z 형식 선택과 LZMA2 및 암호 미지원 안내",
25추가: "create-sevenzip-progress" => "7z 만들기 진행과 취소",
26추가: "create-sevenzip-complete" => "7z 만들기 완료",
27추가: "create-sevenzip-error" => "7z 만들기 저장 실패",
28추가: "create-sevenzip-cancelled" => "7z 만들기 취소 완료",
29추가: "create-sevenzip-resource" => "7z 만들기의 큰 작업 승인",
30추가:
2431 "split-archive" => "분할 7z 목록과 미리보기 비활성화",
2532 "split-first-volume" => "첫 조각의 정확한 파일명 안내",
2633 "split-missing-volume" => "누락 조각 파일명과 재시도 안내",
@@ -511,7 +518,7 @@ impl Scenario {
511518 }
512519 return app;
513520 }
514삭제: "create" | "create-encrypted" => {
521추가: "create" | "create-encrypted" | "create-sevenzip" => {
515522 app.sources = vec![base.join("읽어주세요.txt"), base.join("사진")];
516523 app.scenario_sources = Some(std::rc::Rc::new(vec![
517524 SourceRow {
@@ -526,10 +533,12 @@ impl Scenario {
526533 },
527534 ]));
528535 app.show_create(self.name == "create-encrypted");
536추가: app.set_seven_zip(self.name == "create-sevenzip");
529537 return app;
530538 }
531539 _ => {}
532540 }
541추가: let seven_zip = self.name.starts_with("create-sevenzip");
533542 let creating = self.name.starts_with("create-") || self.name == "password-create";
534543 let listing_error = matches!(self.name, "unsupported" | "damaged");
535544 if matches!(self.name, "gzip-conflict" | "gzip-conflict-choice") {
@@ -544,7 +553,12 @@ impl Scenario {
544553 }];
545554 app.gzip_name = "여행 자료".into();
546555 }
547삭제: let request = if creating {
556추가: let request = if seven_zip {
557추가: Start::CreateSevenZip {
558추가: sources: vec![(base.join("사진"), "사진".into())],
559추가: output_file: base.join("여행 자료.7z"),
560추가: }
561추가: } else if creating {
548562 Start::CreateZip {
549563 sources: vec![(base.join("사진"), "사진".into())],
550564 output_file: base.join("여행 자료.zip"),
@@ -564,7 +578,12 @@ impl Scenario {
564578 }
565579 };
566580 app.targets = Some(if creating {
567삭제: BTreeSet::from(["여행 자료.zip".into()])
581추가: BTreeSet::from([if seven_zip {
582추가: "여행 자료.7z"
583추가: } else {
584추가: "여행 자료.zip"
585추가: }
586추가: .into()])
568587 } else if matches!(self.name, "gzip-conflict" | "gzip-conflict-choice") {
569588 BTreeSet::from(["여행 자료".into()])
570589 } else {
@@ -588,13 +607,19 @@ impl Scenario {
588607 assert!(app.start(request));
589608 {
590609 let mut state = state.borrow_mut();
591삭제: state.frame(Event::Accepted { encryption: true });
610추가: state.frame(Event::Accepted {
611추가: encryption: !seven_zip,
612추가: });
592613 match self.name {
593삭제: "resource-approval" | "resource-ratio" => {
594삭제: let expanded = self.name == "resource-approval";
614추가: "resource-approval" | "resource-ratio" | "create-sevenzip-resource" => {
615추가: let expanded = self.name != "resource-ratio";
595616 state.frame(Event::ResourceRequired(ResourceChallenge {
596617 id: 1,
597삭제: action: ActionKind::Extract,
618추가: action: if seven_zip {
619추가: ActionKind::CreateSevenZip
620추가: } else {
621추가: ActionKind::Extract
622추가: },
598623 scope: ResourceScope {
599624 output: expanded,
600625 entries: expanded,
@@ -723,7 +748,10 @@ impl Scenario {
723748 encrypt: self.name == "password-create",
724749 })
725750 }
726삭제: "extract-complete" | "create-complete" | "extract-unsynced" => {
751추가: "extract-complete"
752추가: | "create-complete"
753추가: | "create-sevenzip-complete"
754추가: | "extract-unsynced" => {
727755 let names = app.targets.as_ref().unwrap();
728756 for name in names {
729757 state.frame(Event::Output {
@@ -751,7 +779,9 @@ impl Scenario {
751779 HostEvent::Exited { success: true },
752780 ]);
753781 }
754삭제: "extract-cancelled" => state.finish(Outcome::Cancelled, Publication::None),
782추가: "extract-cancelled" | "create-sevenzip-cancelled" => {
783추가: state.finish(Outcome::Cancelled, Publication::None)
784추가: }
755785 "extract-partial" | "extract-uncertain" => {
756786 let partial = self.name == "extract-partial";
757787 if partial {
@@ -780,14 +810,19 @@ impl Scenario {
780810 HostEvent::Exited { success: true },
781811 ]);
782812 }
783삭제: "conflict" | "gzip-conflict" | "unsupported" | "damaged" | "source-changed"
784삭제: | "create-error" => {
813추가: "conflict"
814추가: | "gzip-conflict"
815추가: | "unsupported"
816추가: | "damaged"
817추가: | "source-changed"
818추가: | "create-error"
819추가: | "create-sevenzip-error" => {
785820 state.frame(Event::Terminal(Terminal {
786821 outcome: Outcome::Failed,
787822 error: Some(match self.name {
788823 "conflict" | "gzip-conflict" => ErrorCode::Conflict,
789824 "source-changed" => ErrorCode::SourceChanged,
790삭제: "create-error" => ErrorCode::DiskFull,
825추가: "create-error" | "create-sevenzip-error" => ErrorCode::DiskFull,
791826 "unsupported" => ErrorCode::UnsupportedFormat,
792827 _ => ErrorCode::Integrity,
793828 }),