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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp

Issue 2619163002: More early returns in GeometryMapper methods (Closed)
Patch Set: Fix unit tests Created 3 years, 11 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/platform/graphics/paint/GeometryMapper.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 "platform/graphics/paint/GeometryMapper.h" 5 #include "platform/graphics/paint/GeometryMapper.h"
6 6
7 #include "platform/geometry/GeometryTestHelpers.h" 7 #include "platform/geometry/GeometryTestHelpers.h"
8 #include "platform/geometry/LayoutRect.h" 8 #include "platform/geometry/LayoutRect.h"
9 #include "platform/graphics/paint/ClipPaintPropertyNode.h" 9 #include "platform/graphics/paint/ClipPaintPropertyNode.h"
10 #include "platform/graphics/paint/EffectPaintPropertyNode.h" 10 #include "platform/graphics/paint/EffectPaintPropertyNode.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 EXPECT_TRUE(success); \ 88 EXPECT_TRUE(success); \
89 EXPECT_RECT_EQ(expectedTransformedRect, \ 89 EXPECT_RECT_EQ(expectedTransformedRect, \
90 geometryMapper->localToAncestorRect( \ 90 geometryMapper->localToAncestorRect( \
91 inputRect, localPropertyTreeState, \ 91 inputRect, localPropertyTreeState, \
92 ancestorPropertyTreeState, success)); \ 92 ancestorPropertyTreeState, success)); \
93 EXPECT_RECT_EQ(expectedTransformedRect, \ 93 EXPECT_RECT_EQ(expectedTransformedRect, \
94 geometryMapper->mapRectToDestinationSpace( \ 94 geometryMapper->mapRectToDestinationSpace( \
95 inputRect, localPropertyTreeState, \ 95 inputRect, localPropertyTreeState, \
96 ancestorPropertyTreeState, success)); \ 96 ancestorPropertyTreeState, success)); \
97 EXPECT_TRUE(success); \ 97 EXPECT_TRUE(success); \
98 EXPECT_EQ( \ 98 if (ancestorPropertyTreeState.transform() != \
99 expectedTransformToAncestor, \ 99 localPropertyTreeState.transform()) { \
100 getPrecomputedDataForAncestor(ancestorPropertyTreeState) \ 100 EXPECT_EQ( \
101 .toAncestorTransforms.get(localPropertyTreeState.transform())); \ 101 expectedTransformToAncestor, \
102 EXPECT_EQ(expectedClipInAncestorSpace, \ 102 getPrecomputedDataForAncestor(ancestorPropertyTreeState) \
103 getPrecomputedDataForAncestor(ancestorPropertyTreeState) \ 103 .toAncestorTransforms.get(localPropertyTreeState.transform())); \
104 .toAncestorClipRects.get(localPropertyTreeState.clip())); \ 104 } \
105 if (ancestorPropertyTreeState.clip() != localPropertyTreeState.clip()) { \
106 EXPECT_EQ(expectedClipInAncestorSpace, \
107 getPrecomputedDataForAncestor(ancestorPropertyTreeState) \
108 .toAncestorClipRects.get(localPropertyTreeState.clip())); \
109 } \
105 } while (false) 110 } while (false)
106 111
107 TEST_F(GeometryMapperTest, Root) { 112 TEST_F(GeometryMapperTest, Root) {
108 FloatRect input(0, 0, 100, 100); 113 FloatRect input(0, 0, 100, 100);
109 114
110 CHECK_MAPPINGS(input, input, input, 115 CHECK_MAPPINGS(input, input, input,
111 TransformPaintPropertyNode::root()->matrix(), 116 TransformPaintPropertyNode::root()->matrix(),
112 ClipPaintPropertyNode::root()->clipRect().rect(), 117 ClipPaintPropertyNode::root()->clipRect().rect(),
113 rootPropertyTreeState(), rootPropertyTreeState()); 118 rootPropertyTreeState(), rootPropertyTreeState());
114 } 119 }
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 EXPECT_EQ(rootPropertyTreeState().transform(), 581 EXPECT_EQ(rootPropertyTreeState().transform(),
577 leastCommonAncestor(childOfChild2.get(), 582 leastCommonAncestor(childOfChild2.get(),
578 rootPropertyTreeState().transform())); 583 rootPropertyTreeState().transform()));
579 EXPECT_EQ(child2, leastCommonAncestor(childOfChild2.get(), child2.get())); 584 EXPECT_EQ(child2, leastCommonAncestor(childOfChild2.get(), child2.get()));
580 585
581 EXPECT_EQ(rootPropertyTreeState().transform(), 586 EXPECT_EQ(rootPropertyTreeState().transform(),
582 leastCommonAncestor(child1.get(), child2.get())); 587 leastCommonAncestor(child1.get(), child2.get()));
583 } 588 }
584 589
585 } // namespace blink 590 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698