Commit b858b0b5 authored by jbroman@chromium.org's avatar jbroman@chromium.org

Unify geometry test printers in a test support target.

This adds a new target which provides test support for Source/platform/.
These can be used in platform unit tests, or unit tests of targets which
depend on platform.

GYP: blink_platform_test_support (static_library)
GN: //third_party/WebKit/Source/platform:test_support (source_set)

Existing GTest print support for Source/platform/geometry/ types has been
made more consistent, and moved into this target. Both
blink_platform_unittests and webkit_unit_tests depend on it.

To avoid ODR violations, the declarations of these are in the headers
of the types that are being printed. If these are called outside unit tests,
a link error will occur.

This is similar to how ui/gfx/ does things in Chromium; it's seems like
a more reasonable approach than what we do today.

BUG=522198

Review URL: https://codereview.chromium.org/1285413007

git-svn-id: svn://svn.chromium.org/blink/trunk@200933 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent d93e861b
...@@ -35,17 +35,6 @@ ...@@ -35,17 +35,6 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
namespace blink { namespace blink {
// FIXME: Move this somewhere more generic.
void PrintTo(const LayoutRect& rect, std::ostream* os)
{
*os << "LayoutRect("
<< rect.x().toFloat() << ", "
<< rect.y().toFloat() << ", "
<< rect.width().toFloat() << ", "
<< rect.height().toFloat() << ")";
}
namespace { namespace {
LayoutRect initialLayoutOverflow() LayoutRect initialLayoutOverflow()
...@@ -187,5 +176,4 @@ TEST_F(OverflowModelTest, MoveAffectsContentsVisualOverflow) ...@@ -187,5 +176,4 @@ TEST_F(OverflowModelTest, MoveAffectsContentsVisualOverflow)
} }
} // anonymous namespace } // anonymous namespace
} // namespace blink } // namespace blink
...@@ -319,6 +319,21 @@ component("platform") { ...@@ -319,6 +319,21 @@ component("platform") {
} }
} }
source_set("test_support") {
sources = platform_test_support_files
visibility += [ "//third_party/WebKit/*" ]
configs += [
"//third_party/WebKit/Source:config",
"//third_party/WebKit/Source:inside_blink",
"//third_party/WebKit/Source:non_test_config",
]
deps = [
":platform",
]
}
if (!is_mac) { if (!is_mac) {
# TODO(GYP): Can't link Blink binaries yet. # TODO(GYP): Can't link Blink binaries yet.
test("heap_unittests") { test("heap_unittests") {
...@@ -368,6 +383,7 @@ if (!is_mac) { ...@@ -368,6 +383,7 @@ if (!is_mac) {
deps = [ deps = [
":blink_common", ":blink_common",
":platform", ":platform",
":test_support",
"//base", "//base",
"//base/allocator", "//base/allocator",
"//base/test:test_support", "//base/test:test_support",
......
...@@ -1025,12 +1025,17 @@ ...@@ -1025,12 +1025,17 @@
'image-decoders/jpeg/JPEGImageDecoderTest.cpp', 'image-decoders/jpeg/JPEGImageDecoderTest.cpp',
'image-decoders/webp/WEBPImageDecoderTest.cpp', 'image-decoders/webp/WEBPImageDecoderTest.cpp',
], ],
# TODO(jbroman): Move these into platform_test_support_files.
'platform_unittest_support_files': [ 'platform_unittest_support_files': [
'testing/URLTestHelpers.cpp', 'testing/URLTestHelpers.cpp',
'testing/URLTestHelpers.h', 'testing/URLTestHelpers.h',
'testing/UnitTestHelpers.cpp', 'testing/UnitTestHelpers.cpp',
'testing/UnitTestHelpers.h', 'testing/UnitTestHelpers.h',
], ],
'platform_test_support_files': [
'testing/GeometryPrinters.cpp',
'testing/GeometryPrinters.h',
],
'conditions': [ 'conditions': [
['OS=="win"', ['OS=="win"',
{ {
......
...@@ -77,6 +77,7 @@ ...@@ -77,6 +77,7 @@
'target_name': 'blink_platform_unittests', 'target_name': 'blink_platform_unittests',
'type': 'executable', 'type': 'executable',
'dependencies': [ 'dependencies': [
'blink_platform_test_support',
'../config.gyp:unittest_config', '../config.gyp:unittest_config',
'../wtf/wtf.gyp:wtf', '../wtf/wtf.gyp:wtf',
'../wtf/wtf_tests.gyp:wtf_unittest_helpers', '../wtf/wtf_tests.gyp:wtf_unittest_helpers',
...@@ -113,6 +114,20 @@ ...@@ -113,6 +114,20 @@
}], }],
], ],
}, },
{
'target_name': 'blink_platform_test_support',
'type': 'static_library',
'dependencies': [
'../config.gyp:config',
'blink_platform.gyp:blink_platform',
],
'defines': [
'INSIDE_BLINK',
],
'sources': [
'<@(platform_test_support_files)',
],
},
], ],
'conditions': [ 'conditions': [
['OS=="android" and gtest_target_type == "shared_library"', { ['OS=="android" and gtest_target_type == "shared_library"', {
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "platform/geometry/FloatPoint3D.h" #include "platform/geometry/FloatPoint3D.h"
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include <iosfwd>
namespace blink { namespace blink {
...@@ -176,6 +177,10 @@ inline bool operator!=(const FloatBox& a, const FloatBox& b) ...@@ -176,6 +177,10 @@ inline bool operator!=(const FloatBox& a, const FloatBox& b)
return !(a == b); return !(a == b);
} }
// Redeclared here to avoid ODR issues.
// See platform/testing/GeometryPrinters.h.
void PrintTo(const FloatBox&, std::ostream*);
} // namespace blink } // namespace blink
#endif #endif
...@@ -30,18 +30,6 @@ ...@@ -30,18 +30,6 @@
const static float kTestEpsilon = 1e-6; const static float kTestEpsilon = 1e-6;
namespace blink { namespace blink {
void PrintTo(const FloatBox& box, ::std::ostream* os)
{
*os << "FloatBox("
<< box.x() << ", "
<< box.y() << ", "
<< box.z() << ", "
<< box.width() << ", "
<< box.height() << ", "
<< box.depth() << ")";
}
namespace FloatBoxTest { namespace FloatBoxTest {
bool ApproximatelyEqual(const float& a, const float& b) bool ApproximatelyEqual(const float& a, const float& b)
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
namespace blink { namespace blink {
class FloatBox; class FloatBox;
void PrintTo(const FloatBox&, ::std::ostream*);
bool ApproximatelyEqual(const float&, const float&); bool ApproximatelyEqual(const float&, const float&);
namespace FloatBoxTest { namespace FloatBoxTest {
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "third_party/skia/include/core/SkPoint.h" #include "third_party/skia/include/core/SkPoint.h"
#include "wtf/MathExtras.h" #include "wtf/MathExtras.h"
#include <algorithm> #include <algorithm>
#include <iosfwd>
#if OS(MACOSX) #if OS(MACOSX)
typedef struct CGPoint CGPoint; typedef struct CGPoint CGPoint;
...@@ -270,6 +271,10 @@ inline FloatSize toFloatSize(const FloatPoint& a) ...@@ -270,6 +271,10 @@ inline FloatSize toFloatSize(const FloatPoint& a)
// Find point where lines through the two pairs of points intersect. Returns false if the lines don't intersect. // Find point where lines through the two pairs of points intersect. Returns false if the lines don't intersect.
PLATFORM_EXPORT bool findIntersection(const FloatPoint& p1, const FloatPoint& p2, const FloatPoint& d1, const FloatPoint& d2, FloatPoint& intersection); PLATFORM_EXPORT bool findIntersection(const FloatPoint& p1, const FloatPoint& p2, const FloatPoint& d1, const FloatPoint& d2, FloatPoint& intersection);
// Redeclared here to avoid ODR issues.
// See platform/testing/GeometryPrinters.h.
void PrintTo(const FloatPoint&, std::ostream*);
} }
#endif #endif
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "platform/geometry/FloatRect.h" #include "platform/geometry/FloatRect.h"
#include "platform/geometry/IntRect.h" #include "platform/geometry/IntRect.h"
#include "platform/geometry/LayoutSize.h" #include "platform/geometry/LayoutSize.h"
#include <iosfwd>
namespace blink { namespace blink {
...@@ -179,8 +180,11 @@ inline bool operator!=(const FloatQuad& a, const FloatQuad& b) ...@@ -179,8 +180,11 @@ inline bool operator!=(const FloatQuad& a, const FloatQuad& b)
a.p4() != b.p4(); a.p4() != b.p4();
} }
} // namespace blink
// Redeclared here to avoid ODR issues.
// See platform/testing/GeometryPrinters.h.
void PrintTo(const FloatQuad&, std::ostream*);
#endif // FloatQuad_h } // namespace blink
#endif // FloatQuad_h
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "platform/geometry/FloatRectOutsets.h" #include "platform/geometry/FloatRectOutsets.h"
#include "third_party/skia/include/core/SkRect.h" #include "third_party/skia/include/core/SkRect.h"
#include "wtf/Vector.h" #include "wtf/Vector.h"
#include <iosfwd>
#if OS(MACOSX) #if OS(MACOSX)
typedef struct CGRect CGRect; typedef struct CGRect CGRect;
...@@ -245,6 +246,10 @@ PLATFORM_EXPORT IntRect roundedIntRect(const FloatRect&); ...@@ -245,6 +246,10 @@ PLATFORM_EXPORT IntRect roundedIntRect(const FloatRect&);
// Map supplied rect from srcRect to an equivalent rect in destRect. // Map supplied rect from srcRect to an equivalent rect in destRect.
PLATFORM_EXPORT FloatRect mapRect(const FloatRect&, const FloatRect& srcRect, const FloatRect& destRect); PLATFORM_EXPORT FloatRect mapRect(const FloatRect&, const FloatRect& srcRect, const FloatRect& destRect);
} // Redeclared here to avoid ODR issues.
// See platform/testing/GeometryPrinters.h.
void PrintTo(const FloatRect&, std::ostream*);
} // namespace blink
#endif #endif
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "platform/geometry/FloatRect.h" #include "platform/geometry/FloatRect.h"
#include "platform/geometry/FloatSize.h" #include "platform/geometry/FloatSize.h"
#include "third_party/skia/include/core/SkRRect.h" #include "third_party/skia/include/core/SkRRect.h"
#include <iosfwd>
namespace blink { namespace blink {
...@@ -203,6 +204,11 @@ inline bool operator==(const FloatRoundedRect& a, const FloatRoundedRect& b) ...@@ -203,6 +204,11 @@ inline bool operator==(const FloatRoundedRect& a, const FloatRoundedRect& b)
return a.rect() == b.rect() && a.radii() == b.radii(); return a.rect() == b.rect() && a.radii() == b.radii();
} }
// Redeclared here to avoid ODR issues.
// See platform/testing/GeometryPrinters.h.
void PrintTo(const FloatRoundedRect&, std::ostream*);
void PrintTo(const FloatRoundedRect::Radii&, std::ostream*);
} // namespace blink } // namespace blink
#endif // FloatRoundedRect_h #endif // FloatRoundedRect_h
...@@ -34,38 +34,6 @@ ...@@ -34,38 +34,6 @@
namespace blink { namespace blink {
void PrintTo(const FloatSize& size, std::ostream* os)
{
*os << "FloatSize("
<< size.width() << ", "
<< size.height() << ")";
}
void PrintTo(const FloatRect& rect, std::ostream* os)
{
*os << "FloatRect("
<< rect.x() << ", "
<< rect.y() << ", "
<< rect.width() << ", "
<< rect.height() << ")";
}
void PrintTo(const FloatRoundedRect::Radii& radii, std::ostream* os)
{
*os << "FloatRoundedRect::Radii("
<< ::testing::PrintToString(radii.topLeft()) << ", "
<< ::testing::PrintToString(radii.topRight()) << ", "
<< ::testing::PrintToString(radii.bottomRight()) << ", "
<< ::testing::PrintToString(radii.bottomLeft()) << ")";
}
void PrintTo(const FloatRoundedRect& roundedRect, std::ostream* os)
{
*os << "FloatRoundedRect("
<< ::testing::PrintToString(roundedRect.rect()) << ", "
<< ::testing::PrintToString(roundedRect.radii()) << ")";
}
#define TEST_INTERCEPTS(roundedRect, yCoordinate, expectedMinXIntercept, expectedMaxXIntercept) \ #define TEST_INTERCEPTS(roundedRect, yCoordinate, expectedMinXIntercept, expectedMaxXIntercept) \
{ \ { \
float minXIntercept; \ float minXIntercept; \
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "platform/geometry/IntPoint.h" #include "platform/geometry/IntPoint.h"
#include "third_party/skia/include/core/SkSize.h" #include "third_party/skia/include/core/SkSize.h"
#include "wtf/MathExtras.h" #include "wtf/MathExtras.h"
#include <iosfwd>
#if OS(MACOSX) #if OS(MACOSX)
typedef struct CGSize CGSize; typedef struct CGSize CGSize;
...@@ -204,6 +205,10 @@ inline IntPoint flooredIntPoint(const FloatSize& p) ...@@ -204,6 +205,10 @@ inline IntPoint flooredIntPoint(const FloatSize& p)
return IntPoint(clampTo<int>(floorf(p.width())), clampTo<int>(floorf(p.height()))); return IntPoint(clampTo<int>(floorf(p.width())), clampTo<int>(floorf(p.height())));
} }
// Redeclared here to avoid ODR issues.
// See platform/testing/GeometryPrinters.h.
void PrintTo(const FloatSize&, std::ostream*);
} // namespace blink } // namespace blink
#endif // FloatSize_h #endif // FloatSize_h
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "platform/geometry/LayoutPoint.h" #include "platform/geometry/LayoutPoint.h"
#include "platform/geometry/LayoutRectOutsets.h" #include "platform/geometry/LayoutRectOutsets.h"
#include "wtf/Vector.h" #include "wtf/Vector.h"
#include <iosfwd>
namespace blink { namespace blink {
...@@ -251,6 +252,10 @@ inline IntRect pixelSnappedIntRect(LayoutPoint location, LayoutSize size) ...@@ -251,6 +252,10 @@ inline IntRect pixelSnappedIntRect(LayoutPoint location, LayoutSize size)
return IntRect(roundedIntPoint(location), pixelSnappedIntSize(size, location)); return IntRect(roundedIntPoint(location), pixelSnappedIntSize(size, location));
} }
// Redeclared here to avoid ODR issues.
// See platform/testing/GeometryPrinters.h.
void PrintTo(const LayoutRect&, std::ostream*);
} // namespace blink } // namespace blink
#endif // LayoutRect_h #endif // LayoutRect_h
...@@ -15,3 +15,4 @@ platform_files = _gypi.platform_files ...@@ -15,3 +15,4 @@ platform_files = _gypi.platform_files
platform_test_files = get_path_info(_gypi.platform_test_files, "abspath") platform_test_files = get_path_info(_gypi.platform_test_files, "abspath")
platform_unittest_support_files = get_path_info(_gypi.platform_unittest_support_files, "abspath") platform_unittest_support_files = get_path_info(_gypi.platform_unittest_support_files, "abspath")
platform_web_unittest_files = get_path_info(_gypi.platform_web_unittest_files, "abspath") platform_web_unittest_files = get_path_info(_gypi.platform_web_unittest_files, "abspath")
platform_test_support_files = get_path_info(_gypi.platform_test_support_files, "abspath")
// 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 "config.h"
#include "platform/testing/GeometryPrinters.h"
#include "platform/geometry/FloatBox.h"
#include "platform/geometry/FloatPoint.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 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.radii(), 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.bottomRight(), os);
*os << ", ";
PrintTo(radii.bottomLeft(), os);
*os << ")";
}
void PrintTo(const FloatSize& size, std::ostream* os)
{
ScopedFloatFlags scope(*os);
*os << "FloatSize("
<< size.width() << ", "
<< size.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
// 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.
#ifndef GeometryPrinters_h
#define GeometryPrinters_h
#include "platform/geometry/FloatRoundedRect.h"
#include <iosfwd>
namespace blink {
class FloatBox;
class FloatPoint;
class FloatQuad;
class FloatRect;
class FloatSize;
class LayoutRect;
// GTest print support for geometry classes.
//
// To avoid ODR violations, these should also be declared in the respective
// headers defining these types. This is required because otherwise a template
// instantiation may be instantiated differently, depending on whether this
// declaration is found.
//
// As a result, it is not necessary to include this file in tests in order to
// use these printers. If, however, you get a link error about these symbols,
// you need to make sure the blink_platform_test_support target is linked in
// your unit test binary.
void PrintTo(const FloatBox&, std::ostream*);
void PrintTo(const FloatPoint&, std::ostream*);
void PrintTo(const FloatQuad&, std::ostream*);
void PrintTo(const FloatRect&, std::ostream*);
void PrintTo(const FloatRoundedRect&, std::ostream*);
void PrintTo(const FloatRoundedRect::Radii&, std::ostream*);
void PrintTo(const FloatSize&, std::ostream*);
void PrintTo(const LayoutRect&, std::ostream*);
} // namespace blink
#endif // GeometryPrinters_h
...@@ -54,6 +54,7 @@ component("web") { ...@@ -54,6 +54,7 @@ component("web") {
"//testing/gtest", "//testing/gtest",
"//third_party/WebKit/Source/core:testing", "//third_party/WebKit/Source/core:testing",
"//third_party/WebKit/Source/modules:modules_testing", "//third_party/WebKit/Source/modules:modules_testing",
"//third_party/WebKit/Source/platform:test_support",
"//third_party/WebKit/Source/wtf:test_support", "//third_party/WebKit/Source/wtf:test_support",
] ]
...@@ -118,6 +119,7 @@ if (!is_mac) { ...@@ -118,6 +119,7 @@ if (!is_mac) {
"//content/test:test_support", "//content/test:test_support",
"//testing/gmock", "//testing/gmock",
"//testing/gtest", "//testing/gtest",
"//third_party/WebKit/Source/platform:test_support",
"//third_party/WebKit/Source/wtf:test_support", "//third_party/WebKit/Source/wtf:test_support",
"//third_party/libwebp", "//third_party/libwebp",
"//third_party/zlib", "//third_party/zlib",
......
/*
* Copyright (C) 2014 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FloatPointTestHelpers_h
#define FloatPointTestHelpers_h
#include "platform/geometry/FloatPoint.h"
#include <gtest/gtest.h>
// Gtest will automatically pick up this function if included to print out
// FloatPoints, rather than just spitting out their memory.
namespace blink {
inline void PrintTo(const FloatPoint& point, ::std::ostream* os)
{
*os << "FloatPoint("
<< std::fixed
<< std::setprecision(4) << point.x() << "f, "
<< std::setprecision(4) << point.y() << "f)";
os->unsetf(std::ios::floatfield);
}
}
#endif // FloatPointTestHelpers_h
/*
* Copyright (C) 2014 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FloatQuadTestHelpers_h
#define FloatQuadTestHelpers_h
#include "platform/geometry/FloatPoint.h"
#include "platform/geometry/FloatQuad.h"
#include <gtest/gtest.h>
// Gtest will automatically pick up this function if included to print out
// FloatQuads, rather than just spitting out their memory.
namespace blink {
inline void PrintTo(const FloatQuad& quad, ::std::ostream* os)
{
*os << "FloatQuad("
<< std::fixed
<< std::setprecision(4) << "(" << quad.p1().x() << "f, " << quad.p1().y() << "f),"
<< std::setprecision(4) << "(" << quad.p2().x() << "f, " << quad.p2().y() << "f),"
<< std::setprecision(4) << "(" << quad.p3().x() << "f, " << quad.p3().y() << "f),"
<< std::setprecision(4) << "(" << quad.p4().x() << "f, " << quad.p4().y() << "f))";
os->unsetf(std::ios::floatfield);
}
}
#endif // FloatQuadTestHelpers_h
...@@ -39,8 +39,6 @@ ...@@ -39,8 +39,6 @@
#include "public/platform/WebUnitTestSupport.h" #include "public/platform/WebUnitTestSupport.h"
#include "public/web/WebFrameClient.h" #include "public/web/WebFrameClient.h"
#include "web/WebLocalFrameImpl.h" #include "web/WebLocalFrameImpl.h"
#include "web/tests/FloatPointTestHelpers.h"
#include "web/tests/FloatQuadTestHelpers.h"
#include "web/tests/FrameTestHelpers.h" #include "web/tests/FrameTestHelpers.h"
#include <gtest/gtest.h> #include <gtest/gtest.h>
......
...@@ -83,6 +83,7 @@ ...@@ -83,6 +83,7 @@
'conditions': [ 'conditions': [
['component=="shared_library"', { ['component=="shared_library"', {
'dependencies': [ 'dependencies': [
'../platform/blink_platform_tests.gyp:blink_platform_test_support',
'../wtf/wtf_tests.gyp:wtf_unittest_helpers', '../wtf/wtf_tests.gyp:wtf_unittest_helpers',
'<(DEPTH)/base/base.gyp:test_support_base', '<(DEPTH)/base/base.gyp:test_support_base',
'<(DEPTH)/testing/gmock.gyp:gmock', '<(DEPTH)/testing/gmock.gyp:gmock',
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
'dependencies': [ 'dependencies': [
'../../public/blink.gyp:blink', '../../public/blink.gyp:blink',
'../config.gyp:unittest_config', '../config.gyp:unittest_config',
'../platform/blink_platform_tests.gyp:blink_platform_test_support',
'../wtf/wtf_tests.gyp:wtf_unittest_helpers', '../wtf/wtf_tests.gyp:wtf_unittest_helpers',
'web.gyp:blink_web_test_support', 'web.gyp:blink_web_test_support',
'<(DEPTH)/base/base.gyp:base', '<(DEPTH)/base/base.gyp:base',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment