-
-
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/edittext_missing_font test
This test verifies how FP behaves when we want to get some metrics related to text that uses a font which is missing.
- Loading branch information
Showing
4 changed files
with
111 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,54 @@ | ||
package { | ||
import flash.display.Sprite; | ||
import flash.text.TextField; | ||
import flash.text.TextFormat; | ||
|
||
[SWF(width="200", height="200")] | ||
public class Test extends Sprite { | ||
private var nextY: int = 0; | ||
private var nextX: int = 0; | ||
|
||
public function Test() { | ||
stage.scaleMode = "noScale"; | ||
|
||
newTextField(true, "input"); | ||
newTextField(true, "dynamic"); | ||
newTextField(false, "input"); | ||
newTextField(false, "dynamic"); | ||
} | ||
|
||
private function newTextField(device: Boolean, type: String):void { | ||
var text = new TextField(); | ||
text.type = type; | ||
text.border = true; | ||
text.x = nextX; | ||
text.y = nextY; | ||
nextY += 42; | ||
text.width = 100; | ||
text.height = 40; | ||
text.embedFonts = !device; | ||
var tf = new TextFormat(); | ||
tf.font = "Unknown Font 6ad5511bcd8b089c25e2212243c819d1"; | ||
tf.size = 20; | ||
tf.leading = 5; | ||
text.defaultTextFormat = tf; | ||
text.text = "xyz"; | ||
addChild(text); | ||
|
||
trace("device=" + device + ", type=" + type); | ||
trace(" getTextFormat(0, 1).font=" + (text.getTextFormat(0, 1).font)); | ||
trace(" length=" + text.length); | ||
trace(" text=" + text.text); | ||
trace(" numLines=" + text.numLines); | ||
trace(" textWidth is zero?=" + (text.textWidth == 0)); | ||
trace(" getCharBoundaries(0) is null?=" + (text.getCharBoundaries(0) == null)); | ||
trace(" getCharBoundaries(1) is null?=" + (text.getCharBoundaries(1) == null)); | ||
trace(" getCharBoundaries(3) is null?=" + (text.getCharBoundaries(3) == null)); | ||
trace(" getLineMetrics(0).ascent is zero?=" + (text.getLineMetrics(0).ascent == 0)); | ||
trace(" getLineMetrics(0).descent is zero?=" + (text.getLineMetrics(0).descent == 0)); | ||
trace(" getLineMetrics(0).height is 5?=" + (text.getLineMetrics(0).height == 5)); | ||
trace(" getLineMetrics(0).leading=" + (text.getLineMetrics(0).leading)); | ||
trace(" getLineMetrics(0).width is zero?=" + (text.getLineMetrics(0).width == 0)); | ||
} | ||
} | ||
} |
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,56 @@ | ||
device=true, type=input | ||
getTextFormat(0, 1).font=Unknown Font 6ad5511bcd8b089c25e2212243c819d1 | ||
length=3 | ||
text=xyz | ||
numLines=1 | ||
textWidth is zero?=false | ||
getCharBoundaries(0) is null?=false | ||
getCharBoundaries(1) is null?=false | ||
getCharBoundaries(3) is null?=true | ||
getLineMetrics(0).ascent is zero?=false | ||
getLineMetrics(0).descent is zero?=false | ||
getLineMetrics(0).height is 5?=false | ||
getLineMetrics(0).leading=5 | ||
getLineMetrics(0).width is zero?=false | ||
device=true, type=dynamic | ||
getTextFormat(0, 1).font=Unknown Font 6ad5511bcd8b089c25e2212243c819d1 | ||
length=3 | ||
text=xyz | ||
numLines=1 | ||
textWidth is zero?=false | ||
getCharBoundaries(0) is null?=false | ||
getCharBoundaries(1) is null?=false | ||
getCharBoundaries(3) is null?=true | ||
getLineMetrics(0).ascent is zero?=false | ||
getLineMetrics(0).descent is zero?=false | ||
getLineMetrics(0).height is 5?=false | ||
getLineMetrics(0).leading=5 | ||
getLineMetrics(0).width is zero?=false | ||
device=false, type=input | ||
getTextFormat(0, 1).font=Unknown Font 6ad5511bcd8b089c25e2212243c819d1 | ||
length=3 | ||
text=xyz | ||
numLines=1 | ||
textWidth is zero?=true | ||
getCharBoundaries(0) is null?=true | ||
getCharBoundaries(1) is null?=true | ||
getCharBoundaries(3) is null?=true | ||
getLineMetrics(0).ascent is zero?=true | ||
getLineMetrics(0).descent is zero?=true | ||
getLineMetrics(0).height is 5?=true | ||
getLineMetrics(0).leading=5 | ||
getLineMetrics(0).width is zero?=true | ||
device=false, type=dynamic | ||
getTextFormat(0, 1).font=Unknown Font 6ad5511bcd8b089c25e2212243c819d1 | ||
length=3 | ||
text=xyz | ||
numLines=1 | ||
textWidth is zero?=true | ||
getCharBoundaries(0) is null?=true | ||
getCharBoundaries(1) is null?=true | ||
getCharBoundaries(3) is null?=true | ||
getLineMetrics(0).ascent is zero?=true | ||
getLineMetrics(0).descent is zero?=true | ||
getLineMetrics(0).height is 5?=true | ||
getLineMetrics(0).leading=5 | ||
getLineMetrics(0).width is zero?=true |
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 @@ | ||
num_ticks = 1 |