mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-26 03:49:11 +00:00
pipe editing-2: fixes for editing (9 tests)
This commit is contained in:
@@ -10090,8 +10090,8 @@ fn mode_tab_cursors(h: &mut Harness<'static, PdfCraftApp>, text: egui::Rect) ->
|
||||
})
|
||||
}
|
||||
|
||||
const HAND_ON_EVERY_TAB: [(&str, egui::CursorIcon); 3] =
|
||||
[("Edit", egui::CursorIcon::PointingHand), ("Convert", egui::CursorIcon::PointingHand), ("E-Sign", egui::CursorIcon::PointingHand)];
|
||||
const ARROW_ON_EVERY_TAB: [(&str, egui::CursorIcon); 3] =
|
||||
[("Edit", egui::CursorIcon::Default), ("Convert", egui::CursorIcon::Default), ("E-Sign", egui::CursorIcon::Default)];
|
||||
|
||||
/// 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 {
|
||||
@@ -10103,7 +10103,7 @@ fn page_text(h: &Harness<'static, PdfCraftApp>) -> egui::Rect {
|
||||
egui::Rect::from_two_pos(at(block.rect[0], block.rect[1]), at(block.rect[2], block.rect[3]))
|
||||
}
|
||||
|
||||
/// Text scrolled up under the mode bar leaves its tabs the hand (#2755). The Select tool's
|
||||
/// Text scrolled up under the mode bar leaves its tabs the arrow (#2755). The Select tool's
|
||||
/// text layer showed its I-beam there, over chrome that hides the page.
|
||||
#[test]
|
||||
fn mode_tabs_keep_the_hand_over_page_text_scrolled_under_them() {
|
||||
@@ -10121,7 +10121,7 @@ fn mode_tabs_keep_the_hand_over_page_text_scrolled_under_them() {
|
||||
cursor == egui::CursorIcon::Text
|
||||
});
|
||||
assert!(text_cursor, "the I-beam over page text, not {cursor:?}");
|
||||
assert_eq!(mode_tab_cursors(&mut h, text), HAND_ON_EVERY_TAB);
|
||||
assert_eq!(mode_tab_cursors(&mut h, text), ARROW_ON_EVERY_TAB);
|
||||
}
|
||||
|
||||
/// Edit text, then the All tools panel closed, as reported (#2755): a paragraph scrolled up
|
||||
@@ -10134,14 +10134,14 @@ fn mode_tabs_keep_the_hand_over_a_paragraph_scrolled_under_them() {
|
||||
h.set_option("left", "closed").unwrap();
|
||||
h.run_steps(4);
|
||||
let text = page_text(&h);
|
||||
assert_eq!(mode_tab_cursors(&mut h, text), HAND_ON_EVERY_TAB, "a closed paragraph under the tabs");
|
||||
assert_eq!(mode_tab_cursors(&mut h, text), ARROW_ON_EVERY_TAB, "a closed paragraph under the tabs");
|
||||
// Open it, where it shows.
|
||||
h.state_mut().views[0].view.go_to = Some(craft::pages::ui::GoTo::Top { page: 0, fraction: 0.3 });
|
||||
h.run_steps(4);
|
||||
let top = h.state().views[0].page_screen_rect(0).expect("on screen").top();
|
||||
click_at(&mut h, text.center() + egui::vec2(0.0, top));
|
||||
assert!(h.state().views[0].session.line_editor.is_some());
|
||||
assert_eq!(mode_tab_cursors(&mut h, text), HAND_ON_EVERY_TAB, "the open paragraph under the tabs");
|
||||
assert_eq!(mode_tab_cursors(&mut h, text), ARROW_ON_EVERY_TAB, "the open paragraph under the tabs");
|
||||
// Nor does the editor's frame, with the paragraph's top edge just under a tab (the frame
|
||||
// reaches 2 to 6 points outside it).
|
||||
let convert = mode_tab(&h, "Convert").center();
|
||||
@@ -10155,7 +10155,7 @@ fn mode_tabs_keep_the_hand_over_a_paragraph_scrolled_under_them() {
|
||||
assert!((page.top() + text.top() - convert.y - 4.0).abs() < 1.0, "Convert lies on the paragraph's frame");
|
||||
h.hover_at(convert);
|
||||
h.run_steps(2);
|
||||
assert_eq!(h.output().platform_output.cursor_icon, egui::CursorIcon::PointingHand, "the open paragraph's frame under a tab");
|
||||
assert_eq!(h.output().platform_output.cursor_icon, egui::CursorIcon::Default, "the open paragraph's frame under a tab");
|
||||
h.state_mut().views[0].view.go_to = Some(craft::pages::ui::GoTo::Top { page: 0, fraction: 0.5 });
|
||||
h.run_steps(4);
|
||||
click_at(&mut h, convert);
|
||||
|
||||
Reference in New Issue
Block a user