Merge pull request #142 from Team-LJY/fix/work-window-stays-on-top
작업 창 가림과 로딩 중 빈 폴더 안내 수정
- 작성자
- LeeJunyoung
- 작성 시각
- 커밋
fc5e571a73ed8d22840c1f603b7cef945ade5db7
변경된 파일 6개
+351-10| @@ -52,6 +52,8 @@ cargo +1.99.1 build --locked --manifest-path experiments/rust-ui-memory-app/Carg | ||
| 52 | 52 | - search-empty: 검색 결과 없음. 검색 입력과 빈 결과 안내를 확인한다. |
| 53 | 53 | - password: 암호 입력 창. 입력칸과 보기, 취소, 확인 버튼 배치를 확인한다. |
| 54 | 54 | - password-retry: 두 번째 암호 입력 요청. 틀린 암호 안내와 입력칸 배치를 확인한다. |
| 55 | 추가: - archive-loading: 플랫폼과 관계없이 별도 작업 창으로 재현합니다. 최초 생성에서 포커스 정보가 아직 없을 때만 창을 올리며, 다른 앱에 포커스가 있는 상태에서 다시 표시할 때는 올리지 않습니다. 명령줄이나 더블클릭으로 압축파일을 연 직후의 목록 로딩입니다. 목록을 읽는 동안에는 "이 폴더는 비어 있습니다"를 표시하지 않아야 합니다. X11에서는 처음부터 작업 창이 부모 위에 보이고 부모를 클릭해도 유지되는지 확인합니다. 다른 앱으로 전환하면 작업 창이 그 앱 뒤로 내려가야 합니다. | |
| 56 | 추가: - archive-loading-in-parent: 플랫폼과 관계없이 부모 내부 창으로 재현합니다. 실제 앱은 Wayland에서 이 방식을 사용합니다. Wayland의 목록 로딩입니다. 네이티브 창 올리기를 지원하지 않는 환경에서는 같은 진행 화면을 부모 내부의 이동 가능한 창으로 표시합니다. 부모를 클릭해도 작업 화면이 가려지지 않고, 다른 앱이나 기본 파일 선택 창 위에 남지 않아야 합니다. 암호 입력 등 기존 모달이 열리면 작업 화면은 숨깁니다. 애니메이션은 사용하지 않습니다. | |
| 55 | 57 | - extract-progress: 압축 해제 중. 62% 진행 막대와 취소 버튼을 확인한다. |
| 56 | 58 | - extract-unknown: 전체 크기를 모르는 압축 해제. 진행 중 안내와 처리량을 확인한다. |
| 57 | 59 | - extract-complete: 압축 해제 완료. 완료 문구와 결과 행동을 확인한다. |
| @@ -74,6 +74,7 @@ const WORK_RESULT_MAX_HEIGHT: f32 = 220.0; | ||
| 74 | 74 | /// 부모 창 기준 상대 위치를 기억해 두고, 부모 창이 움직이면 같은 상대 위치로 따라감. |
| 75 | 75 | struct WorkWindow { |
| 76 | 76 | open: bool, |
| 77 | 추가: created: bool, | |
| 77 | 78 | initial: Option<egui::Pos2>, |
| 78 | 79 | offset: Option<egui::Vec2>, |
| 79 | 80 | parent: Option<egui::Pos2>, |
| @@ -86,6 +87,7 @@ impl Default for WorkWindow { | ||
| 86 | 87 | fn default() -> Self { |
| 87 | 88 | Self { |
| 88 | 89 | open: false, |
| 90 | 추가: created: false, | |
| 89 | 91 | initial: None, |
| 90 | 92 | offset: None, |
| 91 | 93 | parent: None, |
| @@ -112,16 +114,20 @@ impl WorkWindow { | ||
| 112 | 114 | let (parent, parent_focused, now) = ctx.input(|i| { |
| 113 | 115 | ( |
| 114 | 116 | i.viewport().outer_rect, |
| 115 | 삭제: i.viewport().focused.unwrap_or(false), | |
| 117 | 추가: i.viewport().focused, | |
| 116 | 118 | i.time, |
| 117 | 119 | ) |
| 118 | 120 | }); |
| 119 | 121 | let (child, child_focused) = ctx.input(|i| { |
| 120 | 삭제: i.raw.viewports.get(&id).map_or((None, false), |v| { | |
| 121 | 삭제: (v.outer_rect, v.focused.unwrap_or(false)) | |
| 122 | 추가: i.raw.viewports.get(&id).map_or((None, None), |v| { | |
| 123 | 추가: (v.outer_rect, v.focused) | |
| 122 | 124 | }) |
| 123 | 125 | }); |
| 124 | 삭제: if !self.open { | |
| 126 | 추가: let initial_focus_unknown = | |
| 127 | 추가: !self.created && parent_focused.is_none() && child_focused.is_none(); | |
| 128 | 추가: self.created = true; | |
| 129 | 추가: let opening = !self.open; | |
| 130 | 추가: if opening { | |
| 125 | 131 | // 처음 열 때 부모 창 가운데에 둠. 닫혔다 다시 열 때는 기억한 위치에 둠. |
| 126 | 132 | self.open = true; |
| 127 | 133 | self.initial = parent.map(|p| match self.offset { |
| @@ -165,7 +171,11 @@ impl WorkWindow { | ||
| 165 | 171 | .with_maximize_button(false) |
| 166 | 172 | .with_taskbar(false) |
| 167 | 173 | .with_window_level( |
| 168 | 삭제: if !native_dialog_open && (parent_focused || child_focused) { | |
| 174 | 추가: if !native_dialog_open | |
| 175 | 추가: && (initial_focus_unknown | |
| 176 | 추가: || parent_focused == Some(true) | |
| 177 | 추가: || child_focused == Some(true)) | |
| 178 | 추가: { | |
| 169 | 179 | egui::WindowLevel::AlwaysOnTop |
| 170 | 180 | } else { |
| 171 | 181 | egui::WindowLevel::Normal |
| @@ -218,6 +228,7 @@ pub struct ArchiveApp { | ||
| 218 | 228 | preview_return_focus: Option<egui::Id>, |
| 219 | 229 | preview_initial_focus: bool, |
| 220 | 230 | work: WorkWindow, |
| 231 | 추가: work_in_parent: bool, | |
| 221 | 232 | create_win: WorkWindow, |
| 222 | 233 | /// ZIP 만들기 창에서 보고 있는 폴더 (고른 폴더 기준 상대 경로, 비어 있으면 최상위). |
| 223 | 234 | create_folder: String, |
| @@ -289,6 +300,7 @@ impl ArchiveApp { | ||
| 289 | 300 | preview_return_focus: None, |
| 290 | 301 | preview_initial_focus: false, |
| 291 | 302 | work: WorkWindow::default(), |
| 303 | 추가: work_in_parent: false, | |
| 292 | 304 | create_win: WorkWindow::default(), |
| 293 | 305 | create_folder: String::new(), |
| 294 | 306 | create_listing: None, |
| @@ -332,6 +344,11 @@ impl ArchiveApp { | ||
| 332 | 344 | self.dialogs = dialogs; |
| 333 | 345 | } |
| 334 | 346 | |
| 347 | 추가: /// 창 순서를 지정할 수 없는 환경에서는 부모 안에 작업 화면을 그림. | |
| 348 | 추가: pub fn set_work_window_in_parent(&mut self, enabled: bool) { | |
| 349 | 추가: self.work_in_parent = enabled; | |
| 350 | 추가: } | |
| 351 | 추가: | |
| 335 | 352 | /// 운영체제가 창 테두리를 그려 주지 않을 때(GNOME Wayland) 제목 표시줄을 직접 그림. |
| 336 | 353 | pub fn set_custom_frame(&mut self, custom: bool) { |
| 337 | 354 | self.custom_frame = custom; |
| @@ -1085,7 +1102,11 @@ impl ArchiveApp { | ||
| 1085 | 1102 | ); |
| 1086 | 1103 | theme::status_text(ui, rect, &format!("선택 {selected}개"), half, Align::Max); |
| 1087 | 1104 | }); |
| 1088 | 삭제: if ctx.embed_viewports() && self.work_visible() && !self.limit_result_visible() { | |
| 1105 | 추가: if ctx.embed_viewports() | |
| 1106 | 추가: && !self.work_in_parent | |
| 1107 | 추가: && self.work_visible() | |
| 1108 | 추가: && !self.limit_result_visible() | |
| 1109 | 추가: { | |
| 1089 | 1110 | // 별도 창을 만들 수 없을 때만 쓰는 대체 배치. 목록을 가리지 않도록 하단에 둠. |
| 1090 | 1111 | egui::Panel::bottom("archive-work") |
| 1091 | 1112 | .frame(theme::panel(theme::PANEL).corner_radius(0)) |
| @@ -1515,7 +1536,9 @@ impl ArchiveApp { | ||
| 1515 | 1536 | ); |
| 1516 | 1537 | } |
| 1517 | 1538 | } |
| 1518 | 삭제: if rows.is_empty() { | |
| 1539 | 추가: if rows.is_empty() | |
| 1540 | 추가: && !(self.model.busy() && matches!(self.last_request, Some(Start::List { .. }))) | |
| 1541 | 추가: { | |
| 1519 | 1542 | ui.scope_builder(egui::UiBuilder::new().max_rect(clip), |ui| { |
| 1520 | 1543 | ui.centered_and_justified(|ui| { |
| 1521 | 1544 | ui.label(if self.search.is_empty() { |
| @@ -1918,7 +1941,7 @@ impl ArchiveApp { | ||
| 1918 | 1941 | self.work.open = false; |
| 1919 | 1942 | return; |
| 1920 | 1943 | } |
| 1921 | 삭제: if ctx.embed_viewports() { | |
| 1944 | 추가: if ctx.embed_viewports() && !self.work_in_parent { | |
| 1922 | 1945 | // 별도 창을 만들 수 없는 환경(시험 등)은 show()에서 하단에 그림. |
| 1923 | 1946 | return; |
| 1924 | 1947 | } |
| @@ -1941,6 +1964,43 @@ impl ArchiveApp { | ||
| 1941 | 1964 | } else { |
| 1942 | 1965 | "작업 결과".to_owned() |
| 1943 | 1966 | }; |
| 1967 | 추가: if self.work_in_parent { | |
| 1968 | 추가: // Wayland는 창 올리기를 지원하지 않으므로 부모 안에서 같은 내용을 그림. | |
| 1969 | 추가: let mut open = true; | |
| 1970 | 추가: let mut window = egui::Window::new(RichText::new(title).size(theme::FONT_SMALL)) | |
| 1971 | 추가: .id(egui::Id::new("archive-work-in-parent")) | |
| 1972 | 추가: .default_pos( | |
| 1973 | 추가: ctx.content_rect().center() - egui::vec2(WORK_WIDTH, self.work.height) / 2.0, | |
| 1974 | 추가: ) | |
| 1975 | 추가: .default_width(WORK_WIDTH) | |
| 1976 | 추가: .min_width(WORK_WIDTH) | |
| 1977 | 추가: .max_width(WORK_WIDTH) | |
| 1978 | 추가: .max_height(WORK_MAX_HEIGHT) | |
| 1979 | 추가: .collapsible(false) | |
| 1980 | 추가: .resizable(false) | |
| 1981 | 추가: .fade_in(false) | |
| 1982 | 추가: .fade_out(false) | |
| 1983 | 추가: .title_frame( | |
| 1984 | 추가: theme::panel(theme::STRIPE) | |
| 1985 | 추가: .inner_margin(egui::Margin::symmetric(16, 8)) | |
| 1986 | 추가: .corner_radius(0), | |
| 1987 | 추가: ) | |
| 1988 | 추가: .frame( | |
| 1989 | 추가: theme::panel(theme::PANEL) | |
| 1990 | 추가: .stroke(egui::Stroke::new(1.0, theme::BORDER)) | |
| 1991 | 추가: .corner_radius(0), | |
| 1992 | 추가: ); | |
| 1993 | 추가: if !self.model.busy() { | |
| 1994 | 추가: window = window.open(&mut open); | |
| 1995 | 추가: } | |
| 1996 | 추가: window.show(ctx, |ui| self.work_area(ui)); | |
| 1997 | 추가: if !open { | |
| 1998 | 추가: self.dismissed = true; | |
| 1999 | 추가: self.ui_error = None; | |
| 2000 | 추가: self.model.input_error = None; | |
| 2001 | 추가: } | |
| 2002 | 추가: return; | |
| 2003 | 추가: } | |
| 1944 | 2004 | let window_title = format!("{title} — Zipelo"); |
| 1945 | 2005 | let custom_frame = self.custom_frame; |
| 1946 | 2006 | let size = egui::vec2(WORK_WIDTH, self.work.height); |
| @@ -106,8 +106,7 @@ fn run() -> eframe::Result { | ||
| 106 | 106 | zipelo_ui_memory_app::archive_theme::apply(&cc.egui_ctx); |
| 107 | 107 | #[cfg(all(feature = "ui-fixture", debug_assertions))] |
| 108 | 108 | if let Some(scenario) = scenario { |
| 109 | 삭제: let mut app = scenario.build(); | |
| 110 | 삭제: app.set_custom_frame(custom_frame); | |
| 109 | 추가: let app = scenario.build_with_frame(custom_frame); | |
| 111 | 110 | return Ok(Box::new( |
| 112 | 111 | zipelo_ui_memory_app::archive_screen::scenarios::Preview::new( |
| 113 | 112 | app, |
| @@ -139,6 +138,7 @@ fn run() -> eframe::Result { | ||
| 139 | 138 | fixture, |
| 140 | 139 | ); |
| 141 | 140 | app.set_custom_frame(custom_frame); |
| 141 | 추가: app.set_work_window_in_parent(custom_frame); | |
| 142 | 142 | Ok(Box::new(app)) |
| 143 | 143 | }) |
| 144 | 144 | }, |
| @@ -128,7 +128,15 @@ fn every_listed_scenario_draws_and_keeps_its_expected_screen() { | ||
| 128 | 128 | assert!(app.model.list_id.as_ref().unwrap().is_split()); |
| 129 | 129 | assert!(!app.model.can_preview()); |
| 130 | 130 | } |
| 131 | 추가: if matches!(scenario.name, "archive-loading" | "archive-loading-in-parent") { | |
| 132 | 추가: assert!(app.model.busy()); | |
| 133 | 추가: assert!(app.model.list_id.is_none()); | |
| 134 | 추가: assert!(app.model.entries.is_empty()); | |
| 135 | 추가: assert!(!labels.contains("이 폴더는 비어 있습니다"), "{labels}"); | |
| 136 | 추가: } | |
| 137 | 추가: | |
| 131 | 138 | let expected = match scenario.name { |
| 139 | 추가: "archive-loading" | "archive-loading-in-parent" => "압축파일을 읽는 중", | |
| 132 | 140 | "split-archive" => "읽어주세요.txt", |
| 133 | 141 | "split-first-volume" => "첫 조각 여행.7z.001을 선택해 다시 여세요.", |
| 134 | 142 | "split-missing-volume" => "여행.7z.003 조각이 없습니다", |
| @@ -21,6 +21,8 @@ macro_rules! catalog { | ||
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | catalog! { |
| 24 | 추가: "archive-loading" => "목록 로딩 중 최초 작업 창의 표시 순서", | |
| 25 | 추가: "archive-loading-in-parent" => "Wayland의 부모 내부 목록 로딩 창", | |
| 24 | 26 | "recovery-progress" => "ZIP 복구 분석과 저장 확인 전 대기", |
| 25 | 27 | "recovery-complete" => "전체 항목을 검증한 복구본 저장 완료", |
| 26 | 28 | "recovery-partial" => "유실 항목이 있는 복구본과 경고", |
| @@ -256,6 +258,13 @@ impl Scenario { | ||
| 256 | 258 | }); |
| 257 | 259 | } |
| 258 | 260 | |
| 261 | 추가: /// 플랫폼 테두리만 적용하고 시나리오가 정한 작업 창 방식은 유지함. | |
| 262 | 추가: pub fn build_with_frame(self, custom_frame: bool) -> ArchiveApp { | |
| 263 | 추가: let mut app = self.build(); | |
| 264 | 추가: app.set_custom_frame(custom_frame); | |
| 265 | 추가: app | |
| 266 | 추가: } | |
| 267 | 추가: | |
| 259 | 268 | /// 실제 파일과 작업자를 사용하지 않고 기존 화면 상태를 준비함. |
| 260 | 269 | pub fn build(self) -> ArchiveApp { |
| 261 | 270 | let factory = FakeFactory::manual(); |
| @@ -275,6 +284,24 @@ impl Scenario { | ||
| 275 | 284 | "tar-xz" => "여행 자료.TaR.Xz", |
| 276 | 285 | _ => "여행 자료.zip", |
| 277 | 286 | }); |
| 287 | 추가: if matches!(self.name, "archive-loading" | "archive-loading-in-parent") { | |
| 288 | 추가: app.set_work_window_in_parent(self.name == "archive-loading-in-parent"); | |
| 289 | 추가: app.open_path(archive); | |
| 290 | 추가: { | |
| 291 | 추가: let mut state = state.borrow_mut(); | |
| 292 | 추가: state.frame(Event::Accepted { encryption: false }); | |
| 293 | 추가: state.frame(Event::Progress { | |
| 294 | 추가: stage: Stage::Read, | |
| 295 | 추가: processed: 38 << 20, | |
| 296 | 추가: total: Some(61 << 20), | |
| 297 | 추가: completed_entries: 0, | |
| 298 | 추가: }); | |
| 299 | 추가: } | |
| 300 | 추가: for _ in 0..64 { | |
| 301 | 추가: app.model.poll(); | |
| 302 | 추가: } | |
| 303 | 추가: return app; | |
| 304 | 추가: } | |
| 278 | 305 | app.model.archive = Some(archive.clone()); |
| 279 | 306 | app.model.entries = entries(self.name == "many-items"); |
| 280 | 307 | app.model.list_id = Some(ListId { |
| @@ -694,3 +694,247 @@ fn partial_limit_result_is_visible_in_main_modal_without_native_child() { | ||
| 694 | 694 | assert!(!shown.iter().any(|(text, _)| text == "한도를 늘려 다시 시도")); |
| 695 | 695 | assert_eq!(WORK_CHILD.with(|child| child.borrow().rendered), 0); |
| 696 | 696 | } |
| 697 | 추가: | |
| 698 | 추가: #[test] | |
| 699 | 추가: fn startup_work_window_is_above_parent_before_focus_is_reported() { | |
| 700 | 추가: let factory = FakeFactory::manual(); | |
| 701 | 추가: let mut app = ArchiveApp::new(Box::new(factory.clone()), Some("/sample.zip".into()), false); | |
| 702 | 추가: let ctx = egui::Context::default(); | |
| 703 | 추가: ctx.set_embed_viewports(false); | |
| 704 | 추가: install_work_child_renderer(); | |
| 705 | 추가: let mut raw = egui::RawInput { | |
| 706 | 추가: screen_rect: Some(egui::Rect::from_min_size( | |
| 707 | 추가: egui::Pos2::ZERO, | |
| 708 | 추가: egui::vec2(1060.0, 720.0), | |
| 709 | 추가: )), | |
| 710 | 추가: ..Default::default() | |
| 711 | 추가: }; | |
| 712 | 추가: raw.viewports | |
| 713 | 추가: .insert(egui::ViewportId::ROOT, egui::ViewportInfo::default()); | |
| 714 | 추가: let _ = ctx.run_ui(raw, |ui| app.show(ui)); | |
| 715 | 추가: WORK_CHILD.with(|child| { | |
| 716 | 추가: let child = child.borrow(); | |
| 717 | 추가: let (_, builder) = child | |
| 718 | 추가: .builders | |
| 719 | 추가: .iter() | |
| 720 | 추가: .find(|(id, _)| *id == egui::ViewportId::from_hash_of("archive-work")) | |
| 721 | 추가: .expect("작업 창이 처음부터 보여야 함"); | |
| 722 | 추가: assert_eq!(builder.window_level, Some(egui::WindowLevel::AlwaysOnTop)); | |
| 723 | 추가: }); | |
| 724 | 추가: } | |
| 725 | 추가: | |
| 726 | 추가: #[test] | |
| 727 | 추가: fn native_work_window_follows_app_focus_without_covering_other_apps() { | |
| 728 | 추가: let factory = FakeFactory::manual(); | |
| 729 | 추가: let mut app = ArchiveApp::new(Box::new(factory), Some("/sample.zip".into()), false); | |
| 730 | 추가: let ctx = egui::Context::default(); | |
| 731 | 추가: ctx.set_embed_viewports(false); | |
| 732 | 추가: install_work_child_renderer(); | |
| 733 | 추가: let id = egui::ViewportId::from_hash_of("archive-work"); | |
| 734 | 추가: for (parent, child, level) in [ | |
| 735 | 추가: (None, None, egui::WindowLevel::AlwaysOnTop), | |
| 736 | 추가: (Some(true), Some(false), egui::WindowLevel::AlwaysOnTop), | |
| 737 | 추가: (Some(false), Some(true), egui::WindowLevel::AlwaysOnTop), | |
| 738 | 추가: (Some(false), Some(false), egui::WindowLevel::Normal), | |
| 739 | 추가: (Some(true), Some(false), egui::WindowLevel::AlwaysOnTop), | |
| 740 | 추가: ] { | |
| 741 | 추가: let mut raw = egui::RawInput { | |
| 742 | 추가: screen_rect: Some(egui::Rect::from_min_size( | |
| 743 | 추가: egui::Pos2::ZERO, | |
| 744 | 추가: egui::vec2(1060.0, 720.0), | |
| 745 | 추가: )), | |
| 746 | 추가: ..Default::default() | |
| 747 | 추가: }; | |
| 748 | 추가: for (id, focus) in [(egui::ViewportId::ROOT, parent), (id, child)] { | |
| 749 | 추가: raw.viewports.insert( | |
| 750 | 추가: id, | |
| 751 | 추가: egui::ViewportInfo { | |
| 752 | 추가: focused: focus, | |
| 753 | 추가: ..Default::default() | |
| 754 | 추가: }, | |
| 755 | 추가: ); | |
| 756 | 추가: } | |
| 757 | 추가: let _ = ctx.run_ui(raw, |ui| app.show(ui)); | |
| 758 | 추가: WORK_CHILD.with(|child| { | |
| 759 | 추가: let child = child.borrow(); | |
| 760 | 추가: let (_, builder) = child | |
| 761 | 추가: .builders | |
| 762 | 추가: .iter() | |
| 763 | 추가: .rev() | |
| 764 | 추가: .find(|(window, _)| *window == id) | |
| 765 | 추가: .unwrap(); | |
| 766 | 추가: assert_eq!(builder.window_level, Some(level)); | |
| 767 | 추가: }); | |
| 768 | 추가: } | |
| 769 | 추가: } | |
| 770 | 추가: | |
| 771 | 추가: #[test] | |
| 772 | 추가: fn hosted_work_window_stays_in_parent_and_hides_for_native_picker() { | |
| 773 | 추가: let factory = FakeFactory::manual(); | |
| 774 | 추가: let mut app = ArchiveApp::new(Box::new(factory.clone()), Some("/sample.zip".into()), false); | |
| 775 | 추가: app.set_work_window_in_parent(true); | |
| 776 | 추가: let ctx = egui::Context::default(); | |
| 777 | 추가: ctx.set_embed_viewports(false); | |
| 778 | 추가: install_work_child_renderer(); | |
| 779 | 추가: for _ in 0..3 { | |
| 780 | 추가: policy_render(&ctx, &mut app, vec![]); | |
| 781 | 추가: } | |
| 782 | 추가: let shown = policy_render(&ctx, &mut app, vec![]); | |
| 783 | 추가: assert!( | |
| 784 | 추가: shown.iter().any(|(text, _)| text == "압축파일을 읽는 중"), | |
| 785 | 추가: "{shown:?}" | |
| 786 | 추가: ); | |
| 787 | 추가: assert!(shown.iter().any(|(text, _)| text == "취소")); | |
| 788 | 추가: assert!(WORK_CHILD.with(|child| child.borrow().builders.is_empty())); | |
| 789 | 추가: { | |
| 790 | 추가: let mut worker = factory.state.borrow_mut(); | |
| 791 | 추가: worker.finish(Outcome::Failed, Publication::None); | |
| 792 | 추가: for event in &mut worker.queue { | |
| 793 | 추가: if let HostEvent::Frame { | |
| 794 | 추가: event: Event::Terminal(terminal), | |
| 795 | 추가: .. | |
| 796 | 추가: } = event | |
| 797 | 추가: { | |
| 798 | 추가: terminal.error = Some(ErrorCode::Io); | |
| 799 | 추가: } | |
| 800 | 추가: } | |
| 801 | 추가: } | |
| 802 | 추가: for _ in 0..3 { | |
| 803 | 추가: policy_render(&ctx, &mut app, vec![]); | |
| 804 | 추가: } | |
| 805 | 추가: let dialogs = HeldDialogs::default(); | |
| 806 | 추가: app.set_dialogs(Box::new(dialogs.clone())); | |
| 807 | 추가: policy_click(&ctx, &mut app, "열기"); | |
| 808 | 추가: assert_eq!(dialogs.0.borrow().len(), 1); | |
| 809 | 추가: let shown = policy_render(&ctx, &mut app, vec![]); | |
| 810 | 추가: assert!( | |
| 811 | 추가: !shown | |
| 812 | 추가: .iter() | |
| 813 | 추가: .any(|(text, _)| text == "압축파일을 열지 못했습니다") | |
| 814 | 추가: ); | |
| 815 | 추가: dialogs.0.borrow()[0].send(Ok(None)).unwrap(); | |
| 816 | 추가: for _ in 0..3 { | |
| 817 | 추가: policy_render(&ctx, &mut app, vec![]); | |
| 818 | 추가: } | |
| 819 | 추가: let shown = policy_render(&ctx, &mut app, vec![]); | |
| 820 | 추가: assert!( | |
| 821 | 추가: shown | |
| 822 | 추가: .iter() | |
| 823 | 추가: .any(|(text, _)| text == "압축파일을 열지 못했습니다") | |
| 824 | 추가: ); | |
| 825 | 추가: } | |
| 826 | 추가: | |
| 827 | 추가: | |
| 828 | 추가: #[test] | |
| 829 | 추가: fn native_work_window_reopens_without_raising_over_another_app() { | |
| 830 | 추가: let mut app = zipelo_ui_memory_app::archive_screen::scenarios::parse("extract-complete") | |
| 831 | 추가: .unwrap() | |
| 832 | 추가: .build(); | |
| 833 | 추가: let ctx = egui::Context::default(); | |
| 834 | 추가: ctx.set_embed_viewports(false); | |
| 835 | 추가: install_work_child_renderer(); | |
| 836 | 추가: for _ in 0..3 { | |
| 837 | 추가: policy_render(&ctx, &mut app, vec![]); | |
| 838 | 추가: } | |
| 839 | 추가: let dialogs = HeldDialogs::default(); | |
| 840 | 추가: app.set_dialogs(Box::new(dialogs.clone())); | |
| 841 | 추가: policy_click(&ctx, &mut app, "열기"); | |
| 842 | 추가: assert_eq!(dialogs.0.borrow().len(), 1); | |
| 843 | 추가: let rendered = WORK_CHILD.with(|child| child.borrow().rendered); | |
| 844 | 추가: policy_render(&ctx, &mut app, vec![]); | |
| 845 | 추가: assert_eq!(WORK_CHILD.with(|child| child.borrow().rendered), rendered); | |
| 846 | 추가: dialogs.0.borrow()[0].send(Ok(None)).unwrap(); | |
| 847 | 추가: for focus in [Some(false), None] { | |
| 848 | 추가: let mut raw = egui::RawInput { | |
| 849 | 추가: screen_rect: Some(egui::Rect::from_min_size( | |
| 850 | 추가: egui::Pos2::ZERO, | |
| 851 | 추가: egui::vec2(1060.0, 720.0), | |
| 852 | 추가: )), | |
| 853 | 추가: ..Default::default() | |
| 854 | 추가: }; | |
| 855 | 추가: for id in [ | |
| 856 | 추가: egui::ViewportId::ROOT, | |
| 857 | 추가: egui::ViewportId::from_hash_of("archive-work"), | |
| 858 | 추가: ] { | |
| 859 | 추가: raw.viewports.insert( | |
| 860 | 추가: id, | |
| 861 | 추가: egui::ViewportInfo { | |
| 862 | 추가: focused: focus, | |
| 863 | 추가: ..Default::default() | |
| 864 | 추가: }, | |
| 865 | 추가: ); | |
| 866 | 추가: } | |
| 867 | 추가: let _ = ctx.run_ui(raw, |ui| app.show(ui)); | |
| 868 | 추가: WORK_CHILD.with(|child| { | |
| 869 | 추가: let child = child.borrow(); | |
| 870 | 추가: assert!(child.rendered > rendered); | |
| 871 | 추가: assert_eq!( | |
| 872 | 추가: child.builders.last().unwrap().1.window_level, | |
| 873 | 추가: Some(egui::WindowLevel::Normal) | |
| 874 | 추가: ); | |
| 875 | 추가: }); | |
| 876 | 추가: } | |
| 877 | 추가: } | |
| 878 | 추가: | |
| 879 | 추가: #[test] | |
| 880 | 추가: fn initial_work_window_respects_explicitly_absent_focus() { | |
| 881 | 추가: let mut app = ArchiveApp::new( | |
| 882 | 추가: Box::new(FakeFactory::manual()), | |
| 883 | 추가: Some("/sample.zip".into()), | |
| 884 | 추가: false, | |
| 885 | 추가: ); | |
| 886 | 추가: let ctx = egui::Context::default(); | |
| 887 | 추가: ctx.set_embed_viewports(false); | |
| 888 | 추가: install_work_child_renderer(); | |
| 889 | 추가: let mut raw = egui::RawInput { | |
| 890 | 추가: screen_rect: Some(egui::Rect::from_min_size( | |
| 891 | 추가: egui::Pos2::ZERO, | |
| 892 | 추가: egui::vec2(1060.0, 720.0), | |
| 893 | 추가: )), | |
| 894 | 추가: ..Default::default() | |
| 895 | 추가: }; | |
| 896 | 추가: raw.viewports.insert( | |
| 897 | 추가: egui::ViewportId::ROOT, | |
| 898 | 추가: egui::ViewportInfo { | |
| 899 | 추가: focused: Some(false), | |
| 900 | 추가: ..Default::default() | |
| 901 | 추가: }, | |
| 902 | 추가: ); | |
| 903 | 추가: let _ = ctx.run_ui(raw, |ui| app.show(ui)); | |
| 904 | 추가: WORK_CHILD.with(|child| { | |
| 905 | 추가: assert_eq!( | |
| 906 | 추가: child.borrow().builders.last().unwrap().1.window_level, | |
| 907 | 추가: Some(egui::WindowLevel::Normal) | |
| 908 | 추가: ); | |
| 909 | 추가: }); | |
| 910 | 추가: } | |
| 911 | 추가: | |
| 912 | 추가: #[test] | |
| 913 | 추가: fn scenario_window_hosting_survives_platform_frame_configuration() { | |
| 914 | 추가: for custom_frame in [false, true] { | |
| 915 | 추가: for (name, hosted) in [ | |
| 916 | 추가: ("archive-loading", false), | |
| 917 | 추가: ("archive-loading-in-parent", true), | |
| 918 | 추가: ] { | |
| 919 | 추가: let scenario = zipelo_ui_memory_app::archive_screen::scenarios::parse(name).unwrap(); | |
| 920 | 추가: let mut app = scenario.build_with_frame(custom_frame); | |
| 921 | 추가: let ctx = egui::Context::default(); | |
| 922 | 추가: ctx.set_embed_viewports(false); | |
| 923 | 추가: install_work_child_renderer(); | |
| 924 | 추가: let mut shown = Vec::new(); | |
| 925 | 추가: for _ in 0..3 { | |
| 926 | 추가: shown = policy_render(&ctx, &mut app, vec![]); | |
| 927 | 추가: } | |
| 928 | 추가: assert_eq!( | |
| 929 | 추가: WORK_CHILD.with(|child| child.borrow().builders.is_empty()), | |
| 930 | 추가: hosted, | |
| 931 | 추가: "{name}, custom_frame={custom_frame}" | |
| 932 | 추가: ); | |
| 933 | 추가: assert_eq!( | |
| 934 | 추가: shown.iter().any(|(text, _)| text == "압축파일을 읽는 중"), | |
| 935 | 추가: hosted, | |
| 936 | 추가: "{name}, custom_frame={custom_frame}" | |
| 937 | 추가: ); | |
| 938 | 추가: } | |
| 939 | 추가: } | |
| 940 | 추가: } |