summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-12-06 13:36:33 +0200
committerArtur Signell <artur@vaadin.com>2012-12-06 13:36:33 +0200
commitc2b629a5ab42e7a35c86a8318ccae11b4eb3baa1 (patch)
tree529a51ef9f3cf62020d26938100e1988fc3646d7 /uitest
parentbf4fd2c80075c7efb9d2af59416d45e74ebf219d (diff)
downloadvaadin-framework-c2b629a5ab42e7a35c86a8318ccae11b4eb3baa1.tar.gz
vaadin-framework-c2b629a5ab42e7a35c86a8318ccae11b4eb3baa1.zip
Fixed test to work without VaadinClasses
Change-Id: I6b1cb5cf65acb98ce16df59464022f792b2af166
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/layouts/MovingComponentsWhileOldParentInvisible.html10
-rw-r--r--uitest/src/com/vaadin/tests/layouts/MovingComponentsWhileOldParentInvisible.java71
2 files changed, 58 insertions, 23 deletions
diff --git a/uitest/src/com/vaadin/tests/layouts/MovingComponentsWhileOldParentInvisible.html b/uitest/src/com/vaadin/tests/layouts/MovingComponentsWhileOldParentInvisible.html
index 31b3985a1c..e93332c0a5 100644
--- a/uitest/src/com/vaadin/tests/layouts/MovingComponentsWhileOldParentInvisible.html
+++ b/uitest/src/com/vaadin/tests/layouts/MovingComponentsWhileOldParentInvisible.html
@@ -310,7 +310,7 @@
</tr>
<tr>
<td>assertText</td>
- <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPanel[0]/VLabel[0]</td>
<td>Label inside the component container</td>
</tr>
<tr>
@@ -330,7 +330,7 @@
</tr>
<tr>
<td>assertText</td>
- <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPanel[0]/VLabel[0]</td>
<td>Label inside the component container</td>
</tr>
<!--Next component container-->
@@ -341,7 +341,7 @@
</tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item9</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item8</td>
<td>199,10</td>
</tr>
<tr>
@@ -382,7 +382,7 @@
</tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item10</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item9</td>
<td>199,10</td>
</tr>
<tr>
@@ -423,7 +423,7 @@
</tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item11</td>
+ <td>vaadin=runcomvaadintestslayoutsMovingComponentsWhileOldParentInvisible::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item10</td>
<td>199,10</td>
</tr>
<tr>
diff --git a/uitest/src/com/vaadin/tests/layouts/MovingComponentsWhileOldParentInvisible.java b/uitest/src/com/vaadin/tests/layouts/MovingComponentsWhileOldParentInvisible.java
index e6b8f4a416..364a0e267a 100644
--- a/uitest/src/com/vaadin/tests/layouts/MovingComponentsWhileOldParentInvisible.java
+++ b/uitest/src/com/vaadin/tests/layouts/MovingComponentsWhileOldParentInvisible.java
@@ -1,21 +1,35 @@
package com.vaadin.tests.layouts;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
-import com.vaadin.tests.VaadinClasses;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.AbsoluteLayout;
+import com.vaadin.ui.Accordion;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.ComponentContainer;
-import com.vaadin.ui.CustomLayout;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.FormLayout;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.HasComponents;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.HorizontalSplitPanel;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.SingleComponentContainer;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.VerticalSplitPanel;
public class MovingComponentsWhileOldParentInvisible extends TestBase {
- private ComponentContainer cc = new AbsoluteLayout(); // initial dummy
- // contents
+ private HasComponents cc = new AbsoluteLayout(); // initial dummy
+ // contents
private Label lab;
@Override
@@ -35,12 +49,7 @@ public class MovingComponentsWhileOldParentInvisible extends TestBase {
// componentContainer.addContainerProperty(CAPTION, String.class, "");
// componentContainer.addContainerProperty(CLASS, Class.class, "");
- for (Class<? extends ComponentContainer> cls : VaadinClasses
- .getComponentContainers()) {
- if (cls == CustomLayout.class) {
- // Does not support addComponent
- continue;
- }
+ for (Class<? extends HasComponents> cls : getComponentContainers()) {
componentContainerSelect.addItem(cls);
}
componentContainerSelect.addListener(new ValueChangeListener() {
@@ -48,11 +57,10 @@ public class MovingComponentsWhileOldParentInvisible extends TestBase {
@Override
@SuppressWarnings("unchecked")
public void valueChange(ValueChangeEvent event) {
- ComponentContainer oldCC = cc;
- cc = createComponentContainer((Class<? extends ComponentContainer>) event
+ HasComponents oldCC = cc;
+ cc = createComponentContainer((Class<? extends HasComponents>) event
.getProperty().getValue());
- cc.addComponent(lab);
-
+ addToCC(lab);
replaceComponent(oldCC, cc);
}
});
@@ -70,7 +78,7 @@ public class MovingComponentsWhileOldParentInvisible extends TestBase {
lab.setValue(lab.getValue().replace("inside",
"outside"));
} else {
- cc.addComponent(lab);
+ addToCC(lab);
lab.setValue(lab.getValue().replace("outside",
"inside"));
}
@@ -82,10 +90,37 @@ public class MovingComponentsWhileOldParentInvisible extends TestBase {
addComponent(but1);
}
- protected ComponentContainer createComponentContainer(
- Class<? extends ComponentContainer> value) {
+ protected void addToCC(Label lab2) {
+ if (cc instanceof ComponentContainer) {
+ ((ComponentContainer) cc).addComponent(lab);
+ } else if (cc instanceof SingleComponentContainer) {
+ ((SingleComponentContainer) cc).setContent(lab);
+ } else {
+ throw new RuntimeException("Don't know how to add to "
+ + cc.getClass().getName());
+ }
+ }
+
+ private Collection<Class<? extends HasComponents>> getComponentContainers() {
+ List<Class<? extends HasComponents>> list = new ArrayList<Class<? extends HasComponents>>();
+ list.add(AbsoluteLayout.class);
+ list.add(Accordion.class);
+ list.add(CssLayout.class);
+ list.add(FormLayout.class);
+ list.add(GridLayout.class);
+ list.add(HorizontalLayout.class);
+ list.add(HorizontalSplitPanel.class);
+ list.add(Panel.class);
+ list.add(TabSheet.class);
+ list.add(VerticalLayout.class);
+ list.add(VerticalSplitPanel.class);
+ return list;
+ }
+
+ protected HasComponents createComponentContainer(
+ Class<? extends HasComponents> value) {
try {
- ComponentContainer cc = value.newInstance();
+ HasComponents cc = value.newInstance();
cc.setWidth("300px");
cc.setHeight("300px");
return cc;