mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-27 19:48:14 -06:00
#2240 (on main before this round) took the Read tab out of the mode bar. #3010 and #3022 were written against a mode bar that still had it, so their five tests looked for a Read button that is gone. The tests now check All tools in its place where the scrolled content reaches under it (added text, the Fill & Sign type box). Page 1's text and the form's name field start right of All tools, so those tests check Edit, Convert and E-Sign, the tabs they lie under.
This commit is contained in:
@@ -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),
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user