| | @@ -327,6 +327,122 @@ fn explorer_double_click_opens_files_with_default_app_and_folders_in_place() { |
| 327 | 327 | assert!(!root.exists()); |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | +추가: /// 열기용 풀기가 한도 초과로 실패한 상태까지 진행함. 결과 창을 그리는 문맥도 함께 돌려줌. |
| 331 | +추가: fn double_click_open_hits_limit(s: &mut Explorer) -> egui::Context { |
| 332 | +추가: s.factory.state.borrow_mut().manual = true; |
| 333 | +추가: s.double_click("alpha.txt"); |
| 334 | +추가: assert_eq!(s.factory.state.borrow().starts.len(), 2); |
| 335 | +추가: finish_limit(s); |
| 336 | +추가: let ctx = egui::Context::default(); |
| 337 | +추가: ctx.set_embed_viewports(false); |
| 338 | +추가: for _ in 0..12 { |
| 339 | +추가: policy_render(&ctx, &mut s.app, vec![]); |
| 340 | +추가: } |
| 341 | +추가: assert!(s.app.model.can_retry_expanded()); |
| 342 | +추가: assert!(s.opened.borrow().is_empty()); |
| 343 | +추가: ctx |
| 344 | +추가: } |
| 345 | +추가: |
| 346 | +추가: fn finish_limit(s: &mut Explorer) { |
| 347 | +추가: { |
| 348 | +추가: let mut worker = s.factory.state.borrow_mut(); |
| 349 | +추가: worker.frame(Event::Accepted { encryption: false }); |
| 350 | +추가: worker.frame(Event::Terminal(Terminal { |
| 351 | +추가: outcome: Outcome::Failed, |
| 352 | +추가: error: Some(ErrorCode::Limit), |
| 353 | +추가: publication: Publication::None, |
| 354 | +추가: created_count: 0, |
| 355 | +추가: retained_partial_count: 0, |
| 356 | +추가: durability: Durability::NotApplicable, |
| 357 | +추가: cleanup: Cleanup::Complete, |
| 358 | +추가: })); |
| 359 | +추가: worker.queue.extend([ |
| 360 | +추가: HostEvent::StdoutEof, |
| 361 | +추가: HostEvent::StderrEof, |
| 362 | +추가: HostEvent::Exited { success: true }, |
| 363 | +추가: ]); |
| 364 | +추가: } |
| 365 | +추가: for _ in 0..30 { |
| 366 | +추가: s.frame(egui::Modifiers::NONE, vec![]); |
| 367 | +추가: } |
| 368 | +추가: } |
| 369 | +추가: |
| 370 | +추가: #[test] |
| 371 | +추가: fn explorer_open_keeps_pending_open_when_limit_retry_succeeds() { |
| 372 | +추가: let scratch = Folder::new(); |
| 373 | +추가: let mut s = Explorer::new(&scratch); |
| 374 | +추가: let root = scratch.0.join("sample.zip (Zipelo 임시)"); |
| 375 | +추가: let ctx = double_click_open_hits_limit(&mut s); |
| 376 | +추가: policy_click(&ctx, &mut s.app, "한도를 늘려 다시 시도"); |
| 377 | +추가: assert!(s.app.model.busy()); |
| 378 | +추가: assert!(s.factory.state.borrow().expanded); |
| 379 | +추가: assert!(matches!( |
| 380 | +추가: s.factory.state.borrow().starts.last(), |
| 381 | +추가: Some(Start::Extract { destination, .. }) if destination == &root.join("1") |
| 382 | +추가: )); |
| 383 | +추가: { |
| 384 | +추가: let mut worker = s.factory.state.borrow_mut(); |
| 385 | +추가: worker.frame(Event::Accepted { encryption: false }); |
| 386 | +추가: worker.frame(Event::Output { |
| 387 | +추가: entry_id: None, |
| 388 | +추가: relative_name: "alpha.txt".into(), |
| 389 | +추가: disposition: Disposition::Created, |
| 390 | +추가: }); |
| 391 | +추가: worker.finish(Outcome::Completed, Publication::Complete); |
| 392 | +추가: } |
| 393 | +추가: for _ in 0..30 { |
| 394 | +추가: s.frame(egui::Modifiers::NONE, vec![]); |
| 395 | +추가: } |
| 396 | +추가: // 다시 시도가 성공하면 기본 프로그램이 열림. |
| 397 | +추가: assert_eq!(*s.opened.borrow(), vec![root.join("1").join("alpha.txt")]); |
| 398 | +추가: // 열기가 끝나면 풀 위치는 원래대로 돌아옴. |
| 399 | +추가: s.factory.state.borrow_mut().manual = false; |
| 400 | +추가: assert!(s.app.begin_extract()); |
| 401 | +추가: assert!(matches!( |
| 402 | +추가: s.factory.state.borrow().starts.last(), |
| 403 | +추가: Some(Start::Extract { destination, .. }) if !destination.starts_with(&root) |
| 404 | +추가: )); |
| 405 | +추가: } |
| 406 | +추가: |
| 407 | +추가: #[test] |
| 408 | +추가: fn explorer_open_restores_destination_when_limit_result_is_dismissed() { |
| 409 | +추가: let scratch = Folder::new(); |
| 410 | +추가: let mut s = Explorer::new(&scratch); |
| 411 | +추가: let root = scratch.0.join("sample.zip (Zipelo 임시)"); |
| 412 | +추가: let ctx = double_click_open_hits_limit(&mut s); |
| 413 | +추가: policy_click(&ctx, &mut s.app, "확인"); |
| 414 | +추가: for _ in 0..3 { |
| 415 | +추가: policy_render(&ctx, &mut s.app, vec![]); |
| 416 | +추가: } |
| 417 | +추가: assert!(s.opened.borrow().is_empty()); |
| 418 | +추가: s.factory.state.borrow_mut().manual = false; |
| 419 | +추가: assert!(s.app.begin_extract()); |
| 420 | +추가: let state = s.factory.state.borrow(); |
| 421 | +추가: let Some(Start::Extract { destination, .. }) = state.starts.last() else { |
| 422 | +추가: panic!("{:?}", state.starts.last()); |
| 423 | +추가: }; |
| 424 | +추가: assert_eq!(destination, &scratch.0.join("sample")); |
| 425 | +추가: assert!(!destination.starts_with(&root)); |
| 426 | +추가: } |
| 427 | +추가: |
| 428 | +추가: #[test] |
| 429 | +추가: fn explorer_open_restores_destination_when_expanded_retry_fails_again() { |
| 430 | +추가: let scratch = Folder::new(); |
| 431 | +추가: let mut s = Explorer::new(&scratch); |
| 432 | +추가: let ctx = double_click_open_hits_limit(&mut s); |
| 433 | +추가: policy_click(&ctx, &mut s.app, "한도를 늘려 다시 시도"); |
| 434 | +추가: assert!(s.app.model.busy()); |
| 435 | +추가: finish_limit(&mut s); |
| 436 | +추가: assert!(s.opened.borrow().is_empty()); |
| 437 | +추가: assert!(!s.app.model.can_retry_expanded()); |
| 438 | +추가: s.factory.state.borrow_mut().manual = false; |
| 439 | +추가: assert!(s.app.begin_extract()); |
| 440 | +추가: assert!(matches!( |
| 441 | +추가: s.factory.state.borrow().starts.last(), |
| 442 | +추가: Some(Start::Extract { destination, .. }) if destination == &scratch.0.join("sample") |
| 443 | +추가: )); |
| 444 | +추가: } |
| 445 | +추가: |
| 330 | 446 | #[test] |
| 331 | 447 | fn explorer_double_click_does_not_open_executables() { |
| 332 | 448 | let scratch = Folder::new(); |