]> source.dussan.org Git - vaadin-framework.git/commitdiff
#6918 Test case for CheckBox with null value
authorHenri Sara <henri.sara@itmill.com>
Tue, 3 May 2011 13:37:51 +0000 (13:37 +0000)
committerHenri Sara <henri.sara@itmill.com>
Tue, 3 May 2011 13:37:51 +0000 (13:37 +0000)
svn changeset:18613/svn branch:6.6

tests/src/com/vaadin/tests/components/checkbox/CheckBoxNullValue.html [new file with mode: 0644]
tests/src/com/vaadin/tests/components/checkbox/CheckBoxNullValue.java [new file with mode: 0644]

diff --git a/tests/src/com/vaadin/tests/components/checkbox/CheckBoxNullValue.html b/tests/src/com/vaadin/tests/components/checkbox/CheckBoxNullValue.html
new file mode 100644 (file)
index 0000000..9717cce
--- /dev/null
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>CheckBoxNullValue</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">CheckBoxNullValue</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.components.checkbox.CheckBoxNullValue?restartApplication</td>
+       <td></td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td>initial</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxNullValue::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td>bothnull</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxNullValue::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VCheckBox[0]/domChild[0]</td>
+       <td>6,5</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxNullValue::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VCheckBox[0]/domChild[0]</td>
+       <td>7,4</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxNullValue::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td>bothtrue</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxNullValue::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VCheckBox[0]/domChild[0]</td>
+       <td>6,6</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxNullValue::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VCheckBox[0]/domChild[0]</td>
+       <td>9,9</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxNullValue::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td>bothfalse</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/tests/src/com/vaadin/tests/components/checkbox/CheckBoxNullValue.java b/tests/src/com/vaadin/tests/components/checkbox/CheckBoxNullValue.java
new file mode 100644 (file)
index 0000000..a961b48
--- /dev/null
@@ -0,0 +1,61 @@
+package com.vaadin.tests.components.checkbox;
+
+import com.vaadin.data.Validator.InvalidValueException;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.Label;
+
+public class CheckBoxNullValue extends TestBase {
+
+    @Override
+    protected void setup() {
+        // workaround for #6919
+        getLayout().setWidth("100%");
+
+        final CheckBox checkbox = new CheckBox("A checkbox");
+        checkbox.setValue(null);
+        addComponent(checkbox);
+
+        final CheckBox requiredCheckbox = new CheckBox("A required checkbox");
+        requiredCheckbox.setRequired(true);
+        requiredCheckbox.setValue(null);
+        addComponent(requiredCheckbox);
+
+        final Label valueLabel = new Label("");
+
+        final Button button = new Button("Validate");
+        addComponent(button);
+        button.addListener(new Button.ClickListener() {
+            public void buttonClick(ClickEvent event) {
+                checkbox.setComponentError(null);
+                requiredCheckbox.setComponentError(null);
+                try {
+                    checkbox.validate();
+                } catch (InvalidValueException e) {
+                    checkbox.setComponentError(e);
+                }
+                try {
+                    requiredCheckbox.validate();
+                } catch (InvalidValueException e) {
+                    requiredCheckbox.setComponentError(e);
+                }
+                valueLabel.setValue("Checkbox: " + checkbox.getValue()
+                        + "; Required checkbox: " + requiredCheckbox.getValue());
+            }
+        });
+        addComponent(valueLabel);
+    }
+
+    @Override
+    protected String getDescription() {
+        return "CheckBox should support null values.";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 6918;
+    }
+
+}