]> source.dussan.org Git - vaadin-framework.git/commitdiff
Add support for testing filtering mode
authorArtur Signell <artur.signell@itmill.com>
Tue, 26 Apr 2011 14:22:12 +0000 (14:22 +0000)
committerArtur Signell <artur.signell@itmill.com>
Tue, 26 Apr 2011 14:22:12 +0000 (14:22 +0000)
svn changeset:18472/svn branch:6.6

tests/src/com/vaadin/tests/components/combobox/ComboBoxes2.java
tests/src/com/vaadin/tests/components/select/SelectTest.java

index 92e9c29595818097556bc280575ceed93d1585bd..f41176c6caf27308e244b970f754247670d4af90 100644 (file)
@@ -3,16 +3,23 @@ package com.vaadin.tests.components.combobox;
 import java.util.LinkedHashMap;
 
 import com.vaadin.terminal.Resource;
-import com.vaadin.tests.components.select.AbstractSelectTestCase;
+import com.vaadin.tests.components.select.SelectTest;
 import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.Select;
 
-public class ComboBoxes2 extends AbstractSelectTestCase<ComboBox> {
+public class ComboBoxes2 extends SelectTest<ComboBox> {
 
     private Command<ComboBox, String> inputPromptCommand = new Command<ComboBox, String>() {
         public void execute(ComboBox c, String value, Object data) {
             c.setInputPrompt(value);
         }
     };
+    private Command<ComboBox, Integer> filteringModeCommand = new Command<ComboBox, Integer>() {
+
+        public void execute(ComboBox c, Integer value, Object data) {
+            c.setFilteringMode(value);
+        }
+    };
 
     @Override
     protected Class<ComboBox> getTestClass() {
@@ -24,6 +31,18 @@ public class ComboBoxes2 extends AbstractSelectTestCase<ComboBox> {
         super.createActions();
         createItemIconSelect(CATEGORY_DATA_SOURCE);
         createInputPromptAction(CATEGORY_FEATURES);
+        createFilteringModeAction(CATEGORY_FEATURES);
+    }
+
+    private void createFilteringModeAction(String category) {
+        LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
+        options.put("Off", Select.FILTERINGMODE_OFF);
+        options.put("Contains", Select.FILTERINGMODE_CONTAINS);
+        options.put("Starts with", Select.FILTERINGMODE_STARTSWITH);
+
+        createSelectAction("Filtering mode", category, options, "Contains",
+                filteringModeCommand);
+
     }
 
     private void createInputPromptAction(String category) {
index 3febdd0cec8b9431366d7104c2912dfed180a38a..cdc30921fab1a83cfe9aa2b5add894cbcadaa3ea 100644 (file)
@@ -2,11 +2,12 @@ package com.vaadin.tests.components.select;
 \r
 import com.vaadin.ui.Select;\r
 \r
-public class SelectTest extends AbstractSelectTestCase<Select> {\r
+public class SelectTest<T extends Select> extends AbstractSelectTestCase<T> {\r
 \r
+    @SuppressWarnings("unchecked")\r
     @Override\r
-    protected Class<Select> getTestClass() {\r
-        return Select.class;\r
+    protected Class<T> getTestClass() {\r
+        return (Class<T>) Select.class;\r
     }\r
 \r
 }\r