From 405713a4dff999ecf1987735c6c07693e988472b Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 25 Jun 2012 14:59:07 +0300 Subject: [PATCH] Test for changing Panel contents (#8735) --- .../components/panel/PanelChangeContents.html | 77 +++++++++++++++++++ .../components/panel/PanelChangeContents.java | 73 ++++++++++++++++++ 2 files changed, 150 insertions(+) create mode 100644 tests/testbench/com/vaadin/tests/components/panel/PanelChangeContents.html create mode 100644 tests/testbench/com/vaadin/tests/components/panel/PanelChangeContents.java diff --git a/tests/testbench/com/vaadin/tests/components/panel/PanelChangeContents.html b/tests/testbench/com/vaadin/tests/components/panel/PanelChangeContents.html new file mode 100644 index 0000000000..bff19c4846 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/panel/PanelChangeContents.html @@ -0,0 +1,77 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.panel.PanelChangeContents?restartApplication
assertTextvaadin=runcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/VPanel[0]/VVerticalLayout[0]/VLabel[0]stats
clickvaadin=runcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/VHorizontalLayout[0]/VButton[1]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/VPanel[0]/VVerticalLayout[0]/VLabel[0]companies
clickvaadin=runcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/VHorizontalLayout[0]/VButton[2]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/VPanel[0]/VVerticalLayout[0]/VLabel[0]settings
clickvaadin=runcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/VHorizontalLayout[0]/VButton[0]/domChild[0]
assertTextvaadin=runcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/VPanel[0]/VVerticalLayout[0]/VLabel[0]stats
clickvaadin=runcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/VHorizontalLayout[0]/VButton[1]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/VPanel[0]/VVerticalLayout[0]/VLabel[0]companies
clickvaadin=runcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/VHorizontalLayout[0]/VButton[2]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/VPanel[0]/VVerticalLayout[0]/VLabel[0]settings
+ + diff --git a/tests/testbench/com/vaadin/tests/components/panel/PanelChangeContents.java b/tests/testbench/com/vaadin/tests/components/panel/PanelChangeContents.java new file mode 100644 index 0000000000..4859b22932 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/panel/PanelChangeContents.java @@ -0,0 +1,73 @@ +/* +@VaadinApache2LicenseForJavaFiles@ + */ +package com.vaadin.tests.components.panel; + +import com.vaadin.terminal.WrappedRequest; +import com.vaadin.tests.components.AbstractTestRoot; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.Panel; +import com.vaadin.ui.VerticalLayout; + +public class PanelChangeContents extends AbstractTestRoot implements + ClickListener { + + VerticalLayout stats = new VerticalLayout(); + VerticalLayout companies = new VerticalLayout(); + VerticalLayout settings = new VerticalLayout(); + + Button statsButton = new Button("Stats", this); + Button companiesButton = new Button("Companies", this); + Button settingsButton = new Button("Settings", this); + + private Panel panel; + + @Override + protected void setup(WrappedRequest request) { + VerticalLayout content = new VerticalLayout(); + setSizeFull(); + HorizontalLayout buttons = new HorizontalLayout(); + stats.addComponent(new Label("stats")); + companies.addComponent(new Label("companies")); + settings.addComponent(new Label("settings")); + buttons.addComponent(statsButton); + buttons.addComponent(companiesButton); + buttons.addComponent(settingsButton); + panel = new Panel(); + panel.setSizeFull(); + panel.setContent(stats); + content.addComponent(buttons); + content.addComponent(panel); + content.setMargin(true); + content.setSpacing(true); + content.setExpandRatio(panel, 1); + setContent(content); + } + + public void buttonClick(ClickEvent event) { + if (event.getButton() == statsButton) { + panel.setContent(stats); + } else if (event.getButton() == companiesButton) { + panel.setContent(companies); + } else if (event.getButton() == settingsButton) { + panel.setContent(settings); + } + + } + + @Override + protected String getTestDescription() { + // TODO Auto-generated method stub + return null; + } + + @Override + protected Integer getTicketNumber() { + return 8735; + } + +} -- 2.39.5