-
-
Notifications
You must be signed in to change notification settings - Fork 817
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Add edittext_autosize_align test
This test verifies how text align is handled when autosize and/or word wrap is set.
- Loading branch information
1 parent
6468cd1
commit 22498f7
Showing
6 changed files
with
75 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,68 @@ | ||
package { | ||
import flash.display.Sprite; | ||
import flash.text.TextField; | ||
import flash.text.TextFormat; | ||
|
||
[SWF(width="200", height="800")] | ||
public class Test extends Sprite { | ||
[Embed(source="TestFont.ttf", fontName="TestFont", embedAsCFF="false", unicodeRange="U+0061-U+0064")] | ||
private var TestFont:Class; | ||
|
||
private var nextY: int = 0; | ||
private var nextX: int = 0; | ||
|
||
public function Test() { | ||
stage.scaleMode = "noScale"; | ||
|
||
newTextField("none", "left", false); | ||
newTextField("none", "center", false); | ||
newTextField("none", "right", false); | ||
newTextField("left", "left", false); | ||
newTextField("left", "center", false); | ||
newTextField("left", "right", false); | ||
newTextField("center", "left", false); | ||
newTextField("center", "center", false); | ||
newTextField("center", "right", false); | ||
newTextField("right", "left", false); | ||
newTextField("right", "center", false); | ||
newTextField("right", "right", false); | ||
|
||
nextY = 0; | ||
nextX = 100; | ||
newTextField("none", "left", true); | ||
newTextField("none", "center", true); | ||
newTextField("none", "right", true); | ||
newTextField("left", "left", true); | ||
newTextField("left", "center", true); | ||
newTextField("left", "right", true); | ||
newTextField("center", "left", true); | ||
newTextField("center", "center", true); | ||
newTextField("center", "right", true); | ||
newTextField("right", "left", true); | ||
newTextField("right", "center", true); | ||
newTextField("right", "right", true); | ||
} | ||
|
||
private function newTextField(autosize: String, align: String, wordWrap: Boolean):void { | ||
var text = new TextField(); | ||
text.multiline = true; | ||
text.wordWrap = wordWrap; | ||
text.border = true; | ||
text.x = nextX; | ||
text.y = nextY; | ||
nextY += 62; | ||
text.width = 100; | ||
text.height = 60; | ||
text.embedFonts = true; | ||
var tf = new TextFormat(); | ||
tf.font = "TestFont"; | ||
tf.size = 20; | ||
tf.align = align; | ||
tf.leading = 5; | ||
text.defaultTextFormat = tf; | ||
text.text = "ab\nabab"; | ||
text.autoSize = autosize; | ||
addChild(text); | ||
} | ||
} | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
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,7 @@ | ||
num_ticks = 1 | ||
|
||
[image_comparisons.output] | ||
tolerance = 128 | ||
|
||
[player_options] | ||
with_renderer = { optional = false, sample_count = 4 } |