From bc763019b73291a915f34dd46aa23c9d2f218d68 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Wed, 13 Jun 2012 09:39:01 +0300 Subject: [PATCH] Test for repainting Window contents (#8832, #8943) --- .../window/RepaintWindowContents.html | 57 +++++++++++++++++++ .../window/RepaintWindowContents.java | 56 ++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 tests/testbench/com/vaadin/tests/components/window/RepaintWindowContents.html create mode 100644 tests/testbench/com/vaadin/tests/components/window/RepaintWindowContents.java diff --git a/tests/testbench/com/vaadin/tests/components/window/RepaintWindowContents.html b/tests/testbench/com/vaadin/tests/components/window/RepaintWindowContents.html new file mode 100644 index 0000000000..9cbcf1d5ea --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/window/RepaintWindowContents.html @@ -0,0 +1,57 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.window.RepaintWindowContents?restartApplication
assertTextvaadin=runcomvaadintestscomponentswindowRepaintWindowContents::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VButton[0]/domChild[0]/domChild[0]Button 1
clickvaadin=runcomvaadintestscomponentswindowRepaintWindowContents::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestscomponentswindowRepaintWindowContents::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VButton[0]/domChild[0]/domChild[0]Button 2
clickvaadin=runcomvaadintestscomponentswindowRepaintWindowContents::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestscomponentswindowRepaintWindowContents::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VButton[0]/domChild[0]/domChild[0]Button 1
clickvaadin=runcomvaadintestscomponentswindowRepaintWindowContents::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VButton[0]/domChild[0]
assertTextvaadin=runcomvaadintestscomponentswindowRepaintWindowContents::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VButton[0]/domChild[0]/domChild[0]Button 2
+ + diff --git a/tests/testbench/com/vaadin/tests/components/window/RepaintWindowContents.java b/tests/testbench/com/vaadin/tests/components/window/RepaintWindowContents.java new file mode 100644 index 0000000000..353eb535ca --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/window/RepaintWindowContents.java @@ -0,0 +1,56 @@ +package com.vaadin.tests.components.window; + +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.Layout; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.Window; + +public class RepaintWindowContents extends AbstractTestRoot { + private static final long serialVersionUID = 1L; + + @SuppressWarnings("serial") + @Override + protected void setup(WrappedRequest request) { + final Window window = new Window("Test window"); + addWindow(window); + + final Layout layout1 = new VerticalLayout(); + Button button1 = new Button("Button 1"); + layout1.addComponent(button1); + + final Layout layout2 = new VerticalLayout(); + Button button2 = new Button("Button 2"); + layout2.addComponent(button2); + + window.setContent(layout1); + + button1.addListener(new ClickListener() { + + public void buttonClick(ClickEvent event) { + window.setContent(layout2); + } + }); + + button2.addListener(new ClickListener() { + + public void buttonClick(ClickEvent event) { + window.setContent(layout1); + } + }); + } + + @Override + protected String getTestDescription() { + return "Clicking the button switches the content between content1 and content2"; + } + + @Override + protected Integer getTicketNumber() { + return 8832; + } + +} \ No newline at end of file -- 2.39.5