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

Unified Diff: Source/core/layout/style/SVGLayoutStyleTest.cpp

Issue 975733002: Use Length for the stroke-dasharray property in SVGLayoutStyle (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add test for style-change responsive-ness. Created 5 years, 10 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: Source/core/layout/style/SVGLayoutStyleTest.cpp
diff --git a/Source/core/layout/style/SVGLayoutStyleTest.cpp b/Source/core/layout/style/SVGLayoutStyleTest.cpp
index ad3d662ac9791d5ee949b783313233d9b7dbb38f..c4709a47a683f6278c0a51506ab57a9f0e73979c 100644
--- a/Source/core/layout/style/SVGLayoutStyleTest.cpp
+++ b/Source/core/layout/style/SVGLayoutStyleTest.cpp
@@ -5,8 +5,7 @@
#include "config.h"
#include "core/layout/style/SVGLayoutStyle.h"
-#include "core/layout/ClipPathOperation.h"
-#include "core/layout/style/ShapeValue.h"
+#include "core/svg/SVGLength.h"
#include <gtest/gtest.h>
@@ -14,8 +13,8 @@ using namespace blink;
namespace {
-// Ensures RefPtr values are compared by their values, not by pointers.
-#define TEST_STYLE_REFPTR_VALUE_NO_DIFF(type, fieldName) \
+// Ensures RefPtrWillBePersistent values are compared by their values, not by pointers.
+#define TEST_STYLE_REFPTRWILLBEPERSISTENT_VALUE_NO_DIFF(type, fieldName) \
{ \
RefPtr<SVGLayoutStyle> svg1 = SVGLayoutStyle::create(); \
RefPtr<SVGLayoutStyle> svg2 = SVGLayoutStyle::create(); \
@@ -26,6 +25,18 @@ namespace {
EXPECT_FALSE(svg1->diff(svg2.get()).hasDifference()); \
}
+// Ensures RefPtr values are compared by their values, not by pointers.
+#define TEST_STYLE_REFPTR_VALUE_NO_DIFF(type, fieldName) \
+ { \
+ RefPtr<SVGLayoutStyle> svg1 = SVGLayoutStyle::create(); \
+ RefPtr<SVGLayoutStyle> svg2 = SVGLayoutStyle::create(); \
+ RefPtr<type> value1 = type::create(); \
+ RefPtr<type> value2 = value1->copy(); \
+ svg1->set##fieldName(value1); \
+ svg2->set##fieldName(value2); \
+ EXPECT_FALSE(svg1->diff(svg2.get()).hasDifference()); \
+ }
+
// This is not very useful for fields directly stored by values, because they can only be
// compared by values. This macro mainly ensures that we update the comparisons and tests
// when we change some field to RefPtr in the future.
@@ -42,9 +53,9 @@ TEST(SVGLayoutStyleTest, StrokeStyleShouldCompareValue)
{
TEST_STYLE_VALUE_NO_DIFF(float, StrokeOpacity);
TEST_STYLE_VALUE_NO_DIFF(float, StrokeMiterLimit);
- TEST_STYLE_REFPTR_VALUE_NO_DIFF(SVGLength, StrokeWidth);
+ TEST_STYLE_REFPTRWILLBEPERSISTENT_VALUE_NO_DIFF(SVGLength, StrokeWidth);
TEST_STYLE_VALUE_NO_DIFF(Length, StrokeDashOffset);
- TEST_STYLE_REFPTR_VALUE_NO_DIFF(SVGLengthList, StrokeDashArray);
+ TEST_STYLE_REFPTR_VALUE_NO_DIFF(SVGDashArray, StrokeDashArray);
{
RefPtr<SVGLayoutStyle> svg1 = SVGLayoutStyle::create();

Powered by Google App Engine
This is Rietveld 408576698