K. Moon | 832a694 | 2022-10-31 20:11:31 +0000 | [diff] [blame] | 1 | // Copyright 2014 The PDFium Authors |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 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 | |
Lei Zhang | 3111d40 | 2022-04-18 22:24:07 +0000 | [diff] [blame] | 7 | #include <iterator> |
| 8 | |
Tom Sepez | 9a8a965 | 2017-03-03 15:03:59 -0800 | [diff] [blame] | 9 | #include "testing/gtest/include/gtest/gtest.h" |
Tom Sepez | 9a8a965 | 2017-03-03 15:03:59 -0800 | [diff] [blame] | 10 | |
Tom Sepez | d869446 | 2024-06-10 22:31:31 +0000 | [diff] [blame] | 11 | namespace { |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 12 | |
Tom Sepez | d869446 | 2024-06-10 22:31:31 +0000 | [diff] [blame] | 13 | struct TestCase { |
| 14 | int input; |
| 15 | int expected_output; |
| 16 | }; |
| 17 | |
| 18 | } // namespace |
| 19 | |
| 20 | TEST(XfaUtilsImpTest, XFA_MapRotation) { |
| 21 | static const TestCase kTestCases[] = { |
| 22 | {-1000000, 80}, {-361, 359}, {-360, 0}, {-359, 1}, {-91, 269}, |
| 23 | {-90, 270}, {-89, 271}, {-1, 359}, {0, 0}, {1, 1}, |
| 24 | {89, 89}, {90, 90}, {91, 91}, {359, 359}, {360, 0}, |
| 25 | {361, 1}, {100000, 280}}; |
| 26 | for (const TestCase& item : kTestCases) { |
| 27 | EXPECT_EQ(item.expected_output, XFA_MapRotation(item.input)); |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 28 | } |
| 29 | } |