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

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

Issue 1071803003: Update matrix distance metric to account for snapping. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: grammar Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « ui/gfx/transform_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "ui/gfx/transform_util.h" 5 #include "ui/gfx/transform_util.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/gfx/geometry/point.h" 8 #include "ui/gfx/geometry/point.h"
9 #include "ui/gfx/geometry/point3_f.h" 9 #include "ui/gfx/geometry/point3_f.h"
10 #include "ui/gfx/geometry/rect.h" 10 #include "ui/gfx/geometry/rect.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 185
186 point = Point(0, 0); 186 point = Point(0, 0);
187 transform.TransformPoint(&point); 187 transform.TransformPoint(&point);
188 EXPECT_EQ(Point(-14, -24).ToString(), point.ToString()); 188 EXPECT_EQ(Point(-14, -24).ToString(), point.ToString());
189 189
190 point = Point(1, 1); 190 point = Point(1, 1);
191 transform.TransformPoint(&point); 191 transform.TransformPoint(&point);
192 EXPECT_EQ(Point(-11, -20).ToString(), point.ToString()); 192 EXPECT_EQ(Point(-11, -20).ToString(), point.ToString());
193 } 193 }
194 194
195 TEST(TransformUtilTest, MatrixDistance) {
196 Transform a;
197 Transform b(0, 1, 1, 1,
198 1, 0, 1, 1,
199 1, 1, 0, 1,
200 1, 1, 1, 0);
201 // Each entry in |a| should be 1 away from the corresponding entry in |b|.
202 // This means the matrix distance should be sqrt(num_entries) = 4.
203 EXPECT_EQ(4, MatrixDistance(a, b));
204
205 Transform c = b;
206 EXPECT_EQ(0, MatrixDistance(b, c));
207 }
208
209 } // namespace 195 } // namespace
210 } // namespace gfx 196 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/transform_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698