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

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

Issue 2460683002: Fix focus ring damage sometimes being 1 pixel off. (Closed)
Patch Set: fix linux component/debug link error Created 4 years, 1 month 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 25 matching lines...) Expand all
36 RefPtr<BasicShapeCircle> shape = BasicShapeCircle::create(); 36 RefPtr<BasicShapeCircle> shape = BasicShapeCircle::create();
37 RefPtr<ShapeClipPathOperation> path1 = ShapeClipPathOperation::create(shape); 37 RefPtr<ShapeClipPathOperation> path1 = ShapeClipPathOperation::create(shape);
38 RefPtr<ShapeClipPathOperation> path2 = ShapeClipPathOperation::create(shape); 38 RefPtr<ShapeClipPathOperation> path2 = ShapeClipPathOperation::create(shape);
39 RefPtr<ComputedStyle> style1 = ComputedStyle::create(); 39 RefPtr<ComputedStyle> style1 = ComputedStyle::create();
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) {
47 RefPtr<ComputedStyle> style = ComputedStyle::create();
48 style->setEffectiveZoom(3.5);
49 #if OS(MACOSX)
50 style->setOutlineStyle(BorderStyleSolid);
51 ASSERT_EQ(3, style->getOutlineStrokeWidthForFocusRing());
52 #else
53 ASSERT_EQ(3.5, style->getOutlineStrokeWidthForFocusRing());
54 style->setEffectiveZoom(0.5);
55 ASSERT_EQ(1, style->getOutlineStrokeWidthForFocusRing());
56 #endif
57 }
58
59 TEST(ComputedStyleTest, FocusRingOutset) {
60 RefPtr<ComputedStyle> style = ComputedStyle::create();
61 style->setOutlineStyle(BorderStyleSolid);
62 style->setOutlineStyleIsAuto(OutlineIsAutoOn);
63 style->setEffectiveZoom(4.75);
64 #if OS(MACOSX)
65 ASSERT_EQ(4, style->outlineOutsetExtent());
66 #else
67 ASSERT_EQ(3, style->outlineOutsetExtent());
68 #endif
69 }
70
46 } // namespace blink 71 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.cpp ('k') | third_party/WebKit/Source/core/style/StyleBackgroundData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698