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

Unified Diff: third_party/WebKit/Source/platform/geometry/LayoutRectTest.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/geometry/LayoutRectTest.cpp
diff --git a/third_party/WebKit/Source/platform/geometry/LayoutRectTest.cpp b/third_party/WebKit/Source/platform/geometry/LayoutRectTest.cpp
index 0b98a55d3e3eaee4ccf4749361c2c0e272586c67..5b8e4d0cfb9242edab34cfdae0415709b2a552af 100644
--- a/third_party/WebKit/Source/platform/geometry/LayoutRectTest.cpp
+++ b/third_party/WebKit/Source/platform/geometry/LayoutRectTest.cpp
@@ -5,23 +5,33 @@
#include "platform/geometry/LayoutRect.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "wtf/text/WTFString.h"
namespace blink {
-#ifndef NDEBUG
-TEST(LayoutRectTest, ToString)
+TEST(LayoutRectTest, Formatting)
{
LayoutRect emptyRect = LayoutRect();
- EXPECT_EQ(String("0.000000,0.000000 0.000000x0.000000"), emptyRect.toString());
+ std::ostringstream emptyRectStream;
+ emptyRectStream << emptyRect;
+ EXPECT_EQ("LayoutRect(x=0, y=0, width=0, height=0)", emptyRectStream.str());
LayoutRect rect(1, 2, 3, 4);
- EXPECT_EQ(String("1.000000,2.000000 3.000000x4.000000"), rect.toString());
-
- LayoutRect granularRect(LayoutUnit(1.6f), LayoutUnit(2.7f), LayoutUnit(3.8f), LayoutUnit(4.9f));
- EXPECT_EQ(String("1.593750,2.687500 3.796875x4.890625"), granularRect.toString());
+ std::ostringstream rectStream;
+ rectStream << rect;
+ EXPECT_EQ("LayoutRect(x=1, y=2, width=3, height=4)", rectStream.str());
+
+ LayoutRect granularRect(LayoutUnit(1.6f), LayoutUnit(2.7f), LayoutUnit(3.8f), LayoutUnit(1.6f));
+ std::ostringstream granularRectStream;
+ granularRectStream << granularRect;
+ EXPECT_EQ("LayoutRect(x=1.59375, y=2.6875, width=3.79688, height=1.59375)", granularRectStream.str());
+
+ LayoutRect infiniteRect(LayoutUnit::min(), LayoutUnit::min(), LayoutUnit::max(), LayoutUnit::max());
+ std::ostringstream infiniteRectStream;
+ infiniteRectStream << infiniteRect;
+ EXPECT_EQ("LayoutRect(x=LayoutUnit::min(-3.35544e+07), y=LayoutUnit::min(-3.35544e+07), width=LayoutUnit::max(3.35544e+07), height=LayoutUnit::max(3.35544e+07))", infiniteRectStream.str());
}
+#ifndef NDEBUG
TEST(LayoutRectTest, InclusiveIntersect)
{
LayoutRect rect(11, 12, 0, 0);

Powered by Google App Engine
This is Rietveld 408576698