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

Side by Side Diff: third_party/WebKit/Source/platform/LayoutUnitTest.cpp

Issue 2191233002: Add platform/geometry pretty printers for logging and testing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjust tests to work around uninteresting cross-platform differences Created 4 years, 4 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 unified diff | Download patch
OLDNEW
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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 264
265 LayoutUnit negativeMax; 265 LayoutUnit negativeMax;
266 negativeMax.setRawValue(LayoutUnit::min().rawValue() + 1); 266 negativeMax.setRawValue(LayoutUnit::min().rawValue() + 1);
267 EXPECT_EQ(negativeMax, -LayoutUnit::max()); 267 EXPECT_EQ(negativeMax, -LayoutUnit::max());
268 EXPECT_EQ(LayoutUnit::max(), -negativeMax); 268 EXPECT_EQ(LayoutUnit::max(), -negativeMax);
269 269
270 // -LayoutUnit::min() is saturated to LayoutUnit::max() 270 // -LayoutUnit::min() is saturated to LayoutUnit::max()
271 EXPECT_EQ(LayoutUnit::max(), -LayoutUnit::min()); 271 EXPECT_EQ(LayoutUnit::max(), -LayoutUnit::min());
272 } 272 }
273 273
274 TEST(LayoutUnitTest, Formatting)
275 {
276 LayoutUnit zero;
277 std::ostringstream zeroStream;
278 zeroStream << zero;
279 EXPECT_EQ("0", zeroStream.str());
280
281 std::ostringstream maxStream;
282 maxStream << LayoutUnit::max();
283 EXPECT_EQ("LayoutUnit::max(3.35544e+07)", maxStream.str());
284
285 std::ostringstream minStream;
286 minStream << LayoutUnit::min();
287 EXPECT_EQ("LayoutUnit::min(-3.35544e+07)", minStream.str());
288
289 std::ostringstream nearlyMaxStream;
290 nearlyMaxStream << LayoutUnit::nearlyMax();
291 EXPECT_EQ("LayoutUnit::nearlyMax(3.35544e+07)", nearlyMaxStream.str());
292
293 std::ostringstream nearlyMinStream;
294 nearlyMinStream << LayoutUnit::nearlyMin();
295 EXPECT_EQ("LayoutUnit::nearlyMin(-3.35544e+07)", nearlyMinStream.str());
296 }
297
274 } // namespace blink 298 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698