summaryrefslogtreecommitdiff
path: root/chromium/pdf/page_orientation_unittest.cc
blob: b7427180a1019652d2e97ec30c02def74c9a30b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "pdf/page_orientation.h"

#include "testing/gtest/include/gtest/gtest.h"

namespace chrome_pdf {
namespace {

TEST(PageOrientationTest, RotateClockwise) {
  EXPECT_EQ(RotateClockwise(PageOrientation::kOriginal),
            PageOrientation::kClockwise90);
  EXPECT_EQ(RotateClockwise(PageOrientation::kClockwise90),
            PageOrientation::kClockwise180);
  EXPECT_EQ(RotateClockwise(PageOrientation::kClockwise180),
            PageOrientation::kClockwise270);
  EXPECT_EQ(RotateClockwise(PageOrientation::kClockwise270),
            PageOrientation::kOriginal);
  EXPECT_EQ(RotateClockwise(PageOrientation::kLast),
            PageOrientation::kOriginal);
}

TEST(PageOrientationTest, RotateCounterclockwise) {
  EXPECT_EQ(RotateCounterclockwise(PageOrientation::kOriginal),
            PageOrientation::kClockwise270);
  EXPECT_EQ(RotateCounterclockwise(PageOrientation::kClockwise90),
            PageOrientation::kOriginal);
  EXPECT_EQ(RotateCounterclockwise(PageOrientation::kClockwise180),
            PageOrientation::kClockwise90);
  EXPECT_EQ(RotateCounterclockwise(PageOrientation::kClockwise270),
            PageOrientation::kClockwise180);
  EXPECT_EQ(RotateCounterclockwise(PageOrientation::kLast),
            PageOrientation::kClockwise180);
}

}  // namespace
}  // namespace chrome_pdf