Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion crates/ui-egui/src/dialogs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,8 @@ fn dialog_properties(ui: &mut egui::Ui, app: &mut PdfCraftApp, req: &mut Pending
for (m, n) in names {
ui.selectable_value(&mut v.magnification, m, n);
}
for p in [50.0, 75.0, 125.0, 150.0, 200.0] {
// 100% is saved as Actual Size is (/XYZ zoom 1), so it reads back as Actual Size.
for p in [25.0, 50.0, 75.0, 100.0, 125.0, 150.0, 200.0] {
Comment thread
Ethunxxx marked this conversation as resolved.
Resolved
ui.selectable_value(&mut v.magnification, M::Percent(p), format!("{p:.0}%"));
}
})
Expand Down
31 changes: 31 additions & 0 deletions crates/ui-egui/tests/it/viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,37 @@ fn initial_view_is_edited_and_honoured_on_open() {
assert_eq!((view.current, view.cover, app.right), (1, true, Some(pdfcraft_ui_egui::RightPanel::Bookmarks)));
}

#[test]
fn initial_view_magnification_offers_25_and_100_percent() {
use egui::accesskit::Role;
use pdfcraft_engine::Magnification;
let mut h = harness();
h.state_mut().dialog = Some(Dialog::Properties(pdfcraft_ui_egui::PropsTab::InitialView));
// The dialog's height settles a frame after it opens; egui centers from the previous size.
h.run_steps(6);
for (label, percent) in [("100%", 100.0), ("25%", 25.0)] {
h.get_by_role_and_label(Role::ComboBox, "Magnification").click();
h.run_steps(3);
// The list is taller than the popup, so the item may need scrolling into view.
h.get_by_role_and_label(Role::Button, label).scroll_to_me();
h.run_steps(3);
h.get_by_role_and_label(Role::Button, label).click();
h.run_steps(2);
let (_, v) = h.state().view_draft.as_ref().expect("seeded");
assert_eq!(v.magnification, Magnification::Percent(percent), "{label}");
}
h.get_by_label("OK").click();
h.run_steps(3);
let s = h.state();
let id = s.views[s.active.unwrap()].id;
assert_eq!(s.session.get(id).unwrap().initial_view().magnification, Magnification::Percent(25.0));
// Opening the saved file follows it.
let bytes = s.session.save_bytes(id).unwrap();
let mut app = PdfCraftApp::new();
app.open_bytes("again.pdf", None, bytes.to_vec()).unwrap();
assert_eq!(app.views[0].zoom, 0.25);
}

fn drag(h: &mut Harness<'static, PdfCraftApp>, a: egui::Pos2, b: egui::Pos2) {
h.hover_at(a);
h.run_steps(1);
Expand Down
2 changes: 1 addition & 1 deletion parity/acrobat-features.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3519,7 +3519,7 @@ milestone = "M4"
status = "shipped"
commands = ["file.properties"]
tools = ["doc_initial_view"]
evidence = ["crates/organize/src/view.rs::initial_view_resolves_indirect_boolean_preferences", "crates/ui-egui/tests/it/ui.rs::a_document_asking_for_full_screen_is_asked_about_first", "crates/organize/src/tests.rs::initial_view_round_trips_and_keeps_scripts", "crates/ui-egui/tests/it/viewer.rs::initial_view_is_edited_and_honoured_on_open", "crates/automation/tests/it/automation.rs::initial_view_through_tools", "crates/render/src/inspect/navigation.rs::a_go_to_action_opens_at_its_destination_explicit_or_named", "crates/ui-egui/tests/it/open_action.rs::an_xyz_open_action_puts_its_point_at_the_window_top_left", "crates/ui-egui/tests/it/open_action.rs::a_fith_open_action_puts_its_top_at_the_window_top", "crates/ui-egui/tests/it/open_action.rs::a_named_open_destination_opens_its_page", "crates/ui-egui/tests/it/open_action.rs::a_full_screen_document_shows_its_non_full_screen_panel_outside_full_screen", "crates/organize/src/tests.rs::an_unchanged_opening_destination_keeps_its_position_and_name", "crates/automation/tests/it/automation.rs::doc_info_reports_the_open_destination", "crates/organize/src/tests.rs::choosing_page_one_replaces_a_named_opening_destination", "crates/organize/src/tests.rs::a_named_opening_destination_is_kept_while_it_still_holds"]
evidence = ["crates/organize/src/view.rs::initial_view_resolves_indirect_boolean_preferences", "crates/ui-egui/tests/it/ui.rs::a_document_asking_for_full_screen_is_asked_about_first", "crates/organize/src/tests.rs::initial_view_round_trips_and_keeps_scripts", "crates/ui-egui/tests/it/viewer.rs::initial_view_is_edited_and_honoured_on_open", "crates/ui-egui/tests/it/viewer.rs::initial_view_magnification_offers_25_and_100_percent", "crates/automation/tests/it/automation.rs::initial_view_through_tools", "crates/render/src/inspect/navigation.rs::a_go_to_action_opens_at_its_destination_explicit_or_named", "crates/ui-egui/tests/it/open_action.rs::an_xyz_open_action_puts_its_point_at_the_window_top_left", "crates/ui-egui/tests/it/open_action.rs::a_fith_open_action_puts_its_top_at_the_window_top", "crates/ui-egui/tests/it/open_action.rs::a_named_open_destination_opens_its_page", "crates/ui-egui/tests/it/open_action.rs::a_full_screen_document_shows_its_non_full_screen_panel_outside_full_screen", "crates/organize/src/tests.rs::an_unchanged_opening_destination_keeps_its_position_and_name", "crates/automation/tests/it/automation.rs::doc_info_reports_the_open_destination", "crates/organize/src/tests.rs::choosing_page_one_replaces_a_named_opening_destination", "crates/organize/src/tests.rs::a_named_opening_destination_is_kept_while_it_still_holds"]
notes = "navigation panel, layout, magnification, page, window and interface options; honoured on open; script open actions kept. Open in Full Screen mode (/PageMode /FullScreen) asks first (Full Screen / Not now), as Acrobat does, instead of taking the screen. Window and interface options also read indirect boolean ViewerPreferences values. Missing: Acrobat's Full Screen preference to turn that alert off and its \"remember my choice for this document\" (misc.prefs-full-screen). On open the /OpenAction destination places the view as ISO 32000-2 Table 149 says (the /XYZ point at the window's top-left, /FitH and /FitV top or left at the edge), and a named destination (name or string, /Names /Dests tree or catalog /Dests, §12.3.2.4) resolves; Always use my default zoom keeps only the page. A full-screen document shows its /NonFullScreenPageMode panel outside full screen (Table 147). doc_info reports the opening destination. Document Properties keeps an opening action whose page and magnification are left alone, but still edits only those two; it shows a named destination's page and magnification, and choosing another page or magnification replaces the name with an explicit destination, except that page 1 at the default magnification removes /OpenAction so the first page opens. A name that resolves nowhere reads as page 1 and is kept until another page is chosen"

[[feature]]
Expand Down