PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust
Integration: mode-tab hand tests use the tabs the mode bar has (#2240 × #3010, #3022)
aiongg8341a721e07f
diff --git a/crates/ui-egui/tests/content.rs b/crates/ui-egui/tests/content.rsindex 2c2ad4c6b..d75de6118 100644--- a/crates/ui-egui/tests/content.rs+++ b/crates/ui-egui/tests/content.rs@@ -713,7 +713,7 @@ fn mode_tab(h: &Harness<'static, PdfCraftApp>, label: &str) -> egui::Rect {}/// Scroll the page until `what` (on screen) lies across the mode bar, then the cursor over each-/// tab it lies under: with the All tools panel closed, Read, Edit, Convert and E-Sign.+/// tab it lies under: with the All tools panel closed, every tab: All tools, Edit, Convert and E-Sign.fn mode_tab_cursors(h: &mut Harness<'static, PdfCraftApp>,what: impl Fn(&Harness<'static, PdfCraftApp>) -> egui::Rect,@@ -727,7 +727,7 @@ fn mode_tab_cursors(h.state_mut().views[0].goto = Some((0, (top - (tabs - y)) / page(h).height()));h.run_steps(4);let under = what(h);- ["Read", "Edit", "Convert", "E-Sign"].map(|label| {+ ["All tools", "Edit", "Convert", "E-Sign"].map(|label| {let at = mode_tab(h, label).center();assert!(under.contains(at), "{under:?} lies under {label} at {at:?}");h.hover_at(at);@@ -737,7 +737,7 @@ fn mode_tab_cursors(}const HAND_ON_EVERY_TAB: [(&str, egui::CursorIcon); 4] = [- ("Read", egui::CursorIcon::PointingHand),+ ("All tools", egui::CursorIcon::PointingHand),("Edit", egui::CursorIcon::PointingHand),("Convert", egui::CursorIcon::PointingHand),("E-Sign", egui::CursorIcon::PointingHand),diff --git a/crates/ui-egui/tests/editing.rs b/crates/ui-egui/tests/editing.rsindex ebb910a3d..b0136a2bd 100644--- a/crates/ui-egui/tests/editing.rs+++ b/crates/ui-egui/tests/editing.rs@@ -5879,12 +5879,13 @@ fn mode_tab(h: &Harness<'static, PdfCraftApp>, label: &str) -> egui::Rect {}/// The cursor over each mode bar tab that page 1's text lies under, once that text is scrolled-/// up under the bar. With the All tools panel closed it lies under Read, Edit, Convert and E-Sign.-fn mode_tab_cursors(h: &mut Harness<'static, PdfCraftApp>, text: egui::Rect) -> [(&'static str, egui::CursorIcon); 4] {+/// up under the bar. With the All tools panel closed it lies under Edit, Convert and E-Sign; it+/// starts right of All tools.+fn mode_tab_cursors(h: &mut Harness<'static, PdfCraftApp>, text: egui::Rect) -> [(&'static str, egui::CursorIcon); 3] {h.state_mut().views[0].goto = Some((0, 0.5));h.run_steps(4);let offset = h.state().views[0].page_screen_rect(0).expect("on screen").top();- ["Read", "Edit", "Convert", "E-Sign"].map(|label| {+ ["Edit", "Convert", "E-Sign"].map(|label| {let at = mode_tab(h, label).center();assert!(text.translate(egui::vec2(0.0, offset)).contains(at), "the text lies under {label}");h.hover_at(at);@@ -5893,12 +5894,8 @@ fn mode_tab_cursors(h: &mut Harness<'static, PdfCraftApp>, text: egui::Rect) ->})}-const HAND_ON_EVERY_TAB: [(&str, egui::CursorIcon); 4] = [- ("Read", egui::CursorIcon::PointingHand),- ("Edit", egui::CursorIcon::PointingHand),- ("Convert", egui::CursorIcon::PointingHand),- ("E-Sign", egui::CursorIcon::PointingHand),-];+const HAND_ON_EVERY_TAB: [(&str, egui::CursorIcon); 3] =+ [("Edit", egui::CursorIcon::PointingHand), ("Convert", egui::CursorIcon::PointingHand), ("E-Sign", egui::CursorIcon::PointingHand)];/// Page 1's text block on screen, relative to the page's top edge, in the window as it is now.fn page_text(h: &Harness<'static, PdfCraftApp>) -> egui::Rect {diff --git a/crates/ui-egui/tests/fill_sign.rs b/crates/ui-egui/tests/fill_sign.rsindex 7a54fc2ca..77bab6e91 100644--- a/crates/ui-egui/tests/fill_sign.rs+++ b/crates/ui-egui/tests/fill_sign.rs@@ -1667,7 +1667,7 @@ fn mode_tab(h: &Harness<'static, PdfCraftApp>, label: &str) -> egui::Rect {}/// Scroll the page until `what` (on screen) lies across the mode bar, then the cursor over each-/// tab it lies under: with the All tools panel closed, Read, Edit, Convert and E-Sign.+/// tab it lies under: with the All tools panel closed, every tab: All tools, Edit, Convert and E-Sign.fn mode_tab_cursors(h: &mut Harness<'static, PdfCraftApp>,what: impl Fn(&Harness<'static, PdfCraftApp>) -> egui::Rect,@@ -1681,7 +1681,7 @@ fn mode_tab_cursors(h.state_mut().views[0].goto = Some((0, (top - (tabs - y)) / page(h).height()));h.run_steps(4);let under = what(h);- ["Read", "Edit", "Convert", "E-Sign"].map(|label| {+ ["All tools", "Edit", "Convert", "E-Sign"].map(|label| {let at = mode_tab(h, label).center();assert!(under.contains(at), "{under:?} lies under {label} at {at:?}");h.hover_at(at);@@ -1691,7 +1691,7 @@ fn mode_tab_cursors(}const HAND_ON_EVERY_TAB: [(&str, egui::CursorIcon); 4] = [- ("Read", egui::CursorIcon::PointingHand),+ ("All tools", egui::CursorIcon::PointingHand),("Edit", egui::CursorIcon::PointingHand),("Convert", egui::CursorIcon::PointingHand),("E-Sign", egui::CursorIcon::PointingHand),diff --git a/crates/ui-egui/tests/forms.rs b/crates/ui-egui/tests/forms.rsindex 1528d4c5e..efc27dc83 100644--- a/crates/ui-egui/tests/forms.rs+++ b/crates/ui-egui/tests/forms.rs@@ -1282,11 +1282,12 @@ fn mode_tab(h: &Harness<'static, PdfCraftApp>, label: &str) -> egui::Rect {}/// Scroll the page until `what` (on screen) lies across the mode bar, then the cursor over each-/// tab it lies under: with the All tools panel closed, Read, Edit, Convert and E-Sign.+/// tab it lies under: with the All tools panel closed, Edit, Convert and E-Sign (the name field+/// starts right of All tools).fn mode_tab_cursors(h: &mut Harness<'static, PdfCraftApp>,what: impl Fn(&Harness<'static, PdfCraftApp>) -> egui::Rect,-) -> [(&'static str, egui::CursorIcon); 4] {+) -> [(&'static str, egui::CursorIcon); 3] {let page = |h: &Harness<'static, PdfCraftApp>| h.state().views[0].page_screen_rect(0).expect("on screen");let y = what(h).center().y - page(h).top();let tabs = mode_tab(h, "Convert").center().y;@@ -1296,7 +1297,7 @@ fn mode_tab_cursors(h.state_mut().views[0].goto = Some((0, (top - (tabs - y)) / page(h).height()));h.run_steps(4);let under = what(h);- ["Read", "Edit", "Convert", "E-Sign"].map(|label| {+ ["Edit", "Convert", "E-Sign"].map(|label| {let at = mode_tab(h, label).center();assert!(under.contains(at), "{under:?} lies under {label} at {at:?}");h.hover_at(at);@@ -1305,12 +1306,8 @@ fn mode_tab_cursors(})}-const HAND_ON_EVERY_TAB: [(&str, egui::CursorIcon); 4] = [- ("Read", egui::CursorIcon::PointingHand),- ("Edit", egui::CursorIcon::PointingHand),- ("Convert", egui::CursorIcon::PointingHand),- ("E-Sign", egui::CursorIcon::PointingHand),-];+const HAND_ON_EVERY_TAB: [(&str, egui::CursorIcon); 3] =+ [("Edit", egui::CursorIcon::PointingHand), ("Convert", egui::CursorIcon::PointingHand), ("E-Sign", egui::CursorIcon::PointingHand)];/// A text field scrolled up under the mode bar leaves its tabs the hand (#2755). The field gave/// them its I-beam, and its open editor floated over them and took their clicks.