提交 f9ddb1ca 编写于 作者: O Ojan Vafai

Increase code coverage for RenderLayer::hitTestLayer.

Add tests for the NormalFlowChildren and transforms code paths.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/926823004
上级 89632f4d
......@@ -996,7 +996,6 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont
}
// Now check our overflow objects.
// TODO(ojan): This call has no test coverage.
hitLayer = hitTestChildren(NormalFlowChildren, rootLayer, request, result, hitTestRect, hitTestLocation,
localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattenedTransformState.get(), depthSortDescendants);
if (hitLayer) {
......
......@@ -2,7 +2,9 @@ CONSOLE: unittest-suite-wait-for-done
CONSOLE: PASS: should hit test
CONSOLE: PASS: should hit test child and parent
CONSOLE: PASS: should hit test child with layered parent
CONSOLE: PASS: should hit test transformed child
CONSOLE: PASS: should hit test canvas
CONSOLE:
CONSOLE: All 3 tests passed.
CONSOLE: All 5 tests passed.
CONSOLE: unittest-suite-success
DONE
......@@ -4,11 +4,13 @@ foo, parent { width: 100px; height: 100px; background: blue; }
bar { width: 100px; height: 100px; background: purple; }
parent { display: paragraph; }
child { background: salmon; }
canvas { height: 50px; background-color: pink; }
</style>
<foo /><bar />
<parent>
<child>Foo bar</child>
</parent>
<canvas />
<script>
import "../resources/third_party/unittest/unittest.dart";
import "../resources/unit.dart";
......@@ -48,6 +50,16 @@ void main() {
document.querySelector('parent').style.setProperty("transform", "translate3d(0, 0, 0)");
hitTestWithChildren();
});
test("should hit test transformed child", () {
document.querySelector('child').style.setProperty("transform", "translate3d(100px, 0, 0)");
expect(document.elementFromPoint(50, 210).tagName, equals('parent'));
expect(document.elementFromPoint(150, 210).tagName, equals('child'));
});
test("should hit test canvas", () {
expect(document.elementFromPoint(50, 310).tagName, equals('canvas'));
});
}
</script>
</sky>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册