diff options
Diffstat (limited to 'tests/testbench/com/vaadin')
3 files changed, 247 insertions, 1 deletions
diff --git a/tests/testbench/com/vaadin/launcher/DevelopmentServerLauncher.java b/tests/testbench/com/vaadin/launcher/DevelopmentServerLauncher.java index 0fb346736e..b3a7af42b9 100644 --- a/tests/testbench/com/vaadin/launcher/DevelopmentServerLauncher.java +++ b/tests/testbench/com/vaadin/launcher/DevelopmentServerLauncher.java @@ -64,7 +64,7 @@ public class DevelopmentServerLauncher { try { url = runServer(serverArgs, "Development Server Mode"); // Start Browser - if (!serverArgs.containsKey("nogui") && url != null) { + if (serverArgs.containsKey("gui") && url != null) { System.out.println("Starting Web Browser."); // Open browser into application URL diff --git a/tests/testbench/com/vaadin/tests/components/table/HeaderFooterClickLeftRightMiddle.html b/tests/testbench/com/vaadin/tests/components/table/HeaderFooterClickLeftRightMiddle.html new file mode 100644 index 0000000000..dfd001bf5c --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/HeaderFooterClickLeftRightMiddle.html @@ -0,0 +1,92 @@ +<?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>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.table.HeaderFooterClickLeftRightMiddle?restartApplication</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstableHeaderFooterClickLeftRightMiddle::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VScrollTable[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td>59,8</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableHeaderFooterClickLeftRightMiddle::PID_SLog_row_0</td> + <td>1. Click on header col1 using left</td> +</tr> +<tr> + <td>mouseDownRight</td> + <td>vaadin=runcomvaadintestscomponentstableHeaderFooterClickLeftRightMiddle::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VScrollTable[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td></td> +</tr> +<tr> + <td>mouseUpRight</td> + <td>vaadin=runcomvaadintestscomponentstableHeaderFooterClickLeftRightMiddle::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VScrollTable[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableHeaderFooterClickLeftRightMiddle::PID_SLog_row_0</td> + <td>2. Click on header col1 using right</td> +</tr> +<tr> + <td>doubleClick</td> + <td>vaadin=runcomvaadintestscomponentstableHeaderFooterClickLeftRightMiddle::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VScrollTable[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableHeaderFooterClickLeftRightMiddle::PID_SLog_row_0</td> + <td>3. Double click on header col1 using*</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstableHeaderFooterClickLeftRightMiddle::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VScrollTable[0]/domChild[2]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td>59,8</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableHeaderFooterClickLeftRightMiddle::PID_SLog_row_0</td> + <td>4. Click on footer col2 using left</td> +</tr> +<tr> + <td>mouseDownRight</td> + <td>vaadin=runcomvaadintestscomponentstableHeaderFooterClickLeftRightMiddle::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VScrollTable[0]/domChild[2]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td></td> +</tr> +<tr> + <td>mouseUpRight</td> + <td>vaadin=runcomvaadintestscomponentstableHeaderFooterClickLeftRightMiddle::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VScrollTable[0]/domChild[2]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableHeaderFooterClickLeftRightMiddle::PID_SLog_row_0</td> + <td>5. Click on footer col2 using right</td> +</tr> +<tr> + <td>doubleClick</td> + <td>vaadin=runcomvaadintestscomponentstableHeaderFooterClickLeftRightMiddle::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VScrollTable[0]/domChild[2]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableHeaderFooterClickLeftRightMiddle::PID_SLog_row_0</td> + <td>6. Double click on footer col2 using*</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/tests/testbench/com/vaadin/tests/components/table/HeaderFooterClickLeftRightMiddle.java b/tests/testbench/com/vaadin/tests/components/table/HeaderFooterClickLeftRightMiddle.java new file mode 100644 index 0000000000..642067d826 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/HeaderFooterClickLeftRightMiddle.java @@ -0,0 +1,154 @@ +package com.vaadin.tests.components.table; + +import com.vaadin.data.Container; +import com.vaadin.data.Item; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.data.util.IndexedContainer; +import com.vaadin.tests.components.TestBase; +import com.vaadin.tests.util.Log; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.Table; +import com.vaadin.ui.Table.FooterClickEvent; +import com.vaadin.ui.Table.FooterClickListener; +import com.vaadin.ui.Table.HeaderClickEvent; +import com.vaadin.ui.Table.HeaderClickListener; + +public class HeaderFooterClickLeftRightMiddle extends TestBase { + + private Log log = new Log(10); + + @Override + protected void setup() { + final Table table = new Table(); + table.setColumnReorderingAllowed(true); + table.setContainerDataSource(createContainer()); + table.setWidth("400px"); + table.setHeight("400px"); + table.setImmediate(true); + table.setFooterVisible(true); + + CheckBox immediateCheckbox = new CheckBox("Immediate"); + immediateCheckbox.setImmediate(true); + immediateCheckbox.setValue(table.isImmediate()); + immediateCheckbox.addListener(new ClickListener() { + + public void buttonClick(ClickEvent event) { + table.setImmediate(event.getButton().booleanValue()); + } + }); + + CheckBox headerClickListenerCheckbox = new CheckBox( + "Header click listener"); + headerClickListenerCheckbox.setImmediate(true); + headerClickListenerCheckbox.addListener(new ValueChangeListener() { + + private HeaderClickListener headerClickListener = new HeaderClickListener() { + + public void headerClick(HeaderClickEvent event) { + String type = event.isDoubleClick() ? "Double click" + : "Click"; + log.log(type + " on header " + + event.getPropertyId().toString() + " using " + + event.getButtonName()); + } + + }; + + public void valueChange(ValueChangeEvent event) { + if (table.getListeners(HeaderClickEvent.class).isEmpty()) { + table.addListener(headerClickListener); + } else { + table.removeListener(headerClickListener); + } + } + }); + headerClickListenerCheckbox.setValue(true); + + CheckBox footerClickListenerCheckbox = new CheckBox( + "Footer click listener"); + footerClickListenerCheckbox.setImmediate(true); + footerClickListenerCheckbox.addListener(new ValueChangeListener() { + + private FooterClickListener footerClickListener = new FooterClickListener() { + + public void footerClick(FooterClickEvent event) { + String type = event.isDoubleClick() ? "Double click" + : "Click"; + log.log(type + " on footer " + + event.getPropertyId().toString() + " using " + + event.getButtonName()); + } + }; + + public void valueChange(ValueChangeEvent event) { + if (table.getListeners(FooterClickEvent.class).isEmpty()) { + table.addListener(footerClickListener); + } else { + table.removeListener(footerClickListener); + } + } + }); + footerClickListenerCheckbox.setValue(true); + + CheckBox sortEnabledCheckbox = new CheckBox("Sortable"); + sortEnabledCheckbox.setImmediate(true); + sortEnabledCheckbox.setValue(!table.isSortDisabled()); + sortEnabledCheckbox.addListener(new ClickListener() { + + public void buttonClick(ClickEvent event) { + table.setSortDisabled(!event.getButton().booleanValue()); + } + }); + + CheckBox columnReorderingCheckbox = new CheckBox( + "Column reordering allowed"); + columnReorderingCheckbox.setImmediate(true); + columnReorderingCheckbox.setValue(table.isColumnReorderingAllowed()); + columnReorderingCheckbox.addListener(new ClickListener() { + + public void buttonClick(ClickEvent event) { + table.setColumnReorderingAllowed(event.getButton() + .booleanValue()); + } + }); + + addComponent(immediateCheckbox); + addComponent(headerClickListenerCheckbox); + addComponent(footerClickListenerCheckbox); + addComponent(sortEnabledCheckbox); + addComponent(columnReorderingCheckbox); + addComponent(table); + addComponent(log); + + } + + @Override + protected String getDescription() { + return "Tests the header click listener"; + } + + @Override + protected Integer getTicketNumber() { + return 4515; + } + + private Container createContainer() { + IndexedContainer container = new IndexedContainer(); + container.addContainerProperty("col1", String.class, ""); + container.addContainerProperty("col2", String.class, ""); + container.addContainerProperty("col3", String.class, ""); + + for (int i = 0; i < 100; i++) { + Item item = container.addItem("item " + i); + item.getItemProperty("col1").setValue("first" + i); + item.getItemProperty("col2").setValue("middle" + i); + item.getItemProperty("col3").setValue("last" + i); + } + + return container; + } + +} |