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

Unified Diff: cc/base/math_util_unittest.cc

Issue 1321503002: cc: Do not create separate tilings for almost equal scale factors. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unrelated changes. Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: cc/base/math_util_unittest.cc
diff --git a/cc/base/math_util_unittest.cc b/cc/base/math_util_unittest.cc
index 9d44fba8ac034b9a7637bff7e0f70408fef11ca4..b7d1d141580445a2571c2796fde6f338be20735a 100644
--- a/cc/base/math_util_unittest.cc
+++ b/cc/base/math_util_unittest.cc
@@ -384,5 +384,17 @@ TEST(MathUtilTest, RoundDownUnderflow) {
EXPECT_TRUE(MathUtil::VerifyRoundDown<int16_t>(-123, 50));
}
+TEST(MathUtilTest, AlmostEqualFloats) {
+ float f1 = 7.33907556533813f;
+ float f2 = 7.33907508850098f;
+ float f3 = MathUtil::RoundToFixedPrecision(f1);
+ float f4 = MathUtil::RoundToFixedPrecision(f2);
+ float f5 = MathUtil::RoundToFixedPrecision(2.33907508850098f);
+
+ EXPECT_TRUE(f1 != f2);
+ EXPECT_TRUE(f3 == f4);
+ EXPECT_FALSE(f3 == f5);
+}
+
} // namespace
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698