From ed4b69ec7726c71829ed9211fbc514fc9820bf69 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 8 Feb 2010 14:57:01 +0000 Subject: [PATCH] Test case for various Combobox size configurations svn changeset:11220/svn branch:6.3 --- .../tests/components/combobox/Comboboxes.html | 251 ++++++++++++++++++ .../tests/components/combobox/Comboboxes.java | 153 +++++++++++ 2 files changed, 404 insertions(+) create mode 100644 tests/src/com/vaadin/tests/components/combobox/Comboboxes.html create mode 100644 tests/src/com/vaadin/tests/components/combobox/Comboboxes.java diff --git a/tests/src/com/vaadin/tests/components/combobox/Comboboxes.html b/tests/src/com/vaadin/tests/components/combobox/Comboboxes.html new file mode 100644 index 0000000000..8df7ea00ae --- /dev/null +++ b/tests/src/com/vaadin/tests/components/combobox/Comboboxes.html @@ -0,0 +1,251 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.combobox.Comboboxes
screenCaptureinitial
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboboxes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[1]14,14
waitForVaadin
screenCaptureempty-open
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboboxes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VFilterSelect[0]/domChild[1]14,11
waitForVaadin
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboboxes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VFilterSelect[0]/domChild[1]10,9
waitForVaadin
screenCaptureundefined-wide-open
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboboxes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VFilterSelect[0]/domChild[1]12,19
waitForVaadin
screenCaptureundefined-wide-select-wide-popup
waitForVaadin
mouseClick//div[@id='VAADIN_COMBOBOX_OPTIONLIST']/div/div[3]/span163,4
waitForVaadin
mouseClick//div[@id='VAADIN_COMBOBOX_OPTIONLIST']/div/div[3]/span163,4
waitForVaadin
screenCaptureundefined-wide-select-wide-popup-page-3
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboboxes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VFilterSelect[0]/domChild[1]5,11
waitForVaadin
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboboxes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[6]/VFilterSelect[0]/domChild[1]9,9
waitForVaadin
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboboxes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[7]/VFilterSelect[0]/domChild[1]13,10
waitForVaadin
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboboxes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[8]/VFilterSelect[0]/domChild[1]11,12
waitForVaadin
screenCapturefixed-select-wide-popup
waitForVaadin
mouseClick//div[@id='VAADIN_COMBOBOX_OPTIONLIST']/div/div[3]/span184,2
waitForVaadin
mouseClick//div[@id='VAADIN_COMBOBOX_OPTIONLIST']/div/div[3]/span184,2
waitForVaadin
screenCapturefixed-select-wide-popup-page-3
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboboxes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[8]/VFilterSelect[0]/domChild[1]11,12
waitForVaadin
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboboxes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VCheckBox[0]/domChild[0]23,5
waitForVaadin
screenCapturereadonly
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboboxes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VCheckBox[0]/domChild[0]35,3
waitForVaadin
screenCapturereadonly-error
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboboxes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VCheckBox[0]/domChild[0]26,10
waitForVaadin
screenCaptureerror
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboboxes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VCheckBox[0]/domChild[0]67,8
waitForVaadin
+ + diff --git a/tests/src/com/vaadin/tests/components/combobox/Comboboxes.java b/tests/src/com/vaadin/tests/components/combobox/Comboboxes.java new file mode 100644 index 0000000000..fe18875a47 --- /dev/null +++ b/tests/src/com/vaadin/tests/components/combobox/Comboboxes.java @@ -0,0 +1,153 @@ +package com.vaadin.tests.components.combobox; + +import java.util.ArrayList; +import java.util.List; + +import com.vaadin.tests.components.ComponentTestCase; +import com.vaadin.ui.Button; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.Component; +import com.vaadin.ui.Select; +import com.vaadin.ui.Button.ClickEvent; + +public class Comboboxes extends ComponentTestCase { + + private static final Object CAPTION = "caption"; + Select label[] = new Select[20]; + + @Override + protected void setup() { + super.setup(); + + Select s; + + s = createSelect(null); + s.setWidth(null); + addTestComponent(s); + + s = createSelect("Undefined wide, empty select"); + s.setWidth(null); + addTestComponent(s); + + s = createSelect("Undefined wide select with 5 items"); + s.setWidth(null); + addItem(s, "The first item"); + addItem(s, "The second item"); + addItem(s, "The third item"); + addItem(s, "The fourth item"); + addItem(s, "The fifth item"); + addTestComponent(s); + + s = createSelect("Undefined wide select with 50 items"); + s.setWidth(null); + populate(s, 50); + addTestComponent(s); + + s = createSelect(null); + s.setWidth("100px"); + addTestComponent(s); + + s = createSelect("100px wide, empty select"); + s.setWidth("100px"); + addTestComponent(s); + + s = createSelect("150px wide select with 5 items"); + s.setWidth("150px"); + addItem(s, "The first item"); + addItem(s, "The second item"); + addItem(s, "The third item"); + addItem(s, "The fourth item"); + addItem(s, "The fifth item"); + addTestComponent(s); + + s = createSelect("200px wide select with 50 items"); + s.setWidth("200px"); + populate(s, 50); + addTestComponent(s); + + } + + private void populate(Select s, int nr) { + String text = " an item "; + + String caption = ""; + for (int i = 0; i < nr; i++) { + if (i % 2 == 0) { + caption += text; + } else { + caption += i; + } + + addItem(s, caption); + } + + } + + private void addItem(Select s, String string) { + Object id = s.addItem(); + s.getItem(id).getItemProperty(CAPTION).setValue(string); + + } + + private Select createSelect(String caption) { + Select s = new Select(); + + s.addContainerProperty(CAPTION, String.class, ""); + s.setItemCaptionPropertyId(CAPTION); + s.setCaption(caption); + + return s; + } + + @Override + protected String getDescription() { + return "A generic test for Labels in different configurations"; + } + + @Override + protected List createActions() { + ArrayList actions = new ArrayList(); + + CheckBox errorIndicators = new CheckBox("Error indicators", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + Button b = event.getButton(); + boolean enabled = (Boolean) b.getValue(); + setErrorIndicators(enabled); + + } + }); + + CheckBox enabled = new CheckBox("Enabled", new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + Button b = event.getButton(); + boolean enabled = (Boolean) b.getValue(); + setEnabled(enabled); + } + }); + + CheckBox readonly = new CheckBox("Readonly", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + Button b = event.getButton(); + boolean enabled = (Boolean) b.getValue(); + setReadOnly(enabled); + } + }); + + errorIndicators.setValue(new Boolean(false)); + readonly.setValue(new Boolean(false)); + enabled.setValue(new Boolean(true)); + + errorIndicators.setImmediate(true); + readonly.setImmediate(true); + enabled.setImmediate(true); + + actions.add(errorIndicators); + actions.add(readonly); + actions.add(enabled); + + return actions; + } + +} -- 2.39.5