Skip to content

Commit

Permalink
tests: Add avm2/edittext_max_scroll_v_basic test
Browse files Browse the repository at this point in the history
This test verifies how the max scroll behaves depending on
text field's height and text height.
  • Loading branch information
kjarosh committed Nov 27, 2024
1 parent 3885147 commit c341d5f
Show file tree
Hide file tree
Showing 5 changed files with 1,045 additions and 0 deletions.
44 changes: 44 additions & 0 deletions tests/tests/swfs/avm2/edittext_max_scroll_v_basic/Test.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormat;

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

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

for (var h = 0; h < 50; ++h) {
for (var c = 0; c < 20; ++c) {
test(h, c);
}
}
}

private function test(height: int, chars: uint):void {
var text = new TextField();
text.multiline = true;
text.border = true;
text.width = 100;
text.height = height;
text.embedFonts = true;
var tf = new TextFormat();
tf.font = "TestFont";
tf.size = 20;
tf.leading = 6;
text.defaultTextFormat = tf;

var i = chars;
while (i > 1) {
text.text += "a\n";
i -= 2;
}
if (i > 0) {
text.text += "a";
}
trace("h=" + height + ",chars=" + chars + ",maxScrollV=" + text.maxScrollV + ",textHeight=" + text.textHeight);
}
}
}
Binary file not shown.
Loading

0 comments on commit c341d5f

Please sign in to comment.