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

Unified Diff: third_party/WebKit/Source/platform/testing/GeometryPrinters.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/testing/GeometryPrinters.cpp
diff --git a/third_party/WebKit/Source/platform/testing/GeometryPrinters.cpp b/third_party/WebKit/Source/platform/testing/GeometryPrinters.cpp
deleted file mode 100644
index cc26b5fe033157718a9e5a78cd2c736aff9b94d6..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/platform/testing/GeometryPrinters.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "platform/testing/GeometryPrinters.h"
-
-#include "platform/geometry/FloatBox.h"
-#include "platform/geometry/FloatPoint.h"
-#include "platform/geometry/FloatPoint3D.h"
-#include "platform/geometry/FloatQuad.h"
-#include "platform/geometry/FloatRect.h"
-#include "platform/geometry/FloatSize.h"
-#include "platform/geometry/LayoutRect.h"
-#include <ostream> // NOLINT
-
-namespace blink {
-
-namespace {
-
-class ScopedFloatFlags {
-public:
- ScopedFloatFlags(std::ostream& out) : m_out(out), m_flags(out.flags())
- {
- out.unsetf(std::ios::floatfield);
- m_precision = out.precision(4);
- }
-
- ~ScopedFloatFlags()
- {
- m_out.flags(m_flags);
- m_out.precision(m_precision);
- }
-
-private:
- std::ostream& m_out;
- std::ios::fmtflags m_flags;
- std::streamsize m_precision;
-};
-
-} // namespace
-
-void PrintTo(const FloatBox& box, std::ostream* os)
-{
- ScopedFloatFlags scope(*os);
- *os << "FloatBox("
- << box.x() << ", "
- << box.y() << ", "
- << box.z() << ", "
- << box.width() << ", "
- << box.height() << ", "
- << box.depth() << ")";
-}
-
-void PrintTo(const FloatPoint& point, std::ostream* os)
-{
- ScopedFloatFlags scope(*os);
- *os << "FloatPoint("
- << point.x() << ", "
- << point.y() << ")";
-}
-
-void PrintTo(const FloatPoint3D& point, std::ostream* os)
-{
- ScopedFloatFlags scope(*os);
- *os << "FloatPoint3D("
- << point.x() << ", "
- << point.y() << ", "
- << point.z() << ")";
-}
-
-void PrintTo(const FloatQuad& quad, std::ostream* os)
-{
- ScopedFloatFlags scope(*os);
- *os << "FloatQuad("
- << "(" << quad.p1().x() << ", " << quad.p1().y() << "), "
- << "(" << quad.p2().x() << ", " << quad.p2().y() << "), "
- << "(" << quad.p3().x() << ", " << quad.p3().y() << "), "
- << "(" << quad.p4().x() << ", " << quad.p4().y() << "))";
-}
-
-void PrintTo(const FloatRect& rect, std::ostream* os)
-{
- ScopedFloatFlags scope(*os);
- *os << "FloatRect("
- << rect.x() << ", "
- << rect.y() << ", "
- << rect.width() << ", "
- << rect.height() << ")";
-}
-
-void PrintTo(const FloatRoundedRect& roundedRect, std::ostream* os)
-{
- *os << "FloatRoundedRect(";
- PrintTo(roundedRect.rect(), os);
- *os << ", ";
- PrintTo(roundedRect.getRadii(), os);
- *os << ")";
-}
-
-void PrintTo(const FloatRoundedRect::Radii& radii, std::ostream* os)
-{
- *os << "FloatRoundedRect::Radii(";
- PrintTo(radii.topLeft(), os);
- *os << ", ";
- PrintTo(radii.topRight(), os);
- *os << ", ";
- PrintTo(radii.bottomLeft(), os);
- *os << ", ";
- PrintTo(radii.bottomRight(), os);
- *os << ")";
-}
-
-void PrintTo(const FloatSize& size, std::ostream* os)
-{
- ScopedFloatFlags scope(*os);
- *os << "FloatSize("
- << size.width() << ", "
- << size.height() << ")";
-}
-
-void PrintTo(const IntRect& rect, std::ostream* os)
-{
- *os << "IntRect("
- << rect.x() << ", "
- << rect.y() << ", "
- << rect.width() << ", "
- << rect.height() << ")";
-}
-
-void PrintTo(const LayoutRect& rect, std::ostream* os)
-{
- ScopedFloatFlags scope(*os);
- *os << "LayoutRect("
- << rect.x().toFloat() << ", "
- << rect.y().toFloat() << ", "
- << rect.width().toFloat() << ", "
- << rect.height().toFloat() << ")";
-}
-
-} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698