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

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyleTest.cpp

Issue 2890733002: Make EBorderStyle an enum class. (Closed)
Patch Set: Build for Mac Created 3 years, 7 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 unified diff | Download patch
OLDNEW
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 29 matching lines...) Expand all
40 RefPtr<ComputedStyle> style2 = ComputedStyle::Create(); 40 RefPtr<ComputedStyle> style2 = ComputedStyle::Create();
41 style1->SetClipPath(path1); 41 style1->SetClipPath(path1);
42 style2->SetClipPath(path2); 42 style2->SetClipPath(path2);
43 ASSERT_EQ(*style1, *style2); 43 ASSERT_EQ(*style1, *style2);
44 } 44 }
45 45
46 TEST(ComputedStyleTest, FocusRingWidth) { 46 TEST(ComputedStyleTest, FocusRingWidth) {
47 RefPtr<ComputedStyle> style = ComputedStyle::Create(); 47 RefPtr<ComputedStyle> style = ComputedStyle::Create();
48 style->SetEffectiveZoom(3.5); 48 style->SetEffectiveZoom(3.5);
49 #if OS(MACOSX) 49 #if OS(MACOSX)
50 style->SetOutlineStyle(kBorderStyleSolid); 50 style->SetOutlineStyle(EBorderStyle::kSolid);
51 ASSERT_EQ(3, style->GetOutlineStrokeWidthForFocusRing()); 51 ASSERT_EQ(3, style->GetOutlineStrokeWidthForFocusRing());
52 #else 52 #else
53 ASSERT_EQ(3.5, style->GetOutlineStrokeWidthForFocusRing()); 53 ASSERT_EQ(3.5, style->GetOutlineStrokeWidthForFocusRing());
54 style->SetEffectiveZoom(0.5); 54 style->SetEffectiveZoom(0.5);
55 ASSERT_EQ(1, style->GetOutlineStrokeWidthForFocusRing()); 55 ASSERT_EQ(1, style->GetOutlineStrokeWidthForFocusRing());
56 #endif 56 #endif
57 } 57 }
58 58
59 TEST(ComputedStyleTest, FocusRingOutset) { 59 TEST(ComputedStyleTest, FocusRingOutset) {
60 RefPtr<ComputedStyle> style = ComputedStyle::Create(); 60 RefPtr<ComputedStyle> style = ComputedStyle::Create();
61 style->SetOutlineStyle(kBorderStyleSolid); 61 style->SetOutlineStyle(EBorderStyle::kSolid);
62 style->SetOutlineStyleIsAuto(kOutlineIsAutoOn); 62 style->SetOutlineStyleIsAuto(kOutlineIsAutoOn);
63 style->SetEffectiveZoom(4.75); 63 style->SetEffectiveZoom(4.75);
64 #if OS(MACOSX) 64 #if OS(MACOSX)
65 ASSERT_EQ(4, style->OutlineOutsetExtent()); 65 ASSERT_EQ(4, style->OutlineOutsetExtent());
66 #else 66 #else
67 ASSERT_EQ(3, style->OutlineOutsetExtent()); 67 ASSERT_EQ(3, style->OutlineOutsetExtent());
68 #endif 68 #endif
69 } 69 }
70 70
71 TEST(ComputedStyleTest, Preserve3dForceStackingContext) { 71 TEST(ComputedStyleTest, Preserve3dForceStackingContext) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 103 }
104 104
105 TEST(CompuetedStyleTest, HasOutlineWithCurrentColor) { 105 TEST(CompuetedStyleTest, HasOutlineWithCurrentColor) {
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(kBorderStyleSolid); 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(CompuetedStyleTest, 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(kBorderStyleSolid); 124 style->SetBorderBottomStyle(EBorderStyle::kSolid);
125 EXPECT_TRUE(style->HasBorderColorReferencingCurrentColor()); 125 EXPECT_TRUE(style->HasBorderColorReferencingCurrentColor());
126 } 126 }
127 127
128 } // namespace blink 128 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyleConstants.h ('k') | third_party/WebKit/Source/core/style/OutlineValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698