]> source.dussan.org Git - vaadin-framework.git/commitdiff
Test for changing Panel contents (#8735)
authorArtur Signell <artur@vaadin.com>
Mon, 25 Jun 2012 11:59:07 +0000 (14:59 +0300)
committerArtur Signell <artur@vaadin.com>
Mon, 25 Jun 2012 11:59:07 +0000 (14:59 +0300)
tests/testbench/com/vaadin/tests/components/panel/PanelChangeContents.html [new file with mode: 0644]
tests/testbench/com/vaadin/tests/components/panel/PanelChangeContents.java [new file with mode: 0644]

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 (file)
index 0000000..bff19c4
--- /dev/null
@@ -0,0 +1,77 @@
+<?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.panel.PanelChangeContents?restartApplication</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/VPanel[0]/VVerticalLayout[0]/VLabel[0]</td>
+       <td>stats</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/VHorizontalLayout[0]/VButton[1]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/VPanel[0]/VVerticalLayout[0]/VLabel[0]</td>
+       <td>companies</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/VHorizontalLayout[0]/VButton[2]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/VPanel[0]/VVerticalLayout[0]/VLabel[0]</td>
+       <td>settings</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/VHorizontalLayout[0]/VButton[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/VPanel[0]/VVerticalLayout[0]/VLabel[0]</td>
+       <td>stats</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/VHorizontalLayout[0]/VButton[1]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/VPanel[0]/VVerticalLayout[0]/VLabel[0]</td>
+       <td>companies</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/VHorizontalLayout[0]/VButton[2]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/VPanel[0]/VVerticalLayout[0]/VLabel[0]</td>
+       <td>settings</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
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 (file)
index 0000000..4859b22
--- /dev/null
@@ -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;
+    }
+
+}