Skip to content

Commit 5ed3a49

Browse files
committed
tests: Add failing displayobject_hittestpoint_root test
1 parent 5aa7f02 commit 5ed3a49

File tree

6 files changed

+78
-0
lines changed

6 files changed

+78
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package {
2+
import flash.display.MovieClip;
3+
4+
public class EmptyContainer extends MovieClip {
5+
public function EmptyContainer() {
6+
}
7+
}
8+
}
Binary file not shown.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package {
2+
import flash.display.Loader;
3+
import flash.display.MovieClip;
4+
import flash.display.Shape;
5+
import flash.events.Event;
6+
import flash.net.URLRequest;
7+
8+
public class Test extends MovieClip {
9+
public function Test() {
10+
var shape = new Shape();
11+
shape.name = "shape";
12+
shape.graphics.beginFill(0xFF0000);
13+
shape.graphics.drawRect(0, 0, 100, 100);
14+
shape.graphics.endFill();
15+
16+
addChild(shape);
17+
18+
trace("// stage root - onscreen");
19+
Print(shape);
20+
21+
trace("// stage root - offscreen");
22+
var savedStage = this.stage;
23+
savedStage.removeChild(this);
24+
Print(shape);
25+
savedStage.addChild(this);
26+
27+
var loader = new Loader();
28+
loader.name = "loader";
29+
loader.load(new URLRequest("EmptyContainer.swf"));
30+
31+
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(e: Event) : void {
32+
trace("// load complete");
33+
34+
var container: MovieClip = e.target.content;
35+
//container.name = "container"; // makes fp angry.. okay
36+
container.addChild(shape);
37+
38+
trace("// loader root - offscreen");
39+
Print(shape);
40+
41+
addChild(container);
42+
43+
trace("// loader root - onscreen");
44+
Print(shape);
45+
});
46+
}
47+
48+
public function Print(shape: Shape) : void
49+
{
50+
trace(shape.hitTestPoint(50, 50));
51+
shape.root.x += 100;
52+
trace(shape.hitTestPoint(50, 50));
53+
shape.root.x -= 100;
54+
}
55+
}
56+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// stage root - onscreen
2+
true
3+
true
4+
// stage root - offscreen
5+
true
6+
true
7+
// load complete
8+
// loader root - offscreen
9+
true
10+
false
11+
// loader root - onscreen
12+
true
13+
false
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
num_ticks = 2

0 commit comments

Comments
 (0)