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

Unified Diff: cc/test/geometry_test_utils.cc

Issue 11308153: Migrate most of cc/ from WebKit::WebTransformationMatrix to gfx::Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch for landing Created 8 years, 1 month 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
« no previous file with comments | « cc/test/geometry_test_utils.h ('k') | cc/test/render_pass_test_common.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/geometry_test_utils.cc
diff --git a/cc/test/geometry_test_utils.cc b/cc/test/geometry_test_utils.cc
index 68afd4b0e5e64191153369b3c4446daa530d1323..0d5df9430e392536ebbd3faa7d8926f5950dd325 100644
--- a/cc/test/geometry_test_utils.cc
+++ b/cc/test/geometry_test_utils.cc
@@ -4,11 +4,17 @@
#include "cc/test/geometry_test_utils.h"
-#include "testing/gtest/include/gtest/gtest.h"
#include <public/WebTransformationMatrix.h>
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gfx/transform.h"
+
namespace WebKitTests {
+// NOTE: even though transform data types use double precision, we only check
+// for equality within single-precision error bounds because many transforms
+// originate from single-precision data types such as quads/rects/etc.
+
void ExpectTransformationMatrixEq(const WebKit::WebTransformationMatrix& expected,
const WebKit::WebTransformationMatrix& actual)
{
@@ -30,4 +36,25 @@ void ExpectTransformationMatrixEq(const WebKit::WebTransformationMatrix& expecte
EXPECT_FLOAT_EQ((expected).m44(), (actual).m44());
}
+void ExpectTransformationMatrixEq(const gfx::Transform& expected,
+ const gfx::Transform& actual)
+{
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(0, 0), (actual).matrix().getDouble(0, 0));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(1, 0), (actual).matrix().getDouble(1, 0));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(2, 0), (actual).matrix().getDouble(2, 0));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(3, 0), (actual).matrix().getDouble(3, 0));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(0, 1), (actual).matrix().getDouble(0, 1));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(1, 1), (actual).matrix().getDouble(1, 1));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(2, 1), (actual).matrix().getDouble(2, 1));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(3, 1), (actual).matrix().getDouble(3, 1));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(0, 2), (actual).matrix().getDouble(0, 2));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(1, 2), (actual).matrix().getDouble(1, 2));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(2, 2), (actual).matrix().getDouble(2, 2));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(3, 2), (actual).matrix().getDouble(3, 2));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(0, 3), (actual).matrix().getDouble(0, 3));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(1, 3), (actual).matrix().getDouble(1, 3));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(2, 3), (actual).matrix().getDouble(2, 3));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(3, 3), (actual).matrix().getDouble(3, 3));
+}
+
} // namespace WebKitTests
« no previous file with comments | « cc/test/geometry_test_utils.h ('k') | cc/test/render_pass_test_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698