OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "platform/transforms/AffineTransform.h" | 5 #include "platform/transforms/AffineTransform.h" |
6 | 6 |
| 7 #include "platform/wtf/text/WTFString.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "wtf/text/WTFString.h" | |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 TEST(AffineTransformTest, ToString) { | 12 TEST(AffineTransformTest, ToString) { |
13 AffineTransform identity; | 13 AffineTransform identity; |
14 EXPECT_EQ("identity", identity.toString()); | 14 EXPECT_EQ("identity", identity.toString()); |
15 EXPECT_EQ("[1,0,0,\n0,1,0]", identity.toString(true)); | 15 EXPECT_EQ("[1,0,0,\n0,1,0]", identity.toString(true)); |
16 | 16 |
17 AffineTransform translation = AffineTransform::translation(7, 9); | 17 AffineTransform translation = AffineTransform::translation(7, 9); |
18 EXPECT_EQ("translation(7,9)", translation.toString()); | 18 EXPECT_EQ("translation(7,9)", translation.toString()); |
19 EXPECT_EQ("[1,0,7,\n0,1,9]", translation.toString(true)); | 19 EXPECT_EQ("[1,0,7,\n0,1,9]", translation.toString(true)); |
20 | 20 |
21 AffineTransform rotation; | 21 AffineTransform rotation; |
22 rotation.rotate(180); | 22 rotation.rotate(180); |
23 EXPECT_EQ("translation(0,0), scale(1,1), angle(180deg), remainder(1,0,0,1)", | 23 EXPECT_EQ("translation(0,0), scale(1,1), angle(180deg), remainder(1,0,0,1)", |
24 rotation.toString()); | 24 rotation.toString()); |
25 EXPECT_EQ("[-1,-1.22465e-16,0,\n1.22465e-16,-1,0]", rotation.toString(true)); | 25 EXPECT_EQ("[-1,-1.22465e-16,0,\n1.22465e-16,-1,0]", rotation.toString(true)); |
26 | 26 |
27 AffineTransform columnMajorConstructor(1, 4, 2, 5, 3, 6); | 27 AffineTransform columnMajorConstructor(1, 4, 2, 5, 3, 6); |
28 EXPECT_EQ("[1,2,3,\n4,5,6]", columnMajorConstructor.toString(true)); | 28 EXPECT_EQ("[1,2,3,\n4,5,6]", columnMajorConstructor.toString(true)); |
29 } | 29 } |
30 | 30 |
31 } // namespace blink | 31 } // namespace blink |
OLD | NEW |