Skip to content

Commit

Permalink
tests: Add avm2/edittext_empty_text_format test
Browse files Browse the repository at this point in the history
This test verifies the text format of empty text.
It is observable in empty input text fields,
because they have to show the caret.
  • Loading branch information
kjarosh committed Dec 19, 2024
1 parent 4fec150 commit 492ba87
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/tests/swfs/avm2/edittext_empty_text_format/Test.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package {
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.geom.*;

public class Test extends MovieClip {
[Embed(source="TestFont.ttf", fontName="TestFont", embedAsCFF="false", unicodeRange="U+0061-U+0064")]
private var TestFont:Class;

public function Test() {
stage.scaleMode = "noScale";

var field = new TextField();
var tf = new TextFormat("TestFont", 10);
tf.leading = 5;
field.defaultTextFormat = tf;
field.type = "input";
field.embedFonts = true;

trace(field.textHeight);
trace(field.getLineMetrics(0).ascent);
trace(field.getLineMetrics(0).descent);
trace(field.getLineMetrics(0).height);
trace(field.getLineMetrics(0).leading);
trace(field.getLineMetrics(0).width);
trace(field.getLineMetrics(0).x);
}
}
}
Binary file not shown.
7 changes: 7 additions & 0 deletions tests/tests/swfs/avm2/edittext_empty_text_format/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
15
8
2
15
5
0
2
Binary file not shown.
1 change: 1 addition & 0 deletions tests/tests/swfs/avm2/edittext_empty_text_format/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
num_ticks = 1

0 comments on commit 492ba87

Please sign in to comment.