team-ljyzipelo

공개

작업 창 재표시의 포커스와 시나리오 방식을 유지함

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

변경된 파일 5개

+138-9
수정docs/ui-scenario-guide.md+2-2
@@ -52,8 +52,8 @@ cargo +1.99.1 build --locked --manifest-path experiments/rust-ui-memory-app/Carg
5252- search-empty: 검색 결과 없음. 검색 입력과 빈 결과 안내를 확인한다.
5353- password: 암호 입력 창. 입력칸과 보기, 취소, 확인 버튼 배치를 확인한다.
5454- password-retry: 두 번째 암호 입력 요청. 틀린 암호 안내와 입력칸 배치를 확인한다.
55삭제: - archive-loading: 명령줄이나 더블클릭으로 압축파일을 연 직후의 목록 로딩입니다. 목록을 읽는 동안에는 "이 폴더는 비어 있습니다"를 표시하지 않아야 합니다. X11에서는 처음부터 작업 창이 부모 위에 보이고 부모를 클릭해도 유지되는지 확인합니다. 다른 앱으로 전환하면 작업 창이 그 앱 뒤로 내려가야 합니다.
56삭제: - archive-loading-in-parent: Wayland의 목록 로딩입니다. 네이티브 창 올리기를 지원하지 않는 환경에서는 같은 진행 화면을 부모 내부의 이동 가능한 창으로 표시합니다. 부모를 클릭해도 작업 화면이 가려지지 않고, 다른 앱이나 기본 파일 선택 창 위에 남지 않아야 합니다. 암호 입력 등 기존 모달이 열리면 작업 화면은 숨깁니다. 애니메이션은 사용하지 않습니다.
55추가: - archive-loading: 플랫폼과 관계없이 별도 작업 창으로 재현합니다. 최초 생성에서 포커스 정보가 아직 없을 때만 창을 올리며, 다른 앱에 포커스가 있는 상태에서 다시 표시할 때는 올리지 않습니다. 명령줄이나 더블클릭으로 압축파일을 연 직후의 목록 로딩입니다. 목록을 읽는 동안에는 "이 폴더는 비어 있습니다"를 표시하지 않아야 합니다. X11에서는 처음부터 작업 창이 부모 위에 보이고 부모를 클릭해도 유지되는지 확인합니다. 다른 앱으로 전환하면 작업 창이 그 앱 뒤로 내려가야 합니다.
56추가: - archive-loading-in-parent: 플랫폼과 관계없이 부모 내부 창으로 재현합니다. 실제 앱은 Wayland에서 이 방식을 사용합니다. Wayland의 목록 로딩입니다. 네이티브 창 올리기를 지원하지 않는 환경에서는 같은 진행 화면을 부모 내부의 이동 가능한 창으로 표시합니다. 부모를 클릭해도 작업 화면이 가려지지 않고, 다른 앱이나 기본 파일 선택 창 위에 남지 않아야 합니다. 암호 입력 등 기존 모달이 열리면 작업 화면은 숨깁니다. 애니메이션은 사용하지 않습니다.
5757- extract-progress: 압축 해제 중. 62% 진행 막대와 취소 버튼을 확인한다.
5858- extract-unknown: 전체 크기를 모르는 압축 해제. 진행 중 안내와 처리량을 확인한다.
5959- extract-complete: 압축 해제 완료. 완료 문구와 결과 행동을 확인한다.
수정experiments/rust-ui-memory-app/src/archive_screen.rs+13-4
@@ -74,6 +74,7 @@ const WORK_RESULT_MAX_HEIGHT: f32 = 220.0;
7474/// 부모 창 기준 상대 위치를 기억해 두고, 부모 창이 움직이면 같은 상대 위치로 따라감.
7575struct WorkWindow {
7676 open: bool,
77추가: created: bool,
7778 initial: Option<egui::Pos2>,
7879 offset: Option<egui::Vec2>,
7980 parent: Option<egui::Pos2>,
@@ -86,6 +87,7 @@ impl Default for WorkWindow {
8687 fn default() -> Self {
8788 Self {
8889 open: false,
90추가: created: false,
8991 initial: None,
9092 offset: None,
9193 parent: None,
@@ -112,15 +114,18 @@ impl WorkWindow {
112114 let (parent, parent_focused, now) = ctx.input(|i| {
113115 (
114116 i.viewport().outer_rect,
115삭제: i.viewport().focused.unwrap_or(false),
117추가: i.viewport().focused,
116118 i.time,
117119 )
118120 });
119121 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)
122124 })
123125 });
126추가: let initial_focus_unknown =
127추가: !self.created && parent_focused.is_none() && child_focused.is_none();
128추가: self.created = true;
124129 let opening = !self.open;
125130 if opening {
126131 // 처음 열 때 부모 창 가운데에 둠. 닫혔다 다시 열 때는 기억한 위치에 둠.
@@ -166,7 +171,11 @@ impl WorkWindow {
166171 .with_maximize_button(false)
167172 .with_taskbar(false)
168173 .with_window_level(
169삭제: if !native_dialog_open && (opening || parent_focused || child_focused) {
174추가: if !native_dialog_open
175추가: && (initial_focus_unknown
176추가: || parent_focused == Some(true)
177추가: || child_focused == Some(true))
178추가: {
170179 egui::WindowLevel::AlwaysOnTop
171180 } else {
172181 egui::WindowLevel::Normal
수정experiments/rust-ui-memory-app/src/desktop.rs+1-3
@@ -106,9 +106,7 @@ fn run() -> eframe::Result {
106106 zipelo_ui_memory_app::archive_theme::apply(&cc.egui_ctx);
107107 #[cfg(all(feature = "ui-fixture", debug_assertions))]
108108 if let Some(scenario) = scenario {
109삭제: let mut app = scenario.build();
110삭제: app.set_custom_frame(custom_frame);
111삭제: app.set_work_window_in_parent(custom_frame);
109추가: let app = scenario.build_with_frame(custom_frame);
112110 return Ok(Box::new(
113111 zipelo_ui_memory_app::archive_screen::scenarios::Preview::new(
114112 app,
수정tests/rust-app-ui/scenarios.rs+7-0
@@ -258,6 +258,13 @@ impl Scenario {
258258 });
259259 }
260260
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추가:
261268 /// 실제 파일과 작업자를 사용하지 않고 기존 화면 상태를 준비함.
262269 pub fn build(self) -> ArchiveApp {
263270 let factory = FakeFactory::manual();
수정tests/rust-app-ui/work_window.rs+115-0
@@ -823,3 +823,118 @@ fn hosted_work_window_stays_in_parent_and_hides_for_native_picker() {
823823 .any(|(text, _)| text == "압축파일을 열지 못했습니다")
824824 );
825825}
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추가: }