summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/hwui/tests/common/TestUtils.cpp7
-rw-r--r--libs/hwui/tests/unit/RenderNodeDrawableTests.cpp6
-rw-r--r--libs/hwui/tests/unit/SkiaRenderPropertiesTests.cpp18
3 files changed, 7 insertions, 24 deletions
diff --git a/libs/hwui/tests/common/TestUtils.cpp b/libs/hwui/tests/common/TestUtils.cpp
index 275ce166728b..79daa3f9ffeb 100644
--- a/libs/hwui/tests/common/TestUtils.cpp
+++ b/libs/hwui/tests/common/TestUtils.cpp
@@ -193,10 +193,9 @@ SkColor TestUtils::getColor(const sk_sp<SkSurface>& surface, int x, int y) {
}
SkRect TestUtils::getClipBounds(const SkCanvas* canvas) {
- SkClipStack::BoundsType boundType;
- SkRect clipBounds;
- canvas->getClipStack()->getBounds(&clipBounds, &boundType);
- return clipBounds;
+ SkIRect bounds;
+ (void)canvas->getClipDeviceBounds(&bounds);
+ return SkRect::Make(bounds);
}
SkRect TestUtils::getLocalClipBounds(const SkCanvas* canvas) {
diff --git a/libs/hwui/tests/unit/RenderNodeDrawableTests.cpp b/libs/hwui/tests/unit/RenderNodeDrawableTests.cpp
index f5ff05849793..2f1eae3ec10e 100644
--- a/libs/hwui/tests/unit/RenderNodeDrawableTests.cpp
+++ b/libs/hwui/tests/unit/RenderNodeDrawableTests.cpp
@@ -865,10 +865,8 @@ RENDERTHREAD_TEST(RenderNodeDrawable, colorOp_unbounded) {
void onDrawPaint(const SkPaint&) {
switch (mDrawCounter++) {
case 0:
- // While this mirrors FrameBuilder::colorOp_unbounded, this value is different
- // because there is no root (root is clipped in SkiaPipeline::renderFrame).
- // SkiaPipeline.clipped and clip_replace verify the root clip.
- EXPECT_TRUE(TestUtils::getClipBounds(this).isEmpty());
+ EXPECT_EQ(SkRect::MakeWH(CANVAS_WIDTH, CANVAS_HEIGHT),
+ TestUtils::getClipBounds(this));
break;
case 1:
EXPECT_EQ(SkRect::MakeWH(10, 10), TestUtils::getClipBounds(this));
diff --git a/libs/hwui/tests/unit/SkiaRenderPropertiesTests.cpp b/libs/hwui/tests/unit/SkiaRenderPropertiesTests.cpp
index 92d9d3d0d5fe..95c6ed6059b0 100644
--- a/libs/hwui/tests/unit/SkiaRenderPropertiesTests.cpp
+++ b/libs/hwui/tests/unit/SkiaRenderPropertiesTests.cpp
@@ -87,14 +87,7 @@ TEST(RenderNodeDrawable, renderPropRevealClip) {
testProperty([](RenderProperties& properties) {
properties.mutableRevealClip().set(true, 50, 50, 25);
}, [](const SkCanvas& canvas) {
- SkClipStack::Iter it(*canvas.getClipStack(), SkClipStack::Iter::kBottom_IterStart);
- const SkClipStack::Element *top = it.next();
- ASSERT_NE(nullptr, top);
- SkPath clip;
- top->asPath(&clip);
- SkRect rect;
- EXPECT_TRUE(clip.isOval(&rect));
- EXPECT_EQ(SkRect::MakeLTRB(25, 25, 75, 75), rect);
+ EXPECT_EQ(SkRect::MakeLTRB(25, 25, 75, 75), TestUtils::getClipBounds(&canvas));
});
}
@@ -103,14 +96,7 @@ TEST(RenderNodeDrawable, renderPropOutlineClip) {
properties.mutableOutline().setShouldClip(true);
properties.mutableOutline().setRoundRect(10, 20, 30, 40, 5.0f, 0.5f);
}, [](const SkCanvas& canvas) {
- SkClipStack::Iter it(*canvas.getClipStack(), SkClipStack::Iter::kBottom_IterStart);
- const SkClipStack::Element *top = it.next();
- ASSERT_NE(nullptr, top);
- SkPath clip;
- top->asPath(&clip);
- SkRRect rrect;
- EXPECT_TRUE(clip.isRRect(&rrect));
- EXPECT_EQ(SkRRect::MakeRectXY(SkRect::MakeLTRB(10, 20, 30, 40), 5.0f, 5.0f), rrect);
+ EXPECT_EQ(SkRect::MakeLTRB(10, 20, 30, 40), TestUtils::getClipBounds(&canvas));
});
}