From 236b3787f151a07cbf2202899e10955145c08e17 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Fri, 2 Jul 2010 09:55:18 +0000 Subject: [PATCH] Test case for #5278 svn changeset:14028/svn branch:6.4 --- .../tests/layouts/MovingInvisibleField.java | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 tests/src/com/vaadin/tests/layouts/MovingInvisibleField.java diff --git a/tests/src/com/vaadin/tests/layouts/MovingInvisibleField.java b/tests/src/com/vaadin/tests/layouts/MovingInvisibleField.java new file mode 100644 index 0000000000..0c02d0d3f3 --- /dev/null +++ b/tests/src/com/vaadin/tests/layouts/MovingInvisibleField.java @@ -0,0 +1,56 @@ +package com.vaadin.tests.layouts; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.TextField; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; + +@SuppressWarnings("serial") +public class MovingInvisibleField extends TestBase { + + @Override + protected void setup() { + final VerticalLayout layout1 = new VerticalLayout(); + final VerticalLayout layout2 = new VerticalLayout(); + + final TextField tfHidden = new TextField("Hidden text field caption", + "A hidden text field"); + final TextField tfVisible = new TextField("Visible text field caption", + "A visible text field"); + tfHidden.setVisible(false); + Button b = new Button("Move hidden textfield to other layout"); + b.addListener(new ClickListener() { + + public void buttonClick(ClickEvent event) { + if (layout1.getComponentIndex(tfHidden) != -1) { + layout2.addComponent(tfVisible); + layout2.addComponent(tfHidden); + } else { + layout1.addComponent(tfVisible); + layout1.addComponent(tfHidden); + } + + } + + }); + + layout1.addComponent(tfVisible); + layout1.addComponent(tfHidden); + + addComponent(layout1); + addComponent(b); + addComponent(layout2); + } + + @Override + protected String getDescription() { + return "Above and below the button is a VerticalLayout. Initially the first one contains two components: a visiable and an invisible TextField. Click the button to move the TextFields to the second layout, both should be moved but only the visible rendered."; + } + + @Override + protected Integer getTicketNumber() { + return 5278; + } +} -- 2.39.5