From d3e50f003f039f8d5124317534c49573f09eedd6 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 17 Nov 2011 12:19:15 +0000 Subject: [PATCH] Test for #7739 svn changeset:22046/svn branch:6.7 --- .../combobox/ComboBoxIdenticalItems.html | 112 ++++++++++++++++++ .../combobox/ComboBoxIdenticalItems.java | 54 +++++++++ 2 files changed, 166 insertions(+) create mode 100644 tests/testbench/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.html create mode 100644 tests/testbench/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.java diff --git a/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.html b/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.html new file mode 100644 index 0000000000..6d18c60038 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.html @@ -0,0 +1,112 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.combobox.ComboBoxIdenticalItems?restartApplication
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]66,8
pressSpecialKeyvaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]down
pressSpecialKeyvaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]down
pressSpecialKeyvaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]enter
assertTextvaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::PID_SLog_row_01. Item one-1 selected
pressSpecialKeyvaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]down
pressSpecialKeyvaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]down
pressSpecialKeyvaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]enter
assertTextvaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::PID_SLog_row_02. Item one-2 selected
pressSpecialKeyvaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]down
pressSpecialKeyvaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]down
pressSpecialKeyvaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]enter
assertTextvaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::PID_SLog_row_03. Item two selected
pressSpecialKeyvaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]up
pressSpecialKeyvaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]up
pressSpecialKeyvaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]up
pressSpecialKeyvaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]enter
assertTextvaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::PID_SLog_row_04. Item one-1 selected
+ + diff --git a/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.java b/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.java new file mode 100644 index 0000000000..dcd4af58ad --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.java @@ -0,0 +1,54 @@ +package com.vaadin.tests.components.combobox; + +import com.vaadin.data.Item; +import com.vaadin.data.Property; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.tests.components.TestBase; +import com.vaadin.tests.util.Log; +import com.vaadin.ui.ComboBox; + +public class ComboBoxIdenticalItems extends TestBase { + + private Log log = new Log(5); + + @Override + public void setup() { + final ComboBox select = new ComboBox("ComboBox"); + select.addContainerProperty("caption", String.class, null); + Item item = select.addItem("one-1"); + item.getItemProperty("caption").setValue("One"); + item = select.addItem("one-2"); + item.getItemProperty("caption").setValue("One"); + item = select.addItem("two"); + item.getItemProperty("caption").setValue("Two"); + select.setItemCaptionPropertyId("caption"); + select.setNullSelectionAllowed(false); + select.setImmediate(true); + select.addListener(new Property.ValueChangeListener() { + private static final long serialVersionUID = -7932700771673919620L; + + public void valueChange(ValueChangeEvent event) { + log.log("Item " + select.getValue() + " selected"); + + } + }); + + addComponent(log); + addComponent(select); + } + + @Override + protected String getDescription() { + return "Keyboard selecting of a value is broken in combobox if two " + + "items have the same caption. The first item's id is \"One-1\" " + + "while the second one is \"One-2\". Selecting with mouse works " + + "as expected but selecting with keyboard always returns the " + + "object \"One-1\"."; + } + + @Override + protected Integer getTicketNumber() { + // TODO Auto-generated method stub + return null; + } +} -- 2.39.5