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

Unified Diff: ui/gfx/transform_unittest.cc

Issue 2585263003: Avoid overflow when checking if a transform is integer translation. (Closed)
Patch Set: integer-transform Created 4 years 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
« no previous file with comments | « ui/gfx/transform.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/transform_unittest.cc
diff --git a/ui/gfx/transform_unittest.cc b/ui/gfx/transform_unittest.cc
index 8d99b6e69663402095401a7e6aeae2ff44a38c65..136f4198ceac01a792ad798edb17f43111cfdaf8 100644
--- a/ui/gfx/transform_unittest.cc
+++ b/ui/gfx/transform_unittest.cc
@@ -1345,6 +1345,16 @@ TEST(XFormTest, IntegerTranslation) {
transform.MakeIdentity();
transform.Translate3d(0, 0, 8.9f);
EXPECT_FALSE(transform.IsIdentityOrIntegerTranslation());
+
+ float max_int = std::numeric_limits<int>::max();
+ transform.MakeIdentity();
+ transform.Translate3d(0, 0, max_int + 1000.5f);
+ EXPECT_FALSE(transform.IsIdentityOrIntegerTranslation());
+
+ float max_float = std::numeric_limits<float>::max();
+ transform.MakeIdentity();
+ transform.Translate3d(0, 0, max_float - 0.5f);
+ EXPECT_FALSE(transform.IsIdentityOrIntegerTranslation());
}
TEST(XFormTest, verifyMatrixInversion) {
« no previous file with comments | « ui/gfx/transform.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698