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

Side by Side 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 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "cc/test/geometry_test_utils.h" 5 #include "cc/test/geometry_test_utils.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h"
8 #include <public/WebTransformationMatrix.h> 7 #include <public/WebTransformationMatrix.h>
9 8
9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/gfx/transform.h"
11
10 namespace WebKitTests { 12 namespace WebKitTests {
11 13
14 // NOTE: even though transform data types use double precision, we only check
15 // for equality within single-precision error bounds because many transforms
16 // originate from single-precision data types such as quads/rects/etc.
17
12 void ExpectTransformationMatrixEq(const WebKit::WebTransformationMatrix& expecte d, 18 void ExpectTransformationMatrixEq(const WebKit::WebTransformationMatrix& expecte d,
13 const WebKit::WebTransformationMatrix& actual) 19 const WebKit::WebTransformationMatrix& actual)
14 { 20 {
15 EXPECT_FLOAT_EQ((expected).m11(), (actual).m11()); 21 EXPECT_FLOAT_EQ((expected).m11(), (actual).m11());
16 EXPECT_FLOAT_EQ((expected).m12(), (actual).m12()); 22 EXPECT_FLOAT_EQ((expected).m12(), (actual).m12());
17 EXPECT_FLOAT_EQ((expected).m13(), (actual).m13()); 23 EXPECT_FLOAT_EQ((expected).m13(), (actual).m13());
18 EXPECT_FLOAT_EQ((expected).m14(), (actual).m14()); 24 EXPECT_FLOAT_EQ((expected).m14(), (actual).m14());
19 EXPECT_FLOAT_EQ((expected).m21(), (actual).m21()); 25 EXPECT_FLOAT_EQ((expected).m21(), (actual).m21());
20 EXPECT_FLOAT_EQ((expected).m22(), (actual).m22()); 26 EXPECT_FLOAT_EQ((expected).m22(), (actual).m22());
21 EXPECT_FLOAT_EQ((expected).m23(), (actual).m23()); 27 EXPECT_FLOAT_EQ((expected).m23(), (actual).m23());
22 EXPECT_FLOAT_EQ((expected).m24(), (actual).m24()); 28 EXPECT_FLOAT_EQ((expected).m24(), (actual).m24());
23 EXPECT_FLOAT_EQ((expected).m31(), (actual).m31()); 29 EXPECT_FLOAT_EQ((expected).m31(), (actual).m31());
24 EXPECT_FLOAT_EQ((expected).m32(), (actual).m32()); 30 EXPECT_FLOAT_EQ((expected).m32(), (actual).m32());
25 EXPECT_FLOAT_EQ((expected).m33(), (actual).m33()); 31 EXPECT_FLOAT_EQ((expected).m33(), (actual).m33());
26 EXPECT_FLOAT_EQ((expected).m34(), (actual).m34()); 32 EXPECT_FLOAT_EQ((expected).m34(), (actual).m34());
27 EXPECT_FLOAT_EQ((expected).m41(), (actual).m41()); 33 EXPECT_FLOAT_EQ((expected).m41(), (actual).m41());
28 EXPECT_FLOAT_EQ((expected).m42(), (actual).m42()); 34 EXPECT_FLOAT_EQ((expected).m42(), (actual).m42());
29 EXPECT_FLOAT_EQ((expected).m43(), (actual).m43()); 35 EXPECT_FLOAT_EQ((expected).m43(), (actual).m43());
30 EXPECT_FLOAT_EQ((expected).m44(), (actual).m44()); 36 EXPECT_FLOAT_EQ((expected).m44(), (actual).m44());
31 } 37 }
32 38
39 void ExpectTransformationMatrixEq(const gfx::Transform& expected,
40 const gfx::Transform& actual)
41 {
42 EXPECT_FLOAT_EQ((expected).matrix().getDouble(0, 0), (actual).matrix().getDo uble(0, 0));
43 EXPECT_FLOAT_EQ((expected).matrix().getDouble(1, 0), (actual).matrix().getDo uble(1, 0));
44 EXPECT_FLOAT_EQ((expected).matrix().getDouble(2, 0), (actual).matrix().getDo uble(2, 0));
45 EXPECT_FLOAT_EQ((expected).matrix().getDouble(3, 0), (actual).matrix().getDo uble(3, 0));
46 EXPECT_FLOAT_EQ((expected).matrix().getDouble(0, 1), (actual).matrix().getDo uble(0, 1));
47 EXPECT_FLOAT_EQ((expected).matrix().getDouble(1, 1), (actual).matrix().getDo uble(1, 1));
48 EXPECT_FLOAT_EQ((expected).matrix().getDouble(2, 1), (actual).matrix().getDo uble(2, 1));
49 EXPECT_FLOAT_EQ((expected).matrix().getDouble(3, 1), (actual).matrix().getDo uble(3, 1));
50 EXPECT_FLOAT_EQ((expected).matrix().getDouble(0, 2), (actual).matrix().getDo uble(0, 2));
51 EXPECT_FLOAT_EQ((expected).matrix().getDouble(1, 2), (actual).matrix().getDo uble(1, 2));
52 EXPECT_FLOAT_EQ((expected).matrix().getDouble(2, 2), (actual).matrix().getDo uble(2, 2));
53 EXPECT_FLOAT_EQ((expected).matrix().getDouble(3, 2), (actual).matrix().getDo uble(3, 2));
54 EXPECT_FLOAT_EQ((expected).matrix().getDouble(0, 3), (actual).matrix().getDo uble(0, 3));
55 EXPECT_FLOAT_EQ((expected).matrix().getDouble(1, 3), (actual).matrix().getDo uble(1, 3));
56 EXPECT_FLOAT_EQ((expected).matrix().getDouble(2, 3), (actual).matrix().getDo uble(2, 3));
57 EXPECT_FLOAT_EQ((expected).matrix().getDouble(3, 3), (actual).matrix().getDo uble(3, 3));
58 }
59
33 } // namespace WebKitTests 60 } // namespace WebKitTests
OLDNEW
« 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