Changeset 259704 in webkit
- Timestamp:
- Apr 7, 2020 10:46:25 PM (4 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r259699 r259704 1 2020-04-07 Fujii Hironori <Hironori.Fujii@sony.com> 2 3 [Clang 10] Fix -Wimplicit-int-float-conversion compilation warnings in TestWebKitAPI 4 https://bugs.webkit.org/show_bug.cgi?id=210067 5 6 Reviewed by Darin Adler. 7 8 There are test cases for overflow, non-overflow, underflow and 9 non-underflow edge cases in WTF.clampToIntegerFloat test. 10 maxPlusOne<int> can be used for overflow edge case, INT_MIN for 11 non-underflow. This change added code to calculate values for 12 non-overflow and underflow cases. 13 14 * TestWebKitAPI/Tests/WTF/MathExtras.cpp: 15 (TestWebKitAPI::TEST(WTF.clampToIntegerFloat)): 16 * TestWebKitAPI/Tests/WebCore/FloatRect.cpp: 17 (TestWebKitAPI::TEST(FloatRect.EnclosingIntRect)): Replaced 18 shiftMaxXEdgeTo(INT_MAX) with shiftMaxXEdgeTo(0) because it also 19 causes overflow for enclosingIntRect. 20 1 21 2020-04-07 Aakash Jain <aakash_jain@apple.com> 2 22 -
trunk/Tools/TestWebKitAPI/Tests/WTF/MathExtras.cpp
r245214 r259704 94 94 // due to the narrow mantissa. However it will properly checks within 95 95 // (close to the extreme) and outside the integer range. 96 float maxInt = std::numeric_limits<int>::max(); 96 float overflowInt = maxPlusOne<int>; 97 float maxInt = overflowInt; 98 for (int i = 0; overflowInt == maxInt; i++) 99 maxInt = overflowInt - i; 100 97 101 float minInt = std::numeric_limits<int>::min(); 98 float overflowInt = maxInt * 1.1; 99 float underflowInt = minInt * 1.1; 102 float underflowInt = minInt; 103 for (int i = 0; underflowInt == minInt; i++) 104 underflowInt = minInt - i; 100 105 101 106 EXPECT_GT(overflowInt, maxInt); 102 107 EXPECT_LT(underflowInt, minInt); 103 108 104 // If maxInt == 2^31 - 1 (ie on I32 architecture), the closest float used to represent it is 2^31. 105 EXPECT_NEAR(clampToInteger(maxInt), maxInt, 1); 106 EXPECT_EQ(clampToInteger(minInt), minInt); 107 108 EXPECT_NEAR(clampToInteger(overflowInt), maxInt, 1); 109 EXPECT_EQ(clampToInteger(underflowInt), minInt); 109 EXPECT_EQ(clampToInteger(maxInt), static_cast<int>(maxInt)); 110 EXPECT_EQ(clampToInteger(minInt), std::numeric_limits<int>::min()); 111 112 EXPECT_EQ(clampToInteger(overflowInt), std::numeric_limits<int>::max()); 113 EXPECT_EQ(clampToInteger(underflowInt), std::numeric_limits<int>::min()); 110 114 } 111 115 -
trunk/Tools/TestWebKitAPI/Tests/WebCore/FloatRect.cpp
r245179 r259704 771 771 772 772 WebCore::FloatRect maxIntRect(INT_MIN, INT_MIN, 0, 0); 773 maxIntRect.shiftMaxXEdgeTo( INT_MAX);774 maxIntRect.shiftMaxYEdgeTo( INT_MAX);773 maxIntRect.shiftMaxXEdgeTo(30); 774 maxIntRect.shiftMaxYEdgeTo(30); 775 775 776 776 auto enclosed2 = WebCore::enclosingIntRect(maxIntRect);
Note: See TracChangeset
for help on using the changeset viewer.