| Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 1 | // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 5 | #include "xfa/fxfa/parser/xfa_utils.h" |
| 6 | |
| Tom Sepez | 9a8a965 | 2017-03-03 15:03:59 -0800 | [diff] [blame] | 7 | #include "testing/gtest/include/gtest/gtest.h" |
| Lei Zhang | 4501a50 | 2020-05-18 16:52:59 +0000 | [diff] [blame] | 8 | #include "third_party/base/stl_util.h" |
| Tom Sepez | 9a8a965 | 2017-03-03 15:03:59 -0800 | [diff] [blame] | 9 | |
| Tom Sepez | 64ee2c3 | 2017-04-24 15:04:25 -0700 | [diff] [blame] | 10 | TEST(XfaUtilsImpTest, XFA_MapRotation) { |
| Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 11 | struct TestCase { |
| 12 | int input; |
| 13 | int expected_output; |
| 14 | } TestCases[] = {{-1000000, 80}, {-361, 359}, {-360, 0}, {-359, 1}, |
| 15 | {-91, 269}, {-90, 270}, {-89, 271}, {-1, 359}, |
| 16 | {0, 0}, {1, 1}, {89, 89}, {90, 90}, |
| 17 | {91, 91}, {359, 359}, {360, 0}, {361, 1}, |
| 18 | {100000, 280}}; |
| 19 | |
| Lei Zhang | 4501a50 | 2020-05-18 16:52:59 +0000 | [diff] [blame] | 20 | for (size_t i = 0; i < pdfium::size(TestCases); ++i) { |
| Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 21 | EXPECT_EQ(TestCases[i].expected_output, |
| 22 | XFA_MapRotation(TestCases[i].input)); |
| 23 | } |
| 24 | } |