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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreePrinterTest.cpp

Issue 2377183002: Add paint property path printers and test them (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreePrinter.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/paint/PaintPropertyTreePrinter.h" 5 #include "core/paint/PaintPropertyTreePrinter.h"
6 6
7 #include "core/layout/LayoutObject.h"
7 #include "core/layout/LayoutTestHelper.h" 8 #include "core/layout/LayoutTestHelper.h"
8 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" 9 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h"
9 #include "testing/gmock/include/gmock/gmock-matchers.h" 10 #include "testing/gmock/include/gmock/gmock-matchers.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 12
12 #ifndef NDEBUG 13 #ifndef NDEBUG
13 14
14 namespace blink { 15 namespace blink {
15 16
16 typedef bool TestParamRootLayerScrolling; 17 typedef bool TestParamRootLayerScrolling;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 74
74 TEST_P(PaintPropertyTreePrinterTest, SimpleScrollTree) 75 TEST_P(PaintPropertyTreePrinterTest, SimpleScrollTree)
75 { 76 {
76 setBodyInnerHTML("<div style='height: 4000px;'>hello world</div>"); 77 setBodyInnerHTML("<div style='height: 4000px;'>hello world</div>");
77 String scrollTreeAsString = scrollPropertyTreeAsString(*document().view()); 78 String scrollTreeAsString = scrollPropertyTreeAsString(*document().view());
78 EXPECT_THAT(scrollTreeAsString.ascii().data(), 79 EXPECT_THAT(scrollTreeAsString.ascii().data(),
79 testing::MatchesRegex("root .*" 80 testing::MatchesRegex("root .*"
80 " Scroll \\(.*\\) .*")); 81 " Scroll \\(.*\\) .*"));
81 } 82 }
82 83
84 TEST_P(PaintPropertyTreePrinterTest, SimpleTransformTreePath)
85 {
86 setBodyInnerHTML("<div id='transform' style='transform: translate3d(10px, 10 px, 0px);'></div>");
87 LayoutObject* transformedObject = document().getElementById("transform")->la youtObject();
88 const ObjectPaintProperties* transformedObjectProperties = transformedObject ->objectPaintProperties();
89 String transformPathAsString = transformPaintPropertyPathAsString(transforme dObjectProperties->transform());
90 EXPECT_THAT(transformPathAsString.ascii().data(),
91 testing::MatchesRegex("root .* transform.*"
92 " .* transform.*"
93 " .* transform.*"
94 " .* transform.*"));
95 }
96
97 TEST_P(PaintPropertyTreePrinterTest, SimpleClipTreePath)
98 {
99 setBodyInnerHTML("<div id='clip' style='position: absolute; clip: rect(10px, 80px, 70px, 40px);'></div>");
100 LayoutObject* clippedObject = document().getElementById("clip")->layoutObjec t();
101 const ObjectPaintProperties* clippedObjectProperties = clippedObject->object PaintProperties();
102 String clipPathAsString = clipPaintPropertyPathAsString(clippedObjectPropert ies->cssClip());
103 EXPECT_THAT(clipPathAsString.ascii().data(),
104 testing::MatchesRegex("root .* rect.*"
105 " .* rect.*"
106 " .* rect.*"));
107 }
108
109 TEST_P(PaintPropertyTreePrinterTest, SimpleEffectTreePath)
110 {
111 setBodyInnerHTML("<div id='effect' style='opacity: 0.9;'></div>");
112 LayoutObject* effectObject = document().getElementById("effect")->layoutObje ct();
113 const ObjectPaintProperties* effectObjectProperties = effectObject->objectPa intProperties();
114 String effectPathAsString = effectPaintPropertyPathAsString(effectObjectProp erties->effect());
115 EXPECT_THAT(effectPathAsString.ascii().data(),
116 testing::MatchesRegex("root .* opacity.*"
117 " .* opacity.*"));
118 }
119
120 TEST_P(PaintPropertyTreePrinterTest, SimpleScrollTreePath)
121 {
122 setBodyInnerHTML("<div id='scroll' style='overflow: scroll; height: 100px;'> "
123 " <div id='forceScroll' style='height: 4000px;'></div>"
124 "</div>");
125 LayoutObject* scrollObject = document().getElementById("scroll")->layoutObje ct();
126 const ObjectPaintProperties* scrollObjectProperties = scrollObject->objectPa intProperties();
127 String scrollPathAsString = scrollPaintPropertyPathAsString(scrollObjectProp erties->scroll());
128 EXPECT_THAT(scrollPathAsString.ascii().data(),
129 testing::MatchesRegex("root .* scroll.*"
130 " .* scroll.*"));
131 }
132
83 } // namespace blink 133 } // namespace blink
84 134
85 #endif 135 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreePrinter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698