-
-
Notifications
You must be signed in to change notification settings - Fork 828
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Add avm2/focus_root_movie test
This test verifies the behavior of focus and focusrect on the root movie clip.
- Loading branch information
Showing
5 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package { | ||
|
||
import flash.display.MovieClip; | ||
import flash.display.Shape; | ||
import flash.events.FocusEvent; | ||
|
||
[SWF(width="20", height="20", backgroundColor="#000000")] | ||
public class Test extends MovieClip { | ||
public function Test() { | ||
super(); | ||
addChild(newShape(0)); | ||
|
||
var root: MovieClip = MovieClip(this.root); | ||
root.tabEnabled = true; | ||
root.tabIndex = 1; | ||
root.focusRect = true; | ||
root.buttonMode = true; | ||
|
||
var clip: MovieClip = new MovieClip(); | ||
clip.tabEnabled = true; | ||
clip.tabIndex = 2; | ||
clip.focusRect = true; | ||
clip.addChild(newShape(1)); | ||
stage.addChild(clip); | ||
|
||
stage.addEventListener("focusIn", function(obj) { | ||
return function (evt: FocusEvent): void { | ||
if (evt.relatedObject != null && evt.target != null) { | ||
trace("Focus changed at " + obj.name + ": " + evt.relatedObject.name + " -> " + evt.target.name); | ||
} | ||
}; | ||
}(stage)); | ||
|
||
stage.focus = clip; | ||
trace("After set: " + stage.focus); | ||
stage.focus = root; | ||
trace("After set: " + stage.focus); | ||
trace("====="); | ||
} | ||
|
||
function newShape(n: int): Shape { | ||
var shape = new Shape(); | ||
shape.graphics.beginFill(0xFF0000); | ||
shape.graphics.drawRect(0, 0, 10, 10); | ||
shape.graphics.endFill(); | ||
shape.x = 10 * n; | ||
shape.y = 10 * n; | ||
return shape; | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
After set: [object MovieClip] | ||
Focus changed at null: instance2 -> root1 | ||
After set: [object Test] | ||
===== |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
num_ticks = 1 | ||
|
||
image_comparisons.output.trigger = 1 | ||
|
||
[player_options] | ||
with_renderer = { optional = false, sample_count = 1 } |