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

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

Issue 649203003: Type conversion fixes, ui/gfx/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 6 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
« no previous file with comments | « ui/gfx/geometry/safe_integer_conversions.h ('k') | ui/gfx/geometry/size.h » ('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 (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/geometry/safe_integer_conversions.h" 5 #include "ui/gfx/geometry/safe_integer_conversions.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 int int_max = std::numeric_limits<int>::max(); 89 int int_max = std::numeric_limits<int>::max();
90 int int_min = std::numeric_limits<int>::min(); 90 int int_min = std::numeric_limits<int>::min();
91 91
92 EXPECT_EQ(int_max, ToRoundedInt(infinity)); 92 EXPECT_EQ(int_max, ToRoundedInt(infinity));
93 EXPECT_EQ(int_max, ToRoundedInt(max)); 93 EXPECT_EQ(int_max, ToRoundedInt(max));
94 EXPECT_EQ(int_max, ToRoundedInt(max + 100)); 94 EXPECT_EQ(int_max, ToRoundedInt(max + 100));
95 95
96 EXPECT_EQ(-100, ToRoundedInt(-100.1f)); 96 EXPECT_EQ(-100, ToRoundedInt(-100.1f));
97 EXPECT_EQ(-101, ToRoundedInt(-100.5f)); 97 EXPECT_EQ(-101, ToRoundedInt(-100.5f));
98 EXPECT_EQ(-101, ToRoundedInt(-100.9f)); 98 EXPECT_EQ(-101, ToRoundedInt(-100.9f));
99 EXPECT_EQ(0, ToRoundedInt(0)); 99 EXPECT_EQ(0, ToRoundedInt(0.f));
100 EXPECT_EQ(100, ToRoundedInt(100.1f)); 100 EXPECT_EQ(100, ToRoundedInt(100.1f));
101 EXPECT_EQ(101, ToRoundedInt(100.5f)); 101 EXPECT_EQ(101, ToRoundedInt(100.5f));
102 EXPECT_EQ(101, ToRoundedInt(100.9f)); 102 EXPECT_EQ(101, ToRoundedInt(100.9f));
103 103
104 EXPECT_EQ(int_min, ToRoundedInt(-infinity)); 104 EXPECT_EQ(int_min, ToRoundedInt(-infinity));
105 EXPECT_EQ(int_min, ToRoundedInt(min)); 105 EXPECT_EQ(int_min, ToRoundedInt(min));
106 EXPECT_EQ(int_min, ToRoundedInt(min - 100)); 106 EXPECT_EQ(int_min, ToRoundedInt(min - 100));
107 } 107 }
108 108
109 } // namespace gfx 109 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/geometry/safe_integer_conversions.h ('k') | ui/gfx/geometry/size.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698