| 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, UnaryMinus) |
| 260 { |
| 261 EXPECT_EQ(LayoutUnit(), -LayoutUnit()); |
| 262 EXPECT_EQ(LayoutUnit(999), -LayoutUnit(-999)); |
| 263 EXPECT_EQ(LayoutUnit(-999), -LayoutUnit(999)); |
| 264 |
| 265 LayoutUnit negativeMax; |
| 266 negativeMax.setRawValue(LayoutUnit::min().rawValue() + 1); |
| 267 EXPECT_EQ(negativeMax, -LayoutUnit::max()); |
| 268 EXPECT_EQ(LayoutUnit::max(), -negativeMax); |
| 269 |
| 270 // -LayoutUnit::min() is saturated to LayoutUnit::max() |
| 271 EXPECT_EQ(LayoutUnit::max(), -LayoutUnit::min()); |
| 272 } |
| 273 |
| 259 } // namespace blink | 274 } // namespace blink |
| OLD | NEW |