From: Leif Åstrand Date: Thu, 8 Dec 2011 10:53:36 +0000 (+0000) Subject: Test application and disabled testbench script for #8076 X-Git-Tag: 7.0.0.alpha1~225^2~1^2~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3b7884d57a59614fb00bff4d41dc0b80a5442d3a;p=vaadin-framework.git Test application and disabled testbench script for #8076 svn changeset:22309/svn branch:6.7 --- diff --git a/tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.html2 b/tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.html2 new file mode 100644 index 0000000000..8d185b6219 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.html2 @@ -0,0 +1,57 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.table.ProgrammaticUnselectInRange?restartApplication
mouseClickvaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]23,5
mouseClickvaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]24,3:shift
assertTextvaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]Item 2 is selected
clickvaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]Item 2 is not selected
mouseClickvaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[4]/domChild[0]/domChild[0]32,8:ctrl
assertTextvaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]Item 2 is not selected
+ + diff --git a/tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.java b/tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.java new file mode 100644 index 0000000000..758fa4bf1a --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.java @@ -0,0 +1,67 @@ +package com.vaadin.tests.components.table; + +import com.vaadin.data.Property; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Label; +import com.vaadin.ui.Table; + +public class ProgrammaticUnselectInRange extends TestBase { + + private static final String PROPERTY = "property"; + + final Label selectionLabel = new Label(); + final Table table = new Table(); + + @Override + protected void setup() { + table.addContainerProperty(PROPERTY, Integer.class, ""); + + table.setMultiSelect(true); + table.setSelectable(true); + table.setImmediate(true); + table.setPageLength(5); + + for (int i = 0; i < 5; i++) { + Integer value = Integer.valueOf(i + 1); + table.addItem(new Object[] { value }, value); + } + table.addListener(new Property.ValueChangeListener() { + public void valueChange(ValueChangeEvent event) { + updateSelectionLabel(); + } + }); + + addComponent(table); + addComponent(selectionLabel); + addComponent(new Button("Deselect item 2", new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + table.unselect(Integer.valueOf(2)); + } + })); + + updateSelectionLabel(); + } + + private void updateSelectionLabel() { + if (table.isSelected(Integer.valueOf(2))) { + selectionLabel.setValue("Item 2 is selected"); + } else { + selectionLabel.setValue("Item 2 is not selected"); + } + } + + @Override + protected String getDescription() { + return "Selecting items 1 - 3 using shift click, deselecting item 2 using the button and selecting item 5 using ctrl should keep item 2 deselected according to the server"; + } + + @Override + protected Integer getTicketNumber() { + // TODO Auto-generated method stub + return null; + } + +}