summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2010-12-07 13:44:20 +0000
committerArtur Signell <artur.signell@itmill.com>2010-12-07 13:44:20 +0000
commita91f7ddca1dbe0b039859f6581e750df9a96e898 (patch)
treeeba5c7df02547c07794eda5c04f1483d1a1ea69a /tests
parent318456845454cee32cb2c68dd2a74ee7b3cb6388 (diff)
downloadvaadin-framework-a91f7ddca1dbe0b039859f6581e750df9a96e898.tar.gz
vaadin-framework-a91f7ddca1dbe0b039859f6581e750df9a96e898.zip
Updated tests to be consistent with AbstractTextField hierarchy (#3752)
svn changeset:16363/svn branch:6.5
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/vaadin/tests/components/abstractfield/AbstractTextFieldTest.java180
-rw-r--r--tests/src/com/vaadin/tests/components/textarea/TextAreaTest.java177
-rw-r--r--tests/src/com/vaadin/tests/components/textfield/TextFieldMaxLength.html7
-rw-r--r--tests/src/com/vaadin/tests/components/textfield/TextFieldNullRepresentation.html3
-rw-r--r--tests/src/com/vaadin/tests/components/textfield/TextFieldNullRepresentationAndSelection.html5
-rw-r--r--tests/src/com/vaadin/tests/components/textfield/TextFieldTest.java174
6 files changed, 186 insertions, 360 deletions
diff --git a/tests/src/com/vaadin/tests/components/abstractfield/AbstractTextFieldTest.java b/tests/src/com/vaadin/tests/components/abstractfield/AbstractTextFieldTest.java
index 848a7d5c90..eb9adef8d2 100644
--- a/tests/src/com/vaadin/tests/components/abstractfield/AbstractTextFieldTest.java
+++ b/tests/src/com/vaadin/tests/components/abstractfield/AbstractTextFieldTest.java
@@ -1,11 +1,16 @@
package com.vaadin.tests.components.abstractfield;
+import java.util.ArrayList;
import java.util.LinkedHashMap;
+import java.util.List;
+import com.vaadin.event.FieldEvents.TextChangeEvent;
+import com.vaadin.event.FieldEvents.TextChangeListener;
import com.vaadin.ui.AbstractTextField;
+import com.vaadin.ui.AbstractTextField.TextChangeEventMode;
public abstract class AbstractTextFieldTest<T extends AbstractTextField>
- extends AbstractFieldTest<T> {
+ extends AbstractFieldTest<T> implements TextChangeListener {
private Command<T, Integer> maxlengthCommand = new Command<T, Integer>() {
@@ -27,6 +32,60 @@ public abstract class AbstractTextFieldTest<T extends AbstractTextField>
}
};
+ private Command<T, String> inputPromptCommand = new Command<T, String>() {
+ public void execute(T c, String value, Object data) {
+ c.setInputPrompt(value);
+ }
+ };
+
+ private Command<T, Boolean> textChangeListenerCommand = new Command<T, Boolean>() {
+ public void execute(T c, Boolean value, Object data) {
+ if (value) {
+ c.addListener((TextChangeListener) AbstractTextFieldTest.this);
+ } else {
+ c.removeListener((TextChangeListener) AbstractTextFieldTest.this);
+ }
+ }
+ };
+
+ private Command<T, Integer> colsCommand = new Command<T, Integer>() {
+ public void execute(T c, Integer value, Object data) {
+ c.setColumns(value);
+ }
+ };
+
+ private Command<T, TextChangeEventMode> textChangeEventModeCommand = new Command<T, TextChangeEventMode>() {
+ public void execute(T c, TextChangeEventMode value, Object data) {
+ c.setTextChangeEventMode(value);
+ }
+ };
+
+ private Command<T, Integer> textChangeTimeoutCommand = new Command<T, Integer>() {
+ public void execute(T c, Integer value, Object data) {
+ c.setTextChangeTimeout(value);
+ }
+ };
+
+ private Command<T, Range> selectionRangeCommand = new Command<T, Range>() {
+ public void execute(T c, Range value, Object data) {
+ c.setSelectionRange(value.getStart(),
+ value.getEnd() - value.getStart());
+
+ }
+ };
+ private Command<T, Object> selectAllCommand = new Command<T, Object>() {
+ public void execute(T c, Object value, Object data) {
+ c.selectAll();
+ }
+ };
+
+ private Command<T, Integer> setCursorPositionCommand = new Command<T, Integer>() {
+
+ public void execute(T c, Integer value, Object data) {
+ c.setCursorPosition(value);
+ }
+ };
+
@Override
protected void createActions() {
super.createActions();
@@ -36,6 +95,18 @@ public abstract class AbstractTextFieldTest<T extends AbstractTextField>
createNullSettingAllowedAction(CATEGORY_FEATURES);
createNullRepresentationAction(CATEGORY_FEATURES);
createMaxLengthAction(CATEGORY_FEATURES);
+
+ createInputPromptAction(CATEGORY_FEATURES);
+ createColsAction(CATEGORY_STATE);
+
+ createTextChangeListener(CATEGORY_LISTENERS);
+ createTextChangeEventModeAction(CATEGORY_FEATURES);
+ createTextChangeEventTimeoutAction(CATEGORY_FEATURES);
+
+ createSetTextValueAction(CATEGORY_ACTIONS);
+ createCursorPositionAction(CATEGORY_ACTIONS);
+ createSelectionRangeAction(CATEGORY_ACTIONS);
+
}
private void createNullSettingAllowedAction(String category) {
@@ -60,4 +131,111 @@ public abstract class AbstractTextFieldTest<T extends AbstractTextField>
maxlengthCommand);
}
+
+ public class Range {
+ private int start;
+ private int end;
+
+ public Range(int start, int end) {
+ this.start = start;
+ this.end = end;
+ }
+
+ public int getStart() {
+ return start;
+ }
+
+ public int getEnd() {
+ return end;
+ }
+
+ @Override
+ public String toString() {
+ return start + "-" + end;
+ }
+ }
+
+ private void createSelectionRangeAction(String category) {
+ List<Range> options = new ArrayList<Range>();
+ options.add(new Range(0, 10));
+ options.add(new Range(0, 1));
+ options.add(new Range(0, 2));
+ options.add(new Range(1, 2));
+ options.add(new Range(2, 5));
+ options.add(new Range(5, 10));
+
+ createCategory("Select range", category);
+
+ createClickAction("All", "Select range", selectAllCommand, null);
+ for (Range range : options) {
+ createClickAction(range.toString(), "Select range",
+ selectionRangeCommand, range);
+ }
+
+ }
+
+ private void createCursorPositionAction(String category) {
+ String subCategory = "Set cursor position";
+ createCategory(subCategory, category);
+ for (int i = 0; i < 20; i++) {
+ createClickAction(String.valueOf(i), subCategory,
+ setCursorPositionCommand, Integer.valueOf(i));
+ }
+
+ }
+
+ private void createTextChangeEventTimeoutAction(String category) {
+ LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
+ options.put("0", 0);
+ options.put("100ms", 100);
+ options.put("500ms", 500);
+ options.put("1s", 1000);
+ options.put("2s", 2000);
+ options.put("5s", 5000);
+
+ createSelectAction("TextChange timeout", category, options, "0",
+ textChangeTimeoutCommand);
+ }
+
+ private void createTextChangeEventModeAction(String category) {
+ LinkedHashMap<String, TextChangeEventMode> options = new LinkedHashMap<String, AbstractTextField.TextChangeEventMode>();
+ for (TextChangeEventMode m : TextChangeEventMode.values()) {
+ options.put(m.toString(), m);
+ }
+
+ createSelectAction("TextChange event mode", category, options,
+ TextChangeEventMode.EAGER.toString(),
+ textChangeEventModeCommand);
+
+ }
+
+ private void createTextChangeListener(String category) {
+ createBooleanAction("Text change listener", category, false,
+ textChangeListenerCommand);
+
+ }
+
+ private void createColsAction(String category) {
+ LinkedHashMap<String, Integer> options = createIntegerOptions(20);
+ createSelectAction("Columns", category, options, "0", colsCommand);
+ }
+
+ private void createInputPromptAction(String category) {
+ LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
+ options.put("-", null);
+ options.put("Enter a value", "Enter a value");
+ options.put("- Click here -", "- Click here -");
+ createSelectAction("Input prompt", category, options, "-",
+ inputPromptCommand);
+
+ }
+
+ public void textChange(TextChangeEvent event) {
+ AbstractTextField tf = (AbstractTextField) event.getComponent();
+ log("TextChangeEvent: text='" + event.getText() + "', cursor position="
+ + event.getCursorPosition() + " (field cursor pos: "
+ + tf.getCursorPosition() + ")");
+
+ }
+
}
diff --git a/tests/src/com/vaadin/tests/components/textarea/TextAreaTest.java b/tests/src/com/vaadin/tests/components/textarea/TextAreaTest.java
index 1977067a19..546a1bee32 100644
--- a/tests/src/com/vaadin/tests/components/textarea/TextAreaTest.java
+++ b/tests/src/com/vaadin/tests/components/textarea/TextAreaTest.java
@@ -1,17 +1,11 @@
package com.vaadin.tests.components.textarea;
-import java.util.ArrayList;
import java.util.LinkedHashMap;
-import java.util.List;
-import com.vaadin.event.FieldEvents.TextChangeEvent;
-import com.vaadin.event.FieldEvents.TextChangeListener;
import com.vaadin.tests.components.abstractfield.AbstractTextFieldTest;
-import com.vaadin.ui.AbstractTextField.TextChangeEventMode;
import com.vaadin.ui.TextArea;
-public class TextAreaTest extends AbstractTextFieldTest<TextArea> implements
- TextChangeListener {
+public class TextAreaTest extends AbstractTextFieldTest<TextArea> {
private Command<TextArea, Boolean> wordwrapCommand = new Command<TextArea, Boolean>() {
public void execute(TextArea c, Boolean value, Object data) {
@@ -25,60 +19,6 @@ public class TextAreaTest extends AbstractTextFieldTest<TextArea> implements
}
};
- private Command<TextArea, Integer> colsCommand = new Command<TextArea, Integer>() {
- public void execute(TextArea c, Integer value, Object data) {
- c.setColumns(value);
- }
- };
-
- private Command<TextArea, String> inputPromptCommand = new Command<TextArea, String>() {
- public void execute(TextArea c, String value, Object data) {
- c.setInputPrompt(value);
- }
- };
-
- private Command<TextArea, Boolean> textChangeListenerCommand = new Command<TextArea, Boolean>() {
- public void execute(TextArea c, Boolean value, Object data) {
- if (value) {
- c.addListener((TextChangeListener) TextAreaTest.this);
- } else {
- c.removeListener((TextChangeListener) TextAreaTest.this);
- }
- }
- };
-
- private Command<TextArea, TextChangeEventMode> textChangeEventModeCommand = new Command<TextArea, TextChangeEventMode>() {
- public void execute(TextArea c, TextChangeEventMode value, Object data) {
- c.setTextChangeEventMode(value);
- }
- };
-
- private Command<TextArea, Integer> textChangeTimeoutCommand = new Command<TextArea, Integer>() {
- public void execute(TextArea c, Integer value, Object data) {
- c.setTextChangeTimeout(value);
- }
- };
-
- private Command<TextArea, Range> selectionRangeCommand = new Command<TextArea, Range>() {
- public void execute(TextArea c, Range value, Object data) {
- c.setSelectionRange(value.getStart(),
- value.getEnd() - value.getStart());
-
- }
- };
- private Command<TextArea, Object> selectAllCommand = new Command<TextArea, Object>() {
- public void execute(TextArea c, Object value, Object data) {
- c.selectAll();
- }
- };
-
- private Command<TextArea, Integer> setCursorPositionCommand = new Command<TextArea, Integer>() {
-
- public void execute(TextArea c, Integer value, Object data) {
- c.setCursorPosition(value);
- }
- };
-
@Override
protected Class<TextArea> getTestClass() {
return TextArea.class;
@@ -88,99 +28,7 @@ public class TextAreaTest extends AbstractTextFieldTest<TextArea> implements
protected void createActions() {
super.createActions();
createWordwrapAction(CATEGORY_STATE);
- createInputPromptAction(CATEGORY_FEATURES);
createRowsAction(CATEGORY_STATE);
- createColsAction(CATEGORY_STATE);
-
- createTextChangeListener(CATEGORY_LISTENERS);
- createTextChangeEventModeAction(CATEGORY_FEATURES);
- createTextChangeEventTimeoutAction(CATEGORY_FEATURES);
-
- createCursorPositionAction(CATEGORY_ACTIONS);
- createSelectionRangeAction(CATEGORY_ACTIONS);
- }
-
- public class Range {
- private int start;
- private int end;
-
- public Range(int start, int end) {
- this.start = start;
- this.end = end;
- }
-
- public int getStart() {
- return start;
- }
-
- public int getEnd() {
- return end;
- }
-
- @Override
- public String toString() {
- return start + "-" + end;
- }
- }
-
- private void createSelectionRangeAction(String category) {
- List<Range> options = new ArrayList<Range>();
- options.add(new Range(0, 10));
- options.add(new Range(0, 1));
- options.add(new Range(0, 2));
- options.add(new Range(1, 2));
- options.add(new Range(2, 5));
- options.add(new Range(5, 10));
-
- createCategory("Select range", category);
-
- createClickAction("All", "Select range", selectAllCommand, null);
- for (Range range : options) {
- createClickAction(range.toString(), "Select range",
- selectionRangeCommand, range);
- }
-
- }
-
- private void createCursorPositionAction(String category) {
- String subCategory = "Set cursor position";
- createCategory(subCategory, category);
- for (int i = 0; i < 20; i++) {
- createClickAction(String.valueOf(i), subCategory,
- setCursorPositionCommand, Integer.valueOf(i));
- }
-
- }
-
- private void createTextChangeEventTimeoutAction(String category) {
- LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
- options.put("0", 0);
- options.put("100ms", 100);
- options.put("500ms", 500);
- options.put("1s", 1000);
- options.put("2s", 2000);
- options.put("5s", 5000);
-
- createSelectAction("TextChange timeout", category, options, "0",
- textChangeTimeoutCommand);
- }
-
- private void createTextChangeEventModeAction(String category) {
- LinkedHashMap<String, TextChangeEventMode> options = new LinkedHashMap<String, TextArea.TextChangeEventMode>();
- for (TextChangeEventMode m : TextChangeEventMode.values()) {
- options.put(m.toString(), m);
- }
-
- createSelectAction("TextChange event mode", category, options,
- TextChangeEventMode.EAGER.toString(),
- textChangeEventModeCommand);
-
- }
-
- private void createTextChangeListener(String category) {
- createBooleanAction("Text change listener", category, false,
- textChangeListenerCommand);
-
}
private void createRowsAction(String category) {
@@ -188,31 +36,8 @@ public class TextAreaTest extends AbstractTextFieldTest<TextArea> implements
createSelectAction("Rows", category, options, "0", rowsCommand);
}
- private void createColsAction(String category) {
- LinkedHashMap<String, Integer> options = createIntegerOptions(20);
- createSelectAction("Columns", category, options, "0", colsCommand);
- }
-
private void createWordwrapAction(String category) {
createBooleanAction("Wordwrap", category, false, wordwrapCommand);
}
- private void createInputPromptAction(String category) {
- LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
- options.put("-", null);
- options.put("Enter a value", "Enter a value");
- options.put("- Click here -", "- Click here -");
- createSelectAction("Input prompt", category, options, "-",
- inputPromptCommand);
-
- }
-
- public void textChange(TextChangeEvent event) {
- TextArea tf = (TextArea) event.getComponent();
- log("TextChangeEvent: text='" + event.getText() + "', cursor position="
- + event.getCursorPosition() + " (field cursor pos: "
- + tf.getCursorPosition() + ")");
-
- }
-
}
diff --git a/tests/src/com/vaadin/tests/components/textfield/TextFieldMaxLength.html b/tests/src/com/vaadin/tests/components/textfield/TextFieldMaxLength.html
index c6dcde74ec..f8c59e0bcf 100644
--- a/tests/src/com/vaadin/tests/components/textfield/TextFieldMaxLength.html
+++ b/tests/src/com/vaadin/tests/components/textfield/TextFieldMaxLength.html
@@ -40,7 +40,7 @@
</tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstextfieldTextFieldTest::Root/VOverlay[0]/VMenuBar[0]#item4</td>
+ <td>vaadin=runcomvaadintestscomponentstextfieldTextFieldTest::Root/VOverlay[0]/VMenuBar[0]#item5</td>
<td>38,5</td>
</tr>
<tr>
@@ -82,7 +82,7 @@
</tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstextfieldTextFieldTest::Root/VOverlay[0]/VMenuBar[0]#item4</td>
+ <td>vaadin=runcomvaadintestscomponentstextfieldTextFieldTest::Root/VOverlay[0]/VMenuBar[0]#item5</td>
<td>38,5</td>
</tr>
<tr>
@@ -125,7 +125,7 @@
</tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstextfieldTextFieldTest::Root/VOverlay[0]/VMenuBar[0]#item4</td>
+ <td>vaadin=runcomvaadintestscomponentstextfieldTextFieldTest::Root/VOverlay[0]/VMenuBar[0]#item5</td>
<td>38,5</td>
</tr>
<tr>
@@ -154,7 +154,6 @@
<td>vaadin=runcomvaadintestscomponentstextfieldTextFieldTest::PID_SLog/ChildComponentContainer[0]/VLabel[0]</td>
<td>6. ValueChangeEvent, new value: '123456789012345'</td>
</tr>
-
</tbody></table>
</body>
</html>
diff --git a/tests/src/com/vaadin/tests/components/textfield/TextFieldNullRepresentation.html b/tests/src/com/vaadin/tests/components/textfield/TextFieldNullRepresentation.html
index 85b58bcfd5..5506351d34 100644
--- a/tests/src/com/vaadin/tests/components/textfield/TextFieldNullRepresentation.html
+++ b/tests/src/com/vaadin/tests/components/textfield/TextFieldNullRepresentation.html
@@ -40,7 +40,7 @@
</tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstextfieldTextFieldTest::Root/VOverlay[0]/VMenuBar[0]#item4</td>
+ <td>vaadin=runcomvaadintestscomponentstextfieldTextFieldTest::Root/VOverlay[0]/VMenuBar[0]#item5</td>
<td>32,4</td>
</tr>
<tr>
@@ -106,7 +106,6 @@
<td>vaadin=runcomvaadintestscomponentstextfieldTextFieldTest::PID_SLog/ChildComponentContainer[0]/VLabel[0]</td>
<td>4. ValueChangeEvent, new value: null</td>
</tr>
-
</tbody></table>
</body>
</html>
diff --git a/tests/src/com/vaadin/tests/components/textfield/TextFieldNullRepresentationAndSelection.html b/tests/src/com/vaadin/tests/components/textfield/TextFieldNullRepresentationAndSelection.html
index 02afdd9098..d1882575d1 100644
--- a/tests/src/com/vaadin/tests/components/textfield/TextFieldNullRepresentationAndSelection.html
+++ b/tests/src/com/vaadin/tests/components/textfield/TextFieldNullRepresentationAndSelection.html
@@ -40,7 +40,7 @@
</tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstextfieldTextFieldTest::Root/VOverlay[0]/VMenuBar[0]#item4</td>
+ <td>vaadin=runcomvaadintestscomponentstextfieldTextFieldTest::Root/VOverlay[0]/VMenuBar[0]#item5</td>
<td>27,12</td>
</tr>
<tr>
@@ -108,7 +108,7 @@
</tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstextfieldTextFieldTest::Root/VOverlay[0]/VMenuBar[0]#item4</td>
+ <td>vaadin=runcomvaadintestscomponentstextfieldTextFieldTest::Root/VOverlay[0]/VMenuBar[0]#item5</td>
<td>23,6</td>
</tr>
<tr>
@@ -167,7 +167,6 @@
<td>vaadin=runcomvaadintestscomponentstextfieldTextFieldTest::PID_StestComponent</td>
<td>This is empty</td>
</tr>
-
</tbody></table>
</body>
</html>
diff --git a/tests/src/com/vaadin/tests/components/textfield/TextFieldTest.java b/tests/src/com/vaadin/tests/components/textfield/TextFieldTest.java
index 5937993e83..3d238fa5a3 100644
--- a/tests/src/com/vaadin/tests/components/textfield/TextFieldTest.java
+++ b/tests/src/com/vaadin/tests/components/textfield/TextFieldTest.java
@@ -1,13 +1,9 @@
package com.vaadin.tests.components.textfield;
-import java.util.ArrayList;
import java.util.LinkedHashMap;
-import java.util.List;
-import com.vaadin.event.FieldEvents.TextChangeEvent;
import com.vaadin.event.FieldEvents.TextChangeListener;
import com.vaadin.tests.components.abstractfield.AbstractTextFieldTest;
-import com.vaadin.ui.AbstractTextField.TextChangeEventMode;
import com.vaadin.ui.TextField;
public class TextFieldTest extends AbstractTextFieldTest<TextField> implements
@@ -34,60 +30,6 @@ public class TextFieldTest extends AbstractTextFieldTest<TextField> implements
}
};
- private Command<TextField, Integer> colsCommand = new Command<TextField, Integer>() {
- public void execute(TextField c, Integer value, Object data) {
- c.setColumns(value);
- }
- };
-
- private Command<TextField, String> inputPromptCommand = new Command<TextField, String>() {
- public void execute(TextField c, String value, Object data) {
- c.setInputPrompt(value);
- }
- };
-
- private Command<TextField, Boolean> textChangeListenerCommand = new Command<TextField, Boolean>() {
- public void execute(TextField c, Boolean value, Object data) {
- if (value) {
- c.addListener((TextChangeListener) TextFieldTest.this);
- } else {
- c.removeListener((TextChangeListener) TextFieldTest.this);
- }
- }
- };
-
- private Command<TextField, TextChangeEventMode> textChangeEventModeCommand = new Command<TextField, TextChangeEventMode>() {
- public void execute(TextField c, TextChangeEventMode value, Object data) {
- c.setTextChangeEventMode(value);
- }
- };
-
- private Command<TextField, Integer> textChangeTimeoutCommand = new Command<TextField, Integer>() {
- public void execute(TextField c, Integer value, Object data) {
- c.setTextChangeTimeout(value);
- }
- };
-
- private Command<TextField, Range> selectionRangeCommand = new Command<TextField, Range>() {
- public void execute(TextField c, Range value, Object data) {
- c.setSelectionRange(value.getStart(),
- value.getEnd() - value.getStart());
-
- }
- };
- private Command<TextField, Object> selectAllCommand = new Command<TextField, Object>() {
- public void execute(TextField c, Object value, Object data) {
- c.selectAll();
- }
- };
-
- private Command<TextField, Integer> setCursorPositionCommand = new Command<TextField, Integer>() {
-
- public void execute(TextField c, Integer value, Object data) {
- c.setCursorPosition(value);
- }
- };
-
@Override
protected Class<TextField> getTestClass() {
return TextField.class;
@@ -98,100 +40,7 @@ public class TextFieldTest extends AbstractTextFieldTest<TextField> implements
super.createActions();
createSecretAction(CATEGORY_STATE);
createWordwrapAction(CATEGORY_STATE);
- createInputPromptAction(CATEGORY_FEATURES);
createRowsAction(CATEGORY_STATE);
- createColsAction(CATEGORY_STATE);
-
- createTextChangeListener(CATEGORY_LISTENERS);
- createTextChangeEventModeAction(CATEGORY_FEATURES);
- createTextChangeEventTimeoutAction(CATEGORY_FEATURES);
-
- createSetTextValueAction(CATEGORY_ACTIONS);
- createCursorPositionAction(CATEGORY_ACTIONS);
- createSelectionRangeAction(CATEGORY_ACTIONS);
- }
-
- public class Range {
- private int start;
- private int end;
-
- public Range(int start, int end) {
- this.start = start;
- this.end = end;
- }
-
- public int getStart() {
- return start;
- }
-
- public int getEnd() {
- return end;
- }
-
- @Override
- public String toString() {
- return start + "-" + end;
- }
- }
-
- private void createSelectionRangeAction(String category) {
- List<Range> options = new ArrayList<Range>();
- options.add(new Range(0, 10));
- options.add(new Range(0, 1));
- options.add(new Range(0, 2));
- options.add(new Range(1, 2));
- options.add(new Range(2, 5));
- options.add(new Range(5, 10));
-
- createCategory("Select range", category);
-
- createClickAction("All", "Select range", selectAllCommand, null);
- for (Range range : options) {
- createClickAction(range.toString(), "Select range",
- selectionRangeCommand, range);
- }
-
- }
-
- private void createCursorPositionAction(String category) {
- String subCategory = "Set cursor position";
- createCategory(subCategory, category);
- for (int i = 0; i < 20; i++) {
- createClickAction(String.valueOf(i), subCategory,
- setCursorPositionCommand, Integer.valueOf(i));
- }
-
- }
-
- private void createTextChangeEventTimeoutAction(String category) {
- LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
- options.put("0", 0);
- options.put("100ms", 100);
- options.put("500ms", 500);
- options.put("1s", 1000);
- options.put("2s", 2000);
- options.put("5s", 5000);
-
- createSelectAction("TextChange timeout", category, options, "0",
- textChangeTimeoutCommand);
- }
-
- private void createTextChangeEventModeAction(String category) {
- LinkedHashMap<String, TextChangeEventMode> options = new LinkedHashMap<String, TextField.TextChangeEventMode>();
- for (TextChangeEventMode m : TextChangeEventMode.values()) {
- options.put(m.toString(), m);
- }
-
- createSelectAction("TextChange event mode", category, options,
- TextChangeEventMode.EAGER.toString(),
- textChangeEventModeCommand);
-
- }
-
- private void createTextChangeListener(String category) {
- createBooleanAction("Text change listener", category, false,
- textChangeListenerCommand);
-
}
private void createRowsAction(String category) {
@@ -199,11 +48,6 @@ public class TextFieldTest extends AbstractTextFieldTest<TextField> implements
createSelectAction("Rows", category, options, "0", rowsCommand);
}
- private void createColsAction(String category) {
- LinkedHashMap<String, Integer> options = createIntegerOptions(20);
- createSelectAction("Columns", category, options, "0", colsCommand);
- }
-
private void createSecretAction(String category) {
createBooleanAction("Secret", category, false, secretCommand);
}
@@ -212,22 +56,4 @@ public class TextFieldTest extends AbstractTextFieldTest<TextField> implements
createBooleanAction("Wordwrap", category, false, wordwrapCommand);
}
- private void createInputPromptAction(String category) {
- LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
- options.put("-", null);
- options.put("Enter a value", "Enter a value");
- options.put("- Click here -", "- Click here -");
- createSelectAction("Input prompt", category, options, "-",
- inputPromptCommand);
-
- }
-
- public void textChange(TextChangeEvent event) {
- TextField tf = (TextField) event.getComponent();
- log("TextChangeEvent: text='" + event.getText() + "', cursor position="
- + event.getCursorPosition() + " (field cursor pos: "
- + tf.getCursorPosition() + ")");
-
- }
-
}