[PDF Ink Signatures] Add EraseStrokesAcrossTwoPages test
Add PdfInkModuleStrokeTest.EraseStrokesAcrossTwoPages to check an eraser stroke across two pages erases strokes on both pages. Bug: 352720912 Change-Id: I377c18509ebabb498d71b25d7e3b03e746ccf812 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5787686 Reviewed-by: Andy Phan <andyphan@chromium.org> Reviewed-by: Alan Screen <awscreen@chromium.org> Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com> Commit-Queue: Lei Zhang <thestig@chromium.org> Cr-Commit-Position: refs/heads/main@{#1343087}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
9f10f38a7c
commit
4d12261e0a
@ -38,6 +38,7 @@ using testing::ElementsAre;
|
||||
using testing::ElementsAreArray;
|
||||
using testing::InSequence;
|
||||
using testing::Pair;
|
||||
using testing::SizeIs;
|
||||
|
||||
namespace chrome_pdf {
|
||||
|
||||
@ -598,7 +599,7 @@ TEST_F(PdfInkModuleStrokeTest, StrokeInsidePages) {
|
||||
base::span_from_ref(kTwoPageVerticalLayoutPoint2InsidePage0),
|
||||
kTwoPageVerticalLayoutPoint3InsidePage0);
|
||||
|
||||
EXPECT_THAT(StrokeInputPositions(), ElementsAre(Pair(0, testing::SizeIs(1))));
|
||||
EXPECT_THAT(StrokeInputPositions(), ElementsAre(Pair(0, SizeIs(1))));
|
||||
|
||||
// A stroke in the second page generates a stroke only for that page.
|
||||
ApplyStrokeWithMouseAtPoints(
|
||||
@ -606,8 +607,8 @@ TEST_F(PdfInkModuleStrokeTest, StrokeInsidePages) {
|
||||
base::span_from_ref(kTwoPageVerticalLayoutPoint2InsidePage1),
|
||||
kTwoPageVerticalLayoutPoint3InsidePage1);
|
||||
|
||||
EXPECT_THAT(StrokeInputPositions(), ElementsAre(Pair(0, testing::SizeIs(1)),
|
||||
Pair(1, testing::SizeIs(1))));
|
||||
EXPECT_THAT(StrokeInputPositions(),
|
||||
ElementsAre(Pair(0, SizeIs(1)), Pair(1, SizeIs(1))));
|
||||
}
|
||||
|
||||
TEST_F(PdfInkModuleStrokeTest, StrokeAcrossPages) {
|
||||
@ -624,7 +625,7 @@ TEST_F(PdfInkModuleStrokeTest, StrokeAcrossPages) {
|
||||
base::span_from_ref(kTwoPageVerticalLayoutPoint2InsidePage1),
|
||||
kTwoPageVerticalLayoutPoint3InsidePage1);
|
||||
|
||||
EXPECT_THAT(StrokeInputPositions(), ElementsAre(Pair(0, testing::SizeIs(1))));
|
||||
EXPECT_THAT(StrokeInputPositions(), ElementsAre(Pair(0, SizeIs(1))));
|
||||
}
|
||||
|
||||
TEST_F(PdfInkModuleStrokeTest, StrokePageExitAndReentry) {
|
||||
@ -777,6 +778,42 @@ TEST_F(PdfInkModuleStrokeTest, EraseStrokeErasesTwoStrokes) {
|
||||
EXPECT_EQ(3, client().stroke_finished_count());
|
||||
}
|
||||
|
||||
TEST_F(PdfInkModuleStrokeTest, EraseStrokesAcrossTwoPages) {
|
||||
EnableAnnotationMode();
|
||||
InitializeVerticalTwoPageLayout();
|
||||
|
||||
// Start out without any strokes.
|
||||
EXPECT_TRUE(StrokeInputPositions().empty());
|
||||
EXPECT_EQ(0, client().stroke_finished_count());
|
||||
|
||||
// A stroke in the first page generates a stroke only for that page.
|
||||
ApplyStrokeWithMouseAtPoints(
|
||||
kTwoPageVerticalLayoutPoint1InsidePage0,
|
||||
base::span_from_ref(kTwoPageVerticalLayoutPoint2InsidePage0),
|
||||
kTwoPageVerticalLayoutPoint3InsidePage0);
|
||||
EXPECT_THAT(StrokeInputPositions(), ElementsAre(Pair(0, SizeIs(1))));
|
||||
EXPECT_EQ(1, client().stroke_finished_count());
|
||||
|
||||
// A stroke in the second page generates a stroke only for that page.
|
||||
ApplyStrokeWithMouseAtPoints(
|
||||
kTwoPageVerticalLayoutPoint1InsidePage1,
|
||||
base::span_from_ref(kTwoPageVerticalLayoutPoint2InsidePage1),
|
||||
kTwoPageVerticalLayoutPoint3InsidePage1);
|
||||
EXPECT_THAT(StrokeInputPositions(),
|
||||
ElementsAre(Pair(0, SizeIs(1)), Pair(1, SizeIs(1))));
|
||||
EXPECT_EQ(2, client().stroke_finished_count());
|
||||
|
||||
// Erasing across the two pages should erase everything.
|
||||
SelectEraserTool();
|
||||
ApplyStrokeWithMouseAtPoints(
|
||||
kTwoPageVerticalLayoutPoint1InsidePage0,
|
||||
std::vector<gfx::PointF>{kTwoPageVerticalLayoutPoint2InsidePage0,
|
||||
kTwoPageVerticalLayoutPoint1InsidePage1},
|
||||
kTwoPageVerticalLayoutPoint3InsidePage1);
|
||||
EXPECT_TRUE(VisibleStrokeInputPositions().empty());
|
||||
EXPECT_EQ(3, client().stroke_finished_count());
|
||||
}
|
||||
|
||||
TEST_F(PdfInkModuleStrokeTest, EraseStrokePageExitAndReentry) {
|
||||
EnableAnnotationMode();
|
||||
InitializeVerticalTwoPageLayout();
|
||||
|
Reference in New Issue
Block a user