team-ljyzipelo

공개

자동 풀 위치 권한과 완료 안내를 수정함

작성자
호시노 히나타
작성 시각
커밋
0c96f094ea9b30e30f3786272c0cee282f87518b
부모
495b855
이 시점의 파일 보기

변경된 파일 4개

+171-3
수정experiments/rust-ui-memory-app/src/archive_present.rs+7-1
@@ -86,7 +86,13 @@ pub fn prepare_destination(path: &Path, automatic: bool) -> io::Result<bool> {
8686 Ok(metadata) if metadata.is_dir() && !metadata.file_type().is_symlink() => Ok(false),
8787 Ok(_) => Err(io::Error::other(FOLDER_ERROR)),
8888 Err(error) if error.kind() == io::ErrorKind::NotFound && automatic => {
89삭제: fs::create_dir(path)?;
89추가: let mut builder = fs::DirBuilder::new();
90추가: #[cfg(unix)]
91추가: {
92추가: use std::os::unix::fs::DirBuilderExt;
93추가: builder.mode(0o700);
94추가: }
95추가: builder.create(path)?;
9096 Ok(true)
9197 }
9298 Err(error) => Err(error),
수정experiments/rust-ui-memory-app/src/archive_screen.rs+10-2
@@ -864,7 +864,9 @@ impl ArchiveApp {
864864 let success = self.model.confirmed
865865 && self.model.error.is_none()
866866 && t.as_ref().is_some_and(|t| t.outcome == Outcome::Completed)
867삭제: && warnings.is_empty();
867추가: && warnings
868추가: .iter()
869추가: .all(|warning| *warning == present::SYNC_WARNING);
868870 let cancelled =
869871 self.model.confirmed && t.as_ref().is_some_and(|t| t.outcome == Outcome::Cancelled);
870872 let title = if success {
@@ -929,7 +931,10 @@ impl ArchiveApp {
929931 } else if let Some(error) = &self.model.error {
930932 ui.label(present::client_error_text(error));
931933 }
932삭제: for warning in &warnings {
934추가: for warning in warnings
935추가: .iter()
936추가: .filter(|warning| **warning != present::SYNC_WARNING)
937추가: {
933938 ui.horizontal_wrapped(|ui| {
934939 theme::icon(ui, Icon::Warning, 20.0);
935940 ui.colored_label(theme::WARNING, *warning);
@@ -947,6 +952,9 @@ impl ArchiveApp {
947952 }
948953 if self.details {
949954 theme::panel(theme::STRIPE).show(ui, |ui| {
955추가: if warnings.contains(&present::SYNC_WARNING) {
956추가: ui.label(present::SYNC_WARNING);
957추가: }
950958 if let Some(t) = &t {
951959 for line in terminal_lines(t) {
952960 ui.label(line);
수정tests/rust-app-real-worker/selection_flows.rs+70-0
@@ -146,3 +146,73 @@ fn extraction_completion_matches_actual_worker_selection_matrix() {
146146 }
147147 assert_reaped(&observed);
148148}
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/presentation.rs+84-0
@@ -1062,6 +1062,90 @@ mod widgets {
10621062 assert!(!shown.iter().any(|(text, _)| text == UNCERTAIN));
10631063 }
10641064
1065추가: #[test]
1066추가: fn completed_results_keep_folder_action_and_show_durability_only_in_details() {
1067추가: for creating in [false, true] {
1068추가: for durability in [
1069추가: Durability::Synced,
1070추가: Durability::Unconfirmed,
1071추가: Durability::Failed,
1072추가: ] {
1073추가: let scratch = Folder::new();
1074추가: let factory = FakeFactory::default();
1075추가: let mut app = loaded(&scratch, &factory);
1076추가: factory.state.borrow_mut().manual = true;
1077추가: let ctx = egui::Context::default();
1078추가: let name = if creating {
1079추가: let source = scratch.0.join("source.txt");
1080추가: fs::write(&source, b"source").unwrap();
1081추가: app.add_sources(vec![source]);
1082추가: policy_render(&ctx, &mut app, vec![]);
1083추가: policy_click(&ctx, &mut app, "만들기");
1084추가: match factory.state.borrow().starts.last().unwrap() {
1085추가: Start::CreateZip { output_file, .. } => output_file
1086추가: .file_name()
1087추가: .unwrap()
1088추가: .to_str()
1089추가: .unwrap()
1090추가: .to_owned(),
1091추가: _ => panic!("생성 요청 누락"),
1092추가: }
1093추가: } else {
1094추가: assert!(app.begin_extract());
1095추가: "읽어주세요.txt".to_owned()
1096추가: };
1097추가: {
1098추가: let mut worker = factory.state.borrow_mut();
1099추가: worker.frame(Event::Accepted { encryption: false });
1100추가: worker.frame(Event::Output {
1101추가: entry_id: None,
1102추가: relative_name: name,
1103추가: disposition: Disposition::Created,
1104추가: });
1105추가: worker.finish(Outcome::Completed, Publication::Complete);
1106추가: for event in &mut worker.queue {
1107추가: if let HostEvent::Frame {
1108추가: event: Event::Terminal(terminal),
1109추가: ..
1110추가: } = event
1111추가: {
1112추가: terminal.durability = durability;
1113추가: }
1114추가: }
1115추가: }
1116추가: for _ in 0..30 {
1117추가: policy_render(&ctx, &mut app, vec![]);
1118추가: }
1119추가: let shown = policy_render(&ctx, &mut app, vec![]);
1120추가: let title = if creating {
1121추가: "ZIP 파일을 만들었습니다"
1122추가: } else {
1123추가: "압축을 풀었습니다"
1124추가: };
1125추가: assert!(
1126추가: shown.iter().any(|(text, _)| text == title),
1127추가: "{durability:?}: {shown:?}"
1128추가: );
1129추가: assert!(shown.iter().any(|(text, _)| text == "폴더 열기"));
1130추가: assert!(
1131추가: !shown
1132추가: .iter()
1133추가: .any(|(text, _)| text == "다시 시도" || text == SYNC_WARNING)
1134추가: );
1135추가: policy_click(&ctx, &mut app, "자세히 보기");
1136추가: let details = policy_render(&ctx, &mut app, vec![]);
1137추가: assert_eq!(
1138추가: details.iter().any(|(text, _)| text == SYNC_WARNING),
1139추가: durability != Durability::Synced
1140추가: );
1141추가: policy_click(&ctx, &mut app, "자세히 닫기");
1142추가: let closed = policy_render(&ctx, &mut app, vec![]);
1143추가: assert!(!closed.iter().any(|(text, _)| text == SYNC_WARNING));
1144추가: assert!(closed.iter().any(|(text, _)| text == "폴더 열기"));
1145추가: }
1146추가: }
1147추가: }
1148추가:
10651149 fn picker_frame(
10661150 ctx: &egui::Context,
10671151 picker: &mut Picker,