Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012, Google Inc. All rights reserved. | 2 * Copyright (c) 2012, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 | 249 |
| 250 TEST(LayoutUnitTest, LayoutUnitFloatOverflow) | 250 TEST(LayoutUnitTest, LayoutUnitFloatOverflow) |
| 251 { | 251 { |
| 252 // These should overflow to the max/min according to their sign. | 252 // These should overflow to the max/min according to their sign. |
| 253 EXPECT_EQ(intMaxForLayoutUnit, LayoutUnit(176972000.0f).toInt()); | 253 EXPECT_EQ(intMaxForLayoutUnit, LayoutUnit(176972000.0f).toInt()); |
| 254 EXPECT_EQ(intMinForLayoutUnit, LayoutUnit(-176972000.0f).toInt()); | 254 EXPECT_EQ(intMinForLayoutUnit, LayoutUnit(-176972000.0f).toInt()); |
| 255 EXPECT_EQ(intMaxForLayoutUnit, LayoutUnit(176972000.0).toInt()); | 255 EXPECT_EQ(intMaxForLayoutUnit, LayoutUnit(176972000.0).toInt()); |
| 256 EXPECT_EQ(intMinForLayoutUnit, LayoutUnit(-176972000.0).toInt()); | 256 EXPECT_EQ(intMinForLayoutUnit, LayoutUnit(-176972000.0).toInt()); |
| 257 } | 257 } |
| 258 | 258 |
| 259 TEST(LayoutUnitTest, UnaryMinusSaturated) | |
|
pdr.
2016/07/20 21:03:55
What about -(LayoutUnit::min + 1)?
Xianzhu
2016/07/20 21:09:10
This won't be saturated, just a normal negative.
Xianzhu
2016/07/20 21:19:20
Converted this test case to a full UnaryMinus case
| |
| 260 { | |
| 261 EXPECT_EQ(LayoutUnit::max(), -LayoutUnit::min()); | |
| 262 } | |
| 263 | |
| 259 } // namespace blink | 264 } // namespace blink |
| OLD | NEW |