diff options
10 files changed, 31 insertions, 44 deletions
diff --git a/tests/src/com/vaadin/tests/components/ComponentTestCase.java b/tests/src/com/vaadin/tests/components/ComponentTestCase.java index 3c6d6cbcb3..9eedb53118 100644 --- a/tests/src/com/vaadin/tests/components/ComponentTestCase.java +++ b/tests/src/com/vaadin/tests/components/ComponentTestCase.java @@ -10,9 +10,10 @@ import com.vaadin.ui.Component; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Layout.SpacingHandler; -public abstract class ComponentTestCase extends TestBase { +public abstract class ComponentTestCase<T extends AbstractComponent> extends + TestBase { - private List<AbstractComponent> testComponents = new ArrayList<AbstractComponent>(); + private List<T> testComponents = new ArrayList<T>(); @Override protected void setup() { @@ -45,17 +46,17 @@ public abstract class ComponentTestCase extends TestBase { return actionLayout; } - protected void addTestComponent(AbstractComponent c) { + protected void addTestComponent(T c) { testComponents.add(c); addComponent(c); } - protected List<AbstractComponent> getTestComponents() { + protected List<T> getTestComponents() { return testComponents; } protected void setErrorIndicators(boolean on) { - for (AbstractComponent c : getTestComponents()) { + for (T c : getTestComponents()) { if (c == null) { continue; } @@ -72,7 +73,7 @@ public abstract class ComponentTestCase extends TestBase { protected void setRequired(boolean on) { - for (AbstractComponent c : getTestComponents()) { + for (T c : getTestComponents()) { if (c == null) { continue; } @@ -86,7 +87,7 @@ public abstract class ComponentTestCase extends TestBase { } protected void setEnabled(boolean on) { - for (AbstractComponent c : getTestComponents()) { + for (T c : getTestComponents()) { if (c == null) { continue; } @@ -97,7 +98,7 @@ public abstract class ComponentTestCase extends TestBase { } protected void setReadOnly(boolean on) { - for (AbstractComponent c : getTestComponents()) { + for (T c : getTestComponents()) { if (c == null) { continue; } diff --git a/tests/src/com/vaadin/tests/components/button/Buttons.java b/tests/src/com/vaadin/tests/components/button/Buttons.java index b27d3f8ae9..0540a0dcde 100644 --- a/tests/src/com/vaadin/tests/components/button/Buttons.java +++ b/tests/src/com/vaadin/tests/components/button/Buttons.java @@ -11,7 +11,7 @@ import com.vaadin.ui.Component; import com.vaadin.ui.NativeButton; import com.vaadin.ui.Button.ClickEvent; -public class Buttons extends ComponentTestCase { +public class Buttons extends ComponentTestCase<Button> { Button button[] = new Button[20]; diff --git a/tests/src/com/vaadin/tests/components/combobox/Comboboxes.java b/tests/src/com/vaadin/tests/components/combobox/Comboboxes.java index fe18875a47..f55a252f10 100644 --- a/tests/src/com/vaadin/tests/components/combobox/Comboboxes.java +++ b/tests/src/com/vaadin/tests/components/combobox/Comboboxes.java @@ -6,11 +6,12 @@ import java.util.List; import com.vaadin.tests.components.ComponentTestCase; import com.vaadin.ui.Button; import com.vaadin.ui.CheckBox; +import com.vaadin.ui.ComboBox; import com.vaadin.ui.Component; import com.vaadin.ui.Select; import com.vaadin.ui.Button.ClickEvent; -public class Comboboxes extends ComponentTestCase { +public class Comboboxes extends ComponentTestCase<ComboBox> { private static final Object CAPTION = "caption"; Select label[] = new Select[20]; @@ -19,7 +20,7 @@ public class Comboboxes extends ComponentTestCase { protected void setup() { super.setup(); - Select s; + ComboBox s; s = createSelect(null); s.setWidth(null); @@ -89,14 +90,14 @@ public class Comboboxes extends ComponentTestCase { } - private Select createSelect(String caption) { - Select s = new Select(); + private ComboBox createSelect(String caption) { + ComboBox cb = new ComboBox(); + cb.setImmediate(true); + cb.addContainerProperty(CAPTION, String.class, ""); + cb.setItemCaptionPropertyId(CAPTION); + cb.setCaption(caption); - s.addContainerProperty(CAPTION, String.class, ""); - s.setItemCaptionPropertyId(CAPTION); - s.setCaption(caption); - - return s; + return cb; } @Override diff --git a/tests/src/com/vaadin/tests/components/label/LabelModes.java b/tests/src/com/vaadin/tests/components/label/LabelModes.java index 16568c5da5..d7d426ec88 100644 --- a/tests/src/com/vaadin/tests/components/label/LabelModes.java +++ b/tests/src/com/vaadin/tests/components/label/LabelModes.java @@ -10,7 +10,7 @@ import com.vaadin.ui.Component; import com.vaadin.ui.Label; import com.vaadin.ui.Button.ClickEvent; -public class LabelModes extends ComponentTestCase { +public class LabelModes extends ComponentTestCase<Label> { Label label[] = new Label[20]; diff --git a/tests/src/com/vaadin/tests/components/label/Labels.java b/tests/src/com/vaadin/tests/components/label/Labels.java index 39c2aa8875..64c61ba13c 100644 --- a/tests/src/com/vaadin/tests/components/label/Labels.java +++ b/tests/src/com/vaadin/tests/components/label/Labels.java @@ -8,11 +8,10 @@ import com.vaadin.tests.util.LoremIpsum; import com.vaadin.ui.Button; import com.vaadin.ui.CheckBox; import com.vaadin.ui.Component; -import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.Button.ClickEvent; -public class Labels extends ComponentTestCase { +public class Labels extends ComponentTestCase<Label> { Label label[] = new Label[20]; @@ -56,17 +55,6 @@ public class Labels extends ComponentTestCase { } - private Component createActionLayout() { - HorizontalLayout actionLayout = new HorizontalLayout(); - actionLayout.setSpacing(true); - actionLayout.setMargin(true); - for (Component c : createActions()) { - actionLayout.addComponent(c); - } - addComponent(actionLayout); - return actionLayout; - } - private Label createLabel(String text, String caption) { Label l = new Label(text); l.setCaption(caption); diff --git a/tests/src/com/vaadin/tests/components/menubar/Menubars.java b/tests/src/com/vaadin/tests/components/menubar/Menubars.java index 15c353b98a..0442225134 100644 --- a/tests/src/com/vaadin/tests/components/menubar/Menubars.java +++ b/tests/src/com/vaadin/tests/components/menubar/Menubars.java @@ -11,7 +11,7 @@ import com.vaadin.ui.MenuBar; import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.MenuBar.MenuItem;
-public class Menubars extends ComponentTestCase {
+public class Menubars extends ComponentTestCase<MenuBar> {
MenuBar menubar[] = new MenuBar[20];
diff --git a/tests/src/com/vaadin/tests/components/textfield/TextFields.java b/tests/src/com/vaadin/tests/components/textfield/TextFields.java index 9be2c73c41..a908dccc1d 100644 --- a/tests/src/com/vaadin/tests/components/textfield/TextFields.java +++ b/tests/src/com/vaadin/tests/components/textfield/TextFields.java @@ -10,7 +10,7 @@ import com.vaadin.ui.Component; import com.vaadin.ui.TextField; import com.vaadin.ui.Button.ClickEvent; -public class TextFields extends ComponentTestCase { +public class TextFields extends ComponentTestCase<TextField> { @Override protected void setup() { diff --git a/tests/src/com/vaadin/tests/components/upload/TestImmediateUploadInFormLayout.java b/tests/src/com/vaadin/tests/components/upload/TestImmediateUploadInFormLayout.java index f4652aec18..e3645b777c 100644 --- a/tests/src/com/vaadin/tests/components/upload/TestImmediateUploadInFormLayout.java +++ b/tests/src/com/vaadin/tests/components/upload/TestImmediateUploadInFormLayout.java @@ -11,8 +11,8 @@ import com.vaadin.ui.FormLayout; import com.vaadin.ui.Upload;
import com.vaadin.ui.Upload.Receiver;
-public class TestImmediateUploadInFormLayout extends ComponentTestCase implements
- Receiver {
+public class TestImmediateUploadInFormLayout extends
+ ComponentTestCase<FormLayout> implements Receiver {
@Override
protected String getDescription() {
diff --git a/tests/src/com/vaadin/tests/components/upload/TestUpload.java b/tests/src/com/vaadin/tests/components/upload/TestUpload.java index 5b1590196b..b87300462e 100644 --- a/tests/src/com/vaadin/tests/components/upload/TestUpload.java +++ b/tests/src/com/vaadin/tests/components/upload/TestUpload.java @@ -6,7 +6,6 @@ import java.util.ArrayList; import java.util.List;
import com.vaadin.tests.components.ComponentTestCase;
-import com.vaadin.ui.Button;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Component;
import com.vaadin.ui.Upload;
@@ -15,7 +14,7 @@ import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.Upload.FinishedEvent;
import com.vaadin.ui.Upload.Receiver;
-public class TestUpload extends ComponentTestCase implements Receiver {
+public class TestUpload extends ComponentTestCase<Upload> implements Receiver {
@Override
protected String getDescription() {
@@ -47,8 +46,6 @@ public class TestUpload extends ComponentTestCase implements Receiver { u.setWidth("300px");
addTestComponent(u);
- addTestComponent(new Button("blah"));
-
}
@Override
@@ -58,7 +55,7 @@ public class TestUpload extends ComponentTestCase implements Receiver { CheckBox enabled = new CheckBox("Enabled", new ClickListener() {
public void buttonClick(ClickEvent event) {
- for (Component c : getTestComponents()) {
+ for (Upload c : getTestComponents()) {
c.setEnabled(event.getButton().booleanValue());
}
diff --git a/tests/src/com/vaadin/tests/components/upload/TestUploadAndDisableOnSuccess.java b/tests/src/com/vaadin/tests/components/upload/TestUploadAndDisableOnSuccess.java index 1e3abe146d..c49823e97b 100644 --- a/tests/src/com/vaadin/tests/components/upload/TestUploadAndDisableOnSuccess.java +++ b/tests/src/com/vaadin/tests/components/upload/TestUploadAndDisableOnSuccess.java @@ -16,8 +16,8 @@ import com.vaadin.ui.Upload.FinishedEvent; import com.vaadin.ui.Upload.Receiver;
import com.vaadin.ui.Upload.StartedEvent;
-public class TestUploadAndDisableOnSuccess extends ComponentTestCase implements
- Receiver {
+public class TestUploadAndDisableOnSuccess extends ComponentTestCase<Upload>
+ implements Receiver {
@Override
protected String getDescription() {
return "If upload is detached and attached during upload, the client side componenent never receives information that the upload has finished. Second update will not be successful.";
@@ -78,7 +78,7 @@ public class TestUploadAndDisableOnSuccess extends ComponentTestCase implements List<Component> actions = new ArrayList<Component>();
Button enabled = new Button("Toggle Enabled", new ClickListener() {
public void buttonClick(ClickEvent event) {
- for (Component c : getTestComponents()) {
+ for (Upload c : getTestComponents()) {
c.setEnabled(!c.isEnabled());
}
}
|