mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-31 13:37:35 -06:00
test(ui): the narrow-box tests check the text reaches the box's right edge
This commit is contained in:
@@ -756,8 +756,12 @@ fn the_text_editor_aligns_a_narrow_box_to_its_own_edge() {
|
||||
assert!(r.width() < 60.0, "the box is narrower than the editor: {}", r.width());
|
||||
let pixels = h.render().unwrap();
|
||||
let inside = ink(&pixels, r);
|
||||
let edge = ink(&pixels, egui::Rect::from_min_max(pos2(r.right() - r.width() * 0.25, r.min.y), r.max));
|
||||
let past = ink(&pixels, egui::Rect::from_min_max(pos2(r.right() + 2.0, r.min.y), pos2(r.right() + 40.0, r.max.y)));
|
||||
assert!(inside > 20 && past == 0, "the text is drawn in its box ({inside} dark pixels in it, {past} past its right edge)");
|
||||
assert!(
|
||||
inside > 20 && edge > 0 && past == 0,
|
||||
"the text is drawn in its box, up to its right edge ({inside} dark pixels in it, {edge} in its last quarter, {past} past it)"
|
||||
);
|
||||
}
|
||||
|
||||
fn mode_tab(h: &Harness<'static, PdfCraftApp>, label: &str) -> egui::Rect {
|
||||
|
||||
Reference in New Issue
Block a user