Skip to content

Commit

Permalink
tests: Test TextField::getLineText
Browse files Browse the repository at this point in the history
  • Loading branch information
evilpie committed Feb 7, 2024
1 parent d7c7716 commit ec403e6
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/tests/swfs/avm2/textfield_getlinetext/Test.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.FocusEvent;

public class Test extends Sprite {
public function Test() {
trace("///");
var textField1 = new TextField();
textField1.text = "hello world";
trace(textField1.getLineText(0));
try {
trace(textField1.getLineText(1));
} catch (e) {
trace(e);
}

trace("///");
var textField2 = new TextField();
textField2.multiline = true;
textField2.text = "line 1\nline 2";
trace(textField2.getLineText(0));
trace(textField2.getLineText(1));

trace("///");
var textField3 = new TextField();
textField3.htmlText = "a <b>b</b> <i>i</i>";
trace(textField3.getLineText(0));
}
}
}
8 changes: 8 additions & 0 deletions tests/tests/swfs/avm2/textfield_getlinetext/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
///
hello world
RangeError: Error #2006: The supplied index is out of bounds.
///
line 1
line 2
///
a b i
Binary file not shown.
1 change: 1 addition & 0 deletions tests/tests/swfs/avm2/textfield_getlinetext/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
num_ticks = 1

0 comments on commit ec403e6

Please sign in to comment.