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

Side by Side Diff: sky/tests/layout/document-elementFromPoint.sky

Issue 1215063003: Remove Sky tests that we don't intend to port to the new world (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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
OLDNEW
(Empty)
1 <sky>
2 <style>
3 foo, parent { width: 100px; height: 100px; background: blue; }
4 bar { width: 100px; height: 100px; background: purple; }
5 parent { display: paragraph; }
6 child { background: salmon; display: paragraph; }
7 canvas { height: 50px; background-color: pink; }
8 inline-flex { display: inline-flex; width: 50px; height: 50px; background: green ; }
9 grand-child { width: 50px; height: 50px; transform: translate3d(100px, 0, 0); ba ckground: papayawhip; }
10 </style>
11 <foo /><bar />
12 <parent>
13 <child>Foo bar</child>
14 <inline-flex>
15 <grand-child />
16 </inline-flex>
17 </parent>
18 <canvas />
19 <script>
20 import "../resources/third_party/unittest/unittest.dart";
21 import "../resources/unit.dart";
22
23 import "dart:sky";
24
25 void main() {
26 initUnit();
27
28 test("should hit test", () {
29 // FIXME: We should have much better hit-testing coverage, at least:
30 // inline content (both sections of a wrapped run)
31 // text node
32 // flex box
33 // display: paragraph
34 // position: absolute
35 // position: relative
36 // z-order (missing, zero, positive and negative)
37 expect(document.elementFromPoint(50, 50).tagName, equals('foo'));
38 expect(document.elementFromPoint(50, 150).tagName, equals('bar'));
39 expect(document.elementFromPoint(150, 50).tagName, equals('sky'));
40 });
41
42 void hitTestWithChildren() {
43 expect(document.elementFromPoint(50, 210).tagName, equals('child'));
44 // Right of the <child> inline.
45 expect(document.elementFromPoint(95, 210).tagName, equals('parent'));
46 // Below the <child> inline.
47 expect(document.elementFromPoint(50, 275).tagName, equals('parent'));
48 }
49
50 test("should hit test child and parent", () {
51 hitTestWithChildren();
52 });
53
54 test("should hit test child with layered parent", () {
55 document.querySelector('parent').style["transform"] = "translate3d(0, 0, 0)" ;
56 hitTestWithChildren();
57 });
58
59 test("should hit test transformed child", () {
60 document.querySelector('parent').style["display"] = "flex";
61 document.querySelector('child').style["transform"] = "translate3d(100px, 0, 0)";
62 expect(document.elementFromPoint(50, 210).tagName, equals('parent'));
63 expect(document.elementFromPoint(150, 210).tagName, equals('child'));
64 expect(document.elementFromPoint(25, 240).tagName, equals('inline-flex'));
65 // TODO(ojan): This is incorrect. It should hit grand-child.
66 // This broke sometime before 4153b8a515d54275934d4244aaf2d5a7a8fe3333.
67 expect(document.elementFromPoint(150, 240).tagName, equals('sky'));
68 });
69
70 test("should hit test canvas", () {
71 expect(document.elementFromPoint(50, 310).tagName, equals('canvas'));
72 });
73 }
74 </script>
75 </sky>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698