]> source.dussan.org Git - vaadin-framework.git/commitdiff
Merge commit '257d49'
authorJohannes Dahlström <johannesd@vaadin.com>
Mon, 11 Jun 2012 10:35:50 +0000 (13:35 +0300)
committerJohannes Dahlström <johannesd@vaadin.com>
Mon, 11 Jun 2012 10:35:50 +0000 (13:35 +0300)
Conflicts:
tests/testbench/com/vaadin/tests/application/PaintableIdsShouldBeUnique.java
tests/testbench/com/vaadin/tests/components/TestBase.java
tests/testbench/com/vaadin/tests/components/table/ScrollCausesRequestLoop.java
tests/testbench/com/vaadin/tests/components/table/ScrollDetachSynchronization.java
tests/testbench/com/vaadin/tests/components/table/TableClickValueChangeInteraction.java
tests/testbench/com/vaadin/tests/components/window/ReplacingComponentsInHandleParameters.java
tests/testbench/com/vaadin/tests/containers/TableWithFileSystemContainer.java
tests/testbench/com/vaadin/tests/layouts/GridLayoutCaptions.java
tests/testbench/com/vaadin/tests/layouts/GridLayoutExpandRatioModification.java
tests/testbench/com/vaadin/tests/layouts/VerticalLayoutExpandRatioModification.java
tests/testbench/com/vaadin/tests/tickets/Ticket6002.java

Changed tests creating their own main windows (without a good reason) and extending AbstractTestBase to call getMainWindow() and extend TestBase instead

1  2 
tests/testbench/com/vaadin/tests/components/TestBase.java
tests/testbench/com/vaadin/tests/components/table/ScrollCausesRequestLoop.java
tests/testbench/com/vaadin/tests/components/table/ScrollDetachSynchronization.java
tests/testbench/com/vaadin/tests/components/table/TableClickValueChangeInteraction.java
tests/testbench/com/vaadin/tests/containers/TableWithFileSystemContainer.java
tests/testbench/com/vaadin/tests/layouts/GridLayoutCaptions.java
tests/testbench/com/vaadin/tests/layouts/GridLayoutExpandRatioModification.java
tests/testbench/com/vaadin/tests/layouts/VerticalLayoutExpandRatioModification.java
tests/testbench/com/vaadin/tests/tickets/Ticket6002.java
tests/testbench/com/vaadin/tests/validation/RequiredErrorMessage.java

index 6524a30fb753f99c109abfc7f7b6a7cffe9fb437,4d34fb2c8dea5d7dfa19bf53d527189e9acf5ea7..b3c0f63dcbcd016a01db6e3994e7bc471c6a12b4
@@@ -25,7 -24,16 +25,17 @@@ public abstract class TestBase extends 
          setup();
      }
  
 -    public void setMainWindow(Window mainWindow) {
 +    private LegacyWindow window;
++
+     @Override
 -    private Window window;
++    public void setMainWindow(LegacyWindow mainWindow) {
+         if (mainWindow != window) {
+             throw new IllegalStateException(
+                     "You should not set your own main window when using TestBase. If you need to use a custom Window as the main window, use AbstractTestCase instead.");
+         }
+         super.setMainWindow(mainWindow);
+     }
      private VerticalLayout layout;
  
      public TestBase() {
index c140e7e412c7234037ea59e67d97f618fc3d5ad9,b4c46a2ca6546264d81374468b0dbc8038e346f5..75468af24719e23af1298674a80ee23af2be1f9d
@@@ -4,17 -4,17 +4,17 @@@ import java.util.ArrayList
  import java.util.List;
  
  import com.vaadin.data.util.BeanItemContainer;
- import com.vaadin.tests.components.TestBase;
+ import com.vaadin.tests.components.AbstractTestCase;
  import com.vaadin.tests.util.Person;
  import com.vaadin.ui.HorizontalLayout;
 +import com.vaadin.ui.Root.LegacyWindow;
  import com.vaadin.ui.Table;
 -import com.vaadin.ui.Window;
  
- public class ScrollCausesRequestLoop extends TestBase {
+ public class ScrollCausesRequestLoop extends AbstractTestCase {
  
      @Override
-     protected void setup() {
+     public void init() {
 -        setMainWindow(new Window("", new TestView()));
 +        setMainWindow(new LegacyWindow("", new TestView()));
      }
  
      @Override
index 3b0234d80542d5262d0c9eca4cf68f80e17c9284,07a2974052bec204338cfc3dcb34281ec6ed41c5..c3ce0cd7625c98c28c9f7faf741cc62c4d13d4d4
@@@ -46,6 -49,6 +46,7 @@@ public class ScrollDetachSynchronizatio
          mainLayout.setExpandRatio(firstLayout, 1);
  
          first.addListener(new Button.ClickListener() {
++            @Override
              public void buttonClick(ClickEvent event) {
                  if (mainLayout.getComponent(1).equals(secondLayout)) {
                      mainLayout.replaceComponent(secondLayout, firstLayout);
@@@ -54,6 -57,6 +55,7 @@@
              }
          });
          second.addListener(new Button.ClickListener() {
++            @Override
              public void buttonClick(ClickEvent event) {
                  if (mainLayout.getComponent(1).equals(firstLayout)) {
                      mainLayout.replaceComponent(firstLayout, secondLayout);
index ff5aa89d8420afda359beb912658826f2e733c51,63c6c753cac7433adf432f2f2b17f15c47b8d8f4..e028f3073f65c8f0433481994334532425fd4f36
@@@ -60,6 -63,6 +60,7 @@@ public class TableClickValueChangeInter
          table.setHeight("100px");
          if (listenClicks) {
              table.addListener(new ItemClickListener() {
++                @Override
                  public void itemClick(ItemClickEvent event) {
                      table.requestRepaint();
                      clickLabel.setValue("Click " + event.getItemId());
          }
          if (listenValueChanges) {
              table.addListener(new ValueChangeListener() {
++                @Override
                  public void valueChange(ValueChangeEvent event) {
 -                    valueChangeLabel.setValue("Value " + event.getProperty());
 +                    valueChangeLabel.setValue("Value "
 +                            + event.getProperty().getValue());
                  }
              });
          }
index 459c234c244b121f81b3d20c6d6470f3355562f6,bedb2a735ed28be5b051309a601447c49259eb2d..25d0053fb2b64c0f0584a283d45d88e099588c2f
@@@ -3,17 -3,17 +3,15 @@@ package com.vaadin.tests.containers
  import java.io.File;
  
  import com.vaadin.data.util.FilesystemContainer;
 -import com.vaadin.tests.components.AbstractTestCase;
 +import com.vaadin.tests.components.TestBase;
- import com.vaadin.ui.Root.LegacyWindow;
  import com.vaadin.ui.Table;
 -import com.vaadin.ui.Window;
  
 -public class TableWithFileSystemContainer extends AbstractTestCase {
 +public class TableWithFileSystemContainer extends TestBase {
  
      private String testPath = "C:/temp/img";
  
      @Override
 -    public void init() {
 -        setMainWindow(new Window(""));
 +    public void setup() {
-         setMainWindow(new LegacyWindow(""));
          Table table = new Table("Documents", new FilesystemContainer(new File(
                  testPath)));
          table.setWidth("100%");
index 1fe33d62cafeb7343fb14571941e9c19fb4f9e7c,d851e9326fc4a5a41a2415155b0b7ef2826119dc..bed39d48aeb1296b27a8531ce0b1afc3b58d4036
@@@ -28,7 -27,7 +28,8 @@@ public class GridLayoutCaptions extend
          private CssLayout wrapper2 = new CssLayout();
  
          private FormFieldFactory fff = new FormFieldFactory() {
 -            public Field createField(Item item, Object propertyId,
++            @Override
 +            public Field<?> createField(Item item, Object propertyId,
                      Component uiContext) {
  
                  if (propertyId.equals(DataPOJO.Fields.name.name())) {
      }
  
      @Override
 -    public void init() {
 -        Window mainWindow = new Window("Formlayoutcaptionboom Application");
 +    protected void setup() {
-         LegacyWindow mainWindow = new LegacyWindow(
-                 "Formlayoutcaptionboom Application");
++        LegacyWindow mainWindow = getMainWindow();
++
          Label label = new Label("Hello Vaadin user");
          mainWindow.addComponent(label);
--        setMainWindow(mainWindow);
  
          DataPOJO forDemo = new DataPOJO();
  
          mainWindow.addComponent(aFormWithGl);
  
          Button b = new Button("Give me an error!", new Button.ClickListener() {
++            @Override
              public void buttonClick(ClickEvent event) {
                  aFormWithGl.createErrors();
  
  
          Button b2 = new Button("Get rid of an error!",
                  new Button.ClickListener() {
++                    @Override
                      public void buttonClick(ClickEvent event) {
                          aFormWithGl.clearErrors();
  
index f7f4ac2d4c3e2aab7045a2a7e5219f2778a19101,fa44345dfed5bf6d09306064673bf8af6c3da85a..84f27e5f03309ddc92856769b9d92ac117fe3856
@@@ -20,11 -20,11 +20,11 @@@ public class GridLayoutExpandRatioModif
      private Button button;
  
      @Override
 -    public void init() {
 -        Window main = new Window("The Main Window");
 +    public void setup() {
-         LegacyWindow main = new LegacyWindow("The Main Window");
++        LegacyWindow main = getMainWindow();
++
          mainLayout = new GridLayout(3, 3);
          main.setContent(mainLayout);
--        setMainWindow(main);
  
          // The upper layout
          vl1 = new VerticalLayout();
@@@ -59,6 -59,6 +59,7 @@@
          vl2.setSizeFull();
      }
  
++    @Override
      public void buttonClick(ClickEvent event) {
          if (isVisible) {
              mainLayout.setRowExpandRatio(2, 0);
index d41b288e03da7af4c94d6a678e1dadc9e792a2dc,5b1c7a58887586d379aec2f2fbc8dc1bc6af1d8f..916a82bb85fedf7978dad7d6e81330eb00ee237f
@@@ -19,11 -19,11 +19,11 @@@ public class VerticalLayoutExpandRatioM
      private Button button;
  
      @Override
 -    public void init() {
 -        Window main = new Window("The Main Window");
 +    public void setup() {
-         LegacyWindow main = new LegacyWindow("The Main Window");
++        LegacyWindow main = getMainWindow();
++
          mainLayout = new VerticalLayout();
          main.setContent(mainLayout);
--        setMainWindow(main);
  
          // The upper layout
          vl1 = new VerticalLayout();
@@@ -55,6 -55,6 +55,7 @@@
          vl2.setSizeFull();
      }
  
++    @Override
      public void buttonClick(ClickEvent event) {
          if (isVisible) {
              mainLayout.setExpandRatio(vl2, 0);
index 0875e3de48137346a7a13b89379abcd457621b8a,ad3b01ae7868cf691933b172883307425ef520e1..d720d45463d8d0cd0cd86613cad9b6e163ca2d0e
@@@ -3,18 -3,18 +3,17 @@@ package com.vaadin.tests.tickets
  import com.vaadin.data.Property;
  import com.vaadin.data.Property.ValueChangeEvent;
  import com.vaadin.data.util.ObjectProperty;
 -import com.vaadin.tests.components.AbstractTestCase;
 +import com.vaadin.tests.components.TestBase;
  import com.vaadin.ui.Label;
 +import com.vaadin.ui.Root.LegacyWindow;
  import com.vaadin.ui.TextField;
  import com.vaadin.ui.VerticalLayout;
 -import com.vaadin.ui.Window;
  
 -public class Ticket6002 extends AbstractTestCase {
 +public class Ticket6002 extends TestBase {
  
      @Override
 -    public void init() {
 -        Window main = new Window("The Main Window");
 -        setMainWindow(main);
 +    public void setup() {
-         LegacyWindow main = new LegacyWindow("The Main Window");
-         setMainWindow(main);
++        LegacyWindow main = getMainWindow();
  
          final VerticalLayout mainLayout = new VerticalLayout();
          main.setContent(mainLayout);
@@@ -32,6 -32,6 +31,7 @@@
          final TextField tf1 = new TextField(
                  "Changing this field modifies only the textfield", property1);
          tf1.addListener(new Property.ValueChangeListener() {
++            @Override
              public void valueChange(ValueChangeEvent event) {
                  // This value change event is called twice if the new
                  // input value is an integer. The second time is during
@@@ -56,6 -56,6 +56,7 @@@
                  "Changing this field modifies the layout - do it twice",
                  property2);
          tf2.addListener(new Property.ValueChangeListener() {
++            @Override
              public void valueChange(ValueChangeEvent event) {
                  // This value change event is called twice if the new
                  // input value is an integer. The second time is during
index e18b8ffd4e4c69433ae56a69fa3b6471c3ac4694,81c737cd17e62da17de56313dbdb1d0d2f772f2c..7b03bc7ec253b2efa0865ad13e5063e617e5da95
@@@ -1,12 -1,12 +1,12 @@@
  package com.vaadin.tests.validation;
  
- import com.vaadin.tests.components.TestBase;
+ import com.vaadin.tests.components.AbstractTestCase;
  import com.vaadin.ui.Form;
 +import com.vaadin.ui.Root.LegacyWindow;
  import com.vaadin.ui.TextField;
  import com.vaadin.ui.VerticalLayout;
 -import com.vaadin.ui.Window;
  
- public class RequiredErrorMessage extends TestBase {
+ public class RequiredErrorMessage extends AbstractTestCase {
  
      @Override
      protected Integer getTicketNumber() {
@@@ -19,9 -19,9 +19,9 @@@
      }
  
      @Override
-     public void setup() {
+     public void init() {
  
 -        final Window main = new Window(getClass().getName());
 +        final LegacyWindow main = new LegacyWindow(getClass().getName());
          setMainWindow(main);
  
          final Form form = new Form(new VerticalLayout());