압축 TAR 형식의 파일 선택과 화면 안내를 보완함
- 작성자
- 호시노 히나타
- 작성 시각
- 커밋
942cb68d96bc953846f5ab7980ec453172f88a8a- 부모
- 8c5d69b
변경된 파일 11개
+136-16| @@ -269,7 +269,7 @@ | ||
| 269 | 269 | |
| 270 | 270 | 고정 문구: |
| 271 | 271 | |
| 272 | 삭제: - 빈 화면: "압축파일을 여기에 끌어 놓으세요", "또는", "ZIP, 7z, TAR, GZ, TAR.GZ 파일을 열 수 있습니다", "놓으면 엽니다" | |
| 272 | 추가: - 빈 화면: "압축파일을 여기에 끌어 놓으세요", "또는", "ZIP, 7z, TAR, GZ, TAR.GZ, TAR.BZ2, TAR.XZ 파일을 열 수 있습니다", "놓으면 엽니다" | |
| 273 | 273 | - 닫기 확인 창 "작업 중 닫기": "작업을 취소하고 닫을까요?", 버튼 [계속 작업]과 [취소하고 닫기] |
| 274 | 274 | - "종료 확인 중" 창: "마무리하는 중입니다. 잠시만 기다려 주세요", 버튼 [닫기 취소] |
| 275 | 275 |
| @@ -42,6 +42,8 @@ cargo +1.99.1 build --locked --manifest-path experiments/rust-ui-memory-app/Carg | ||
| 42 | 42 | ## 상황과 확인할 점 |
| 43 | 43 | |
| 44 | 44 | - empty: 빈 첫 화면. 파일 열기 안내와 툴바 배치를 확인한다. |
| 45 | 추가: - tar-bz2: TAR.BZ2 목록. 제목표시줄의 파일 이름과 목록을 확인한다. | |
| 46 | 추가: - tar-xz: TAR.XZ 목록. 제목표시줄의 대소문자가 섞인 복합 확장자와 목록을 확인한다. | |
| 45 | 47 | - archive: 파일과 폴더가 있는 압축파일. 이름, 크기, 잠금 아이콘과 상태 줄을 확인한다. |
| 46 | 48 | - folder: 사진 폴더 내부. 상위 폴더 이동과 경로 줄을 확인한다. |
| 47 | 49 | - many-items: 기본 5개 외에 500개 파일을 추가한 목록. 스크롤바와 행 배치를 확인한다. |
| @@ -93,3 +95,5 @@ python3 tests/ci/run_rust.py local | ||
| 93 | 95 | |
| 94 | 96 | 화면에 새 창, 버튼, 메시지, 상태 또는 오류를 추가하거나 바꾸면 같은 PR에서 상황, 시험과 이 가이드를 갱신한다. 화면 변화가 없으면 PR 본문에 "UI 변경 없음"이라고 적는다. 사용자가 직접 올린 UI 변경에서 빠진 상황은 병합 뒤 프론트엔드 담당이 보완한다. |
| 95 | 97 | |
| 98 | 추가: | |
| 99 | 추가: TAR.BZ2와 TAR.XZ의 자동 해제 폴더 이름은 미리보기에 표시되지 않는다. tests/rust-app-ui/presentation.rs의 이름 시험과 tests/rust-app-real-worker/compressed_tar_flows.rs의 실제 작업자 시험에서 복합 확장자 제거와 해제 결과를 확인한다. |
| @@ -37,7 +37,7 @@ pub trait Dialogs { | ||
| 37 | 37 | |
| 38 | 38 | pub fn archive_filters() -> Vec<(&'static str, Vec<String>)> { |
| 39 | 39 | let mut extensions = Vec::new(); |
| 40 | 삭제: for extension in ["zip", "7z", "tar", "gz", "tgz"] { | |
| 40 | 추가: for extension in ["zip", "7z", "tar", "gz", "tgz", "tar.bz2", "tar.xz"] { | |
| 41 | 41 | let mut variants = vec![String::new()]; |
| 42 | 42 | for character in extension.chars() { |
| 43 | 43 | let mut next = Vec::new(); |
| @@ -70,8 +70,11 @@ pub fn middle_text(text: &str, max_chars: usize) -> String { | ||
| 70 | 70 | pub fn default_destination(archive: &Path) -> PathBuf { |
| 71 | 71 | let name = archive.file_name().unwrap_or_default().to_string_lossy(); |
| 72 | 72 | let lower = name.to_ascii_lowercase(); |
| 73 | 삭제: let stem = if lower.ends_with(".tar.gz") { | |
| 74 | 삭제: &name[..name.len() - 7] | |
| 73 | 추가: let compound = [".tar.bz2", ".tar.gz", ".tar.xz"] | |
| 74 | 추가: .into_iter() | |
| 75 | 추가: .find(|suffix| lower.ends_with(suffix)); | |
| 76 | 추가: let stem = if let Some(suffix) = compound { | |
| 77 | 추가: &name[..name.len() - suffix.len()] | |
| 75 | 78 | } else { |
| 76 | 79 | name.rsplit_once('.') |
| 77 | 80 | .map_or(name.as_ref(), |(stem, _)| stem) |
| @@ -1103,7 +1103,7 @@ impl ArchiveApp { | ||
| 1103 | 1103 | ui.add_space(theme::PAD as f32); |
| 1104 | 1104 | ui.colored_label( |
| 1105 | 1105 | theme::MUTED, |
| 1106 | 삭제: "ZIP, 7z, TAR, GZ, TAR.GZ 파일을 열 수 있습니다", | |
| 1106 | 추가: "ZIP, 7z, TAR, GZ, TAR.GZ, TAR.BZ2, TAR.XZ 파일을 열 수 있습니다", | |
| 1107 | 1107 | ); |
| 1108 | 1108 | }); |
| 1109 | 1109 | } |
| @@ -0,0 +1,71 @@ | ||
| 1 | 추가: #[test] | |
| 2 | 추가: fn compressed_tar_opens_with_native_dialog_and_extracts_to_compound_stem() { | |
| 3 | 추가: use zipelo_ui_memory_app::archive_dialog::Purpose; | |
| 4 | 추가: for (kind, name) in [("bz2", "여행 자료.TaR.Bz2"), ("xz", "여행 자료.tAr.XZ")] { | |
| 5 | 추가: let scratch = Scratch::new(); | |
| 6 | 추가: let generated = std::process::Command::new("python3") | |
| 7 | 추가: .arg( | |
| 8 | 추가: Path::new(env!("CARGO_MANIFEST_DIR")) | |
| 9 | 추가: .join("../../tests/rust-archive-worker/compressed_tar_cases.py"), | |
| 10 | 추가: ) | |
| 11 | 추가: .arg(&scratch.0) | |
| 12 | 추가: .arg(kind) | |
| 13 | 추가: .arg("normal") | |
| 14 | 추가: .output() | |
| 15 | 추가: .unwrap(); | |
| 16 | 추가: assert!( | |
| 17 | 추가: generated.status.success(), | |
| 18 | 추가: "{}", | |
| 19 | 추가: String::from_utf8_lossy(&generated.stderr) | |
| 20 | 추가: ); | |
| 21 | 추가: let archive = scratch.path(name); | |
| 22 | 추가: fs::rename(scratch.path("input"), &archive).unwrap(); | |
| 23 | 추가: let original = fs::read(&archive).unwrap(); | |
| 24 | 추가: let (factory, observed) = observed_factory(); | |
| 25 | 추가: let mut screen = Screen::new(factory); | |
| 26 | 추가: screen | |
| 27 | 추가: .dialogs | |
| 28 | 추가: .0 | |
| 29 | 추가: .borrow_mut() | |
| 30 | 추가: .answers | |
| 31 | 추가: .push_back(Some(vec![archive.clone()])); | |
| 32 | 추가: screen.click("열기"); | |
| 33 | 추가: screen.settle(); | |
| 34 | 추가: assert_eq!(screen.dialogs.0.borrow().requests[0].purpose, Purpose::Open); | |
| 35 | 추가: assert_eq!( | |
| 36 | 추가: screen.app.model.list_id.as_ref().unwrap().format, | |
| 37 | 추가: Format::Tar | |
| 38 | 추가: ); | |
| 39 | 추가: assert!( | |
| 40 | 추가: screen | |
| 41 | 추가: .app | |
| 42 | 추가: .model | |
| 43 | 추가: .entries | |
| 44 | 추가: .iter() | |
| 45 | 추가: .any(|e| e.name == "한글.txt") | |
| 46 | 추가: ); | |
| 47 | 추가: assert!(screen.app.begin_extract()); | |
| 48 | 추가: screen.settle(); | |
| 49 | 추가: let output = scratch.path("여행 자료"); | |
| 50 | 추가: assert_eq!( | |
| 51 | 추가: fs::read(output.join("folder/payload.bin")).unwrap(), | |
| 52 | 추가: fs::read(scratch.path("expected")).unwrap() | |
| 53 | 추가: ); | |
| 54 | 추가: assert_eq!(fs::read(output.join("한글.txt")).unwrap(), b"end"); | |
| 55 | 추가: assert!(output.join("empty").is_dir()); | |
| 56 | 추가: assert_eq!(fs::read(&archive).unwrap(), original); | |
| 57 | 추가: assert!( | |
| 58 | 추가: matches!(observed.borrow().starts.last(), Some(Start::Extract { | |
| 59 | 추가: destination, gzip_output_name: None, .. | |
| 60 | 추가: }) if destination == &output) | |
| 61 | 추가: ); | |
| 62 | 추가: let labels = screen | |
| 63 | 추가: .render(vec![]) | |
| 64 | 추가: .into_iter() | |
| 65 | 추가: .map(|(s, _)| s) | |
| 66 | 추가: .collect::<Vec<_>>() | |
| 67 | 추가: .join("\n"); | |
| 68 | 추가: assert!(labels.contains("압축을 풀었습니다"), "{labels}"); | |
| 69 | 추가: assert_reaped(&observed); | |
| 70 | 추가: } | |
| 71 | 추가: } |
| @@ -311,6 +311,7 @@ mod screen { | ||
| 311 | 311 | include!("password_flows.rs"); |
| 312 | 312 | include!("selection_flows.rs"); |
| 313 | 313 | include!("native_dialog_flows.rs"); |
| 314 | 추가: include!("compressed_tar_flows.rs"); | |
| 314 | 315 | |
| 315 | 316 | fn archive_flow(name: &str, format: Format) { |
| 316 | 317 | let scratch = Scratch::new(); |
| @@ -17,11 +17,21 @@ fn archive_filter_contains_every_case_variant_and_all_files_option() { | ||
| 17 | 17 | .into_iter() |
| 18 | 18 | .map(str::to_owned) |
| 19 | 19 | .collect::<BTreeSet<_>>(); |
| 20 | 삭제: assert_eq!( | |
| 21 | 삭제: filters[0].1.iter().cloned().collect::<BTreeSet<_>>(), | |
| 22 | 삭제: expected | |
| 23 | 삭제: ); | |
| 24 | 삭제: assert_eq!(filters[0].1.len(), expected.len()); | |
| 20 | 추가: let actual = filters[0].1.iter().cloned().collect::<BTreeSet<_>>(); | |
| 21 | 추가: assert!(expected.is_subset(&actual)); | |
| 22 | 추가: for extension in [ | |
| 23 | 추가: "tar.bz2", "TAR.BZ2", "TaR.bZ2", "tar.xz", "TAR.XZ", "tAr.Xz", | |
| 24 | 추가: ] { | |
| 25 | 추가: assert!(actual.contains(extension), "{extension}"); | |
| 26 | 추가: } | |
| 27 | 추가: assert_eq!(actual.len(), expected.len() + 64); | |
| 28 | 추가: assert_eq!(filters[0].1.len(), actual.len()); | |
| 29 | 추가: for extension in actual.difference(&expected) { | |
| 30 | 추가: assert!(matches!( | |
| 31 | 추가: extension.to_ascii_lowercase().as_str(), | |
| 32 | 추가: "tar.bz2" | "tar.xz" | |
| 33 | 추가: )); | |
| 34 | 추가: } | |
| 25 | 35 | assert_eq!(filters[1], ("모든 파일", vec!["*".to_owned()])); |
| 26 | 36 | } |
| 27 | 37 |
| @@ -320,7 +320,18 @@ fn duplicate_names_prevent_file_completion_assumptions() { | ||
| 320 | 320 | } |
| 321 | 321 | #[test] |
| 322 | 322 | fn default_names_and_middle_truncation_preserve_unicode() { |
| 323 | 삭제: assert_eq!(default_destination(&path("자료.tar.gz")), path("자료")); | |
| 323 | 추가: for name in [ | |
| 324 | 추가: "자료.tar.gz", | |
| 325 | 추가: "자료.tar.bz2", | |
| 326 | 추가: "자료.TAR.BZ2", | |
| 327 | 추가: "자료.TaR.xZ", | |
| 328 | 추가: "자료.tar.xz", | |
| 329 | 추가: ] { | |
| 330 | 추가: assert_eq!(default_destination(&path(name)), path("자료")); | |
| 331 | 추가: } | |
| 332 | 추가: for name in [".tar.bz2", ".TAR.XZ"] { | |
| 333 | 추가: assert_eq!(default_destination(&path(name)), path("압축 해제")); | |
| 334 | 추가: } | |
| 324 | 335 | assert_eq!(default_destination(&path("자료.zip")), path("자료")); |
| 325 | 336 | assert_eq!(middle_text("가나다라마바사아자차", 7), "가나다…아자차"); |
| 326 | 337 | assert_eq!(bytes_text(21), "21 B"); |
| @@ -96,7 +96,8 @@ 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 | 삭제: "empty" => "압축파일", | |
| 99 | 추가: "empty" => "TAR.BZ2, TAR.XZ", | |
| 100 | 추가: "tar-bz2" | "tar-xz" => "읽어주세요.txt", | |
| 100 | 101 | "folder-empty" => "이 폴더는 비어 있습니다", |
| 101 | 102 | "dialog-error" => "파일 선택 창을 열 수 없습니다", |
| 102 | 103 | "extract-partial" => "일부 파일만 풀렸습니다", |
| @@ -119,6 +120,13 @@ fn every_listed_scenario_draws_and_keeps_its_expected_screen() { | ||
| 119 | 120 | _ => "읽어주세요.txt", |
| 120 | 121 | }; |
| 121 | 122 | assert!(labels.contains(expected), "{}: {labels}", scenario.name); |
| 123 | 추가: if matches!(scenario.name, "tar-bz2" | "tar-xz") { | |
| 124 | 추가: assert!(app.model.entries.iter().all(|entry| !entry.encrypted)); | |
| 125 | 추가: assert_eq!( | |
| 126 | 추가: app.model.list_id.as_ref().unwrap().format, | |
| 127 | 추가: zipelo_ui_memory_app::archive_ui::Format::Tar | |
| 128 | 추가: ); | |
| 129 | 추가: } | |
| 122 | 130 | if scenario.name == "many-items" { |
| 123 | 131 | assert_eq!(app.model.entries.len(), 505); |
| 124 | 132 | } |
| @@ -23,6 +23,8 @@ macro_rules! catalog { | ||
| 23 | 23 | catalog! { |
| 24 | 24 | "empty" => "빈 첫 화면", |
| 25 | 25 | "archive" => "폴더와 파일이 있는 압축파일", |
| 26 | 추가: "tar-bz2" => "TAR.BZ2 목록과 자동 해제 폴더", | |
| 27 | 추가: "tar-xz" => "TAR.XZ 목록과 자동 해제 폴더", | |
| 26 | 28 | "folder" => "사진 하위 폴더", |
| 27 | 29 | "many-items" => "500개 항목과 세로 스크롤", |
| 28 | 30 | "selection" => "여러 파일과 폴더 선택", |
| @@ -162,10 +164,11 @@ impl Scenario { | ||
| 162 | 164 | if self.name == "empty" { |
| 163 | 165 | return app; |
| 164 | 166 | } |
| 165 | 삭제: let archive = base.join(if self.name == "gzip-conflict" { | |
| 166 | 삭제: "여행 자료.gz" | |
| 167 | 삭제: } else { | |
| 168 | 삭제: "여행 자료.zip" | |
| 167 | 추가: let archive = base.join(match self.name { | |
| 168 | 추가: "gzip-conflict" => "여행 자료.gz", | |
| 169 | 추가: "tar-bz2" => "여행 자료.TAR.BZ2", | |
| 170 | 추가: "tar-xz" => "여행 자료.TaR.Xz", | |
| 171 | 추가: _ => "여행 자료.zip", | |
| 169 | 172 | }); |
| 170 | 173 | app.model.archive = Some(archive.clone()); |
| 171 | 174 | app.model.entries = entries(self.name == "many-items"); |
| @@ -181,6 +184,15 @@ impl Scenario { | ||
| 181 | 184 | }); |
| 182 | 185 | app.model.confirmed = true; |
| 183 | 186 | match self.name { |
| 187 | 추가: "tar-bz2" | "tar-xz" => { | |
| 188 | 추가: app.model.list_id.as_mut().unwrap().format = Format::Tar; | |
| 189 | 추가: for entry in &mut app.model.entries { | |
| 190 | 추가: entry.encrypted = false; | |
| 191 | 추가: } | |
| 192 | 추가: app.destination = present::default_destination(&archive); | |
| 193 | 추가: app.automatic_destination = true; | |
| 194 | 추가: return app; | |
| 195 | 추가: } | |
| 184 | 196 | "archive" | "many-items" => return app, |
| 185 | 197 | "folder-empty" => { |
| 186 | 198 | app.browse_folder("빈 폴더"); |