Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1468)

Unified Diff: third_party/WebKit/Source/platform/transforms/AffineTransformTest.cpp

Issue 2265453003: Add platform/transforms pretty printers for logging and testing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused code Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/transforms/AffineTransformTest.cpp
diff --git a/third_party/WebKit/Source/platform/transforms/AffineTransformTest.cpp b/third_party/WebKit/Source/platform/transforms/AffineTransformTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..efa5922fd7446d5d55f4bb4ca64d64a25a1cabec
--- /dev/null
+++ b/third_party/WebKit/Source/platform/transforms/AffineTransformTest.cpp
@@ -0,0 +1,31 @@
+// Copyright 2016 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 "platform/transforms/AffineTransform.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+#include "wtf/text/WTFString.h"
+
+namespace blink {
+
+TEST(AffineTransformTest, ToString)
+{
+ AffineTransform identity;
+ EXPECT_EQ(String("identity"), identity.toString());
jbroman 2016/08/21 16:21:07 nit: You shouldn't need the String() wrapper on th
pdr. 2016/08/22 17:27:35 Done. I should remove these from the other tests i
+ EXPECT_EQ(String("[1,0,0,\n0,1,0]"), identity.toString(true));
+
+ AffineTransform translation = AffineTransform::translation(7, 9);
+ EXPECT_EQ(String("translation(7,9)"), translation.toString());
+ EXPECT_EQ(String("[1,0,7,\n0,1,9]"), translation.toString(true));
+
+ AffineTransform rotation;
+ rotation.rotate(180);
+ EXPECT_EQ(String("translation(0,0), scale(1,1), angle(3.14159rad), remainder(1,0,0,1)"), rotation.toString());
+ EXPECT_EQ(String("[-1,-1.22465e-16,0,\n1.22465e-16,-1,0]"), rotation.toString(true));
+
+ AffineTransform columnMajorConstructor(1, 4, 2, 5, 3, 6);
+ EXPECT_EQ(String("[1,2,3,\n4,5,6]"), columnMajorConstructor.toString(true));
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698