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

Unified 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, 5 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/LayoutUnitTest.cpp
diff --git a/third_party/WebKit/Source/platform/LayoutUnitTest.cpp b/third_party/WebKit/Source/platform/LayoutUnitTest.cpp
index 4b27c33b7daa8fc4362ceee89d177120cfc002b7..84a1e51999d4bfebe7e154341a0aa92f3e5d6a16 100644
--- a/third_party/WebKit/Source/platform/LayoutUnitTest.cpp
+++ b/third_party/WebKit/Source/platform/LayoutUnitTest.cpp
@@ -271,4 +271,28 @@ TEST(LayoutUnitTest, UnaryMinus)
EXPECT_EQ(LayoutUnit::max(), -LayoutUnit::min());
}
+TEST(LayoutUnitTest, Formatting)
+{
+ LayoutUnit zero;
+ std::ostringstream zeroStream;
+ zeroStream << zero;
+ EXPECT_EQ("0", zeroStream.str());
+
+ std::ostringstream maxStream;
+ maxStream << LayoutUnit::max();
+ EXPECT_EQ("LayoutUnit::max(3.35544e+07)", maxStream.str());
+
+ std::ostringstream minStream;
+ minStream << LayoutUnit::min();
+ EXPECT_EQ("LayoutUnit::min(-3.35544e+07)", minStream.str());
+
+ std::ostringstream nearlyMaxStream;
+ nearlyMaxStream << LayoutUnit::nearlyMax();
+ EXPECT_EQ("LayoutUnit::nearlyMax(3.35544e+07)", nearlyMaxStream.str());
+
+ std::ostringstream nearlyMinStream;
+ nearlyMinStream << LayoutUnit::nearlyMin();
+ EXPECT_EQ("LayoutUnit::nearlyMin(-3.35544e+07)", nearlyMinStream.str());
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698