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

Side by Side Diff: ui/gfx/geometry/scale_unittest.cc

Issue 1315633002: gfx: Converge scale precision related differences to single class. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Corrected simple nit. Created 5 years, 3 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/geometry/scale.cc ('k') | ui/gfx/gfx.gyp » ('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) 2015 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 <limits>
6
7 #include "base/command_line.h"
8 #include "base/logging.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/gfx/geometry/scale.h"
11 #include "ui/gfx/switches.h"
12
13 namespace gfx {
14
15 TEST(ScaleTest, ScaleOperations) {
16 base::CommandLine::ForCurrentProcess()->AppendSwitch(
17 switches::kEnableFixedPrecisionScale);
18
19 Scale scale1(7.33907556533813f);
20 Scale scale2(7.33907508850098f);
21 Scale scale3(2.33907508850098f);
22
23 EXPECT_TRUE(scale1 == scale2);
24 EXPECT_FALSE(scale1 == scale3);
25
26 // For higher scale values (e.g. >= 10), the absolute values may get
27 // represented same as computed values.
28 EXPECT_FALSE(scale1.AbsoluteValue() == scale2.AbsoluteValue());
29
30 EXPECT_TRUE(scale2 != scale3);
31 EXPECT_TRUE(scale3 < scale1);
32 EXPECT_TRUE(scale1 > scale3);
33
34 scale3 = Scale(7.33907556533813f);
35 EXPECT_TRUE(scale1 == scale3);
36
37 Scale scale4(scale3);
38 EXPECT_TRUE(scale3 == scale4);
39 }
40
41 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/geometry/scale.cc ('k') | ui/gfx/gfx.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698