chromium/pdf/pdf_ink_transform_unittest.cc

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "pdf/pdf_ink_transform.h"

#include <array>

#include "pdf/ink/ink_affine_transform.h"
#include "pdf/page_orientation.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/geometry/vector2d_f.h"

namespace chrome_pdf {

namespace {

// Standard page size for tests.
constexpr gfx::Size kPageSizePortrait(50, 60);
constexpr gfx::Size kPageSizePortrait2x(kPageSizePortrait.width() * 2,
                                        kPageSizePortrait.height() * 2);
constexpr gfx::Size kPageSizeLandscape(kPageSizePortrait.height(),
                                       kPageSizePortrait.width());
constexpr gfx::Size kPageSizeLandscape2x(kPageSizeLandscape.width() * 2,
                                         kPageSizeLandscape.height() * 2);

// Scale factors used in tests.
constexpr float kScaleFactor1x =;
constexpr float kScaleFactor2x =;

// Standard page content area for tests.
constexpr gfx::Rect kPageContentAreaPortraitNoOffset(gfx::Point(),
                                                     kPageSizePortrait);
constexpr gfx::Rect kPageContentAreaPortraitNoOffset2x(gfx::Point(),
                                                       kPageSizePortrait2x);
constexpr gfx::Rect kPageContentAreaLandscapeNoOffset(gfx::Point(),
                                                      kPageSizeLandscape);

// Viewport origin offset used in tests.
constexpr gfx::Vector2dF kViewportOriginOffsetNone;

// Sample input positions in screen-based coordinates, based upon the standard
// page size.
constexpr gfx::PointF kInputPositionTopLeft;
constexpr gfx::PointF kInputPositionPortraitBottomRight(49.0f, 59.0f);
constexpr gfx::PointF kInputPositionLandscapeBottomRight(59.0f, 49.0f);
constexpr gfx::PointF kInputPositionPortraitBottomRight2x(99.0f, 119.0f);
constexpr gfx::PointF kInputPositionLandscapeBottomRight2x(119.0f, 99.0f);
constexpr gfx::PointF kInputPositionInterior(40.0f, 16.0f);
constexpr gfx::PointF kInputPositionInterior2x(80.0f, 32.0f);

// Sample canonical output positions.
constexpr gfx::PointF kCanonicalPositionTopLeft;
constexpr gfx::PointF kCanonicalPositionTopRight(49.0f, 0.0f);
constexpr gfx::PointF kCanonicalPositionBottomLeft(0.0f, 59.0f);
constexpr gfx::PointF kCanonicalPositionBottomRight(49.0f, 59.0f);

// Canonical positions can have fractional parts if the scale factor was
// not 1.0. When converting from a scale of 2x, the canonical position can end
// up with an additional half.
constexpr gfx::Vector2dF kCanonicalPositionHalf(0.5f, 0.5f);
constexpr gfx::Vector2dF kCanonicalPositionHalfX(0.5f, 0.0f);
constexpr gfx::Vector2dF kCanonicalPositionHalfY(0.0f, 0.5f);

struct InputOutputPair {};

}  // namespace

TEST(PdfInkTransformTest, EventPositionToCanonicalPositionIdentity) {}

TEST(PdfInkTransformTest, EventPositionToCanonicalPositionZoom) {}

TEST(PdfInkTransformTest, EventPositionToCanonicalPositionRotateClockwise90) {}

TEST(PdfInkTransformTest, EventPositionToCanonicalPositionRotateClockwise180) {}

TEST(PdfInkTransformTest, EventPositionToCanonicalPositionRotateClockwise270) {}

TEST(PdfInkTransformTest, EventPositionToCanonicalPositionScrolled) {}

TEST(PdfInkTransformTest,
     EventPositionToCanonicalPositionZoomScrolledClockwise90) {}

TEST(PdfInkTransformTest, RenderTransformIdentity) {}

TEST(PdfInkTransformTest, RenderTransformZoom) {}

TEST(PdfInkTransformTest, RenderTransformRotateClockwise90) {}

TEST(PdfInkTransformTest, RenderTransformRotateClockwise180) {}

TEST(PdfInkTransformTest, RenderTransformRotateClockwise270) {}

TEST(PdfInkTransformTest, RenderTransformScrolled) {}

TEST(PdfInkTransformTest, RenderTransformOffsetScrolled) {}

TEST(PdfInkTransformTest, RenderTransformZoomScrolledClockwise90) {}

TEST(PdfInkTransformTest, RenderTransformOffsetZoomScrolledClockwise90) {}

}  // namespace chrome_pdf