team-ljyzipelo

공개

분할 7z 목록 연동과 조각 오류 안내를 추가한다

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

변경된 파일 12개

+650-21
수정docs/ui-scenario-guide.md+13-0
@@ -168,3 +168,16 @@ Ubuntu 제거 안내는 패키지 관리자 터미널 출력입니다. 이전
168168실제 압축파일에서는 파일 하나를 선택하고 [미리보기]를 직접 눌렀을 때만 읽기를 시작한다.
169169닫은 뒤 선택, 폴더 위치와 스크롤을 유지하고 실행 전 키보드 포커스로 돌아간다.
170170시나리오의 텍스트와 이미지는 화면 점검용이며 디코더 검증은 실제 압축파일로 별도 수행한다.
171추가:
172추가: ### 분할 7z
173추가:
174추가: 조각 오류와 제외 형식 안내는 주 창 안의 작업 결과 모달로 표시한다. 별도 결과 창 전환 없이 파일명과 재시도 방법을 확인할 수 있다.
175추가:
176추가: - split-archive: .7z.001 목록과 미리보기 비활성화. 분할 입력은 목록 보기와 풀기만 지원.
177추가: - split-first-volume: .7z.002 등 선택 시 필요한 .001의 정확한 이름 안내. 자동으로 다른 파일을 열지 않음.
178추가: - split-missing-volume: 확정된 중간 누락의 파일명과 같은 폴더에 모든 조각을 모은 뒤 .001을 다시 여는 방법 안내.
179추가: - split-incomplete: 불완전하거나 손상된 묶음 안내. 마지막 누락 파일명을 추측하지 않음.
180추가: - split-unsupported: 분할 ZIP, RAR과 분할 압축 만들기 미지원 안내.
181추가: - split-source-changed: 목록 이후 조각 변경 시 다시 열기 안내.
182추가:
183추가: 운영체제 기본 열기 창에서 같은 폴더의 첫 조각 `.7z.001`을 선택한다. 분할 묶음은 최대 999개이며 목록 열람 성공은 전체 데이터 무결성 검증 완료를 뜻하지 않는다. 실제 분할 파일 처리는 작업자 구현 후 독립 도구 표본으로 확인한다. Windows와 Wayland에서 첫 조각 선택, 누락 이름, .001 재시도 안내와 닫기를 확인하며, 위 디자인 상황은 실제 파일 검증을 대신하지 않는다.
수정experiments/rust-ui-memory-app/src/archive_dialog.rs+3-1
@@ -37,7 +37,9 @@ pub trait Dialogs {
3737
3838pub fn archive_filters() -> Vec<(&'static str, Vec<String>)> {
3939 let mut extensions = Vec::new();
40삭제: for extension in ["zip", "7z", "tar", "gz", "tgz", "tar.bz2", "tar.xz"] {
40추가: for extension in [
41추가: "zip", "7z", "7z.001", "tar", "gz", "tgz", "tar.bz2", "tar.xz",
42추가: ] {
4143 let mut variants = vec![String::new()];
4244 for character in extension.chars() {
4345 let mut next = Vec::new();
수정experiments/rust-ui-memory-app/src/archive_present.rs+52-0
@@ -19,6 +19,9 @@ pub const FOLDER_ERROR: &str = "풀 위치 폴더를 만들 수 없습니다.
1919
2020pub fn error_text(code: ErrorCode) -> &'static str {
2121 match code {
22추가: ErrorCode::MissingVolume => {
23추가: "분할 압축파일의 조각이 없습니다. 모든 조각을 같은 폴더에 모은 뒤 .001을 다시 여세요"
24추가: }
2225 ErrorCode::Integrity => "압축파일이 손상됐습니다",
2326 ErrorCode::UnsupportedFormat => "지원하지 않는 압축 형식입니다",
2427 ErrorCode::UnsupportedFeature => "아직 지원하지 않는 기능입니다",
@@ -425,3 +428,52 @@ pub fn operation_text(text: &str, creating: bool) -> String {
425428 text.to_owned()
426429 }
427430}
431추가:
432추가: pub fn volume_problem_text(problem: &VolumeProblem) -> String {
433추가: fn visible(c: char) -> String {
434추가: if c.is_control() || matches!(c, '\u{202a}'..='\u{202e}' | '\u{2066}'..='\u{2069}') {
435추가: c.escape_unicode().to_string()
436추가: } else {
437추가: c.to_string()
438추가: }
439추가: }
440추가: let name = match &problem.volume {
441추가: NativePath::Unix(bytes) => bytes
442추가: .utf8_chunks()
443추가: .map(|chunk| {
444추가: let mut text = chunk.valid().chars().map(visible).collect::<String>();
445추가: for byte in chunk.invalid() {
446추가: text.push_str(&format!("\\x{byte:02x}"));
447추가: }
448추가: text
449추가: })
450추가: .collect::<String>(),
451추가: NativePath::Windows(units) => char::decode_utf16(units.iter().copied())
452추가: .map(|c| {
453추가: c.map(visible)
454추가: .unwrap_or_else(|e| format!("\\u{{{:04x}}}", e.unpaired_surrogate()))
455추가: })
456추가: .collect::<String>(),
457추가: };
458추가: match problem.reason {
459추가: VolumeProblemReason::FirstVolumeRequired => format!("첫 조각 {name}을 선택해 다시 여세요."),
460추가: VolumeProblemReason::MissingVolume => {
461추가: format!("{name} 조각이 없습니다. 모든 조각을 같은 폴더에 모은 뒤 .001을 다시 여세요.")
462추가: }
463추가: VolumeProblemReason::IncompleteSet => format!(
464추가: "{name}의 분할 묶음이 불완전하거나 손상됐습니다. 모든 조각의 존재와 손상을 확인한 뒤 .001을 다시 여세요."
465추가: ),
466추가: }
467추가: }
468추가:
469추가: pub const SPLIT_SUPPORT: &str =
470추가: "분할 7z는 .7z.001부터 열 수 있습니다. 분할 ZIP과 RAR, 분할 압축 만들기는 지원하지 않습니다.";
471추가:
472추가: pub fn excluded_split(path: &Path) -> bool {
473추가: let name = path
474추가: .file_name()
475추가: .unwrap_or_default()
476추가: .to_string_lossy()
477추가: .to_ascii_lowercase();
478추가: name.ends_with(".zip.001") || name.ends_with(".z01") || name.ends_with(".rar")
479추가: }
수정experiments/rust-ui-memory-app/src/archive_process.rs+15-0
@@ -135,6 +135,9 @@ fn list_to_wire(id: ui::ListId) -> wire::ListId {
135135 catalog_version: id.catalog_version,
136136 format: format_to_wire(id.format),
137137 source_object: match id.source_object {
138추가: ui::SourceObject::SplitSevenZip { manifest_sha256 } => {
139추가: wire::SourceObject::SplitSevenZip { manifest_sha256 }
140추가: }
138141 ui::SourceObject::Unix { device, inode } => wire::SourceObject::Unix { device, inode },
139142 ui::SourceObject::Windows { volume, file_id } => wire::SourceObject::Windows {
140143 volume_serial: volume,
@@ -150,6 +153,9 @@ fn list_to_ui(id: wire::ListId) -> ui::ListId {
150153 catalog_version: id.catalog_version,
151154 format: format_to_ui(id.format),
152155 source_object: match id.source_object {
156추가: wire::SourceObject::SplitSevenZip { manifest_sha256 } => {
157추가: ui::SourceObject::SplitSevenZip { manifest_sha256 }
158추가: }
153159 wire::SourceObject::Unix { device, inode } => ui::SourceObject::Unix { device, inode },
154160 wire::SourceObject::Windows {
155161 volume_serial,
@@ -229,6 +235,7 @@ fn start_to_wire(start: ui::Start) -> wire::Start {
229235}
230236fn error_to_ui(error: wire::ErrorCode) -> Option<ui::ErrorCode> {
231237 Some(match error {
238추가: wire::ErrorCode::MissingVolume => ui::ErrorCode::MissingVolume,
232239 wire::ErrorCode::None => return None,
233240 wire::ErrorCode::Integrity => ui::ErrorCode::Integrity,
234241 wire::ErrorCode::UnsupportedFormat => ui::ErrorCode::UnsupportedFormat,
@@ -250,6 +257,14 @@ fn event_to_ui(
250257 expected: Option<wire::ActionKind>,
251258) -> Result<ui::Event, ()> {
252259 Ok(match message {
260추가: wire::Message::VolumeProblem { reason, volume }
261추가: if matches!(
262추가: expected,
263추가: Some(wire::ActionKind::List | wire::ActionKind::Extract)
264추가: ) =>
265추가: {
266추가: ui::Event::VolumeProblem(ui::VolumeProblem { reason, volume })
267추가: }
253268 wire::Message::Accepted { action, encryption } if expected == Some(action) => {
254269 ui::Event::Accepted { encryption }
255270 }
수정experiments/rust-ui-memory-app/src/archive_screen.rs+35-10
@@ -971,6 +971,13 @@ impl ArchiveApp {
971971 idle && self.can_preview() && !self.preview_open,
972972 false,
973973 )
974추가: .on_disabled_hover_text(
975추가: if self.model.list_id.as_ref().is_some_and(ListId::is_split) {
976추가: "분할 압축파일은 미리보기를 지원하지 않습니다"
977추가: } else {
978추가: "일반 파일 하나를 선택하세요"
979추가: },
980추가: )
974981 .clicked()
975982 {
976983 self.begin_preview(ui.ctx());
@@ -1778,11 +1785,16 @@ impl ArchiveApp {
17781785
17791786 fn limit_result_visible(&self) -> bool {
17801787 self.result_visible()
1781삭제: && self
1782삭제: .model
1783삭제: .terminal
1784삭제: .as_ref()
1785삭제: .is_some_and(|terminal| terminal.error == Some(ErrorCode::Limit))
1788추가: && (self.model.volume_problem.is_some()
1789추가: || self.model.terminal.as_ref().is_some_and(|terminal| {
1790추가: terminal.error == Some(ErrorCode::Limit)
1791추가: || (terminal.error == Some(ErrorCode::UnsupportedFormat)
1792추가: && self
1793추가: .model
1794추가: .archive
1795추가: .as_ref()
1796추가: .is_some_and(|p| present::excluded_split(p)))
1797추가: }))
17861798 }
17871799
17881800 fn limit_result_dialog(&mut self, ctx: &egui::Context) {
@@ -2128,12 +2140,25 @@ impl ArchiveApp {
21282140 _ => format!("{} 폴더에 저장했습니다.", self.destination.display()),
21292141 };
21302142 theme::bounded_text(ui, &path, ui.available_width());
2143추가: } else if let Some(problem) = &self.model.volume_problem {
2144추가: ui.add(egui::Label::new(present::volume_problem_text(problem)).wrap());
21312145 } else if let Some(code) = t.as_ref().and_then(|t| t.error) {
2132삭제: ui.label(if creating && code == ErrorCode::SourceChanged {
2133삭제: "묶을 파일이 바뀌었습니다. 파일을 확인한 뒤 다시 만드세요".to_owned()
2134삭제: } else {
2135삭제: present::operation_text(present::error_text(code), creating)
2136삭제: });
2146추가: ui.label(
2147추가: if code == ErrorCode::UnsupportedFormat
2148추가: && self
2149추가: .model
2150추가: .archive
2151추가: .as_ref()
2152추가: .is_some_and(|p| present::excluded_split(p))
2153추가: {
2154추가: present::SPLIT_SUPPORT.to_owned()
2155추가: } else if creating && code == ErrorCode::SourceChanged {
2156추가: "묶을 파일이 바뀌었습니다. 파일을 확인한 뒤 다시 만드세요"
2157추가: .to_owned()
2158추가: } else {
2159추가: present::operation_text(present::error_text(code), creating)
2160추가: },
2161추가: );
21372162 } else if let Some(error) = &self.model.error {
21382163 ui.label(present::operation_text(
21392164 present::client_error_text(error),
수정experiments/rust-ui-memory-app/src/archive_ui.rs+77-7
@@ -12,6 +12,7 @@ pub enum Format {
1212pub enum SourceObject {
1313 Unix { device: u64, inode: u64 },
1414 Windows { volume: u64, file_id: [u8; 16] },
15추가: SplitSevenZip { manifest_sha256: [u8; 32] },
1516}
1617#[derive(Clone, Debug, Eq, PartialEq)]
1718pub struct ListId {
@@ -21,6 +22,26 @@ pub struct ListId {
2122 pub archive_bytes: u64,
2223 pub archive_sha256: [u8; 32],
2324}
25추가: impl ListId {
26추가: pub fn valid(&self) -> bool {
27추가: matches!(
28추가: (self.catalog_version, self.format, &self.source_object),
29추가: (
30추가: 1,
31추가: _,
32추가: SourceObject::Unix { .. } | SourceObject::Windows { .. }
33추가: ) | (2, Format::SevenZip, SourceObject::SplitSevenZip { .. })
34추가: )
35추가: }
36추가: pub fn is_split(&self) -> bool {
37추가: matches!(self.source_object, SourceObject::SplitSevenZip { .. })
38추가: }
39추가: }
40추가: #[derive(Clone, Debug, Eq, PartialEq)]
41추가: pub struct VolumeProblem {
42추가: pub reason: VolumeProblemReason,
43추가: pub volume: NativePath,
44추가: }
2445#[derive(Clone, Debug, Eq, PartialEq)]
2546pub enum Selection {
2647 All,
@@ -159,6 +180,7 @@ pub enum Outcome {
159180}
160181#[derive(Clone, Copy, Debug, Eq, PartialEq)]
161182pub enum ErrorCode {
183추가: MissingVolume,
162184 Integrity,
163185 UnsupportedFormat,
164186 UnsupportedFeature,
@@ -211,7 +233,8 @@ pub struct Terminal {
211233 pub cleanup: Cleanup,
212234}
213235pub use worker_protocol::protocol::{
214삭제: ActionKind, Limits, PreviewFormat, PreviewInfo, ResourceScope, ResourceUsage,
236추가: ActionKind, Limits, NativePath, PreviewFormat, PreviewInfo, ResourceScope, ResourceUsage,
237추가: VolumeProblemReason,
215238};
216239
217240pub struct Preview {
@@ -268,6 +291,7 @@ pub struct ResourceChallenge {
268291
269292#[derive(Clone, Debug)]
270293pub enum Event {
294추가: VolumeProblem(VolumeProblem),
271295 PreviewBegin(PreviewInfo),
272296 PreviewChunk {
273297 entry_id: u32,
@@ -342,6 +366,7 @@ impl Factory for Unavailable {
342366 }
343367}
344368struct Running {
369추가: volume_problem: Option<VolumeProblem>,
345370 preview: Option<PreviewBuffer>,
346371 preview_discarded: bool,
347372 id: u64,
@@ -377,6 +402,7 @@ pub enum Close {
377402}
378403#[derive(Default)]
379404pub struct Model {
405추가: pub volume_problem: Option<VolumeProblem>,
380406 running: Option<Running>,
381407 pub preview: Option<Preview>,
382408 next_id: u64,
@@ -419,6 +445,7 @@ impl Model {
419445 }
420446 pub fn can_preview(&self) -> bool {
421447 self.can_extract()
448추가: && self.list_id.as_ref().is_some_and(|id| !id.is_split())
422449 && self.selected.len() == 1
423450 && self
424451 .entries
@@ -579,6 +606,8 @@ impl Model {
579606 list_id,
580607 } => {
581608 archive.is_absolute()
609추가: && list_id.valid()
610추가: && !list_id.is_split()
582611 && self.archive.as_ref() == Some(archive)
583612 && self.list_id.as_ref() == Some(list_id)
584613 && self
@@ -632,6 +661,7 @@ impl Model {
632661 };
633662 self.preview = None;
634663 let estimated = self.estimate(&start);
664추가: self.volume_problem = None;
635665 let mut connection = match factory.connect(id) {
636666 Ok(c) => c,
637667 Err(e) => {
@@ -661,6 +691,7 @@ impl Model {
661691 }
662692 self.next_id = id;
663693 self.terminal = None;
694추가: self.volume_problem = None;
664695 self.retry_start = None;
665696 self.resource = None;
666697 self.challenge = None;
@@ -673,6 +704,7 @@ impl Model {
673704 self.error = send_error;
674705 self.confirmed = false;
675706 self.running = Some(Running {
707추가: volume_problem: None,
676708 preview: None,
677709 preview_discarded: false,
678710 id,
@@ -928,14 +960,18 @@ impl Model {
928960 }
929961 }
930962 }
931삭제: if self
932삭제: .terminal
933삭제: .as_ref()
934삭제: .is_some_and(|t| t.error == Some(ErrorCode::SourceChanged))
935삭제: {
963추가: if self.terminal.as_ref().is_some_and(|t| {
964추가: matches!(
965추가: t.error,
966추가: Some(ErrorCode::SourceChanged | ErrorCode::MissingVolume)
967추가: )
968추가: }) {
936969 self.list_id = None;
937970 self.selected.clear();
938971 }
972추가: if self.confirmed && run.cancel_sequence.is_none() {
973추가: self.volume_problem = run.volume_problem.take();
974추가: }
939975 self.retry_start = if !matches!(run.start, Start::Preview { .. })
940976 && !run.expanded
941977 && run.cancel_sequence.is_none()
@@ -991,6 +1027,19 @@ impl Model {
9911027 return;
9921028 }
9931029 match event {
1030추가: Event::VolumeProblem(problem) => {
1031추가: if run.cancel_sequence.is_some() {
1032추가: return;
1033추가: }
1034추가: if run.volume_problem.is_some()
1035추가: || !matches!(run.start, Start::List { .. } | Start::Extract { .. })
1036추가: || !problem.volume.is_basename()
1037추가: {
1038추가: self.error = Some("분할 조각 오류 응답이 유효하지 않습니다".into());
1039추가: } else {
1040추가: run.volume_problem = Some(problem);
1041추가: }
1042추가: }
9941043 Event::PreviewBegin(info) => {
9951044 if run.preview_discarded {
9961045 return;
@@ -1080,7 +1129,7 @@ impl Model {
10801129 } => {
10811130 if !matches!(run.start, Start::List { .. })
10821131 || run.list_end.is_some()
1083삭제: || list_id.catalog_version != 1
1132추가: || !list_id.valid()
10841133 {
10851134 self.error = Some("목록 완료 응답이 유효하지 않습니다".into());
10861135 } else {
@@ -1229,6 +1278,26 @@ impl Model {
12291278 }
12301279 }
12311280 Event::Terminal(t) => {
1281추가: if run.cancel_sequence.is_none()
1282추가: && run.volume_problem.as_ref().is_some_and(|problem| {
1283추가: t.outcome != Outcome::Failed
1284추가: || t.error
1285추가: != match problem.reason {
1286추가: VolumeProblemReason::FirstVolumeRequired => {
1287추가: Some(ErrorCode::InvalidRequest)
1288추가: }
1289추가: VolumeProblemReason::MissingVolume => {
1290추가: Some(ErrorCode::MissingVolume)
1291추가: }
1292추가: VolumeProblemReason::IncompleteSet => {
1293추가: Some(ErrorCode::Integrity)
1294추가: }
1295추가: }
1296추가: })
1297추가: {
1298추가: self.error =
1299추가: Some("분할 조각 오류와 종료 상태가 일치하지 않습니다".into());
1300추가: }
12321301 if matches!(run.start, Start::Preview { .. })
12331302 && (t.publication != Publication::None
12341303 || t.created_count != 0
@@ -1380,6 +1449,7 @@ pub fn terminal_lines(t: &Terminal) -> Vec<String> {
13801449 if let Some(error) = t.error {
13811450 lines.push(
13821451 match error {
1452추가: ErrorCode::MissingVolume => "분할 압축파일의 조각이 없습니다. 모든 조각을 같은 폴더에 모은 뒤 첫 조각을 다시 여세요",
13831453 ErrorCode::Integrity => "압축파일이 손상됐습니다",
13841454 ErrorCode::UnsupportedFormat => "지원하지 않는 압축 형식입니다",
13851455 ErrorCode::UnsupportedFeature => "아직 지원하지 않는 기능입니다",
수정tests/rust-app-ui/conflict_codec.rs+57-0
@@ -50,3 +50,60 @@ fn conflict_adapter_preserves_sizes_names_ids_and_choices() {
5050 }
5151 }
5252}
53추가:
54추가: #[test]
55추가: fn split_list_id_adapter_round_trip_preserves_manifest_and_logical_input() {
56추가: let id = ui::ListId {
57추가: catalog_version: 2,
58추가: format: ui::Format::SevenZip,
59추가: source_object: ui::SourceObject::SplitSevenZip {
60추가: manifest_sha256: [0xa5; 32],
61추가: },
62추가: archive_bytes: u64::MAX,
63추가: archive_sha256: [0x5a; 32],
64추가: };
65추가: let wire_id = list_to_wire(id.clone());
66추가: assert!(wire_id.valid());
67추가: assert_eq!(list_to_ui(wire_id), id);
68추가: }
69추가: #[test]
70추가: fn volume_problem_adapter_preserves_native_filename_and_rejects_other_actions() {
71추가: for volume in [
72추가: wire::NativePath::Unix(vec![0xff, 46, 55, 122]),
73추가: wire::NativePath::Windows(vec![0xd800, 46, 55, 122]),
74추가: ] {
75추가: for action in [
76추가: Some(wire::ActionKind::List),
77추가: Some(wire::ActionKind::Extract),
78추가: Some(wire::ActionKind::Preview),
79추가: Some(wire::ActionKind::CreateZip),
80추가: None,
81추가: ] {
82추가: let event = event_to_ui(
83추가: wire::Message::VolumeProblem {
84추가: reason: wire::VolumeProblemReason::MissingVolume,
85추가: volume: volume.clone(),
86추가: },
87추가: action,
88추가: );
89추가: if matches!(
90추가: action,
91추가: Some(wire::ActionKind::List | wire::ActionKind::Extract)
92추가: ) {
93추가: match event.unwrap() {
94추가: ui::Event::VolumeProblem(problem) => {
95추가: assert_eq!(problem.volume, volume);
96추가: assert_eq!(problem.reason, wire::VolumeProblemReason::MissingVolume);
97추가: }
98추가: _ => panic!("조각 오류 변환 누락"),
99추가: }
100추가: } else {
101추가: assert!(event.is_err());
102추가: }
103추가: }
104추가: }
105추가: assert_eq!(
106추가: error_to_ui(wire::ErrorCode::MissingVolume),
107추가: Some(ui::ErrorCode::MissingVolume)
108추가: );
109추가: }
수정tests/rust-app-ui/native_dialogs.rs+3-3
@@ -10,9 +10,9 @@ fn archive_filter_contains_every_case_variant_and_all_files_option() {
1010 assert_eq!(filters.len(), 2);
1111 assert_eq!(filters[0].0, "압축파일");
1212 let expected = [
13삭제: "zip", "ziP", "zIp", "zIP", "Zip", "ZiP", "ZIp", "ZIP", "7z", "7Z", "tar", "taR", "tAr",
14삭제: "tAR", "Tar", "TaR", "TAr", "TAR", "gz", "gZ", "Gz", "GZ", "tgz", "tgZ", "tGz", "tGZ",
15삭제: "Tgz", "TgZ", "TGz", "TGZ",
13추가: "zip", "ziP", "zIp", "zIP", "Zip", "ZiP", "ZIp", "ZIP", "7z", "7Z", "7z.001", "7Z.001",
14추가: "tar", "taR", "tAr", "tAR", "Tar", "TaR", "TAr", "TAR", "gz", "gZ", "Gz", "GZ", "tgz",
15추가: "tgZ", "tGz", "tGZ", "Tgz", "TgZ", "TGz", "TGZ",
1616 ]
1717 .into_iter()
1818 .map(str::to_owned)
수정tests/rust-app-ui/regressions.rs+1-0
@@ -5,6 +5,7 @@ mod fake;
55#[cfg(feature = "ui")]
66mod native_dialogs;
77mod preview;
8추가: mod split_volumes;
89use fake::*;
910use std::path::PathBuf;
1011use zipelo_ui_memory_app::archive_ui::*;
수정tests/rust-app-ui/scenario_tests.rs+48-0
@@ -95,7 +95,17 @@ fn every_listed_scenario_draws_and_keeps_its_expected_screen() {
9595 app.model.error
9696 );
9797 assert!(app.model.input_error.is_none(), "{}", scenario.name);
98추가: if scenario.name == "split-archive" {
99추가: assert!(app.model.list_id.as_ref().unwrap().is_split());
100추가: assert!(!app.model.can_preview());
101추가: }
98102 let expected = match scenario.name {
103추가: "split-archive" => "읽어주세요.txt",
104추가: "split-first-volume" => "첫 조각 여행.7z.001을 선택해 다시 여세요.",
105추가: "split-missing-volume" => "여행.7z.003 조각이 없습니다",
106추가: "split-incomplete" => "분할 묶음이 불완전하거나 손상됐습니다",
107추가: "split-unsupported" => "분할 ZIP과 RAR",
108추가: "split-source-changed" => "원본 파일이 바뀌었습니다",
99109 "preview-implicit-folder" => "자료",
100110 "preview-catalog-approval" | "preview-catalog-bytes-approval" => {
101111 "큰 작업을 허용할까요?"
@@ -555,3 +565,41 @@ fn preview_image_respects_renderer_texture_limit() {
555565 }
556566 assert!(image_seen);
557567}
568추가:
569추가: #[test]
570추가: fn split_errors_use_main_modal_without_native_child() {
571추가: for name in [
572추가: "split-first-volume",
573추가: "split-missing-volume",
574추가: "split-incomplete",
575추가: "split-unsupported",
576추가: ] {
577추가: let scenario = scenarios::parse(name).unwrap();
578추가: let mut app = scenario.build();
579추가: let ctx = egui::Context::default();
580추가: ctx.set_embed_viewports(false);
581추가: let mut labels = String::new();
582추가: for _ in 0..3 {
583추가: let mut output = ctx.run_ui(
584추가: egui::RawInput {
585추가: screen_rect: Some(egui::Rect::from_min_size(
586추가: egui::Pos2::ZERO,
587추가: egui::vec2(1060.0, 720.0),
588추가: )),
589추가: ..Default::default()
590추가: },
591추가: |ui| scenario.show(&mut app, ui),
592추가: );
593추가: labels = text(&output.shapes);
594추가: output.textures_delta.clear();
595추가: assert!(
596추가: output
597추가: .viewport_output
598추가: .keys()
599추가: .all(|id| *id == egui::ViewportId::ROOT),
600추가: "{name}"
601추가: );
602추가: }
603추가: assert!(labels.contains("작업 결과"), "{name}: {labels}");
604추가: }
605추가: }
수정tests/rust-app-ui/scenarios.rs+70-0
@@ -21,6 +21,12 @@ macro_rules! catalog {
2121}
2222
2323catalog! {
24추가: "split-archive" => "분할 7z 목록과 미리보기 비활성화",
25추가: "split-first-volume" => "첫 조각의 정확한 파일명 안내",
26추가: "split-missing-volume" => "누락 조각 파일명과 재시도 안내",
27추가: "split-incomplete" => "누락 이름을 단정하지 않는 불완전 묶음 안내",
28추가: "split-unsupported" => "분할 ZIP과 RAR 및 분할 생성 미지원 안내",
29추가: "split-source-changed" => "목록 이후 분할 조각 변경 안내",
2430 "preview-catalog-bytes-approval" => "16 GiB를 넘는 전체 목록의 미리보기 승인",
2531 "preview-catalog-approval" => "미리보기의 전체 목록 처리 예산 승인",
2632 "preview-loading" => "미리보기 로딩과 취소",
@@ -262,6 +268,70 @@ impl Scenario {
262268 archive_sha256: [7; 32],
263269 });
264270 app.model.confirmed = true;
271추가: if self.name.starts_with("split-") {
272추가: let archive = base.join(if self.name == "split-unsupported" {
273추가: "여행.zip.001"
274추가: } else {
275추가: "여행.7z.001"
276추가: });
277추가: app.model.archive = Some(archive.clone());
278추가: app.model.list_id = Some(ListId {
279추가: catalog_version: 2,
280추가: format: Format::SevenZip,
281추가: source_object: SourceObject::SplitSevenZip {
282추가: manifest_sha256: [9; 32],
283추가: },
284추가: archive_bytes: 2_700_000,
285추가: archive_sha256: [7; 32],
286추가: });
287추가: if self.name == "split-archive" {
288추가: app.model.selected.insert(1);
289추가: return app;
290추가: }
291추가: app.start(Start::List { archive });
292추가: let mut state = state.borrow_mut();
293추가: state.frame(Event::Accepted { encryption: false });
294추가: let reason = match self.name {
295추가: "split-first-volume" => Some(VolumeProblemReason::FirstVolumeRequired),
296추가: "split-missing-volume" => Some(VolumeProblemReason::MissingVolume),
297추가: "split-incomplete" => Some(VolumeProblemReason::IncompleteSet),
298추가: _ => None,
299추가: };
300추가: let error = match reason {
301추가: Some(VolumeProblemReason::FirstVolumeRequired) => ErrorCode::InvalidRequest,
302추가: Some(VolumeProblemReason::MissingVolume) => ErrorCode::MissingVolume,
303추가: Some(VolumeProblemReason::IncompleteSet) => ErrorCode::Integrity,
304추가: None if self.name == "split-source-changed" => ErrorCode::SourceChanged,
305추가: None => ErrorCode::UnsupportedFormat,
306추가: };
307추가: if let Some(reason) = reason {
308추가: state.frame(Event::VolumeProblem(VolumeProblem {
309추가: reason,
310추가: volume: NativePath::Unix(if reason == VolumeProblemReason::MissingVolume {
311추가: "여행.7z.003".as_bytes().to_vec()
312추가: } else {
313추가: "여행.7z.001".as_bytes().to_vec()
314추가: }),
315추가: }));
316추가: }
317추가: state.frame(Event::Terminal(Terminal {
318추가: outcome: Outcome::Failed,
319추가: error: Some(error),
320추가: publication: Publication::None,
321추가: created_count: 0,
322추가: retained_partial_count: 0,
323추가: durability: Durability::NotApplicable,
324추가: cleanup: Cleanup::Complete,
325추가: }));
326추가: state.queue.push_back(HostEvent::StdoutEof);
327추가: state.queue.push_back(HostEvent::StderrEof);
328추가: state.queue.push_back(HostEvent::Exited { success: true });
329추가: drop(state);
330추가: for _ in 0..32 {
331추가: app.model.poll();
332추가: }
333추가: return app;
334추가: }
265335 if self.name.starts_with("preview-") {
266336 app.model.selected = BTreeSet::from([1]);
267337 if self.name == "preview-implicit-folder" {
추가tests/rust-app-ui/split_volumes.rs+276-0
@@ -0,0 +1,276 @@
1추가: use super::*;
2추가:
3추가: fn split_id() -> ListId {
4추가: ListId {
5추가: catalog_version: 2,
6추가: format: Format::SevenZip,
7추가: source_object: SourceObject::SplitSevenZip {
8추가: manifest_sha256: [19; 32],
9추가: },
10추가: archive_bytes: 900,
11추가: archive_sha256: [23; 32],
12추가: }
13추가: }
14추가: fn setup() -> (Model, FakeFactory) {
15추가: let mut model = Model::default();
16추가: let mut factory = FakeFactory::manual();
17추가: assert!(model.begin(
18추가: Start::List {
19추가: archive: path("자료.7z.001")
20추가: },
21추가: &mut factory
22추가: ));
23추가: factory
24추가: .state
25추가: .borrow_mut()
26추가: .frame(Event::Accepted { encryption: false });
27추가: (model, factory)
28추가: }
29추가: fn problem(reason: VolumeProblemReason) -> VolumeProblem {
30추가: VolumeProblem {
31추가: reason,
32추가: volume: NativePath::Unix("자료.7z.003".as_bytes().to_vec()),
33추가: }
34추가: }
35추가: fn terminal(factory: &FakeFactory, outcome: Outcome, error: Option<ErrorCode>) {
36추가: factory.state.borrow_mut().frame(Event::Terminal(Terminal {
37추가: outcome,
38추가: error,
39추가: publication: Publication::None,
40추가: created_count: 0,
41추가: retained_partial_count: 0,
42추가: durability: Durability::NotApplicable,
43추가: cleanup: Cleanup::Complete,
44추가: }));
45추가: }
46추가: fn exited(factory: &FakeFactory) {
47추가: let mut state = factory.state.borrow_mut();
48추가: state.queue.push_back(HostEvent::StdoutEof);
49추가: state.queue.push_back(HostEvent::StderrEof);
50추가: state.queue.push_back(HostEvent::Exited { success: true });
51추가: }
52추가: #[test]
53추가: fn split_list_id_is_preserved_for_extract_and_preview_cannot_start() {
54추가: let (mut model, mut factory) = setup();
55추가: {
56추가: let mut state = factory.state.borrow_mut();
57추가: state.frame(Event::Entry(Entry {
58추가: id: 0,
59추가: name: "small.txt".into(),
60추가: kind: Kind::File,
61추가: bytes: Some(7),
62추가: packed: Some(9),
63추가: encrypted: false,
64추가: }));
65추가: state.frame(Event::ListEnd {
66추가: entry_count: 1,
67추가: list_id: split_id(),
68추가: });
69추가: }
70추가: terminal(&factory, Outcome::Completed, None);
71추가: exited(&factory);
72추가: pump(&mut model);
73추가: assert_eq!(model.list_id, Some(split_id()));
74추가: assert!(model.can_extract());
75추가: model.selected.insert(0);
76추가: assert!(!model.can_preview());
77추가: assert!(!model.begin_preview(&mut factory));
78추가: assert!(!model.begin(
79추가: Start::Preview {
80추가: archive: model.archive.clone().unwrap(),
81추가: entry_id: 0,
82추가: list_id: split_id()
83추가: },
84추가: &mut factory
85추가: ));
86추가: assert!(model.extract(path("output"), true, None, &mut factory));
87추가: assert!(
88추가: matches!(factory.state.borrow().starts.last(), Some(Start::Extract { list_id, .. }) if list_id == &split_id())
89추가: );
90추가: }
91추가: #[test]
92추가: fn split_list_id_rejects_invalid_version_format_and_source_combinations() {
93추가: for id in [
94추가: ListId {
95추가: catalog_version: 1,
96추가: ..split_id()
97추가: },
98추가: ListId {
99추가: format: Format::Zip,
100추가: ..split_id()
101추가: },
102추가: ListId {
103추가: source_object: SourceObject::Unix {
104추가: device: 1,
105추가: inode: 2,
106추가: },
107추가: ..split_id()
108추가: },
109추가: ] {
110추가: let (mut model, factory) = setup();
111추가: factory.state.borrow_mut().frame(Event::ListEnd {
112추가: entry_count: 0,
113추가: list_id: id,
114추가: });
115추가: terminal(&factory, Outcome::Completed, None);
116추가: exited(&factory);
117추가: pump(&mut model);
118추가: assert!(model.error.is_some());
119추가: assert!(model.list_id.is_none());
120추가: }
121추가: }
122추가: #[test]
123추가: fn volume_problem_waits_for_terminal_eofs_and_reap_and_clears_on_new_job() {
124추가: let (mut model, mut factory) = setup();
125추가: factory
126추가: .state
127추가: .borrow_mut()
128추가: .frame(Event::VolumeProblem(problem(
129추가: VolumeProblemReason::MissingVolume,
130추가: )));
131추가: terminal(&factory, Outcome::Failed, Some(ErrorCode::MissingVolume));
132추가: for _ in 0..32 {
133추가: model.poll();
134추가: assert!(model.volume_problem.is_none());
135추가: }
136추가: assert!(model.busy());
137추가: exited(&factory);
138추가: pump(&mut model);
139추가: assert!(model.confirmed);
140추가: assert_eq!(
141추가: model.volume_problem,
142추가: Some(problem(VolumeProblemReason::MissingVolume))
143추가: );
144추가: assert!(model.begin(
145추가: Start::List {
146추가: archive: path("next.zip")
147추가: },
148추가: &mut factory
149추가: ));
150추가: assert!(model.volume_problem.is_none());
151추가: }
152추가: #[test]
153추가: fn volume_problem_reason_requires_matching_failed_terminal() {
154추가: for reason in [
155추가: VolumeProblemReason::FirstVolumeRequired,
156추가: VolumeProblemReason::MissingVolume,
157추가: VolumeProblemReason::IncompleteSet,
158추가: ] {
159추가: for valid in [true, false] {
160추가: let (mut model, factory) = setup();
161추가: factory
162추가: .state
163추가: .borrow_mut()
164추가: .frame(Event::VolumeProblem(problem(reason)));
165추가: let error = match reason {
166추가: VolumeProblemReason::FirstVolumeRequired => ErrorCode::InvalidRequest,
167추가: VolumeProblemReason::MissingVolume => ErrorCode::MissingVolume,
168추가: VolumeProblemReason::IncompleteSet => ErrorCode::Integrity,
169추가: };
170추가: terminal(
171추가: &factory,
172추가: if valid {
173추가: Outcome::Failed
174추가: } else {
175추가: Outcome::Completed
176추가: },
177추가: Some(error),
178추가: );
179추가: exited(&factory);
180추가: pump(&mut model);
181추가: assert_eq!(model.confirmed, valid);
182추가: assert_eq!(model.volume_problem.is_some(), valid);
183추가: }
184추가: }
185추가: let (mut model, factory) = setup();
186추가: factory
187추가: .state
188추가: .borrow_mut()
189추가: .frame(Event::VolumeProblem(problem(
190추가: VolumeProblemReason::MissingVolume,
191추가: )));
192추가: terminal(&factory, Outcome::Failed, Some(ErrorCode::Integrity));
193추가: exited(&factory);
194추가: pump(&mut model);
195추가: assert!(!model.confirmed);
196추가: assert!(model.volume_problem.is_none());
197추가: }
198추가: #[test]
199추가: fn duplicate_or_unsafe_volume_names_are_rejected() {
200추가: for duplicate in [false, true] {
201추가: let (mut model, factory) = setup();
202추가: let mut value = problem(VolumeProblemReason::MissingVolume);
203추가: if !duplicate {
204추가: value.volume = NativePath::Unix(b"../outside.7z.003".to_vec());
205추가: }
206추가: factory
207추가: .state
208추가: .borrow_mut()
209추가: .frame(Event::VolumeProblem(value.clone()));
210추가: if duplicate {
211추가: factory
212추가: .state
213추가: .borrow_mut()
214추가: .frame(Event::VolumeProblem(value));
215추가: }
216추가: terminal(&factory, Outcome::Failed, Some(ErrorCode::MissingVolume));
217추가: exited(&factory);
218추가: pump(&mut model);
219추가: assert!(!model.confirmed);
220추가: assert!(model.volume_problem.is_none());
221추가: }
222추가: }
223추가: #[test]
224추가: fn cancellation_discards_late_volume_problem() {
225추가: let (mut model, factory) = setup();
226추가: for _ in 0..4 {
227추가: model.poll();
228추가: }
229추가: model.cancel();
230추가: factory
231추가: .state
232추가: .borrow_mut()
233추가: .frame(Event::VolumeProblem(problem(
234추가: VolumeProblemReason::MissingVolume,
235추가: )));
236추가: factory.state.borrow_mut().frame(Event::CancelAck {
237추가: request_sequence: 1,
238추가: status: CancelStatus::Requested,
239추가: });
240추가: terminal(&factory, Outcome::Cancelled, None);
241추가: exited(&factory);
242추가: pump(&mut model);
243추가: assert!(model.confirmed, "{:?}", model.error);
244추가: assert!(model.volume_problem.is_none());
245추가: }
246추가: #[test]
247추가: fn volume_filename_display_preserves_native_units_and_escapes_controls() {
248추가: use zipelo_ui_memory_app::archive_present::volume_problem_text;
249추가: let mut value = problem(VolumeProblemReason::MissingVolume);
250추가: value.volume = NativePath::Unix(b"a\n\xff.7z.003".to_vec());
251추가: let text = volume_problem_text(&value);
252추가: assert!(text.contains("a\\u{a}\\xff.7z.003"), "{text}");
253추가: assert!(!text.contains('\n'));
254추가: value.volume = NativePath::Windows(vec![0xd800, 0x202e, 46, 55, 122, 46, 48, 48, 51]);
255추가: let text = volume_problem_text(&value);
256추가: assert!(text.contains("\\u{d800}\\u{202e}.7z.003"), "{text}");
257추가: }
258추가:
259추가: #[test]
260추가: fn wrong_job_volume_problem_is_not_presented() {
261추가: let (mut model, factory) = setup();
262추가: factory
263추가: .state
264추가: .borrow_mut()
265추가: .frame(Event::VolumeProblem(problem(
266추가: VolumeProblemReason::MissingVolume,
267추가: )));
268추가: if let Some(HostEvent::Frame { job_id, .. }) = factory.state.borrow_mut().queue.back_mut() {
269추가: *job_id += 1;
270추가: }
271추가: terminal(&factory, Outcome::Failed, Some(ErrorCode::MissingVolume));
272추가: exited(&factory);
273추가: pump(&mut model);
274추가: assert!(!model.confirmed);
275추가: assert!(model.volume_problem.is_none());
276추가: }