OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/style/ComputedStyle.h" | 5 #include "core/style/ComputedStyle.h" |
6 | 6 |
7 #include "core/style/ClipPathOperation.h" | 7 #include "core/style/ClipPathOperation.h" |
8 #include "core/style/ShapeValue.h" | 8 #include "core/style/ShapeValue.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 TEST(ComputedStyleTest, | 95 TEST(ComputedStyleTest, |
96 UpdatePropertySpecificDifferencesRespectsTransformAnimation) { | 96 UpdatePropertySpecificDifferencesRespectsTransformAnimation) { |
97 RefPtr<ComputedStyle> style = ComputedStyle::Create(); | 97 RefPtr<ComputedStyle> style = ComputedStyle::Create(); |
98 RefPtr<ComputedStyle> other = ComputedStyle::Clone(*style); | 98 RefPtr<ComputedStyle> other = ComputedStyle::Clone(*style); |
99 other->SetHasCurrentTransformAnimation(); | 99 other->SetHasCurrentTransformAnimation(); |
100 StyleDifference diff; | 100 StyleDifference diff; |
101 style->UpdatePropertySpecificDifferences(*other, diff); | 101 style->UpdatePropertySpecificDifferences(*other, diff); |
102 EXPECT_TRUE(diff.TransformChanged()); | 102 EXPECT_TRUE(diff.TransformChanged()); |
103 } | 103 } |
104 | 104 |
105 TEST(CompuetedStyleTest, HasOutlineWithCurrentColor) { | 105 TEST(ComputedStyleTest, HasOutlineWithCurrentColor) { |
nainar
2017/05/23 05:06:50
These were spelt incorrectly and never ran before.
| |
106 RefPtr<ComputedStyle> style = ComputedStyle::Create(); | 106 RefPtr<ComputedStyle> style = ComputedStyle::Create(); |
107 EXPECT_FALSE(style->HasOutline()); | 107 EXPECT_FALSE(style->HasOutline()); |
108 EXPECT_FALSE(style->HasOutlineWithCurrentColor()); | 108 EXPECT_FALSE(style->HasOutlineWithCurrentColor()); |
109 style->SetOutlineColor(StyleColor::CurrentColor()); | 109 style->SetOutlineColor(StyleColor::CurrentColor()); |
110 EXPECT_FALSE(style->HasOutlineWithCurrentColor()); | 110 EXPECT_FALSE(style->HasOutlineWithCurrentColor()); |
111 style->SetOutlineWidth(5); | 111 style->SetOutlineWidth(5); |
112 EXPECT_FALSE(style->HasOutlineWithCurrentColor()); | 112 EXPECT_FALSE(style->HasOutlineWithCurrentColor()); |
113 style->SetOutlineStyle(EBorderStyle::kSolid); | 113 style->SetOutlineStyle(EBorderStyle::kSolid); |
114 EXPECT_TRUE(style->HasOutlineWithCurrentColor()); | 114 EXPECT_TRUE(style->HasOutlineWithCurrentColor()); |
115 } | 115 } |
116 | 116 |
117 TEST(CompuetedStyleTest, HasBorderColorReferencingCurrentColor) { | 117 TEST(ComputedStyleTest, HasBorderColorReferencingCurrentColor) { |
118 RefPtr<ComputedStyle> style = ComputedStyle::Create(); | 118 RefPtr<ComputedStyle> style = ComputedStyle::Create(); |
119 EXPECT_FALSE(style->HasBorderColorReferencingCurrentColor()); | 119 EXPECT_FALSE(style->HasBorderColorReferencingCurrentColor()); |
120 style->SetBorderBottomColor(StyleColor::CurrentColor()); | 120 style->SetBorderBottomColor(StyleColor::CurrentColor()); |
121 EXPECT_FALSE(style->HasBorderColorReferencingCurrentColor()); | 121 EXPECT_FALSE(style->HasBorderColorReferencingCurrentColor()); |
122 style->SetBorderBottomWidth(5); | 122 style->SetBorderBottomWidth(5); |
123 EXPECT_FALSE(style->HasBorderColorReferencingCurrentColor()); | 123 EXPECT_FALSE(style->HasBorderColorReferencingCurrentColor()); |
124 style->SetBorderBottomStyle(EBorderStyle::kSolid); | 124 style->SetBorderBottomStyle(EBorderStyle::kSolid); |
125 EXPECT_TRUE(style->HasBorderColorReferencingCurrentColor()); | 125 EXPECT_TRUE(style->HasBorderColorReferencingCurrentColor()); |
126 } | 126 } |
127 | 127 |
128 TEST(ComputedStyleTest, BorderWidth) { | |
129 RefPtr<ComputedStyle> style = ComputedStyle::Create(); | |
nainar
2017/05/23 05:06:50
Happy to copy this test for all Border*Width.
| |
130 style->SetBorderBottomWidth(5); | |
131 EXPECT_EQ(style->BorderBottomWidth(), 0); | |
132 EXPECT_EQ(style->BorderBottom().Width(), 5); | |
133 style->SetBorderBottomStyle(EBorderStyle::kSolid); | |
134 EXPECT_EQ(style->BorderBottomWidth(), 5); | |
135 EXPECT_EQ(style->BorderBottom().Width(), 5); | |
136 } | |
137 | |
128 } // namespace blink | 138 } // namespace blink |
OLD | NEW |