team-ljyzipelo

공개

Merge pull request #85 from Team-LJY/features/ui-redesign

압축 파일 열기와 만들기 UI를 재설계
작성자
LeeJunyoung
작성 시각
커밋
eca9a733cc3e7519ce9cce554dbaee5515a52c34
이 시점의 파일 보기

변경된 파일 67개

+2,180-90

변경 내용이 커서 일부 파일의 Diff를 생략했어요. 생략한 파일은 파일 보기나 Raw로 확인할 수 있어요.

수정experiments/rust-ui-memory-app/Cargo.toml+5-0
@@ -51,3 +51,8 @@ eframe = { version = "=0.37.0", optional = true, default-features = false, featu
5151name = "renderer_fallback"
5252path = "../../tests/rust-app-ui/renderer_fallback.rs"
5353required-features = ["ui"]
54추가:
55추가: [[bin]]
56추가: name = "zipelo-ui-capture"
57추가: path = "../../tests/rust-app-ui/capture.rs"
58추가: required-features = ["ui-fixture"]
추가experiments/rust-ui-memory-app/src/archive_picker.rs+263-0
@@ -0,0 +1,263 @@
1추가: use crate::{archive_present as present, archive_theme as theme};
2추가: use eframe::egui::{self, Align, Layout};
3추가: use std::path::{Path, PathBuf};
4추가:
5추가: #[derive(Clone, Copy, PartialEq)]
6추가: pub enum Purpose {
7추가: Open,
8추가: Destination,
9추가: Retry,
10추가: Files,
11추가: Folder,
12추가: ZipFolder,
13추가: }
14추가:
15추가: pub enum Choice {
16추가: Cancel,
17추가: Paths(Vec<PathBuf>),
18추가: }
19추가:
20추가: pub struct Picker {
21추가: pub purpose: Purpose,
22추가: current: PathBuf,
23추가: entries: Vec<present::BrowserEntry>,
24추가: selected: Vec<PathBuf>,
25추가: error: bool,
26추가: }
27추가:
28추가: impl Picker {
29추가: pub fn new(purpose: Purpose, start: &Path) -> Self {
30추가: let current = if start.is_dir() {
31추가: start.to_path_buf()
32추가: } else {
33추가: start
34추가: .parent()
35추가: .filter(|p| p.is_dir())
36추가: .map(Path::to_path_buf)
37추가: .unwrap_or_else(present::home_directory)
38추가: };
39추가: let mut picker = Self {
40추가: purpose,
41추가: current,
42추가: entries: Vec::new(),
43추가: selected: Vec::new(),
44추가: error: false,
45추가: };
46추가: picker.reload();
47추가: picker
48추가: }
49추가:
50추가: fn reload(&mut self) {
51추가: self.selected.clear();
52추가: match present::directory_entries(&self.current) {
53추가: Ok(entries) => {
54추가: self.entries = entries;
55추가: self.error = false;
56추가: }
57추가: Err(_) => {
58추가: self.entries.clear();
59추가: self.error = true;
60추가: }
61추가: }
62추가: }
63추가:
64추가: fn directory_mode(&self) -> bool {
65추가: matches!(
66추가: self.purpose,
67추가: Purpose::Destination | Purpose::Retry | Purpose::Folder | Purpose::ZipFolder
68추가: )
69추가: }
70추가:
71추가: pub fn show(&mut self, ctx: &egui::Context) -> Option<Choice> {
72추가: let mut choice = None;
73추가: let mut navigate = None;
74추가: let width = (ctx.content_rect().width() - 64.0).min(720.0);
75추가: let height = (ctx.content_rect().height() - 280.0).clamp(160.0, 340.0);
76추가: let title = match self.purpose {
77추가: Purpose::Open => "파일 열기",
78추가: Purpose::Destination | Purpose::Retry => "풀 위치 선택",
79추가: Purpose::Files => "묶을 파일 선택",
80추가: Purpose::Folder => "묶을 폴더 선택",
81추가: Purpose::ZipFolder => "ZIP 저장 폴더 선택",
82추가: };
83추가: let title = if self.purpose == Purpose::Open {
84추가: "파일 열기"
85추가: } else {
86추가: title
87추가: };
88추가: let modal = egui::Modal::new(egui::Id::unique("archive-picker")).show(ctx, |ui| {
89추가: ui.set_width(width);
90추가: ui.heading(title);
91추가: egui::ScrollArea::horizontal()
92추가: .id_salt("breadcrumbs")
93추가: .show(ui, |ui| {
94추가: ui.horizontal(|ui| {
95추가: let mut ancestors = self.current.ancestors().collect::<Vec<_>>();
96추가: ancestors.reverse();
97추가: for path in ancestors {
98추가: let label = path
99추가: .file_name()
100추가: .unwrap_or(path.as_os_str())
101추가: .to_string_lossy();
102추가: if ui
103추가: .button(label.as_ref())
104추가: .on_hover_text(path.display().to_string())
105추가: .clicked()
106추가: {
107추가: navigate = Some(path.to_path_buf());
108추가: }
109추가: }
110추가: });
111추가: });
112추가: ui.separator();
113추가: ui.horizontal_top(|ui| {
114추가: ui.allocate_ui_with_layout(
115추가: egui::vec2(128.0, height),
116추가: Layout::top_down(Align::Min),
117추가: |ui| {
118추가: ui.set_min_size(egui::vec2(128.0, height));
119추가: for (label, path) in present::shortcuts() {
120추가: if theme::action(ui, &label, false, true).clicked() {
121추가: navigate = Some(path);
122추가: }
123추가: }
124추가: if let Some(parent) = self.current.parent() {
125추가: if theme::action(ui, "상위 폴더", false, true).clicked() {
126추가: navigate = Some(parent.to_path_buf());
127추가: }
128추가: }
129추가: },
130추가: );
131추가: ui.add_space(theme::SPACE);
132추가: ui.allocate_ui_with_layout(
133추가: egui::vec2((width - 160.0).max(240.0), height),
134추가: Layout::top_down(Align::Min),
135추가: |ui| {
136추가: ui.set_min_size(egui::vec2((width - 160.0).max(240.0), height));
137추가: if self.error {
138추가: ui.colored_label(
139추가: theme::ERROR,
140추가: "이 폴더를 열 수 없습니다. 접근 권한을 확인하세요",
141추가: );
142추가: } else if self.entries.is_empty() {
143추가: ui.label("이 폴더는 비어 있습니다");
144추가: }
145추가: egui::ScrollArea::vertical()
146추가: .id_salt("picker-entries")
147추가: .max_height(height)
148추가: .show_rows(ui, theme::ROW, self.entries.len(), |ui, rows| {
149추가: for index in rows {
150추가: let entry = &self.entries[index];
151추가: let selected = self.selected.contains(&entry.path);
152추가: let response = ui
153추가: .horizontal(|ui| {
154추가: theme::icon(
155추가: ui,
156추가: if entry.directory {
157추가: theme::Icon::Folder
158추가: } else {
159추가: theme::Icon::File
160추가: },
161추가: 20.0,
162추가: );
163추가: let name = if entry.link {
164추가: format!("{} (링크)", entry.name)
165추가: } else {
166추가: entry.name.clone()
167추가: };
168추가: ui.add_sized(
169추가: [ui.available_width(), theme::ROW],
170추가: egui::Button::new("")
171추가: .left_text(present::middle_text(&name, 38))
172추가: .selected(selected),
173추가: )
174추가: .on_hover_text(entry.path.display().to_string())
175추가: })
176추가: .inner;
177추가: theme::focus(&response);
178추가: if response.clicked() {
179추가: if self.purpose == Purpose::Files
180추가: && ui.input(|i| i.modifiers.command || i.modifiers.ctrl)
181추가: {
182추가: if selected {
183추가: self.selected.retain(|p| p != &entry.path);
184추가: } else if !entry.directory {
185추가: self.selected.push(entry.path.clone());
186추가: }
187추가: } else {
188추가: self.selected = vec![entry.path.clone()];
189추가: }
190추가: }
191추가: let keyboard_activation = response.has_focus()
192추가: && ui.input(|i| {
193추가: i.key_pressed(egui::Key::Enter)
194추가: || i.key_pressed(egui::Key::Space)
195추가: });
196추가: if response.double_clicked() || keyboard_activation {
197추가: if entry.directory && !entry.link {
198추가: navigate = Some(entry.path.clone());
199추가: } else if !self.directory_mode() {
200추가: choice = Some(Choice::Paths(vec![entry.path.clone()]));
201추가: }
202추가: }
203추가: }
204추가: });
205추가: },
206추가: );
207추가: });
208추가: ui.separator();
209추가: ui.horizontal(|ui| {
210추가: if self.purpose == Purpose::Files {
211추가: ui.label("Ctrl을 누르면 여러 파일을 고를 수 있습니다");
212추가: }
213추가: ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
214추가: let selected_directory = self.selected.first().filter(|path| {
215추가: self.entries
216추가: .iter()
217추가: .any(|e| &e.path == *path && (e.directory || e.link))
218추가: });
219추가: let paths = if self.directory_mode() {
220추가: vec![
221추가: selected_directory
222추가: .cloned()
223추가: .unwrap_or_else(|| self.current.clone()),
224추가: ]
225추가: } else {
226추가: self.selected
227추가: .iter()
228추가: .filter(|path| {
229추가: self.entries
230추가: .iter()
231추가: .any(|e| &e.path == *path && !e.directory)
232추가: })
233추가: .cloned()
234추가: .collect()
235추가: };
236추가: let label = if self.directory_mode() {
237추가: "이 폴더 선택"
238추가: } else if self.purpose == Purpose::Files {
239추가: "추가"
240추가: } else {
241추가: "열기"
242추가: };
243추가: let enabled = !paths.is_empty() && !self.error;
244추가: let (cancel, confirm) = theme::action_pair(ui, "취소", Some((label, enabled)));
245추가: if navigate.is_none() && confirm {
246추가: choice = Some(Choice::Paths(paths));
247추가: }
248추가: if cancel {
249추가: choice = Some(Choice::Cancel);
250추가: }
251추가: });
252추가: });
253추가: });
254추가: if modal.should_close() {
255추가: choice = Some(Choice::Cancel);
256추가: }
257추가: if let Some(path) = navigate {
258추가: self.current = path;
259추가: self.reload();
260추가: }
261추가: choice
262추가: }
263추가: }
추가experiments/rust-ui-memory-app/src/archive_present.rs+364-0
@@ -0,0 +1,364 @@
1추가: use crate::archive_ui::*;
2추가: use std::{
3추가: collections::BTreeSet,
4추가: fs, io,
5추가: path::{Path, PathBuf},
6추가: };
7추가:
8추가: pub const UNCERTAIN: &str = "저장이 끝났는지 확인하지 못했습니다. 풀 위치 폴더를 확인하세요.";
9추가: pub const PARTIAL: &str = "일부 파일만 풀렸습니다. 풀린 파일은 풀 위치 폴더에 남아 있습니다.";
10추가: pub const LEFTOVERS: &str =
11추가: "선택한 파일은 모두 저장했지만 임시 파일을 지우지 못했습니다. 풀 위치 폴더를 확인하세요.";
12추가: pub const SYNC_FAILED: &str =
13추가: "파일을 디스크에 완전히 저장하지 못했습니다. 풀 위치 폴더를 확인하세요.";
14추가: pub const SYNC_WARNING: &str = "파일을 디스크에 완전히 저장했는지 확인하지 못했습니다.";
15추가: pub const CLEANUP_WARNING: &str =
16추가: "임시 파일을 지우지 못했습니다. 풀 위치 폴더에 남은 임시 파일이 있을 수 있습니다.";
17추가: pub const INTERNAL: &str = "내부 오류가 발생했습니다. 프로그램을 다시 시작해 주세요";
18추가: pub const FOLDER_ERROR: &str = "풀 위치 폴더를 만들 수 없습니다. 접근 권한을 확인하세요";
19추가:
20추가: pub fn error_text(code: ErrorCode) -> &'static str {
21추가: match code {
22추가: ErrorCode::Integrity => "압축파일이 손상됐습니다",
23추가: ErrorCode::UnsupportedFormat => "지원하지 않는 압축 형식입니다",
24추가: ErrorCode::UnsupportedFeature => "아직 지원하지 않는 기능입니다",
25추가: ErrorCode::WrongPassword => "암호가 올바르지 않습니다",
26추가: ErrorCode::UnsafePath => "파일 경로의 안전성을 확인할 수 없어 중단했습니다",
27추가: ErrorCode::Conflict => "같은 이름의 파일이 이미 있습니다. 다른 폴더를 선택하세요",
28추가: ErrorCode::Limit => "처리 한도를 초과했습니다",
29추가: ErrorCode::Io => "파일을 읽거나 쓰지 못했습니다. 파일과 폴더의 접근 권한을 확인하세요",
30추가: ErrorCode::DiskFull => "디스크 여유 공간이 부족합니다. 공간을 확보한 뒤 다시 시도하세요",
31추가: ErrorCode::SourceChanged => "원본 파일이 바뀌었습니다. 압축파일을 다시 여세요",
32추가: ErrorCode::InvalidRequest => "풀 위치와 선택한 항목을 확인하세요",
33추가: ErrorCode::Protocol | ErrorCode::Internal => INTERNAL,
34추가: }
35추가: }
36추가:
37추가: pub fn progress_text(stage: Stage, creating: bool) -> &'static str {
38추가: match stage {
39추가: Stage::Scan | Stage::Read => "압축파일을 읽는 중",
40추가: Stage::Decode if creating => "압축하는 중",
41추가: Stage::Decode => "압축을 푸는 중",
42추가: Stage::Write => "파일을 저장하는 중",
43추가: Stage::Verify => "확인하는 중",
44추가: Stage::Commit => "마무리하는 중",
45추가: }
46추가: }
47추가:
48추가: pub fn bytes_text(bytes: u64) -> String {
49추가: for (unit, size) in [("GB", 1_u64 << 30), ("MB", 1 << 20), ("KB", 1 << 10)] {
50추가: if bytes >= size {
51추가: return format!("{:.1} {unit}", bytes as f64 / size as f64);
52추가: }
53추가: }
54추가: format!("{bytes} B")
55추가: }
56추가:
57추가: pub fn middle_text(text: &str, max_chars: usize) -> String {
58추가: let chars = text.chars().collect::<Vec<_>>();
59추가: if chars.len() <= max_chars || max_chars < 5 {
60추가: return text.into();
61추가: }
62추가: let left = (max_chars - 1) / 2;
63추가: chars[..left]
64추가: .iter()
65추가: .chain(std::iter::once(&'…'))
66추가: .chain(chars[chars.len() - (max_chars - left - 1)..].iter())
67추가: .collect()
68추가: }
69추가:
70추가: pub fn default_destination(archive: &Path) -> PathBuf {
71추가: let name = archive.file_name().unwrap_or_default().to_string_lossy();
72추가: let lower = name.to_ascii_lowercase();
73추가: let stem = if lower.ends_with(".tar.gz") {
74추가: &name[..name.len() - 7]
75추가: } else {
76추가: name.rsplit_once('.')
77추가: .map_or(name.as_ref(), |(stem, _)| stem)
78추가: };
79추가: archive.with_file_name(if stem.is_empty() {
80추가: "압축 해제"
81추가: } else {
82추가: stem
83추가: })
84추가: }
85추가:
86추가: pub fn prepare_destination(path: &Path, automatic: bool) -> io::Result<bool> {
87추가: match fs::symlink_metadata(path) {
88추가: Ok(metadata) if metadata.is_dir() && !metadata.file_type().is_symlink() => Ok(false),
89추가: Ok(_) => Err(io::Error::other(FOLDER_ERROR)),
90추가: Err(error) if error.kind() == io::ErrorKind::NotFound && automatic => {
91추가: let mut builder = fs::DirBuilder::new();
92추가: #[cfg(unix)]
93추가: {
94추가: use std::os::unix::fs::DirBuilderExt;
95추가: builder.mode(0o700);
96추가: }
97추가: builder.create(path)?;
98추가: Ok(true)
99추가: }
100추가: Err(error) => Err(error),
101추가: }
102추가: }
103추가:
104추가: pub fn remove_owned_empty(path: &Path) {
105추가: // 이번 요청에서 만든 폴더만 호출하며 비어 있지 않으면 보존함.
106추가: let _ = fs::remove_dir(path);
107추가: }
108추가:
109추가: fn requested(entry: &Entry, selection: &Selection) -> bool {
110추가: match selection {
111추가: Selection::All => true,
112추가: Selection::EntryIds(ids) => ids.contains(&entry.id),
113추가: }
114추가: }
115추가:
116추가: pub fn target_files(
117추가: entries: &[Entry],
118추가: selection: &Selection,
119추가: gzip: Option<&str>,
120추가: ) -> Option<BTreeSet<String>> {
121추가: let mut names = BTreeSet::new();
122추가: for entry in entries
123추가: .iter()
124추가: .filter(|entry| entry.kind == Kind::File && requested(entry, selection))
125추가: {
126추가: if !names.insert(gzip.unwrap_or(&entry.name).replace('\\', "/")) {
127추가: return None;
128추가: }
129추가: }
130추가: Some(names)
131추가: }
132추가:
133추가: pub fn target_directories(entries: &[Entry], selection: &Selection) -> BTreeSet<String> {
134추가: let mut directories = BTreeSet::new();
135추가: for entry in entries.iter().filter(|entry| {
136추가: matches!(entry.kind, Kind::File | Kind::Directory) && requested(entry, selection)
137추가: }) {
138추가: let normalized = entry.name.replace('\\', "/");
139추가: let name = normalized.trim_end_matches('/');
140추가: if entry.kind == Kind::Directory {
141추가: directories.insert(name.to_owned());
142추가: }
143추가: let mut parent = name;
144추가: while let Some((directory, _)) = parent.rsplit_once('/') {
145추가: directories.insert(directory.to_owned());
146추가: parent = directory;
147추가: }
148추가: }
149추가: directories
150추가: }
151추가:
152추가: pub fn durability_warning(durability: Durability) -> Option<&'static str> {
153추가: match durability {
154추가: Durability::Failed => Some(SYNC_FAILED),
155추가: Durability::Unconfirmed => Some(SYNC_WARNING),
156추가: _ => None,
157추가: }
158추가: }
159추가:
160추가: pub fn warnings(
161추가: terminal: Option<&Terminal>,
162추가: confirmed: bool,
163추가: targets: Option<&BTreeSet<String>>,
164추가: directories: &BTreeSet<String>,
165추가: outputs: &[(String, Disposition)],
166추가: ) -> Vec<&'static str> {
167추가: let mut result = publication_warnings(terminal, confirmed, targets, directories, outputs);
168추가: if let Some(warning) = terminal
169추가: .filter(|_| confirmed)
170추가: .and_then(|t| durability_warning(t.durability))
171추가: {
172추가: result.push(warning);
173추가: }
174추가: result
175추가: }
176추가:
177추가: pub fn publication_warnings(
178추가: terminal: Option<&Terminal>,
179추가: confirmed: bool,
180추가: targets: Option<&BTreeSet<String>>,
181추가: directories: &BTreeSet<String>,
182추가: outputs: &[(String, Disposition)],
183추가: ) -> Vec<&'static str> {
184추가: let Some(t) = terminal.filter(|_| confirmed) else {
185추가: return vec![UNCERTAIN];
186추가: };
187추가: let created = outputs
188추가: .iter()
189추가: .filter(|(_, state)| *state == Disposition::Created)
190추가: .map(|(name, _)| name.replace('\\', "/"))
191추가: .collect::<BTreeSet<_>>();
192추가: let created_reports = outputs
193추가: .iter()
194추가: .filter(|(_, state)| *state == Disposition::Created)
195추가: .count();
196추가: let uncertain = t.publication == Publication::Uncertain
197추가: || outputs
198추가: .iter()
199추가: .any(|(_, state)| *state == Disposition::CommitUncertain)
200추가: || created.len() != created_reports
201추가: || created_reports as u64 != t.created_count
202추가: || (t.publication == Publication::None && !created.is_empty());
203추가: let retained = t.retained_partial_count > 0
204추가: || outputs
205추가: .iter()
206추가: .any(|(_, state)| *state == Disposition::PartialRetained);
207추가: let mut result = Vec::new();
208추가: let mut all_saved_with_leftovers = false;
209추가: if uncertain {
210추가: result.push(UNCERTAIN);
211추가: } else if let Some(targets) = targets {
212추가: let files = created
213추가: .difference(directories)
214추가: .cloned()
215추가: .collect::<BTreeSet<_>>();
216추가: let saved = targets.intersection(&files).count();
217추가: let unknown = !targets.is_disjoint(directories)
218추가: || created
219추가: .iter()
220추가: .any(|name| !targets.contains(name) && !directories.contains(name));
221추가: if unknown {
222추가: result.push(UNCERTAIN);
223추가: } else if !targets.is_empty() && saved == targets.len() && retained {
224추가: result.push(LEFTOVERS);
225추가: all_saved_with_leftovers = true;
226추가: } else if saved > 0 && saved < targets.len() && t.outcome != Outcome::Completed {
227추가: result.push(PARTIAL);
228추가: } else if (saved == 0 && !files.is_empty())
229추가: || (retained && saved == 0)
230추가: || (t.outcome == Outcome::Completed && saved != targets.len())
231추가: {
232추가: result.push(UNCERTAIN);
233추가: }
234추가: } else {
235추가: result.push(UNCERTAIN);
236추가: }
237추가: if (retained || t.cleanup != Cleanup::Complete) && !all_saved_with_leftovers {
238추가: result.push(CLEANUP_WARNING);
239추가: }
240추가: result
241추가: }
242추가:
243추가: pub fn definitely_unsaved(
244추가: t: Option<&Terminal>,
245추가: confirmed: bool,
246추가: outputs: &[(String, Disposition)],
247추가: ) -> bool {
248추가: t.is_some_and(|t| {
249추가: confirmed
250추가: && t.publication == Publication::None
251추가: && t.created_count == 0
252추가: && t.retained_partial_count == 0
253추가: && t.cleanup == Cleanup::Complete
254추가: && outputs
255추가: .iter()
256추가: .all(|(_, state)| *state == Disposition::Removed)
257추가: })
258추가: }
259추가:
260추가: #[derive(Clone)]
261추가: pub struct BrowserEntry {
262추가: pub path: PathBuf,
263추가: pub name: String,
264추가: pub directory: bool,
265추가: pub link: bool,
266추가: }
267추가:
268추가: pub fn directory_entries(path: &Path) -> io::Result<Vec<BrowserEntry>> {
269추가: if fs::symlink_metadata(path)?.file_type().is_symlink() {
270추가: return Err(io::Error::other("링크 폴더는 탐색하지 않음"));
271추가: }
272추가: let mut entries = Vec::new();
273추가: for item in fs::read_dir(path)? {
274추가: let item = item?;
275추가: let kind = item.file_type()?;
276추가: entries.push(BrowserEntry {
277추가: path: item.path(),
278추가: name: item.file_name().to_string_lossy().into(),
279추가: directory: kind.is_dir(),
280추가: link: kind.is_symlink(),
281추가: });
282추가: }
283추가: entries.sort_by(|a, b| {
284추가: b.directory
285추가: .cmp(&a.directory)
286추가: .then_with(|| a.name.to_lowercase().cmp(&b.name.to_lowercase()))
287추가: });
288추가: Ok(entries)
289추가: }
290추가:
291추가: pub fn home_directory() -> PathBuf {
292추가: std::env::var_os(if cfg!(windows) { "USERPROFILE" } else { "HOME" })
293추가: .map(PathBuf::from)
294추가: .filter(|p| p.is_absolute())
295추가: .unwrap_or_else(|| std::env::current_dir().unwrap_or_else(|_| PathBuf::from("/")))
296추가: }
297추가:
298추가: pub fn shortcuts() -> Vec<(String, PathBuf)> {
299추가: let home = home_directory();
300추가: let mut paths = vec![("홈".into(), home.clone())];
301추가: for (label, candidates) in [
302추가: ("바탕 화면", ["Desktop", "바탕화면"]),
303추가: ("문서", ["Documents", "문서"]),
304추가: ("다운로드", ["Downloads", "다운로드"]),
305추가: ] {
306추가: if let Some(path) = candidates
307추가: .iter()
308추가: .map(|name| home.join(name))
309추가: .find(|p| p.is_dir())
310추가: {
311추가: paths.push((label.into(), path));
312추가: }
313추가: }
314추가: #[cfg(windows)]
315추가: for drive in b'A'..=b'Z' {
316추가: let path = PathBuf::from(format!("{}:\\", drive as char));
317추가: if path.is_dir() {
318추가: paths.push((format!("{}:", drive as char), path));
319추가: }
320추가: }
321추가: paths
322추가: }
323추가:
324추가: pub fn folder_command(path: &Path) -> std::process::Command {
325추가: let mut command = std::process::Command::new(if cfg!(windows) {
326추가: "explorer"
327추가: } else {
328추가: "xdg-open"
329추가: });
330추가: command.arg(path);
331추가: command
332추가: }
333추가:
334추가: pub const UNCONFIRMED_FINISH: &str =
335추가: "작업이 정상적으로 끝났는지 확인하지 못했습니다. 풀 위치 폴더를 확인하세요";
336추가:
337추가: pub fn client_error_text(error: &str) -> &'static str {
338추가: if error.starts_with("작업자 종료 결과를 확인할 수 없습니다") {
339추가: UNCONFIRMED_FINISH
340추가: } else {
341추가: INTERNAL
342추가: }
343추가: }
344추가:
345추가: pub fn activity_text(model: &Model, creating: bool) -> &'static str {
346추가: if model.terminal.is_some()
347추가: || matches!(
348추가: model.cancel,
349추가: Some(CancelStatus::TooLate | CancelStatus::Finished)
350추가: )
351추가: {
352추가: "마무리하는 중"
353추가: } else if model.cancellation_requested() || model.cancel.is_some() {
354추가: "취소하는 중..."
355추가: } else if model.challenge.is_some() {
356추가: "암호를 입력하세요"
357추가: } else {
358추가: model
359추가: .progress
360추가: .map_or("압축파일을 읽는 중", |(stage, _, _, _)| {
361추가: progress_text(stage, creating)
362추가: })
363추가: }
364추가: }
수정experiments/rust-ui-memory-app/src/archive_screen.rs

Diff가 표시 한도를 넘어서 생략했어요.

Raw로 열기
추가experiments/rust-ui-memory-app/src/archive_theme.rs+281-0
@@ -0,0 +1,281 @@
1추가: use eframe::egui::{self, Color32, FontId, Stroke, TextStyle};
2추가:
3추가: pub const BACKGROUND: Color32 = Color32::from_rgb(247, 248, 250);
4추가: pub const PANEL: Color32 = Color32::WHITE;
5추가: pub const STRIPE: Color32 = Color32::from_rgb(243, 245, 248);
6추가: pub const BORDER: Color32 = Color32::from_rgb(217, 222, 229);
7추가: pub const TEXT: Color32 = Color32::from_rgb(31, 41, 51);
8추가: pub const MUTED: Color32 = Color32::from_rgb(91, 102, 115);
9추가: pub const BLUE: Color32 = Color32::from_rgb(37, 99, 235);
10추가: pub const BLUE_HOVER: Color32 = Color32::from_rgb(29, 78, 216);
11추가: pub const BLUE_ACTIVE: Color32 = Color32::from_rgb(30, 64, 175);
12추가: pub const SELECTED: Color32 = Color32::from_rgb(232, 240, 254);
13추가: pub const DROP: Color32 = Color32::from_rgb(238, 244, 255);
14추가: pub const DASH: Color32 = Color32::from_rgb(170, 180, 192);
15추가: pub const SUCCESS: Color32 = Color32::from_rgb(21, 128, 61);
16추가: pub const SUCCESS_BG: Color32 = Color32::from_rgb(232, 245, 236);
17추가: pub const WARNING: Color32 = Color32::from_rgb(180, 83, 9);
18추가: pub const WARNING_BG: Color32 = Color32::from_rgb(255, 247, 232);
19추가: pub const ERROR: Color32 = Color32::from_rgb(185, 28, 28);
20추가: pub const ERROR_BG: Color32 = Color32::from_rgb(253, 237, 237);
21추가: pub const FOLDER: Color32 = Color32::from_rgb(224, 165, 38);
22추가: pub const FILE: Color32 = Color32::from_rgb(123, 135, 148);
23추가: pub const SPACE: f32 = 8.0;
24추가: pub const PAD: i8 = 16;
25추가: pub const DROP_PAD: i8 = 24;
26추가: pub const DROP_HEIGHT: f32 = 280.0;
27추가: pub const DROP_RADIUS: u8 = 12;
28추가: pub const ROW: f32 = 32.0;
29추가: pub const BUTTON: f32 = 40.0;
30추가: pub const BODY: f32 = 15.0;
31추가: pub const TITLE: f32 = 22.0;
32추가:
33추가: pub fn apply(ctx: &egui::Context) {
34추가: ctx.set_theme(egui::Theme::Light);
35추가: ctx.set_visuals(egui::Visuals::light());
36추가: ctx.style_mut_of(egui::Theme::Light, |style| {
37추가: style
38추가: .text_styles
39추가: .insert(TextStyle::Body, FontId::proportional(BODY));
40추가: style
41추가: .text_styles
42추가: .insert(TextStyle::Button, FontId::proportional(BODY));
43추가: style
44추가: .text_styles
45추가: .insert(TextStyle::Small, FontId::proportional(BODY));
46추가: style
47추가: .text_styles
48추가: .insert(TextStyle::Heading, FontId::proportional(TITLE));
49추가: style.visuals.override_text_color = Some(TEXT);
50추가: style.visuals.panel_fill = BACKGROUND;
51추가: style.visuals.window_fill = PANEL;
52추가: style.visuals.extreme_bg_color = PANEL;
53추가: style.visuals.faint_bg_color = STRIPE;
54추가: style.visuals.selection.bg_fill = SELECTED;
55추가: style.visuals.selection.stroke = Stroke::new(2.0, BLUE);
56추가: style.visuals.widgets.inactive.bg_fill = PANEL;
57추가: style.visuals.widgets.inactive.weak_bg_fill = PANEL;
58추가: style.visuals.widgets.inactive.bg_stroke = Stroke::new(1.0, BORDER);
59추가: style.visuals.widgets.hovered.bg_fill = DROP;
60추가: style.visuals.widgets.hovered.weak_bg_fill = DROP;
61추가: style.visuals.widgets.hovered.bg_stroke = Stroke::new(1.0, BLUE);
62추가: style.visuals.widgets.active.bg_stroke = Stroke::new(2.0, BLUE);
63추가: for widget in [
64추가: &mut style.visuals.widgets.inactive,
65추가: &mut style.visuals.widgets.hovered,
66추가: &mut style.visuals.widgets.active,
67추가: &mut style.visuals.widgets.noninteractive,
68추가: ] {
69추가: widget.corner_radius = egui::CornerRadius::same(6);
70추가: widget.fg_stroke = Stroke::new(1.5, TEXT);
71추가: }
72추가: style.visuals.window_corner_radius = egui::CornerRadius::same(8);
73추가: style.spacing.item_spacing = egui::vec2(SPACE, SPACE);
74추가: style.spacing.button_padding = egui::vec2(16.0, SPACE);
75추가: style.spacing.interact_size.y = ROW;
76추가: style.spacing.window_margin = egui::Margin::same(PAD);
77추가: style.visuals.disabled_alpha = 0.4;
78추가: });
79추가: }
80추가:
81추가: pub fn focus(response: &egui::Response) {
82추가: if response.has_focus() {
83추가: response.ctx.layer_painter(response.layer_id).rect_stroke(
84추가: response.rect.expand(2.0),
85추가: 6,
86추가: Stroke::new(2.0, BLUE),
87추가: egui::StrokeKind::Outside,
88추가: );
89추가: }
90추가: }
91추가:
92추가: pub fn action(ui: &mut egui::Ui, text: &str, primary: bool, enabled: bool) -> egui::Response {
93추가: let response = ui
94추가: .scope(|ui| {
95추가: if primary {
96추가: let style = ui.style_mut();
97추가: style.visuals.widgets.inactive.bg_fill = BLUE;
98추가: style.visuals.widgets.inactive.weak_bg_fill = BLUE;
99추가: style.visuals.widgets.hovered.bg_fill = BLUE_HOVER;
100추가: style.visuals.widgets.hovered.weak_bg_fill = BLUE_HOVER;
101추가: style.visuals.widgets.active.bg_fill = BLUE_ACTIVE;
102추가: style.visuals.widgets.active.weak_bg_fill = BLUE_ACTIVE;
103추가: }
104추가: ui.add_enabled(
105추가: enabled,
106추가: egui::Button::new(egui::RichText::new(text).strong().color(if primary {
107추가: PANEL
108추가: } else if text == "취소" {
109추가: ERROR
110추가: } else {
111추가: TEXT
112추가: }))
113추가: .min_size(egui::vec2(
114추가: if primary { 112.0 } else { 0.0 },
115추가: if primary { BUTTON } else { 36.0 },
116추가: ))
117추가: .stroke(Stroke::new(1.0, if primary { BLUE } else { BORDER })),
118추가: )
119추가: })
120추가: .inner;
121추가: focus(&response);
122추가: response
123추가: }
124추가:
125추가: pub fn panel(fill: Color32) -> egui::Frame {
126추가: egui::Frame::new()
127추가: .fill(fill)
128추가: .inner_margin(egui::Margin::same(PAD))
129추가: .corner_radius(8)
130추가: }
131추가:
132추가: #[derive(Clone, Copy)]
133추가: pub enum Icon {
134추가: File,
135추가: Folder,
136추가: Archive,
137추가: Lock,
138추가: Success,
139추가: Warning,
140추가: Error,
141추가: }
142추가:
143추가: pub fn icon(ui: &mut egui::Ui, kind: Icon, size: f32) {
144추가: let (rect, _) = ui.allocate_exact_size(egui::vec2(size, size), egui::Sense::hover());
145추가: let p = ui.painter();
146추가: let color = match kind {
147추가: Icon::Folder => FOLDER,
148추가: Icon::Archive => BLUE,
149추가: Icon::Lock | Icon::Warning => WARNING,
150추가: Icon::Success => SUCCESS,
151추가: Icon::Error => ERROR,
152추가: Icon::File => FILE,
153추가: };
154추가: let s = Stroke::new(if size > 32.0 { 2.5 } else { 1.5 }, color);
155추가: let point = |x, y| rect.min + egui::vec2(x * size, y * size);
156추가: let box_at = |x, y, w, h| egui::Rect::from_min_max(point(x, y), point(x + w, y + h));
157추가: match kind {
158추가: Icon::Folder => {
159추가: p.rect_filled(box_at(0.08, 0.22, 0.42, 0.22), 2, color);
160추가: p.rect_filled(box_at(0.08, 0.34, 0.84, 0.50), 2, color);
161추가: }
162추가: Icon::File | Icon::Archive => {
163추가: p.rect_stroke(
164추가: box_at(0.19, 0.08, 0.62, 0.84),
165추가: 2,
166추가: s,
167추가: egui::StrokeKind::Inside,
168추가: );
169추가: p.line_segment([point(0.60, 0.08), point(0.60, 0.30)], s);
170추가: p.line_segment([point(0.60, 0.30), point(0.81, 0.30)], s);
171추가: if matches!(kind, Icon::Archive) {
172추가: for y in [0.42, 0.57, 0.72] {
173추가: p.line_segment([point(0.39, y), point(0.59, y)], s);
174추가: }
175추가: }
176추가: }
177추가: Icon::Lock => {
178추가: p.circle_stroke(point(0.50, 0.35), size * 0.23, s);
179추가: p.rect_filled(box_at(0.18, 0.39, 0.64, 0.47), 2, color);
180추가: }
181추가: Icon::Success | Icon::Error => {
182추가: p.circle_stroke(rect.center(), size * 0.40, s);
183추가: if matches!(kind, Icon::Success) {
184추가: p.line_segment([point(0.28, 0.50), point(0.44, 0.66)], s);
185추가: p.line_segment([point(0.44, 0.66), point(0.74, 0.33)], s);
186추가: } else {
187추가: p.line_segment([point(0.34, 0.34), point(0.66, 0.66)], s);
188추가: p.line_segment([point(0.66, 0.34), point(0.34, 0.66)], s);
189추가: }
190추가: }
191추가: Icon::Warning => {
192추가: p.add(egui::Shape::closed_line(
193추가: vec![point(0.50, 0.08), point(0.94, 0.86), point(0.06, 0.86)],
194추가: s,
195추가: ));
196추가: p.line_segment([point(0.50, 0.32), point(0.50, 0.57)], s);
197추가: p.circle_filled(point(0.50, 0.73), size * 0.035, color);
198추가: }
199추가: }
200추가: }
201추가:
202추가: pub fn column_label(
203추가: ui: &mut egui::Ui,
204추가: text: impl Into<egui::WidgetText>,
205추가: width: f32,
206추가: align: egui::Align,
207추가: ) -> egui::Response {
208추가: let layout = if align == egui::Align::Max {
209추가: egui::Layout::right_to_left(egui::Align::Center)
210추가: } else {
211추가: egui::Layout::left_to_right(egui::Align::Center)
212추가: };
213추가: ui.allocate_ui_with_layout(egui::vec2(width, ROW), layout, |ui| {
214추가: ui.set_min_width(width);
215추가: ui.set_max_width(width);
216추가: ui.add(egui::Label::new(text).truncate())
217추가: })
218추가: .inner
219추가: }
220추가:
221추가: pub fn action_pair(
222추가: ui: &mut egui::Ui,
223추가: secondary: &str,
224추가: primary: Option<(&str, bool)>,
225추가: ) -> (bool, bool) {
226추가: let text_width = |text: &str| {
227추가: ui.painter()
228추가: .layout_no_wrap(text.into(), FontId::proportional(BODY), TEXT)
229추가: .size()
230추가: .x
231추가: };
232추가: let width = text_width(secondary)
233추가: + 32.0
234추가: + primary.map_or(0.0, |(label, _)| {
235추가: SPACE + (text_width(label) + 32.0).max(112.0)
236추가: });
237추가: ui.horizontal(|ui| {
238추가: ui.with_layout(egui::Layout::left_to_right(egui::Align::Center), |ui| {
239추가: ui.add_space((ui.available_width() - width).max(0.0));
240추가: let secondary = action(ui, secondary, false, true).clicked();
241추가: let primary = primary.is_some_and(|(label, enabled)| {
242추가: action(ui, label, true, enabled)
243추가: .on_disabled_hover_text(match label {
244추가: "만들기" => "묶을 파일이나 폴더를 추가하세요",
245추가: "다른 폴더에 풀기" => "기존 풀 위치 폴더를 먼저 확인하세요",
246추가: _ => "입력한 내용을 확인하세요",
247추가: })
248추가: .clicked()
249추가: });
250추가: (secondary, primary)
251추가: })
252추가: .inner
253추가: })
254추가: .inner
255추가: }
256추가:
257추가: pub fn indeterminate(ui: &mut egui::Ui) {
258추가: let (rect, response) = ui.allocate_exact_size(
259추가: egui::vec2(ui.available_width(), SPACE * 2.0),
260추가: egui::Sense::hover(),
261추가: );
262추가: ui.painter().rect_filled(rect, 8, BORDER);
263추가: let phase = if ui.style().animation_time > 0.0 {
264추가: ui.input(|i| (i.time * 0.6).fract()) as f32
265추가: } else {
266추가: 0.5
267추가: };
268추가: let width = (SPACE * 8.0).min(rect.width());
269추가: let pulse = egui::Rect::from_min_size(
270추가: rect.min + egui::vec2((rect.width() - width) * phase, 0.0),
271추가: egui::vec2(width, rect.height()),
272추가: );
273추가: ui.painter().rect_filled(pulse, 8, BLUE);
274추가: response.widget_info(|| {
275추가: egui::WidgetInfo::labeled(
276추가: egui::Role::ProgressIndicator,
277추가: ui.is_enabled(),
278추가: "전체 크기를 알 수 없는 작업 진행 중",
279추가: )
280추가: });
281추가: }
수정experiments/rust-ui-memory-app/src/archive_ui.rs+5-0
@@ -280,6 +280,11 @@ impl Model {
280280 pub fn busy(&self) -> bool {
281281 self.running.is_some()
282282 }
283추가: pub fn cancellation_requested(&self) -> bool {
284추가: self.running
285추가: .as_ref()
286추가: .is_some_and(|run| run.cancel_sequence.is_some())
287추가: }
283288 pub fn job_id(&self) -> Option<u64> {
284289 self.running.as_ref().map(|r| r.id)
285290 }
수정experiments/rust-ui-memory-app/src/desktop.rs+2-18
@@ -7,7 +7,7 @@ mod fake;
77mod renderer;
88#[path = "system_font.rs"]
99mod system_font;
10삭제: use eframe::egui::{self, Color32, FontData, FontDefinitions, FontFamily, FontId, TextStyle};
10추가: use eframe::egui::{self, FontData, FontDefinitions, FontFamily};
1111fn main() -> eframe::Result {
1212 let result = run();
1313 #[cfg(target_os = "windows")]
@@ -63,23 +63,7 @@ fn run() -> eframe::Result {
6363 .families
6464 .insert(FontFamily::Proportional, vec!["noto-kr".into()]);
6565 cc.egui_ctx.set_fonts(fonts);
66삭제: cc.egui_ctx.set_visuals(egui::Visuals::light());
67삭제: cc.egui_ctx.style_mut_of(egui::Theme::Light, |style| {
68삭제: style
69삭제: .text_styles
70삭제: .insert(TextStyle::Body, FontId::proportional(18.0));
71삭제: style
72삭제: .text_styles
73삭제: .insert(TextStyle::Button, FontId::proportional(18.0));
74삭제: style
75삭제: .text_styles
76삭제: .insert(TextStyle::Heading, FontId::proportional(26.0));
77삭제: style.visuals.panel_fill = Color32::WHITE;
78삭제: style.visuals.override_text_color = Some(Color32::from_rgb(24, 39, 57));
79삭제: style.visuals.selection.bg_fill = Color32::from_rgb(211, 230, 246);
80삭제: style.spacing.item_spacing = egui::vec2(12.0, 10.0);
81삭제: style.spacing.button_padding = egui::vec2(14.0, 10.0);
82삭제: });
66추가: zipelo_ui_memory_app::archive_theme::apply(&cc.egui_ctx);
8367 let (fixture, startup) = zipelo_ui_memory_app::archive_ui::launch_args(
8468 std::env::args_os().skip(1).collect(),
8569 std::env::current_dir()?,
수정experiments/rust-ui-memory-app/src/lib.rs+7-0
@@ -11,3 +11,10 @@ pub mod archive_ui;
1111pub mod archive_screen;
1212
1313pub mod archive_process;
14추가:
15추가: pub mod archive_present;
16추가:
17추가: #[cfg(feature = "ui")]
18추가: pub mod archive_picker;
19추가: #[cfg(feature = "ui")]
20추가: pub mod archive_theme;
수정tests/rust-app-real-worker/flows.rs+74-15
@@ -58,6 +58,7 @@ fn binary(name: &str) -> PathBuf {
5858#[derive(Default)]
5959struct Observation {
6060 jobs: Vec<Vec<&'static str>>,
61추가: starts: Vec<Start>,
6162}
6263struct ObservedFactory {
6364 process: ProcessFactory,
@@ -82,6 +83,9 @@ impl Factory for ObservedFactory {
8283}
8384impl Connection for ObservedConnection {
8485 fn send(&mut self, request: Request) -> Result<(), String> {
86추가: if let Command::Start(start) = &request.command {
87추가: self.observed.borrow_mut().starts.push(start.clone());
88추가: }
8589 self.connection.send(request)
8690 }
8791 fn poll(&mut self) -> Option<HostEvent> {
@@ -230,9 +234,17 @@ mod screen {
230234 let point = self.locate(label);
231235 self.click_at(point);
232236 }
233삭제: fn fill(&mut self, label: &str, offset: egui::Vec2, value: &Path) {
234삭제: let point = self.locate(label) + offset;
237추가: fn set_text(&mut self, id: &str, value: &str) {
238추가: self.render(vec![]);
239추가: let point = self
240추가: .context
241추가: .read_response(egui::Id::unique(id))
242추가: .unwrap()
243추가: .rect
244추가: .center();
235245 self.click_at(point);
246추가: self.context
247추가: .memory_mut(|memory| memory.request_focus(egui::Id::unique(id)));
236248 self.render(vec![
237249 egui::Event::Key {
238250 key: egui::Key::A,
@@ -241,9 +253,18 @@ mod screen {
241253 repeat: false,
242254 modifiers: egui::Modifiers::COMMAND,
243255 },
244삭제: egui::Event::Text(value.to_str().unwrap().to_string()),
256추가: egui::Event::Text(value.into()),
245257 ]);
246258 }
259추가: fn escape(&mut self) {
260추가: self.render(vec![egui::Event::Key {
261추가: key: egui::Key::Escape,
262추가: physical_key: None,
263추가: pressed: true,
264추가: repeat: false,
265추가: modifiers: egui::Modifiers::NONE,
266추가: }]);
267추가: }
247268 fn settle(&mut self) {
248269 let deadline = Instant::now() + Duration::from_secs(10);
249270 while self.app.model.busy() {
@@ -254,14 +275,12 @@ mod screen {
254275 completed(&self.app.model);
255276 }
256277 fn open(&mut self, archive: &Path) {
257삭제: self.click("파일 열기");
258삭제: self.fill("압축파일 절대 경로", egui::vec2(0.0, 22.0), archive);
259삭제: self.click("열기");
278추가: self.app.open_path(archive.to_path_buf());
260279 assert!(self.app.model.busy());
261280 self.settle();
262281 }
263282 fn extract(&mut self, destination: &Path) {
264삭제: self.fill("출력 폴더", egui::vec2(100.0, 0.0), destination);
283추가: self.app.choose_destination(destination.to_path_buf());
265284 self.click("풀기");
266285 assert!(self.app.model.busy());
267286 self.settle();
@@ -272,6 +291,7 @@ mod screen {
272291 }
273292 }
274293 include!("password_flows.rs");
294추가: include!("selection_flows.rs");
275295
276296 fn archive_flow(name: &str, format: Format) {
277297 let scratch = Scratch::new();
@@ -336,6 +356,49 @@ mod screen {
336356 fn targz_open_and_extract_via_actual_widgets_and_worker() {
337357 archive_flow("sample.tar.gz", Format::TarGzip);
338358 }
359추가:
360추가: #[test]
361추가: fn empty_directory_zip_extracts_successfully_with_existing_directory_reuse() {
362추가: let scratch = Scratch::new();
363추가: let source = make_directory(&scratch.path("empty-source"));
364추가: fs::create_dir(source.join("child")).unwrap();
365추가: let archive = scratch.path("empty-source.zip");
366추가: let output = make_directory(&scratch.path("output"));
367추가: let (factory, observed) = observed_factory();
368추가: let mut screen = Screen::new(factory);
369추가: screen.app.add_sources(vec![source]);
370추가: screen.render(vec![]);
371추가: screen.click("만들기");
372추가: screen.settle();
373추가: assert!(archive.is_file());
374추가: screen.open(&archive);
375추가: assert!(
376추가: screen
377추가: .app
378추가: .model
379추가: .entries
380추가: .iter()
381추가: .all(|entry| entry.kind == Kind::Directory)
382추가: );
383추가: for expected in [2, 0] {
384추가: screen.extract(&output);
385추가: assert!(output.join("empty-source/child").is_dir());
386추가: assert_eq!(
387추가: screen.app.model.terminal.as_ref().unwrap().created_count,
388추가: expected
389추가: );
390추가: let shown = screen.render(vec![]);
391추가: assert!(shown.iter().any(|(text, _)| text == "압축을 풀었습니다"));
392추가: assert!(
393추가: !shown
394추가: .iter()
395추가: .any(|(text, _)| text.contains("저장이 끝났는지"))
396추가: );
397추가: screen.click("확인");
398추가: }
399추가: assert_reaped(&observed);
400추가: }
401추가:
339402 #[test]
340403 fn create_zip_reopen_and_extract_via_actual_widgets_and_worker() {
341404 let scratch = Scratch::new();
@@ -345,14 +408,10 @@ mod screen {
345408 let output = make_directory(&scratch.path("output"));
346409 let (factory, observed) = observed_factory();
347410 let mut screen = Screen::new(factory);
348삭제: screen.click("ZIP 만들기");
349삭제: screen.fill(
350삭제: "원본 파일 절대 경로 / 한 줄에 하나",
351삭제: egui::vec2(0.0, 25.0),
352삭제: &source,
353삭제: );
354삭제: screen.fill("저장할 ZIP 절대 경로", egui::vec2(0.0, 22.0), &archive);
355삭제: screen.click("ZIP 만들기");
411추가: screen.app.add_sources(vec![source.clone()]);
412추가: screen.render(vec![]);
413추가: screen.set_text("zip-name", archive.file_name().unwrap().to_str().unwrap());
414추가: screen.click("만들기");
356415 assert!(screen.app.model.busy());
357416 screen.settle();
358417 assert!(archive.is_file());
수정tests/rust-app-real-worker/password_flows.rs+22-35
@@ -30,7 +30,7 @@ impl Screen {
3030 self.render(vec![]);
3131 let input = self
3232 .context
33삭제: .read_response(egui::Id::new("archive-password-input"))
33추가: .read_response(egui::Id::unique("archive-password-input"))
3434 .expect("암호 입력란이 없음")
3535 .rect
3636 .center();
@@ -48,10 +48,13 @@ impl Screen {
4848 if !text.is_empty() {
4949 assert!(!rendered.iter().any(|(value, _)| value.contains(text)));
5050 }
51삭제: self.click("암호 전달");
51추가: if self.app.model.challenge.is_some_and(|(_, _, encrypt)| encrypt) {
52추가: self.set_text("archive-password-confirm", text);
53추가: }
54추가: self.click("확인");
5255 }
5356 fn start_password_extract(&mut self, output: &Path) {
54삭제: self.fill("출력 폴더", egui::vec2(100.0, 0.0), output);
57추가: self.app.choose_destination(output.to_path_buf());
5558 self.click("풀기");
5659 assert!(self.app.model.busy());
5760 }
@@ -67,15 +70,11 @@ impl Screen {
6770 assert!(self.app.model.challenge.is_none());
6871 }
6972 fn start_encrypted_zip(&mut self, source: &Path, archive: &Path) {
70삭제: self.click("ZIP 만들기");
71삭제: self.fill(
72삭제: "원본 파일 절대 경로 / 한 줄에 하나",
73삭제: egui::vec2(0.0, 25.0),
74삭제: source,
75삭제: );
76삭제: self.fill("저장할 ZIP 절대 경로", egui::vec2(0.0, 22.0), archive);
77삭제: self.click("암호로 보호");
78삭제: self.click("ZIP 만들기");
73추가: self.app.add_sources(vec![source.to_path_buf()]);
74추가: self.render(vec![]);
75추가: self.set_text("zip-name", archive.file_name().unwrap().to_str().unwrap());
76추가: self.click("암호로 보호하기");
77추가: self.click("만들기");
7978 assert!(self.app.model.busy(), "{}", self.app.model.status());
8079 }
8180}
@@ -131,17 +130,9 @@ fn wrong_password_retry_clears_input_and_succeeds_without_partial_output() {
131130 .iter()
132131 .any(|(value, _)| value == "암호가 맞지 않습니다. 다시 입력하세요")
133132 );
134삭제: screen.click("암호 전달");
133추가: screen.click("확인");
135134 assert_eq!(screen.app.model.challenge, Some((second, 2, false)));
136삭제: assert!(
137삭제: screen
138삭제: .app
139삭제: .model
140삭제: .input_error
141삭제: .as_ref()
142삭제: .unwrap()
143삭제: .contains("1~1024바이트")
144삭제: );
135추가: assert!(screen.app.model.input_error.is_none());
145136 screen.render(vec![]);
146137 screen.password_answer(FIXTURE_PASSWORD);
147138 screen.finish_password_job(Outcome::Completed);
@@ -181,7 +172,7 @@ fn cancel_password_extraction_waits_for_cleanup_without_writes() {
181172 screen.open(&archive);
182173 screen.start_password_extract(&output);
183174 screen.password_request(1, false);
184삭제: screen.click("작업 취소");
175추가: screen.escape();
185176 screen.app.model.request_close();
186177 screen.app.model.confirm_close();
187178 assert!(matches!(
@@ -234,7 +225,7 @@ fn cancel_password_creation_does_not_create_an_archive() {
234225 let mut screen = Screen::new(factory);
235226 screen.start_encrypted_zip(&source, &archive);
236227 screen.password_request(1, true);
237삭제: screen.click("작업 취소");
228추가: screen.escape();
238229 screen.finish_password_job(Outcome::Cancelled);
239230 assert!(!archive.exists());
240231 assert_eq!(fs::read(source).unwrap(), b"preserve");
@@ -254,15 +245,7 @@ fn oversized_utf8_password_stays_in_dialog_then_accepts_valid_input() {
254245 let id = screen.password_request(1, false);
255246 screen.password_answer(&"가".repeat(342));
256247 assert_eq!(screen.app.model.challenge, Some((id, 1, false)));
257삭제: assert!(
258삭제: screen
259삭제: .app
260삭제: .model
261삭제: .input_error
262삭제: .as_ref()
263삭제: .unwrap()
264삭제: .contains("1~1024바이트")
265삭제: );
248추가: assert!(screen.render(vec![]).iter().any(|(text, _)| text.contains("1~1024바이트")));
266249 assert_eq!(fs::read_dir(&output).unwrap().count(), 0);
267250 screen.password_answer(FIXTURE_PASSWORD);
268251 screen.finish_password_job(Outcome::Completed);
@@ -280,14 +263,18 @@ fn invalid_password_then_cancel(invalid: &str, close: bool) {
280263 let challenge = screen.password_request(1, true);
281264 screen.password_answer(invalid);
282265 assert_eq!(screen.app.model.challenge, Some((challenge, 1, true)));
283삭제: assert!(screen.app.model.status().contains("1~1024바이트"));
266추가: if invalid.is_empty() {
267추가: assert!(screen.app.model.input_error.is_none());
268추가: } else {
269추가: assert!(screen.render(vec![]).iter().any(|(text, _)| text.contains("1~1024바이트")));
270추가: }
284271 if close {
285272 screen.app.model.request_close();
286273 screen.app.model.confirm_close();
287274 assert_eq!(screen.app.model.close, Close::Waiting);
288275 assert!(!screen.app.model.confirmed);
289276 } else {
290삭제: screen.click("작업 취소");
277추가: screen.escape();
291278 }
292279 screen.finish_password_job(Outcome::Cancelled);
293280 assert_eq!(screen.app.model.status(), "작업 취소됨");
추가tests/rust-app-real-worker/selection_flows.rs+218-0
@@ -0,0 +1,218 @@
1추가: #[test]
2추가: fn extraction_completion_matches_actual_worker_selection_matrix() {
3추가: use std::collections::BTreeSet;
4추가:
5추가: fn contents(root: &Path) -> BTreeSet<String> {
6추가: fn visit(root: &Path, current: &Path, found: &mut BTreeSet<String>) {
7추가: for entry in fs::read_dir(current).unwrap() {
8추가: let path = entry.unwrap().path();
9추가: found.insert(
10추가: path.strip_prefix(root)
11추가: .unwrap()
12추가: .to_str()
13추가: .unwrap()
14추가: .replace('\\', "/"),
15추가: );
16추가: if path.is_dir() {
17추가: visit(root, &path, found);
18추가: }
19추가: }
20추가: }
21추가: let mut found = BTreeSet::new();
22추가: visit(root, root, &mut found);
23추가: found
24추가: }
25추가:
26추가: let scratch = Scratch::new();
27추가: let docs = make_directory(&scratch.path("docs"));
28추가: fs::create_dir(docs.join("empty")).unwrap();
29추가: fs::create_dir(docs.join("nested")).unwrap();
30추가: fs::write(docs.join("nested/one.txt"), b"nested content").unwrap();
31추가: let root_file = scratch.path("root.txt");
32추가: fs::write(&root_file, b"root content").unwrap();
33추가: let archive = scratch.path("selection.zip");
34추가: let (factory, observed) = observed_factory();
35추가: let mut screen = Screen::new(factory);
36추가: screen.app.add_sources(vec![docs, root_file]);
37추가: screen.render(vec![]);
38추가: screen.set_text("zip-name", "selection.zip");
39추가: screen.click("만들기");
40추가: screen.settle();
41추가:
42추가: let cases: [(&str, Option<&[&str]>, &[&str]); 6] = [
43추가: (
44추가: "all",
45추가: None,
46추가: &[
47추가: "docs",
48추가: "docs/empty",
49추가: "docs/nested",
50추가: "docs/nested/one.txt",
51추가: "root.txt",
52추가: ],
53추가: ),
54추가: (
55추가: "files",
56추가: Some(&["docs/nested/one.txt", "root.txt"]),
57추가: &["docs", "docs/nested", "docs/nested/one.txt", "root.txt"],
58추가: ),
59추가: ("directory", Some(&["docs"]), &["docs"]),
60추가: (
61추가: "mixed",
62추가: Some(&["docs", "docs/nested/one.txt"]),
63추가: &["docs", "docs/nested", "docs/nested/one.txt"],
64추가: ),
65추가: ("empty", Some(&["docs/empty"]), &["docs", "docs/empty"]),
66추가: (
67추가: "nested-directory",
68추가: Some(&["docs/nested"]),
69추가: &["docs", "docs/nested"],
70추가: ),
71추가: ];
72추가: for (name, selected, expected) in cases {
73추가: screen.open(&archive);
74추가: let ids = selected.map(|names| {
75추가: names
76추가: .iter()
77추가: .map(|name| {
78추가: screen
79추가: .app
80추가: .model
81추가: .entries
82추가: .iter()
83추가: .find(|entry| entry.name.trim_end_matches('/') == *name)
84추가: .unwrap_or_else(|| panic!("목록 항목 누락: {name}"))
85추가: .id
86추가: })
87추가: .collect::<BTreeSet<_>>()
88추가: });
89추가: if let Some(ids) = &ids {
90추가: screen.app.model.selected = ids.clone();
91추가: screen.click("선택한 항목만 풀기");
92추가: }
93추가: let output = make_directory(&scratch.path(name));
94추가: screen.extract(&output);
95추가: let terminal = screen.app.model.terminal.as_ref().unwrap();
96추가: assert_eq!(terminal.outcome, Outcome::Completed, "{name}");
97추가: assert!(screen.app.model.confirmed, "{name}");
98추가: assert!(terminal.error.is_none(), "{name}");
99추가: let expected = expected
100추가: .iter()
101추가: .map(|name| name.to_string())
102추가: .collect::<BTreeSet<_>>();
103추가: assert_eq!(contents(&output), expected, "{name}");
104추가: let reports = screen
105추가: .app
106추가: .model
107추가: .outputs
108추가: .iter()
109추가: .map(|(name, disposition)| {
110추가: assert_eq!(*disposition, Disposition::Created);
111추가: name.clone()
112추가: })
113추가: .collect::<BTreeSet<_>>();
114추가: assert_eq!(reports, expected, "{name}");
115추가: assert_eq!(terminal.created_count as usize, expected.len(), "{name}");
116추가: for (path, bytes) in [
117추가: ("docs/nested/one.txt", b"nested content".as_slice()),
118추가: ("root.txt", b"root content".as_slice()),
119추가: ] {
120추가: if expected.contains(path) {
121추가: assert_eq!(fs::read(output.join(path)).unwrap(), bytes, "{name}");
122추가: }
123추가: }
124추가: match observed.borrow().starts.last().unwrap() {
125추가: Start::Extract { selection, .. } => match (selection, &ids) {
126추가: (Selection::All, None) => {}
127추가: (Selection::EntryIds(actual), Some(ids)) => {
128추가: assert_eq!(actual, &ids.iter().copied().collect::<Vec<_>>(), "{name}");
129추가: }
130추가: _ => panic!("요청 선택 범위 불일치: {name}"),
131추가: },
132추가: _ => panic!("추출 요청 누락: {name}"),
133추가: }
134추가: let shown = screen.render(vec![]);
135추가: assert!(
136추가: shown.iter().any(|(text, _)| text == "압축을 풀었습니다"),
137추가: "{name}: {shown:?}"
138추가: );
139추가: assert!(
140추가: !shown
141추가: .iter()
142추가: .any(|(text, _)| text.contains("저장이 끝났는지") || text.contains("일부 파일만")),
143추가: "{name}"
144추가: );
145추가: screen.click("확인");
146추가: }
147추가: assert_reaped(&observed);
148추가: }
149추가:
150추가: #[cfg(unix)]
151추가: #[test]
152추가: fn auto_destination_is_private_under_desktop_umask() {
153추가: use std::{os::unix::fs::PermissionsExt, process::Command};
154추가:
155추가: const CHILD: &str = "ZIPELO_PRIVATE_DESTINATION_CHILD";
156추가: if std::env::var_os(CHILD).is_none() {
157추가: let output = Command::new("sh")
158추가: .args([
159추가: "-c",
160추가: "umask 0002; exec \"$@\"",
161추가: "zipelo-private-destination",
162추가: ])
163추가: .arg(std::env::current_exe().unwrap())
164추가: .args([
165추가: "--exact",
166추가: "screen::auto_destination_is_private_under_desktop_umask",
167추가: "--nocapture",
168추가: ])
169추가: .env(CHILD, "1")
170추가: .output()
171추가: .unwrap();
172추가: assert!(
173추가: output.status.success(),
174추가: "umask 0002 추출 회귀 실패: {}{}",
175추가: String::from_utf8_lossy(&output.stdout),
176추가: String::from_utf8_lossy(&output.stderr)
177추가: );
178추가: return;
179추가: }
180추가:
181추가: let mask = Command::new("sh").args(["-c", "umask"]).output().unwrap();
182추가: assert_eq!(String::from_utf8(mask.stdout).unwrap().trim(), "0002");
183추가: let scratch = Scratch::new();
184추가: let archive = scratch.path("sample.zip");
185추가: fs::copy(
186추가: Path::new(env!("CARGO_MANIFEST_DIR"))
187추가: .join("../../tests/rust-app-real-worker/fixtures/sample.zip"),
188추가: &archive,
189추가: )
190추가: .unwrap();
191추가: let output = scratch.path("sample");
192추가: assert!(!output.exists());
193추가: let (factory, observed) = observed_factory();
194추가: let mut screen = Screen::new(factory);
195추가: screen.open(&archive);
196추가: screen.click("풀기");
197추가: assert!(screen.app.model.busy());
198추가: screen.settle();
199추가: assert_eq!(
200추가: fs::metadata(&output).unwrap().permissions().mode() & 0o777,
201추가: 0o700
202추가: );
203추가: assert_eq!(
204추가: fs::read(output.join("content.txt")).unwrap(),
205추가: b"Zipelo real worker flow\n"
206추가: );
207추가: assert_eq!(
208추가: screen.app.model.terminal.as_ref().unwrap().publication,
209추가: Publication::Complete
210추가: );
211추가: assert!(
212추가: screen
213추가: .render(vec![])
214추가: .iter()
215추가: .any(|(text, _)| text == "압축을 풀었습니다")
216추가: );
217추가: assert_reaped(&observed);
218추가: }
추가tests/rust-app-ui/capture.rs+335-0
@@ -0,0 +1,335 @@
1추가: use eframe::egui::{self, FontData, FontDefinitions, FontFamily, FontId, TextStyle};
2추가: use std::{collections::VecDeque, path::PathBuf};
3추가: use zipelo_ui_memory_app::{archive_screen::ArchiveApp, archive_ui::*};
4추가: #[path = "../../experiments/rust-ui-memory-app/src/renderer.rs"]
5추가: mod renderer;
6추가: #[path = "../../experiments/rust-ui-memory-app/src/system_font.rs"]
7추가: mod system_font;
8추가:
9추가: #[derive(Clone)]
10추가: struct CaptureFactory {
11추가: mode: String,
12추가: }
13추가: struct CaptureConnection {
14추가: job: u64,
15추가: sequence: u64,
16추가: mode: String,
17추가: queue: VecDeque<HostEvent>,
18추가: create_name: Option<String>,
19추가: }
20추가: impl CaptureConnection {
21추가: fn event(&mut self, event: Event) {
22추가: self.queue.push_back(HostEvent::Frame {
23추가: job_id: self.job,
24추가: sequence: self.sequence,
25추가: event,
26추가: });
27추가: self.sequence += 1;
28추가: }
29추가: fn terminal(&mut self, terminal: Terminal) {
30추가: self.event(Event::Terminal(terminal));
31추가: self.queue.extend([
32추가: HostEvent::StdoutEof,
33추가: HostEvent::StderrEof,
34추가: HostEvent::Exited { success: true },
35추가: ]);
36추가: }
37추가: fn finish(&mut self, listing: bool) {
38추가: let error = !listing && self.mode == "error";
39추가: let cancelled = !listing && self.mode == "cancelled";
40추가: let mut count = 0;
41추가: if !listing && !error && !cancelled {
42추가: let names = self
43추가: .create_name
44추가: .clone()
45추가: .map(|name| vec![name])
46추가: .unwrap_or_else(|| {
47추가: vec![
48추가: "읽어주세요.txt".into(),
49추가: "여행 일정.pdf".into(),
50추가: "사진".into(),
51추가: ]
52추가: });
53추가: for name in names {
54추가: self.event(Event::Output {
55추가: entry_id: None,
56추가: relative_name: name,
57추가: disposition: Disposition::Created,
58추가: });
59추가: count += 1;
60추가: }
61추가: }
62추가: self.terminal(Terminal {
63추가: outcome: if error {
64추가: Outcome::Failed
65추가: } else if cancelled {
66추가: Outcome::Cancelled
67추가: } else {
68추가: Outcome::Completed
69추가: },
70추가: error: error.then_some(ErrorCode::DiskFull),
71추가: publication: if listing || error || cancelled {
72추가: Publication::None
73추가: } else {
74추가: Publication::Complete
75추가: },
76추가: created_count: count,
77추가: retained_partial_count: 0,
78추가: durability: if listing {
79추가: Durability::NotApplicable
80추가: } else {
81추가: Durability::Synced
82추가: },
83추가: cleanup: Cleanup::Complete,
84추가: });
85추가: }
86추가: }
87추가: fn entries() -> Vec<Entry> {
88추가: vec![
89추가: Entry {
90추가: id: 0,
91추가: name: "읽어주세요.txt".into(),
92추가: kind: Kind::File,
93추가: bytes: Some(4096),
94추가: packed: Some(1800),
95추가: encrypted: false,
96추가: },
97추가: Entry {
98추가: id: 1,
99추가: name: "여행 일정.pdf".into(),
100추가: kind: Kind::File,
101추가: bytes: Some(1_287_952),
102추가: packed: Some(900_000),
103추가: encrypted: true,
104추가: },
105추가: Entry {
106추가: id: 2,
107추가: name: "사진".into(),
108추가: kind: Kind::Directory,
109추가: bytes: Some(0),
110추가: packed: None,
111추가: encrypted: false,
112추가: },
113추가: ]
114추가: }
115추가: impl Factory for CaptureFactory {
116추가: fn connect(&mut self, job: u64) -> Result<Box<dyn Connection>, String> {
117추가: Ok(Box::new(CaptureConnection {
118추가: job,
119추가: sequence: 0,
120추가: mode: self.mode.clone(),
121추가: queue: VecDeque::new(),
122추가: create_name: None,
123추가: }))
124추가: }
125추가: }
126추가: impl Connection for CaptureConnection {
127추가: fn send(&mut self, request: Request) -> Result<(), String> {
128추가: match request.command {
129추가: Command::Start(start) => {
130추가: self.event(Event::Accepted { encryption: true });
131추가: match start {
132추가: Start::List { .. } => {
133추가: for entry in entries() {
134추가: self.event(Event::Entry(entry));
135추가: }
136추가: self.event(Event::ListEnd {
137추가: entry_count: 3,
138추가: list_id: ListId {
139추가: catalog_version: 1,
140추가: format: Format::Zip,
141추가: source_object: SourceObject::Unix {
142추가: device: 1,
143추가: inode: 1,
144추가: },
145추가: archive_bytes: 902000,
146추가: archive_sha256: [7; 32],
147추가: },
148추가: });
149추가: self.finish(true);
150추가: }
151추가: Start::Extract { .. } => {
152추가: if self.mode.starts_with("password") {
153추가: self.event(Event::PasswordRequired {
154추가: challenge_id: 17,
155추가: attempt: if self.mode == "password-retry" { 2 } else { 1 },
156추가: encrypt: false,
157추가: });
158추가: } else if self.mode.starts_with("progress") || self.mode == "cancelling" {
159추가: self.event(Event::Progress {
160추가: stage: Stage::Decode,
161추가: processed: 38 << 20,
162추가: total: (self.mode != "progress-unknown").then_some(61 << 20),
163추가: completed_entries: 12,
164추가: });
165추가: } else {
166추가: self.finish(false);
167추가: }
168추가: }
169추가: Start::CreateZip {
170추가: output_file,
171추가: aes256,
172추가: ..
173추가: } => {
174추가: self.create_name =
175추가: Some(output_file.file_name().unwrap().to_string_lossy().into());
176추가: if aes256 {
177추가: self.event(Event::PasswordRequired {
178추가: challenge_id: 17,
179추가: attempt: 1,
180추가: encrypt: true,
181추가: });
182추가: } else {
183추가: self.finish(false);
184추가: }
185추가: }
186추가: }
187추가: }
188추가: Command::Password { .. } => self.finish(false),
189추가: Command::Cancel => {
190추가: self.event(Event::CancelAck {
191추가: request_sequence: request.sequence,
192추가: status: CancelStatus::Requested,
193추가: });
194추가: if self.mode != "cancelling" {
195추가: self.terminal(Terminal {
196추가: outcome: Outcome::Cancelled,
197추가: error: None,
198추가: publication: Publication::None,
199추가: created_count: 0,
200추가: retained_partial_count: 0,
201추가: durability: Durability::NotApplicable,
202추가: cleanup: Cleanup::Complete,
203추가: });
204추가: }
205추가: }
206추가: }
207추가: Ok(())
208추가: }
209추가: fn poll(&mut self) -> Option<HostEvent> {
210추가: self.queue.pop_front()
211추가: }
212추가: }
213추가: struct Capture {
214추가: app: ArchiveApp,
215추가: mode: String,
216추가: factory: CaptureFactory,
217추가: triggered: bool,
218추가: }
219추가: impl eframe::App for Capture {
220추가: fn ui(&mut self, root: &mut egui::Ui, _: &mut eframe::Frame) {
221추가: if self.mode == "hover" {
222추가: root.ctx().input_mut(|i| {
223추가: i.raw.hovered_files = vec![egui::HoveredFile {
224추가: path: Some(PathBuf::from("여행.zip")),
225추가: ..Default::default()
226추가: }]
227추가: });
228추가: }
229추가: if !self.triggered && self.app.model.list_id.is_some() {
230추가: self.triggered = true;
231추가: if [
232추가: "password",
233추가: "password-retry",
234추가: "password-create",
235추가: "progress",
236추가: "progress-unknown",
237추가: "cancelling",
238추가: "success",
239추가: "error",
240추가: "cancelled",
241추가: ]
242추가: .contains(&self.mode.as_str())
243추가: {
244추가: let archive = self.app.model.archive.clone().unwrap();
245추가: let start = if self.mode == "password-create" {
246추가: Start::CreateZip {
247추가: sources: vec![(archive.clone(), "자료".into())],
248추가: output_file: archive.with_file_name("보호한 자료.zip"),
249추가: method: Method::Deflate,
250추가: aes256: true,
251추가: }
252추가: } else {
253추가: Start::Extract {
254추가: archive,
255추가: destination: std::env::current_dir().unwrap(),
256추가: selection: Selection::All,
257추가: list_id: self.app.model.list_id.clone().unwrap(),
258추가: gzip_output_name: None,
259추가: }
260추가: };
261추가: // 이전 화면과 같은 공개 상태 API로 암호 및 진행 상태를 재현함.
262추가: if self.mode == "password-create" {
263추가: self.app.model.begin(start, &mut self.factory);
264추가: } else {
265추가: self.app.begin_extract();
266추가: }
267추가: }
268추가: }
269추가: self.app.show(root);
270추가: root.ctx()
271추가: .request_repaint_after(std::time::Duration::from_millis(30));
272추가: }
273추가: }
274추가: fn main() -> eframe::Result {
275추가: let mode = std::env::args().nth(1).unwrap_or_else(|| "empty".into());
276추가: let base = std::env::current_dir()
277추가: .unwrap()
278추가: .join("tests/ui-redesign/runs/fixtures");
279추가: std::fs::create_dir_all(&base).unwrap();
280추가: std::fs::write(base.join("읽어주세요.txt"), "화면 검증 입력").unwrap();
281추가: std::fs::create_dir_all(base.join("사진")).unwrap();
282추가: let font = system_font::load().map_err(|e| eframe::Error::AppCreation(Box::new(e)))?;
283추가: let title = format!("Zipelo UI capture {mode}");
284추가: renderer::run_native(
285추가: &title,
286추가: eframe::NativeOptions {
287추가: viewport: egui::ViewportBuilder::default()
288추가: .with_inner_size([1060.0, 720.0])
289추가: .with_min_inner_size([760.0, 540.0]),
290추가: ..Default::default()
291추가: },
292추가: || {
293추가: let mode = mode.clone();
294추가: let base = base.clone();
295추가: let bytes = font.bytes.clone();
296추가: let face_index = font.face_index;
297추가: Box::new(move |cc| {
298추가: let mut fonts = FontDefinitions::empty();
299추가: let mut data = FontData::from_owned(bytes.clone());
300추가: data.index = face_index;
301추가: fonts.font_data.insert("noto-kr".into(), data.into());
302추가: fonts
303추가: .families
304추가: .insert(FontFamily::Proportional, vec!["noto-kr".into()]);
305추가: cc.egui_ctx.set_fonts(fonts);
306추가: cc.egui_ctx.set_visuals(egui::Visuals::light());
307추가: cc.egui_ctx.style_mut_of(egui::Theme::Light, |style| {
308추가: style
309추가: .text_styles
310추가: .insert(TextStyle::Body, FontId::proportional(18.0));
311추가: style
312추가: .text_styles
313추가: .insert(TextStyle::Button, FontId::proportional(18.0));
314추가: style
315추가: .text_styles
316추가: .insert(TextStyle::Heading, FontId::proportional(26.0));
317추가: });
318추가: let factory = CaptureFactory { mode: mode.clone() };
319추가: let startup = (!["empty", "hover", "create", "create-filled"]
320추가: .contains(&mode.as_str()))
321추가: .then(|| base.join("여행.zip"));
322추가: let mut app = ArchiveApp::new(Box::new(factory.clone()), startup, true);
323추가: if mode == "create-filled" {
324추가: app.add_sources(vec![base.join("읽어주세요.txt"), base.join("사진")]);
325추가: }
326추가: Ok(Box::new(Capture {
327추가: app,
328추가: mode,
329추가: factory,
330추가: triggered: false,
331추가: }))
332추가: })
333추가: },
334추가: )
335추가: }
추가tests/rust-app-ui/presentation.rs

Diff가 표시 한도를 넘어서 생략했어요.

Raw로 열기
수정tests/rust-app-ui/regressions.rs+26-22
@@ -413,7 +413,7 @@ fn renders_every_flow_with_actual_egui_widgets() {
413413 1060.0,
414414 );
415415 let create = render(&mut app, vec![], 1060.0);
416삭제: assert!(create.iter().any(|(t, _)| t == "저장할 ZIP 절대 경로"));
416추가: assert!(create.iter().any(|(t, _)| t == "2. 저장 위치"));
417417 let mut app = ArchiveApp::new(Box::new(f.clone()), Some(path("locked.zip")), true);
418418 for _ in 0..8 {
419419 app.model.poll();
@@ -422,7 +422,7 @@ fn renders_every_flow_with_actual_egui_widgets() {
422422 render(&mut app, vec![], width);
423423 render(&mut app, vec![], width);
424424 let password = render(&mut app, vec![], width);
425삭제: assert!(password.iter().any(|(t, _)| t.contains("암호 전달")));
425추가: assert!(password.iter().any(|(t, _)| t == "암호가 필요합니다"));
426426 }
427427 assert!(app.model.password("synthetic secret".into()));
428428 pump(&mut app.model);
@@ -644,29 +644,31 @@ fn extract_button_sends_gzip_name_only_for_raw_gzip() {
644644 }],
645645 );
646646 };
647추가: let scratch = presentation::Folder::new();
648추가: app.choose_destination(scratch.0.clone());
647649 render(&mut app, vec![]);
648삭제: let texts = render(&mut app, vec![]);
649삭제: let folder = texts
650삭제: .iter()
651삭제: .find(|(text, _)| text == "출력 폴더")
652삭제: .unwrap()
653삭제: .1;
654삭제: click(&mut app, folder + egui::vec2(100.0, 0.0));
655삭제: render(
656삭제: &mut app,
657삭제: vec![egui::Event::Text(
658삭제: path("button-output").to_string_lossy().into_owned(),
659삭제: )],
660삭제: );
661650 if format == Format::Gzip {
662삭제: let texts = render(&mut app, vec![]);
663삭제: let name = texts
664삭제: .iter()
665삭제: .find(|(text, _)| text == "출력 파일명")
651추가: render(&mut app, vec![]);
652추가: let input = ctx
653추가: .read_response(egui::Id::unique("gzip-name"))
666654 .unwrap()
667삭제: .1;
668삭제: click(&mut app, name + egui::vec2(100.0, 0.0));
669삭제: render(&mut app, vec![egui::Event::Text("plain.txt".into())]);
655추가: .rect
656추가: .center();
657추가: click(&mut app, input);
658추가: ctx.memory_mut(|memory| memory.request_focus(egui::Id::unique("gzip-name")));
659추가: render(
660추가: &mut app,
661추가: vec![
662추가: egui::Event::Key {
663추가: key: egui::Key::A,
664추가: physical_key: None,
665추가: pressed: true,
666추가: repeat: false,
667추가: modifiers: egui::Modifiers::COMMAND,
668추가: },
669추가: egui::Event::Text("plain.txt".into()),
670추가: ],
671추가: );
670672 }
671673 let texts = render(&mut app, vec![]);
672674 let button = texts.iter().find(|(text, _)| text == "풀기").unwrap().1;
@@ -846,3 +848,5 @@ fn password_validation_and_retry_do_not_erase_transport_failure() {
846848 assert_eq!(model.error.as_deref(), Some("pipe error"));
847849 assert!(!model.confirmed);
848850}
851추가:
852추가: mod presentation;
추가tests/ui-redesign/README.md+56-0
@@ -0,0 +1,56 @@
1추가: # Zipelo 화면 회귀 확인
2추가:
3추가: 설계 기준은 docs/ui-design-v0.1.md의 수용 기준 23개이며, 비교 기준 커밋은 b10c7eedddd202f83766aa8f001142cdfdb4097c임.
4추가:
5추가: ## 기능 시험
6추가:
7추가: 프로젝트 루트에서 실행함.
8추가:
9추가: ```sh
10추가: python3 tests/ci/run_rust.py local
11추가: ```
12추가:
13추가: tests/rust-app-ui/presentation.rs에서 결과 안내, 오류 문구, 폴더 생성과 정리, 선택창, 암호 확인, 키보드 입력과 최소 크기를 검증함. tests/rust-app-real-worker/flows.rs와 password_flows.rs는 실제 작업자를 사용해 파일 생성과 재해제, 암호 재입력 및 취소 후 파일 보존을 검증함.
14추가:
15추가: ## 전후 화면 재현
16추가:
17추가: Linux의 Xvfb, xdotool, ImageMagick import와 시스템 CJK 글꼴이 필요함. 제품 의존성은 추가하지 않음. 실행 파일 준비는 로컬 Git 객체와 기존 Cargo 오프라인 캐시를 사용함. 기존 산출물은 지우지 않으며 새 output 폴더를 지정함.
18추가:
19추가: ```sh
20추가: python3 tests/ui-redesign/prepare.py --output tests/ui-redesign/runs/reproduce --target-dir tests/ui-redesign/runs/target
21추가: python3 tests/ui-redesign/capture.py --binary tests/ui-redesign/runs/reproduce/before-capture --variant before
22추가: python3 tests/ui-redesign/capture.py --binary tests/ui-redesign/runs/reproduce/after-capture --variant after
23추가: python3 tests/ui-redesign/capture.py --binary tests/ui-redesign/runs/reproduce/after-capture --variant after --width 760 --height 540 --output tests/ui-redesign/screenshots/minimum
24추가: ```
25추가:
26추가: 촬영기는 전용 Xvfb를 만들고 X11을 지정하며 종료 시 자신이 만든 창과 서버만 종료함. 결과는 screenshots/before, screenshots/after, screenshots/minimum에 저장함. 15개 상태를 각각 촬영하며 capture.json에 크기와 경로를 기록함.
27추가:
28추가: 촬영 화면은 tests/rust-app-ui/capture.rs의 합성 입력임. 글꼴과 eframe 렌더러 및 실제 화면 컴포넌트를 사용하고 "화면 시험 모드"를 표시함. 암호 불일치 화면에는 고정된 시험 문자열만 입력함. 합성 작업자는 실제 압축 파일을 읽거나 결과 파일을 저장하지 않으며, 기본 풀 위치 생성은 tests/ui-redesign/runs/fixtures 아래에서 확인함. 실제 파일 작업 검증은 별도의 real_worker 시험 결과와 구분함.
29추가:
30추가: 기준 화면 준비 시 같은 촬영 도우미를 기준 커밋 소스에 넣고, 새 화면 전용 메서드 두 곳만 기존 공개 모델 호출로 바꿈. 기준 제품 소스는 바꾸지 않음. --states 옵션으로 일부 상태만 다시 촬영할 수 있으며 다른 상태의 기록은 보존함.
31추가:
32추가: 최소 크기에서 ZIP 만들기 본문은 내부 스크롤로 모든 설정에 접근함. 주 버튼과 취소 버튼은 본문 스크롤 밖에 고정함. 폴더 열기는 셸 없이 운영체제 명령에 경로 하나를 인자로 전달하며, 특수 문자가 있는 경로도 시험함. Windows 실제 화면과 운영체제 파일 탐색기 실행 확인은 이 Linux 촬영 기록에 포함하지 않음.
33추가:
34추가: 실제 X11 창에서 파일 이름을 눌러 행 선택을 확인하는 별도 검증임.
35추가:
36추가: ```sh
37추가: python3 tests/ui-redesign/check_row_selection.py --binary tests/ui-redesign/runs/reproduce/after-capture
38추가: ```
39추가:
40추가: validation.json에는 실행한 소스 트리, local 결과와 화면 해시를 기록함. 기록 파일과 이 설명의 추가는 시험 후 문서 변경임. 대용량 작업자 시험은 원본 스냅샷과 임시 공간을 함께 확인하므로 실행 파일 시스템에 최소 12GB 이상의 여유 공간이 필요하며 빌드 캐시 공간은 별도임.
41추가:
42추가: PR85 리뷰 회귀는 presentation.rs의 keyboard_file_pickers_enter_child_before_confirming_file, keyboard_folder_pickers_navigate_before_explicit_folder_confirmation, changed_zip_sources_retry_creation_with_or_without_open_archive에서 확인함. 폴더 행의 Tab 및 Enter 탐색은 6개 선택 모드에서, ZIP 원본 변경 뒤 생성 재시도는 기존 압축파일 유무 두 경우에서 검증함.
43추가:
44추가: ZIP 만들기의 취소 우선 처리는 keyboard_cancel_and_escape_never_start_zip_creation과 zip_creation_enter_only_activates_focused_make_button에서 검증함. Tab으로 취소와 만들기 버튼에 초점을 옮긴 뒤 Enter를 누르며, Esc와 이름 입력칸의 Enter가 생성 요청을 보내지 않는지도 확인함.
45추가:
46추가: Enter는 egui 버튼의 초점 활성화만 사용하며 암호 입력란의 제출만 예외임. secondary_button_enter_matrix_never_starts_creation_or_extraction은 기본 화면, 생성 창, 결과, 진행, 종료 확인과 선택창의 탐색 버튼을 한 번에 검증함. password_secondary_enter_does_not_submit_valid_input은 유효한 암호가 있어도 보기, 숨기기와 취소 버튼이 제출하지 않음을 검증함.
47추가:
48추가: 폴더 생성 보고는 추출 시작 시 기록한 파일 대상과 예상 폴더 및 상위 폴더로 구분함. 빈 폴더만 있는 ZIP은 실제 작업자로 만들고 새 폴더 추출과 기존 폴더 재사용 모두 성공 표시를 확인함. 파일 저장 누락, 알 수 없는 생성 보고와 저장 불확실 결과의 경고는 유지함.
49추가:
50추가: 선택 추출의 완료 대상은 실제 요청에 보낸 Selection에서 계산함. 폴더 선택이 하위 파일을 자동 포함하지 않으며, 선택한 항목의 상위 폴더 생성은 허용함. selection_flows.rs의 extraction_completion_matches_actual_worker_selection_matrix는 전체, 파일만, 폴더만, 혼합, 빈 폴더와 중첩 폴더 선택 6가지를 실제 작업자로 검증함. 요청 ID, 생성 보고와 개수, 실제 경로와 파일 내용, 정상 완료 표시가 모두 일치하는지 확인함.
51추가:
52추가: 자동 풀 위치는 Unix DirBuilder mode 0700으로 생성함. auto_destination_is_private_under_desktop_umask는 별도 자식 프로세스의 umask 0002에서 실제 작업자 추출, 폴더 권한과 파일 내용을 확인함. 시험 프로세스 전체의 umask는 변경하지 않음. completed_results_keep_folder_action_and_distinguish_durability는 추출과 ZIP 생성의 정상 완료에서 Synced, Unconfirmed와 Failed 내구성 조합을 확인함. 완료 제목과 폴더 열기를 유지하며 완료 + Unconfirmed의 저장 확인 경고만 자세히 보기 안에서 표시함. Failed 내구성 경고는 완료 결과에서도 본문에 바로 표시함. 두 시험 모두 수정 전 실패와 수정 후 통과를 확인함. Windows 실제 실행을 대신하는 시험은 아님.
53추가:
54추가: 실패와 부분 추출에서는 저장 확인 경고를 본문에 바로 표시함. durability_warning_visibility_matches_completed_failed_and_partial_results는 Completed + Unconfirmed, Failed + Unconfirmed, 일부 파일만 저장된 Failed + Unconfirmed 세 조합을 검증함. 자세히 보기를 열어도 경고를 중복 표시하지 않으며, 닫은 뒤에도 실패 경고는 유지함. 수정 전 실패와 수정 후 통과를 확인함.
55추가:
56추가: 내구성 표시는 문구 비교 없이 Durability 값으로 판단하며, 파일 게시 결과와 내구성 안내를 분리함. Failed와 Unconfirmed는 서로 다른 문구로 안내함. 위 표시 위치 시험은 완료, 실패와 부분 추출에 Synced, Unconfirmed와 Failed를 조합한 9가지로 확장함. 완료 + Failed 경고는 자세히 보기를 열지 않아도 알림 상자에 표시함. 확장한 두 UI 시험의 수정 전 실패와 수정 후 통과를 확인함.
추가tests/ui-redesign/capture.py+130-0
@@ -0,0 +1,130 @@
1추가: """격리한 Xvfb에서 상태별 실제 창을 촬영함."""
2추가:
3추가: import argparse
4추가: import json
5추가: import os
6추가: from pathlib import Path
7추가: import subprocess
8추가: import time
9추가:
10추가: ROOT = Path(__file__).resolve().parents[2]
11추가:
12추가:
13추가: def command(args, environment, **kwargs):
14추가: return subprocess.run(args, env=environment, check=True, **kwargs)
15추가:
16추가:
17추가: def stop(process):
18추가: process.terminate()
19추가: try:
20추가: process.wait(timeout=3)
21추가: except subprocess.TimeoutExpired:
22추가: process.kill()
23추가: process.wait()
24추가:
25추가:
26추가: def capture(binary, variant, state, output, environment, width, height):
27추가: automatic = ROOT / "tests/ui-redesign/runs/fixtures/여행"
28추가: try:
29추가: automatic.rmdir()
30추가: except OSError:
31추가: pass
32추가: mode = "opened" if state in {"picker", "selected-empty"} else state
33추가: log = ROOT / "tests/ui-redesign/runs" / f"{variant}-{state}.log"
34추가: with log.open("w") as stream:
35추가: app = subprocess.Popen([str(binary), mode], cwd=ROOT, env=environment, stdout=stream, stderr=stream)
36추가: try:
37추가: deadline = time.monotonic() + 15
38추가: window = None
39추가: while time.monotonic() < deadline and app.poll() is None:
40추가: found = subprocess.run(
41추가: ["xdotool", "search", "--onlyvisible", "--name", "^Zipelo UI capture"],
42추가: env=environment, capture_output=True, text=True,
43추가: )
44추가: if found.returncode == 0:
45추가: window = found.stdout.splitlines()[0]
46추가: break
47추가: time.sleep(0.1)
48추가: if window is None:
49추가: raise RuntimeError(f"창 열기 실패: {log}")
50추가: command(["xdotool", "windowsize", window, str(width), str(height)], environment)
51추가: command(["xdotool", "windowfocus", "--sync", window], environment)
52추가: time.sleep(0.7)
53추가:
54추가: def click(x, y):
55추가: command(["xdotool", "mousemove", "--window", window, str(x), str(y), "click", "1"], environment)
56추가: time.sleep(0.4)
57추가:
58추가: if state == "create" or (state == "create-filled" and variant == "before"):
59추가: click(180 if variant == "before" else width - 90, 18 if variant == "before" else 40)
60추가: if state == "create-filled" and variant == "before":
61추가: base = ROOT / "tests/ui-redesign/runs/fixtures"
62추가: click(100, 105)
63추가: command(["xdotool", "type", "--clearmodifiers", "--delay", "0",
64추가: str(ROOT / "tests/ui-redesign/README.md")], environment)
65추가: command(["xdotool", "key", "Return"], environment)
66추가: command(["xdotool", "type", "--clearmodifiers", "--delay", "0", str(base)], environment)
67추가: click(100, 200)
68추가: command(["xdotool", "type", "--clearmodifiers", "--delay", "0", str(base / "archive.zip")], environment)
69추가: elif state == "picker":
70추가: click(97 if variant == "before" else width - 90, 18 if variant == "before" else height - 80)
71추가: elif state == "selected-empty":
72추가: click(16 if variant == "before" else 24, 126 if variant == "before" else height - 36)
73추가: elif state == "cancelling":
74추가: click(260 if variant == "before" else width - 60, 18 if variant == "before" else height - 36)
75추가: if state == "password-create" and variant == "after":
76추가: click(width // 2 - 56, height // 2 - 12)
77추가: command(["xdotool", "type", "--clearmodifiers", "--delay", "0", "fixture-password"], environment)
78추가: command(["xdotool", "key", "Tab", "Tab"], environment)
79추가: command(["xdotool", "type", "--clearmodifiers", "--delay", "0", "different"], environment)
80추가: command(["xdotool", "mousemove", "--window", window, "2", "2"], environment)
81추가: time.sleep(0.3)
82추가: destination = output / f"{state}.png"
83추가: command(["import", "-window", window, str(destination)], environment)
84추가: return {"state": state, "path": str(destination.relative_to(ROOT)), "width": width, "height": height}
85추가: finally:
86추가: stop(app)
87추가:
88추가:
89추가: def main():
90추가: parser = argparse.ArgumentParser(description=__doc__)
91추가: parser.add_argument("--binary", type=Path, required=True)
92추가: parser.add_argument("--variant", choices=["before", "after"], required=True)
93추가: parser.add_argument("--states", nargs="+", default=["empty", "hover", "opened", "selected-empty", "picker", "create", "create-filled", "password", "password-retry", "password-create", "progress", "progress-unknown", "cancelling", "success", "error"])
94추가: parser.add_argument("--width", type=int, default=1060)
95추가: parser.add_argument("--height", type=int, default=720)
96추가: parser.add_argument("--output", type=Path)
97추가: args = parser.parse_args()
98추가: output = (args.output or ROOT / "tests/ui-redesign/screenshots" / args.variant).resolve()
99추가: if not output.is_relative_to(ROOT / "tests"):
100추가: raise ValueError("촬영 결과는 tests/ 안에만 저장함")
101추가: output.mkdir(parents=True, exist_ok=True)
102추가: read_fd, write_fd = os.pipe()
103추가: server = subprocess.Popen(
104추가: ["Xvfb", "-displayfd", str(write_fd), "-screen", "0", "1280x900x24", "-nolisten", "tcp"],
105추가: pass_fds=(write_fd,), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
106추가: )
107추가: os.close(write_fd)
108추가: try:
109추가: with os.fdopen(read_fd) as stream:
110추가: display = stream.readline().strip()
111추가: if not display:
112추가: raise RuntimeError("Xvfb를 시작하지 못함")
113추가: environment = dict(os.environ, DISPLAY=f":{display}", LIBGL_ALWAYS_SOFTWARE="1", WINIT_UNIX_BACKEND="x11", XDG_SESSION_TYPE="x11")
114추가: environment.pop("WAYLAND_DISPLAY", None)
115추가: results = [
116추가: capture(args.binary.resolve(), args.variant, state, output, environment, args.width, args.height)
117추가: for state in args.states
118추가: ]
119추가: metadata = output / "capture.json"
120추가: existing = json.loads(metadata.read_text()) if metadata.exists() else []
121추가: merged = {row["state"]: row for row in existing}
122추가: merged.update({row["state"]: row for row in results})
123추가: metadata.write_text(json.dumps(list(merged.values()), ensure_ascii=False, indent=4) + "\n")
124추가: print(json.dumps(results, ensure_ascii=False))
125추가: finally:
126추가: stop(server)
127추가:
128추가:
129추가: if __name__ == "__main__":
130추가: main()
추가tests/ui-redesign/check_row_selection.py+51-0
@@ -0,0 +1,51 @@
1추가: """실제 X11 창에서 파일 행을 눌렀을 때 선택 배경이 바뀌는지 확인함."""
2추가:
3추가: import argparse
4추가: from pathlib import Path
5추가: import subprocess
6추가: import sys
7추가: import time
8추가:
9추가: import capture
10추가:
11추가:
12추가: def main():
13추가: parser = argparse.ArgumentParser(description=__doc__)
14추가: parser.add_argument("--binary", type=Path, required=True)
15추가: args = parser.parse_args()
16추가: original = capture.command
17추가: clicked = False
18추가:
19추가: def command(arguments, environment, **kwargs):
20추가: nonlocal clicked
21추가: if arguments[:3] == ["xdotool", "mousemove", "--window"] and arguments[-2:] == ["2", "2"]:
22추가: original(
23추가: ["xdotool", "mousemove", "--window", arguments[3], "120", "271"],
24추가: environment,
25추가: )
26추가: time.sleep(0.2)
27추가: original(["xdotool", "click", "1"], environment)
28추가: clicked = True
29추가: time.sleep(0.2)
30추가: return original(arguments, environment, **kwargs)
31추가:
32추가: capture.command = command
33추가: output = capture.ROOT / "tests/ui-redesign/runs/row-selection"
34추가: sys.argv = [
35추가: sys.argv[0], "--binary", str(args.binary), "--variant", "after",
36추가: "--states", "opened", "--output", str(output),
37추가: ]
38추가: capture.main()
39추가: if not clicked:
40추가: raise AssertionError("행 클릭을 실행하지 못함")
41추가: pixel = subprocess.check_output(
42추가: ["convert", str(output / "opened.png"), "-format", "%[pixel:p{500,271}]", "info:"],
43추가: text=True,
44추가: ).strip()
45추가: if pixel != "srgb(232,240,254)":
46추가: raise AssertionError(f"행 선택 배경 불일치: {pixel}")
47추가: print("실제 파일 이름 클릭 후 선택 표시 확인")
48추가:
49추가:
50추가: if __name__ == "__main__":
51추가: main()
추가tests/ui-redesign/prepare.py+65-0
@@ -0,0 +1,65 @@
1추가: """현재 화면과 로컬 Git 기준 화면의 촬영 실행 파일을 준비함."""
2추가:
3추가: import argparse
4추가: import os
5추가: from pathlib import Path
6추가: import subprocess
7추가: import tarfile
8추가:
9추가: ROOT = Path(__file__).resolve().parents[2]
10추가: MANIFEST = Path("experiments/rust-ui-memory-app/Cargo.toml")
11추가: HELPER = Path("tests/rust-app-ui/capture.rs")
12추가: BIN = '\n[[bin]]\nname = "zipelo-ui-capture"\npath = "../../tests/rust-app-ui/capture.rs"\nrequired-features = ["ui-fixture"]\n'
13추가:
14추가:
15추가: def main():
16추가: parser = argparse.ArgumentParser(description=__doc__)
17추가: parser.add_argument("--before-ref", default="b10c7eedddd202f83766aa8f001142cdfdb4097c")
18추가: parser.add_argument("--output", type=Path, default=ROOT / "tests/ui-redesign/runs")
19추가: parser.add_argument("--target-dir", type=Path, required=True)
20추가: args = parser.parse_args()
21추가: output = args.output.resolve()
22추가: if not output.is_relative_to(ROOT / "tests"):
23추가: raise ValueError("기준 소스와 실행 파일은 tests/ 안에만 저장함")
24추가: before = output / "before-src"
25추가: if before.exists():
26추가: raise ValueError("기존 기준 소스는 보존함. 새 --output 폴더를 지정하세요")
27추가: before.mkdir(parents=True)
28추가: revision = subprocess.check_output(
29추가: ["git", "rev-parse", "--verify", "--end-of-options", args.before_ref + "^{commit}"],
30추가: cwd=ROOT, text=True,
31추가: ).strip()
32추가: with subprocess.Popen(["git", "archive", revision], cwd=ROOT, stdout=subprocess.PIPE) as archive:
33추가: with tarfile.open(fileobj=archive.stdout, mode="r|") as source:
34추가: source.extractall(before, filter="data")
35추가: if archive.wait() != 0:
36추가: raise RuntimeError("로컬 기준 소스를 읽지 못함")
37추가: helper = (ROOT / HELPER).read_text()
38추가: helper = helper.replace(
39추가: "self.app.begin_extract();",
40추가: "self.app.model.begin(start, &mut self.factory);",
41추가: )
42추가: helper = helper.replace(
43추가: 'app.add_sources(vec![base.join("읽어주세요.txt"), base.join("사진")]);',
44추가: "let _ = &mut app;",
45추가: )
46추가: (before / HELPER).write_text(helper)
47추가: original = before / MANIFEST
48추가: original.write_text(original.read_text() + BIN)
49추가: environment = dict(os.environ, CARGO_TARGET_DIR=str(args.target_dir.resolve()))
50추가: for variant, root in [("before", before), ("after", ROOT)]:
51추가: with (output / f"{variant}-build.log").open("w") as log:
52추가: subprocess.run(
53추가: ["cargo", "+1.99.1", "build", "--locked", "--offline", "--manifest-path",
54추가: str(root / MANIFEST), "--features", "ui-fixture", "--bin", "zipelo-ui-capture"],
55추가: cwd=ROOT, env=environment, stdout=log, stderr=log, check=True,
56추가: )
57추가: executable = args.target_dir.resolve() / "debug/zipelo-ui-capture"
58추가: destination = output / f"{variant}-capture"
59추가: destination.write_bytes(executable.read_bytes())
60추가: destination.chmod(executable.stat().st_mode)
61추가: print(f"기준 커밋 {revision}, 촬영 실행 파일 {output}")
62추가:
63추가:
64추가: if __name__ == "__main__":
65추가: main()
추가tests/ui-redesign/screenshots/after/cancelling.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/after/capture.json+92-0
@@ -0,0 +1,92 @@
1추가: [
2추가: {
3추가: "state": "empty",
4추가: "path": "tests/ui-redesign/screenshots/after/empty.png",
5추가: "width": 1060,
6추가: "height": 720
7추가: },
8추가: {
9추가: "state": "hover",
10추가: "path": "tests/ui-redesign/screenshots/after/hover.png",
11추가: "width": 1060,
12추가: "height": 720
13추가: },
14추가: {
15추가: "state": "opened",
16추가: "path": "tests/ui-redesign/screenshots/after/opened.png",
17추가: "width": 1060,
18추가: "height": 720
19추가: },
20추가: {
21추가: "state": "selected-empty",
22추가: "path": "tests/ui-redesign/screenshots/after/selected-empty.png",
23추가: "width": 1060,
24추가: "height": 720
25추가: },
26추가: {
27추가: "state": "picker",
28추가: "path": "tests/ui-redesign/screenshots/after/picker.png",
29추가: "width": 1060,
30추가: "height": 720
31추가: },
32추가: {
33추가: "state": "create",
34추가: "path": "tests/ui-redesign/screenshots/after/create.png",
35추가: "width": 1060,
36추가: "height": 720
37추가: },
38추가: {
39추가: "state": "create-filled",
40추가: "path": "tests/ui-redesign/screenshots/after/create-filled.png",
41추가: "width": 1060,
42추가: "height": 720
43추가: },
44추가: {
45추가: "state": "password",
46추가: "path": "tests/ui-redesign/screenshots/after/password.png",
47추가: "width": 1060,
48추가: "height": 720
49추가: },
50추가: {
51추가: "state": "password-retry",
52추가: "path": "tests/ui-redesign/screenshots/after/password-retry.png",
53추가: "width": 1060,
54추가: "height": 720
55추가: },
56추가: {
57추가: "state": "password-create",
58추가: "path": "tests/ui-redesign/screenshots/after/password-create.png",
59추가: "width": 1060,
60추가: "height": 720
61추가: },
62추가: {
63추가: "state": "progress",
64추가: "path": "tests/ui-redesign/screenshots/after/progress.png",
65추가: "width": 1060,
66추가: "height": 720
67추가: },
68추가: {
69추가: "state": "progress-unknown",
70추가: "path": "tests/ui-redesign/screenshots/after/progress-unknown.png",
71추가: "width": 1060,
72추가: "height": 720
73추가: },
74추가: {
75추가: "state": "cancelling",
76추가: "path": "tests/ui-redesign/screenshots/after/cancelling.png",
77추가: "width": 1060,
78추가: "height": 720
79추가: },
80추가: {
81추가: "state": "success",
82추가: "path": "tests/ui-redesign/screenshots/after/success.png",
83추가: "width": 1060,
84추가: "height": 720
85추가: },
86추가: {
87추가: "state": "error",
88추가: "path": "tests/ui-redesign/screenshots/after/error.png",
89추가: "width": 1060,
90추가: "height": 720
91추가: }
92추가: ]
추가tests/ui-redesign/screenshots/after/create-filled.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/after/create.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/after/empty.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/after/error.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/after/hover.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/after/opened.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/after/password-create.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/after/password-retry.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/after/password.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/after/picker.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/after/progress-unknown.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/after/progress.png

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

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

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

파일 내려받기
추가tests/ui-redesign/screenshots/after/success.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/before/cancelling.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/before/capture.json+92-0
@@ -0,0 +1,92 @@
1추가: [
2추가: {
3추가: "state": "empty",
4추가: "path": "tests/ui-redesign/screenshots/before/empty.png",
5추가: "width": 1060,
6추가: "height": 720
7추가: },
8추가: {
9추가: "state": "hover",
10추가: "path": "tests/ui-redesign/screenshots/before/hover.png",
11추가: "width": 1060,
12추가: "height": 720
13추가: },
14추가: {
15추가: "state": "opened",
16추가: "path": "tests/ui-redesign/screenshots/before/opened.png",
17추가: "width": 1060,
18추가: "height": 720
19추가: },
20추가: {
21추가: "state": "selected-empty",
22추가: "path": "tests/ui-redesign/screenshots/before/selected-empty.png",
23추가: "width": 1060,
24추가: "height": 720
25추가: },
26추가: {
27추가: "state": "picker",
28추가: "path": "tests/ui-redesign/screenshots/before/picker.png",
29추가: "width": 1060,
30추가: "height": 720
31추가: },
32추가: {
33추가: "state": "create",
34추가: "path": "tests/ui-redesign/screenshots/before/create.png",
35추가: "width": 1060,
36추가: "height": 720
37추가: },
38추가: {
39추가: "state": "create-filled",
40추가: "path": "tests/ui-redesign/screenshots/before/create-filled.png",
41추가: "width": 1060,
42추가: "height": 720
43추가: },
44추가: {
45추가: "state": "password",
46추가: "path": "tests/ui-redesign/screenshots/before/password.png",
47추가: "width": 1060,
48추가: "height": 720
49추가: },
50추가: {
51추가: "state": "password-retry",
52추가: "path": "tests/ui-redesign/screenshots/before/password-retry.png",
53추가: "width": 1060,
54추가: "height": 720
55추가: },
56추가: {
57추가: "state": "password-create",
58추가: "path": "tests/ui-redesign/screenshots/before/password-create.png",
59추가: "width": 1060,
60추가: "height": 720
61추가: },
62추가: {
63추가: "state": "progress",
64추가: "path": "tests/ui-redesign/screenshots/before/progress.png",
65추가: "width": 1060,
66추가: "height": 720
67추가: },
68추가: {
69추가: "state": "progress-unknown",
70추가: "path": "tests/ui-redesign/screenshots/before/progress-unknown.png",
71추가: "width": 1060,
72추가: "height": 720
73추가: },
74추가: {
75추가: "state": "cancelling",
76추가: "path": "tests/ui-redesign/screenshots/before/cancelling.png",
77추가: "width": 1060,
78추가: "height": 720
79추가: },
80추가: {
81추가: "state": "success",
82추가: "path": "tests/ui-redesign/screenshots/before/success.png",
83추가: "width": 1060,
84추가: "height": 720
85추가: },
86추가: {
87추가: "state": "error",
88추가: "path": "tests/ui-redesign/screenshots/before/error.png",
89추가: "width": 1060,
90추가: "height": 720
91추가: }
92추가: ]
추가tests/ui-redesign/screenshots/before/create-filled.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/before/create.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/before/empty.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/before/error.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/before/hover.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/before/opened.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/before/password-create.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/before/password-retry.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/before/password.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/before/picker.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/before/progress-unknown.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/before/progress.png

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

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

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

파일 내려받기
추가tests/ui-redesign/screenshots/before/success.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/minimum/cancelling.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/minimum/capture.json+92-0
@@ -0,0 +1,92 @@
1추가: [
2추가: {
3추가: "state": "empty",
4추가: "path": "tests/ui-redesign/screenshots/minimum/empty.png",
5추가: "width": 760,
6추가: "height": 540
7추가: },
8추가: {
9추가: "state": "hover",
10추가: "path": "tests/ui-redesign/screenshots/minimum/hover.png",
11추가: "width": 760,
12추가: "height": 540
13추가: },
14추가: {
15추가: "state": "opened",
16추가: "path": "tests/ui-redesign/screenshots/minimum/opened.png",
17추가: "width": 760,
18추가: "height": 540
19추가: },
20추가: {
21추가: "state": "selected-empty",
22추가: "path": "tests/ui-redesign/screenshots/minimum/selected-empty.png",
23추가: "width": 760,
24추가: "height": 540
25추가: },
26추가: {
27추가: "state": "picker",
28추가: "path": "tests/ui-redesign/screenshots/minimum/picker.png",
29추가: "width": 760,
30추가: "height": 540
31추가: },
32추가: {
33추가: "state": "create",
34추가: "path": "tests/ui-redesign/screenshots/minimum/create.png",
35추가: "width": 760,
36추가: "height": 540
37추가: },
38추가: {
39추가: "state": "create-filled",
40추가: "path": "tests/ui-redesign/screenshots/minimum/create-filled.png",
41추가: "width": 760,
42추가: "height": 540
43추가: },
44추가: {
45추가: "state": "password",
46추가: "path": "tests/ui-redesign/screenshots/minimum/password.png",
47추가: "width": 760,
48추가: "height": 540
49추가: },
50추가: {
51추가: "state": "password-retry",
52추가: "path": "tests/ui-redesign/screenshots/minimum/password-retry.png",
53추가: "width": 760,
54추가: "height": 540
55추가: },
56추가: {
57추가: "state": "password-create",
58추가: "path": "tests/ui-redesign/screenshots/minimum/password-create.png",
59추가: "width": 760,
60추가: "height": 540
61추가: },
62추가: {
63추가: "state": "progress",
64추가: "path": "tests/ui-redesign/screenshots/minimum/progress.png",
65추가: "width": 760,
66추가: "height": 540
67추가: },
68추가: {
69추가: "state": "progress-unknown",
70추가: "path": "tests/ui-redesign/screenshots/minimum/progress-unknown.png",
71추가: "width": 760,
72추가: "height": 540
73추가: },
74추가: {
75추가: "state": "cancelling",
76추가: "path": "tests/ui-redesign/screenshots/minimum/cancelling.png",
77추가: "width": 760,
78추가: "height": 540
79추가: },
80추가: {
81추가: "state": "success",
82추가: "path": "tests/ui-redesign/screenshots/minimum/success.png",
83추가: "width": 760,
84추가: "height": 540
85추가: },
86추가: {
87추가: "state": "error",
88추가: "path": "tests/ui-redesign/screenshots/minimum/error.png",
89추가: "width": 760,
90추가: "height": 540
91추가: }
92추가: ]
추가tests/ui-redesign/screenshots/minimum/create-filled.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/minimum/create.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/minimum/empty.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/minimum/error.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/minimum/hover.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/minimum/opened.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/minimum/password-create.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/minimum/password-retry.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/minimum/password.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/minimum/picker.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/minimum/progress-unknown.png

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

파일 내려받기
추가tests/ui-redesign/screenshots/minimum/progress.png

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

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

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

파일 내려받기
추가tests/ui-redesign/screenshots/minimum/success.png

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

파일 내려받기
추가tests/ui-redesign/validation.json

Diff가 표시 한도를 넘어서 생략했어요.

Raw로 열기