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

Side by Side Diff: ui/gfx/point3_unittest.cc

Issue 11367025: ui: Add the gfx::Vector3dF class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Just for git-try 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/point3_f.cc ('k') | ui/gfx/vector3d_f.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/gfx/point3_f.h"
6
7 #include "base/basictypes.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 namespace gfx {
11
12 TEST(Point3Test, VectorArithmetic) {
13 gfx::Point3F a(1.6f, 5.1f, 3.2f);
14 gfx::Vector3dF v1(3.1f, -3.2f, 9.3f);
15 gfx::Vector3dF v2(-8.1f, 1.2f, 3.3f);
16
17 static const struct {
18 gfx::Point3F expected;
19 gfx::Point3F actual;
20 } tests[] = {
21 { gfx::Point3F(4.7f, 1.9f, 12.5f), a + v1 },
22 { gfx::Point3F(-1.5f, 8.3f, -6.1f), a - v1 },
23 { a, a - v1 + v1 },
24 { a, a + v1 - v1 },
25 { a, a + gfx::Vector3dF() },
26 { gfx::Point3F(12.8f, 0.7f, 9.2f), a + v1 - v2 },
27 { gfx::Point3F(-9.6f, 9.5f, -2.8f), a - v1 + v2 }
28 };
29
30 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i)
31 EXPECT_EQ(tests[i].expected.ToString(),
32 tests[i].actual.ToString());
33 }
34
35 TEST(Point3Test, VectorFromPoints) {
36 gfx::Point3F a(1.6f, 5.2f, 3.2f);
37 gfx::Vector3dF v1(3.1f, -3.2f, 9.3f);
38
39 gfx::Point3F b(a + v1);
40 EXPECT_EQ((b - a).ToString(), v1.ToString());
41 }
42
43 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/point3_f.cc ('k') | ui/gfx/vector3d_f.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698