team-ljyzipelo

공개

실패와 부분 추출의 저장 확인 경고를 바로 표시함

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

변경된 파일 2개

+92-2
수정experiments/rust-ui-memory-app/src/archive_screen.rs+2-2
@@ -933,7 +933,7 @@ impl ArchiveApp {
933933 }
934934 for warning in warnings
935935 .iter()
936삭제: .filter(|warning| **warning != present::SYNC_WARNING)
936추가: .filter(|warning| !success || **warning != present::SYNC_WARNING)
937937 {
938938 ui.horizontal_wrapped(|ui| {
939939 theme::icon(ui, Icon::Warning, 20.0);
@@ -952,7 +952,7 @@ impl ArchiveApp {
952952 }
953953 if self.details {
954954 theme::panel(theme::STRIPE).show(ui, |ui| {
955삭제: if warnings.contains(&present::SYNC_WARNING) {
955추가: if success && warnings.contains(&present::SYNC_WARNING) {
956956 ui.label(present::SYNC_WARNING);
957957 }
958958 if let Some(t) = &t {
수정tests/rust-app-ui/presentation.rs+90-0
@@ -1146,6 +1146,96 @@ mod widgets {
11461146 }
11471147 }
11481148
1149추가: #[test]
1150추가: fn durability_warning_visibility_matches_completed_failed_and_partial_results() {
1151추가: for (outcome, publication, saved, expected_files) in [
1152추가: (Outcome::Completed, Publication::Complete, 1, 1),
1153추가: (Outcome::Failed, Publication::None, 0, 1),
1154추가: (Outcome::Failed, Publication::Partial, 1, 2),
1155추가: ] {
1156추가: let scratch = Folder::new();
1157추가: let factory = FakeFactory::default();
1158추가: let mut app = loaded(&scratch, &factory);
1159추가: app.model.entries = (0..expected_files)
1160추가: .map(|id| Entry {
1161추가: id,
1162추가: name: format!("{id}.txt"),
1163추가: kind: Kind::File,
1164추가: bytes: Some(1),
1165추가: packed: None,
1166추가: encrypted: false,
1167추가: })
1168추가: .collect();
1169추가: factory.state.borrow_mut().manual = true;
1170추가: assert!(app.begin_extract());
1171추가: {
1172추가: let mut worker = factory.state.borrow_mut();
1173추가: worker.frame(Event::Accepted { encryption: false });
1174추가: if saved > 0 {
1175추가: worker.frame(Event::Output {
1176추가: entry_id: Some(0),
1177추가: relative_name: "0.txt".into(),
1178추가: disposition: Disposition::Created,
1179추가: });
1180추가: }
1181추가: worker.finish(outcome, publication);
1182추가: for event in &mut worker.queue {
1183추가: if let HostEvent::Frame {
1184추가: event: Event::Terminal(terminal),
1185추가: ..
1186추가: } = event
1187추가: {
1188추가: terminal.created_count = saved;
1189추가: terminal.durability = Durability::Unconfirmed;
1190추가: terminal.error = (outcome == Outcome::Failed).then_some(ErrorCode::Io);
1191추가: }
1192추가: }
1193추가: }
1194추가: let ctx = egui::Context::default();
1195추가: for _ in 0..30 {
1196추가: policy_render(&ctx, &mut app, vec![]);
1197추가: }
1198추가: let completed = outcome == Outcome::Completed;
1199추가: let shown = policy_render(&ctx, &mut app, vec![]);
1200추가: assert_eq!(
1201추가: shown.iter().any(|(text, _)| text == SYNC_WARNING),
1202추가: !completed,
1203추가: "{outcome:?}/{publication:?}: {shown:?}"
1204추가: );
1205추가: assert_eq!(shown.iter().any(|(text, _)| text == "폴더 열기"), completed);
1206추가: assert_eq!(
1207추가: shown.iter().any(|(text, _)| text == "압축을 풀었습니다"),
1208추가: completed
1209추가: );
1210추가: assert_eq!(
1211추가: shown
1212추가: .iter()
1213추가: .any(|(text, _)| text == "압축을 풀지 못했습니다"),
1214추가: !completed
1215추가: );
1216추가: assert_eq!(
1217추가: shown.iter().any(|(text, _)| text == PARTIAL),
1218추가: publication == Publication::Partial
1219추가: );
1220추가: policy_click(&ctx, &mut app, "자세히 보기");
1221추가: let details = policy_render(&ctx, &mut app, vec![]);
1222추가: assert_eq!(
1223추가: details
1224추가: .iter()
1225추가: .filter(|(text, _)| text == SYNC_WARNING)
1226추가: .count(),
1227추가: 1,
1228추가: "{outcome:?}/{publication:?}: {details:?}"
1229추가: );
1230추가: policy_click(&ctx, &mut app, "자세히 닫기");
1231추가: let closed = policy_render(&ctx, &mut app, vec![]);
1232추가: assert_eq!(
1233추가: closed.iter().any(|(text, _)| text == SYNC_WARNING),
1234추가: !completed
1235추가: );
1236추가: }
1237추가: }
1238추가:
11491239 fn picker_frame(
11501240 ctx: &egui::Context,
11511241 picker: &mut Picker,