| | @@ -309,3 +309,89 @@ fn child_window_buttons_hover_again_after_title_bar_drag() { |
| 309 | 309 | assert!(hovered_red, "닫기 버튼에 마우스를 올린 배경이 없음"); |
| 310 | 310 | assert_eq!(cursor, Some(egui::CursorIcon::PointingHand)); |
| 311 | 311 | } |
| 312 | +추가: |
| 313 | +추가: #[test] |
| 314 | +추가: fn close_confirmation_is_not_covered_by_separate_work_window() { |
| 315 | +추가: let scratch = Folder::new(); |
| 316 | +추가: let factory = FakeFactory::default(); |
| 317 | +추가: let mut app = loaded(&scratch, &factory); |
| 318 | +추가: factory.state.borrow_mut().manual = true; |
| 319 | +추가: assert!(app.begin_extract()); |
| 320 | +추가: factory |
| 321 | +추가: .state |
| 322 | +추가: .borrow_mut() |
| 323 | +추가: .frame(Event::Accepted { encryption: false }); |
| 324 | +추가: let ctx = egui::Context::default(); |
| 325 | +추가: ctx.set_embed_viewports(false); |
| 326 | +추가: install_work_child_renderer(); |
| 327 | +추가: for _ in 0..6 { |
| 328 | +추가: policy_render(&ctx, &mut app, vec![]); |
| 329 | +추가: } |
| 330 | +추가: assert!(app.model.busy()); |
| 331 | +추가: assert!( |
| 332 | +추가: WORK_CHILD.with(|child| child.borrow().rendered) > 0, |
| 333 | +추가: "작업 중에는 진행 창이 떠 있어야 함" |
| 334 | +추가: ); |
| 335 | +추가: |
| 336 | +추가: // 작업 중 메인 창을 닫으면 메인 창 가운데에 종료 확인 창이 뜸. |
| 337 | +추가: app.model.request_close(); |
| 338 | +추가: assert_eq!(app.model.close, Close::Confirm); |
| 339 | +추가: policy_render(&ctx, &mut app, vec![]); |
| 340 | +추가: WORK_CHILD.with(|child| child.borrow_mut().rendered = 0); |
| 341 | +추가: let mut shown = Vec::new(); |
| 342 | +추가: for _ in 0..5 { |
| 343 | +추가: shown = policy_render(&ctx, &mut app, vec![]); |
| 344 | +추가: } |
| 345 | +추가: for label in ["작업 중 닫기", "계속 작업", "취소하고 닫기"] { |
| 346 | +추가: assert!(shown.iter().any(|(text, _)| text == label), "{label}"); |
| 347 | +추가: } |
| 348 | +추가: // 항상 위에 뜨는 진행 창이 확인 창을 가리지 않도록 그동안 진행 창을 그리지 않음. |
| 349 | +추가: assert_eq!( |
| 350 | +추가: WORK_CHILD.with(|child| child.borrow().rendered), |
| 351 | +추가: 0, |
| 352 | +추가: "종료 확인 중에 별도 진행 창이 떠 있음" |
| 353 | +추가: ); |
| 354 | +추가: |
| 355 | +추가: // 계속 작업을 고르면 진행 창이 다시 나타남. |
| 356 | +추가: app.model.keep_open(); |
| 357 | +추가: for _ in 0..3 { |
| 358 | +추가: policy_render(&ctx, &mut app, vec![]); |
| 359 | +추가: } |
| 360 | +추가: assert!(app.model.busy()); |
| 361 | +추가: assert!( |
| 362 | +추가: WORK_CHILD.with(|child| child.borrow().rendered) > 0, |
| 363 | +추가: "계속 작업을 고르면 진행 창이 다시 나타나야 함" |
| 364 | +추가: ); |
| 365 | +추가: |
| 366 | +추가: // 취소하고 닫기 뒤 정리를 기다리는 동안("종료 확인 중")도 가리지 않음. |
| 367 | +추가: app.model.request_close(); |
| 368 | +추가: app.model.confirm_close(); |
| 369 | +추가: assert_eq!(app.model.close, Close::Waiting); |
| 370 | +추가: policy_render(&ctx, &mut app, vec![]); |
| 371 | +추가: WORK_CHILD.with(|child| child.borrow_mut().rendered = 0); |
| 372 | +추가: for _ in 0..5 { |
| 373 | +추가: shown = policy_render(&ctx, &mut app, vec![]); |
| 374 | +추가: } |
| 375 | +추가: assert!(shown.iter().any(|(text, _)| text == "종료 확인 중")); |
| 376 | +추가: assert_eq!( |
| 377 | +추가: WORK_CHILD.with(|child| child.borrow().rendered), |
| 378 | +추가: 0, |
| 379 | +추가: "종료 확인 중에 별도 진행 창이 떠 있음" |
| 380 | +추가: ); |
| 381 | +추가: |
| 382 | +추가: // 정리가 끝나면 결과 확인 안내 없이 바로 닫히고, 그사이 결과 창도 뜨지 않음. |
| 383 | +추가: factory |
| 384 | +추가: .state |
| 385 | +추가: .borrow_mut() |
| 386 | +추가: .finish(Outcome::Cancelled, Publication::None); |
| 387 | +추가: for _ in 0..12 { |
| 388 | +추가: shown = policy_render(&ctx, &mut app, vec![]); |
| 389 | +추가: } |
| 390 | +추가: assert_eq!(app.model.close, Close::Allowed); |
| 391 | +추가: assert!(!shown.iter().any(|(text, _)| text == "결과 확인 후 닫기")); |
| 392 | +추가: assert_eq!( |
| 393 | +추가: WORK_CHILD.with(|child| child.borrow().rendered), |
| 394 | +추가: 0, |
| 395 | +추가: "닫히는 동안 별도 결과 창이 떠 있음" |
| 396 | +추가: ); |
| 397 | +추가: } |