| | @@ -420,3 +420,99 @@ fn explorer_ctrl_removes_a_large_directory_subtree_without_ancestor_rescans() { |
| 420 | 420 | assert!(s.app.model.selected.is_empty()); |
| 421 | 421 | assert!(started.elapsed() < std::time::Duration::from_secs(2)); |
| 422 | 422 | } |
| 423 | +추가: |
| 424 | +추가: #[test] |
| 425 | +추가: fn explorer_mouse_click_gives_list_focus_for_keyboard_selection_and_navigation() { |
| 426 | +추가: let scratch = Folder::new(); |
| 427 | +추가: let mut s = Explorer::new(&scratch); |
| 428 | +추가: assert!(s.ctx.memory(|memory| memory.focused()).is_none()); |
| 429 | +추가: s.click("alpha.txt", egui::Modifiers::NONE); |
| 430 | +추가: assert!(s.ctx.memory(|memory| memory.focused()).is_some()); |
| 431 | +추가: s.key(egui::Key::ArrowDown, egui::Modifiers::NONE); |
| 432 | +추가: s.selected(&[2]); |
| 433 | +추가: s.key(egui::Key::ArrowDown, explorer_shift()); |
| 434 | +추가: s.selected(&[2, 3]); |
| 435 | +추가: s.key(egui::Key::A, explorer_ctrl()); |
| 436 | +추가: s.selected(&[0, 1, 2, 3, 4, 5]); |
| 437 | +추가: s.click("docs", egui::Modifiers::NONE); |
| 438 | +추가: s.key(egui::Key::Enter, egui::Modifiers::NONE); |
| 439 | +추가: assert!( |
| 440 | +추가: layout_text(&s.frame(egui::Modifiers::NONE, vec![])) |
| 441 | +추가: .iter() |
| 442 | +추가: .any(|(text, _, _)| text == "child.txt") |
| 443 | +추가: ); |
| 444 | +추가: s.key(egui::Key::Backspace, egui::Modifiers::NONE); |
| 445 | +추가: assert!( |
| 446 | +추가: layout_text(&s.frame(egui::Modifiers::NONE, vec![])) |
| 447 | +추가: .iter() |
| 448 | +추가: .any(|(text, _, _)| text == "alpha.txt") |
| 449 | +추가: ); |
| 450 | +추가: s.click("alpha.txt", egui::Modifiers::NONE); |
| 451 | +추가: s.key(egui::Key::Escape, egui::Modifiers::NONE); |
| 452 | +추가: s.selected(&[]); |
| 453 | +추가: } |
| 454 | +추가: |
| 455 | +추가: #[test] |
| 456 | +추가: fn explorer_retry_preserves_original_scope_after_selection_changes_and_conflicts() { |
| 457 | +추가: for selected in [false, true] { |
| 458 | +추가: for conflict in [false, true] { |
| 459 | +추가: let scratch = Folder::new(); |
| 460 | +추가: let mut s = Explorer::new(&scratch); |
| 461 | +추가: s.factory.state.borrow_mut().manual = true; |
| 462 | +추가: if selected { |
| 463 | +추가: s.click("docs", egui::Modifiers::NONE); |
| 464 | +추가: } |
| 465 | +추가: assert!(s.app.begin_extract()); |
| 466 | +추가: let original = match s.factory.state.borrow().starts.last().unwrap() { |
| 467 | +추가: Start::Extract { selection, .. } => selection.clone(), |
| 468 | +추가: _ => panic!("추출 요청이 필요함"), |
| 469 | +추가: }; |
| 470 | +추가: { |
| 471 | +추가: let mut worker = s.factory.state.borrow_mut(); |
| 472 | +추가: worker.frame(Event::Accepted { encryption: false }); |
| 473 | +추가: worker.finish(Outcome::Failed, Publication::None); |
| 474 | +추가: for event in &mut worker.queue { |
| 475 | +추가: if let HostEvent::Frame { |
| 476 | +추가: event: Event::Terminal(t), |
| 477 | +추가: .. |
| 478 | +추가: } = event |
| 479 | +추가: { |
| 480 | +추가: t.error = Some(if conflict { |
| 481 | +추가: ErrorCode::Conflict |
| 482 | +추가: } else { |
| 483 | +추가: ErrorCode::Io |
| 484 | +추가: }); |
| 485 | +추가: } |
| 486 | +추가: } |
| 487 | +추가: } |
| 488 | +추가: for _ in 0..30 { |
| 489 | +추가: s.frame(egui::Modifiers::NONE, vec![]); |
| 490 | +추가: } |
| 491 | +추가: s.click("alpha.txt", egui::Modifiers::NONE); |
| 492 | +추가: s.selected(&[1]); |
| 493 | +추가: let chosen = scratch.0.join("retry-output"); |
| 494 | +추가: if conflict { |
| 495 | +추가: fs::create_dir(&chosen).unwrap(); |
| 496 | +추가: let dialogs = TestDialogs::default(); |
| 497 | +추가: dialogs |
| 498 | +추가: .0 |
| 499 | +추가: .borrow_mut() |
| 500 | +추가: .answers |
| 501 | +추가: .push_back(Some(vec![chosen.clone()])); |
| 502 | +추가: s.app.set_dialogs(Box::new(dialogs)); |
| 503 | +추가: } |
| 504 | +추가: policy_click( |
| 505 | +추가: &s.ctx, |
| 506 | +추가: &mut s.app, |
| 507 | +추가: if conflict { |
| 508 | +추가: "다른 폴더에 풀기" |
| 509 | +추가: } else { |
| 510 | +추가: "다시 시도" |
| 511 | +추가: }, |
| 512 | +추가: ); |
| 513 | +추가: assert!(matches!(s.factory.state.borrow().starts.last(), |
| 514 | +추가: Some(Start::Extract { selection, destination, .. }) |
| 515 | +추가: if selection == &original && (!conflict || destination == &chosen))); |
| 516 | +추가: } |
| 517 | +추가: } |
| 518 | +추가: } |