Index: third_party/WebKit/Source/core/style/ComputedStyleTest.cpp |
diff --git a/third_party/WebKit/Source/core/style/ComputedStyleTest.cpp b/third_party/WebKit/Source/core/style/ComputedStyleTest.cpp |
index 7c8f3c64a124c1d1e9c5d725abdbf2ef97d07eaa..351c75c0f834d852027dc48d035ea09bf6db089d 100644 |
--- a/third_party/WebKit/Source/core/style/ComputedStyleTest.cpp |
+++ b/third_party/WebKit/Source/core/style/ComputedStyleTest.cpp |
@@ -10,6 +10,18 @@ |
namespace blink { |
+// 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. |
+#define TEST_STYLE_VALUE_NO_DIFF(type, fieldName) \ |
+ { \ |
+ RefPtr<ComputedStyle> style1 = ComputedStyle::create(); \ |
+ RefPtr<ComputedStyle> style2 = ComputedStyle::create(); \ |
+ style1->set##fieldName(ComputedStyle::initial##fieldName()); \ |
+ style2->set##fieldName(ComputedStyle::initial##fieldName()); \ |
+ ASSERT_EQ(*style1, *style2); \ |
+ } |
+ |
TEST(ComputedStyleTest, ShapeOutsideBoxEqual) { |
ShapeValue* shape1 = ShapeValue::createBoxShapeValue(ContentBox); |
ShapeValue* shape2 = ShapeValue::createBoxShapeValue(ContentBox); |
@@ -92,4 +104,11 @@ TEST(ComputedStyleTest, LastPublicPseudoStyle) { |
EXPECT_TRUE(style->hasAnyPublicPseudoStyles()); |
} |
+TEST(ComputedStyleTest, MiscStyleShouldCompareValue) { |
+ TEST_STYLE_VALUE_NO_DIFF(UnzoomedLength, StrokeWidth); |
+ TEST_STYLE_VALUE_NO_DIFF(unsigned, PaintOrder); |
+ TEST_STYLE_VALUE_NO_DIFF(unsigned, CapStyle); |
+ TEST_STYLE_VALUE_NO_DIFF(unsigned, JoinStyle); |
+} |
+ |
} // namespace blink |