Skip to content

Commit

Permalink
[PDF Ink Signatures] Use more matchers in pdf_ink_module_unittest.cc
Browse files Browse the repository at this point in the history
Currently the StrokePageExitAndReentry test case constructs a
`PdfInkModule::PageStrokeInputPoints` and matches against that. Replace
this exact match with a set of matchers that do the same thing. Then the
test data can just be plain arrays.

Also fix a typo in the test case name.

Change-Id: I6916c21859178b519f7a94ef65f29655b9bb5d60
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5662519
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Andy Phan <andyphan@chromium.org>
Reviewed-by: Alan Screen <awscreen@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1320637}
  • Loading branch information
leizleiz authored and pull[bot] committed Jun 28, 2024
1 parent 0817d50 commit 1018230
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pdf/pdf_ink_module_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "ui/gfx/geometry/vector2d_f.h"

using testing::ElementsAre;
using testing::ElementsAreArray;
using testing::Pair;

namespace chrome_pdf {
Expand Down Expand Up @@ -553,7 +554,7 @@ TEST_F(PdfInkModuleStrokeTest, StrokeAcrossPages) {
ElementsAre(Pair(0, testing::SizeIs(1))));
}

TEST_F(PdfInkModuleStrokeTest, StrokePageExitAndRentry) {
TEST_F(PdfInkModuleStrokeTest, StrokePageExitAndReentry) {
EnableAnnotationMode();
InitializeVerticalTwoPageLayout();

Expand All @@ -571,13 +572,13 @@ TEST_F(PdfInkModuleStrokeTest, StrokePageExitAndRentry) {
kTwoPageVerticalLayoutPoint3InsidePage0,
/*expect_mouse_events_handled=*/true);

const PdfInkModule::StrokeInputPoints kSegment1 = {gfx::PointF(5.0f, 5.0f),
gfx::PointF(5.0f, 0.0f)};
const PdfInkModule::StrokeInputPoints kSegment2 = {gfx::PointF(10.0f, 0.0f),
gfx::PointF(10.0f, 5.0f)};
constexpr gfx::PointF kSegment1[] = {gfx::PointF(5.0f, 5.0f),
gfx::PointF(5.0f, 0.0f)};
constexpr gfx::PointF kSegment2[] = {gfx::PointF(10.0f, 0.0f),
gfx::PointF(10.0f, 5.0f)};
EXPECT_THAT(ink_module().GetStrokesInputPositionsForTesting(),
ElementsAre(Pair(0, PdfInkModule::PageStrokeInputPoints{
{kSegment1, kSegment2}})));
ElementsAre(Pair(0, ElementsAre(ElementsAreArray(kSegment1),
ElementsAreArray(kSegment2)))));
}

} // namespace
Expand Down

0 comments on commit 1018230

Please sign in to comment.