Skip to content

Commit b0aad6b

Browse files
committed
core: Add integration tests for frame script cleanup pass
1 parent e937ddf commit b0aad6b

File tree

16 files changed

+541
-0
lines changed

16 files changed

+541
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Main constructor
2+
Container constructor
3+
Child constructor
4+
GrandChild constructor
5+
LeafChild constructor
6+
Main addFrameScript
7+
Child addFrameScript
8+
Main frame1
9+
GrandChild addFrameScript
10+
Container addFrameScript
11+
LeafChild addFrameScript
12+
Child frame1
13+
GrandChild frame1
14+
Container frame1
15+
LeafChild frame1
16+
Main frame2
17+
Container frame2
18+
Child frame2
19+
GrandChild frame2
20+
LeafChild frame2
21+
Container frame1
22+
Child frame1
23+
GrandChild frame1
24+
LeafChild frame1
25+
Main frame1
26+
Container frame2
27+
Child frame2
28+
GrandChild frame2
29+
LeafChild frame2
30+
Main frame2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
package
2+
{
3+
import flash.display.MovieClip;
4+
5+
public class Main extends MovieClip
6+
{
7+
public var child:*;
8+
9+
public var repeats:uint = 0;
10+
11+
public var descendant_names:Array = ["Container","Child","GrandChild","LeafChild"];
12+
13+
public var descendant_order:Array = [2,0,1,3];
14+
15+
public function Main()
16+
{
17+
trace("Main constructor");
18+
super();
19+
this.addScripts();
20+
var descendants:* = collectDescendants();
21+
for(i in this.descendant_order)
22+
{
23+
if(this.descendant_order[i] == 0)
24+
{
25+
descendants[i].addScripts();
26+
}
27+
}
28+
}
29+
30+
public function collectDescendants() : Array
31+
{
32+
return [this.child].concat(this.child.collectDescendants());
33+
}
34+
35+
public function addScripts() : *
36+
{
37+
trace("Main addFrameScript");
38+
addFrameScript(0,this.frame1,1,this.frame2);
39+
}
40+
41+
internal function frame1() : *
42+
{
43+
trace("Main frame1");
44+
if(this.repeats > 0)
45+
{
46+
return;
47+
}
48+
var descendants:* = collectDescendants();
49+
for(i in this.descendant_order)
50+
{
51+
for(j in this.descendant_order)
52+
{
53+
if(this.descendant_order[j] == i + 1)
54+
{
55+
descendants[j].addScripts();
56+
}
57+
}
58+
}
59+
}
60+
61+
internal function frame2() : *
62+
{
63+
trace("Main frame2");
64+
if(this.repeats > 0)
65+
{
66+
stop();
67+
}
68+
else
69+
{
70+
this.repeats += 1;
71+
}
72+
}
73+
}
74+
}
75+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package
2+
{
3+
import flash.display.MovieClip;
4+
5+
public class MyChild extends MovieClip
6+
{
7+
public static var counter:uint = 1;
8+
9+
public var grandchild:*;
10+
11+
public var id:uint = counter;
12+
13+
public var repeats:uint = 0;
14+
15+
public var name:String = "Child";
16+
17+
public function MyChild()
18+
{
19+
counter += 1;
20+
trace(this.name + " constructor");
21+
super();
22+
}
23+
24+
public function collectDescendants() : Array
25+
{
26+
return [this.grandchild].concat(this.grandchild.collectDescendants());
27+
}
28+
29+
public function addScripts() : *
30+
{
31+
trace(this.name + " addFrameScript");
32+
addFrameScript(0,this.frame1,1,this.frame2);
33+
}
34+
35+
internal function frame1() : *
36+
{
37+
trace(this.name + " frame1");
38+
}
39+
40+
internal function frame2() : *
41+
{
42+
trace(this.name + " frame2");
43+
if(this.repeats > 0)
44+
{
45+
stop();
46+
}
47+
else
48+
{
49+
this.repeats += 1;
50+
}
51+
}
52+
}
53+
}
54+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package
2+
{
3+
import flash.display.MovieClip;
4+
5+
public class MyContainer extends MovieClip
6+
{
7+
public var myChild1:*;
8+
9+
public var myChild2:*;
10+
11+
public var repeats:uint = 0;
12+
13+
public function MyContainer()
14+
{
15+
trace("Container constructor");
16+
super();
17+
}
18+
19+
public function collectDescendants() : Array
20+
{
21+
return [this.myChild1].concat(this.myChild1.collectDescendants()).concat([this.myChild2]).concat(this.myChild2.collectDescendants());
22+
}
23+
24+
public function addScripts() : *
25+
{
26+
trace("Container addFrameScript");
27+
addFrameScript(0,this.frame1,1,this.frame2);
28+
}
29+
30+
internal function frame1() : *
31+
{
32+
trace("Container frame1");
33+
}
34+
35+
internal function frame2() : *
36+
{
37+
trace("Container frame2");
38+
if(this.repeats > 0)
39+
{
40+
stop();
41+
}
42+
else
43+
{
44+
this.repeats += 1;
45+
}
46+
}
47+
}
48+
}
49+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package
2+
{
3+
import flash.display.MovieClip;
4+
5+
public class MyLeaf extends MovieClip
6+
{
7+
public static var counter:uint = 1;
8+
9+
public var id:uint = counter;
10+
11+
public var repeats:uint = 0;
12+
13+
public var name:String = "";
14+
15+
public function MyLeaf()
16+
{
17+
if(this.id == 1)
18+
{
19+
this.name = "GrandChild";
20+
}
21+
else
22+
{
23+
this.name = "LeafChild";
24+
}
25+
counter += 1;
26+
trace(this.name + " constructor");
27+
super();
28+
}
29+
30+
public function collectDescendants() : Array
31+
{
32+
return [];
33+
}
34+
35+
public function addScripts() : *
36+
{
37+
trace(this.name + " addFrameScript");
38+
addFrameScript(0,this.frame1,1,this.frame2);
39+
}
40+
41+
internal function frame1() : *
42+
{
43+
trace(this.name + " frame1");
44+
}
45+
46+
internal function frame2() : *
47+
{
48+
trace(this.name + " frame2");
49+
if(this.repeats > 0)
50+
{
51+
stop();
52+
}
53+
else
54+
{
55+
this.repeats += 1;
56+
}
57+
}
58+
}
59+
}
60+
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
num_frames = 20
2+
ignore = false
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Main constructor
2+
Container constructor
3+
Child constructor
4+
GrandChild constructor
5+
LeafChild constructor
6+
Main addFrameScript
7+
Child addFrameScript
8+
Main frame1
9+
GrandChild addFrameScript
10+
Container addFrameScript
11+
LeafChild addFrameScript
12+
Container frame1
13+
Child frame1
14+
GrandChild frame1
15+
LeafChild frame1
16+
Main frame2
17+
Container frame2
18+
Child frame2
19+
GrandChild frame2
20+
LeafChild frame2
21+
Container frame1
22+
Child frame1
23+
GrandChild frame1
24+
LeafChild frame1
25+
Main frame1
26+
Container frame2
27+
Child frame2
28+
GrandChild frame2
29+
LeafChild frame2
30+
Main frame2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
package
2+
{
3+
import flash.display.MovieClip;
4+
5+
public class Main extends MovieClip
6+
{
7+
public var child:*;
8+
9+
public var repeats:uint = 0;
10+
11+
public var descendant_names:Array = ["Container","Child","GrandChild","LeafChild"];
12+
13+
public var descendant_order:Array = [2,0,1,3];
14+
15+
public function Main()
16+
{
17+
trace("Main constructor");
18+
super();
19+
this.addScripts();
20+
var descendants:* = collectDescendants();
21+
for(i in this.descendant_order)
22+
{
23+
if(this.descendant_order[i] == 0)
24+
{
25+
descendants[i].addScripts();
26+
}
27+
}
28+
}
29+
30+
public function collectDescendants() : Array
31+
{
32+
return [this.child].concat(this.child.collectDescendants());
33+
}
34+
35+
public function addScripts() : *
36+
{
37+
trace("Main addFrameScript");
38+
addFrameScript(0,this.frame1,1,this.frame2);
39+
}
40+
41+
internal function frame1() : *
42+
{
43+
trace("Main frame1");
44+
if(this.repeats > 0)
45+
{
46+
return;
47+
}
48+
var descendants:* = collectDescendants();
49+
for(i in this.descendant_order)
50+
{
51+
for(j in this.descendant_order)
52+
{
53+
if(this.descendant_order[j] == i + 1)
54+
{
55+
descendants[j].addScripts();
56+
}
57+
}
58+
}
59+
gotoAndPlay(1);
60+
}
61+
62+
internal function frame2() : *
63+
{
64+
trace("Main frame2");
65+
if(this.repeats > 0)
66+
{
67+
stop();
68+
}
69+
else
70+
{
71+
this.repeats += 1;
72+
}
73+
}
74+
}
75+
}
76+

0 commit comments

Comments
 (0)