Skip to content

Commit

Permalink
Add testcases for PASSWORD editor.
Browse files Browse the repository at this point in the history
  • Loading branch information
PinZhang committed Nov 12, 2014
1 parent 742ea6d commit 66f2863
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/automation.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ casper.test.begin("unit tests", 7 + gfxTests.length, function(test) {
function basicUnitTests() {
casper.waitForText("DONE", function() {
var content = this.getPageContent();
if (content.contains("DONE: 71038 pass, 0 fail, 180 known fail, 0 unknown pass")) {
if (content.contains("DONE: 71085 pass, 0 fail, 180 known fail, 0 unknown pass")) {
test.pass('main unit tests');
} else {
this.debugPage();
Expand Down
12 changes: 9 additions & 3 deletions tests/com/nokia/mid/ui/TestTextEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.TextField;

public class TestTextEditor extends Canvas implements Testlet {
public void test(TestHarness th) {
public void testConstraints(TestHarness th, int constraints) {
TextEditor textEditor = new TextEditor("Hello, world!", 20, 0, 100, 24);

th.check(textEditor.getContent(), "Hello, world!");
th.check(textEditor.getMaxSize(), 20);
th.check(textEditor.getCaretPosition(), 13);

textEditor.setConstraints(0);
th.check(textEditor.getConstraints(), 0);
textEditor.setConstraints(constraints);
th.check(textEditor.getConstraints(), constraints);

th.check(textEditor.getWidth(), 100);
th.check(textEditor.getHeight(), 24);
Expand Down Expand Up @@ -100,5 +101,10 @@ public void test(TestHarness th) {
textEditor.setParent(null);
}

public void test(TestHarness th) {
testConstraints(th, TextField.ANY);
testConstraints(th, TextField.PASSWORD);
}

protected void paint(Graphics graphics) {}
}

0 comments on commit 66f2863

Please sign in to comment.