]> source.dussan.org Git - vaadin-framework.git/commitdiff
Updated DateField test to be more specific so TB test can be made.
authorJohn Alhroos <john.ahlroos@itmill.com>
Mon, 9 Aug 2010 13:32:56 +0000 (13:32 +0000)
committerJohn Alhroos <john.ahlroos@itmill.com>
Mon, 9 Aug 2010 13:32:56 +0000 (13:32 +0000)
svn changeset:14435/svn branch:6.4

tests/src/com/vaadin/tests/components/datefield/DateFieldMinResolution.java

index 2ecec9e8cfefcf9d38bc5ab210ecef82e8f365ab..e7c34420602eeb697377caf153b61202f125fea7 100644 (file)
@@ -1,47 +1,51 @@
 package com.vaadin.tests.components.datefield;
 
-import java.util.Date;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
 
 import com.vaadin.data.Property;
 import com.vaadin.data.Property.ValueChangeEvent;
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.DateField;
 import com.vaadin.ui.InlineDateField;
+import com.vaadin.ui.Label;
 
 public class DateFieldMinResolution extends TestBase {
 
     @Override
     protected void setup() {
 
+        final SimpleDateFormat dformat = new SimpleDateFormat(
+                "dd/MM/yyyy HH:mm");
+
+        Calendar cal = Calendar.getInstance();
+        cal.set(2019, 1, 1, 1, 1);
+
         DateField df = new DateField("foo");
         df.setResolution(DateField.RESOLUTION_MIN);
-        df.setDateFormat("dd/MM/YYY HH:mm");
-        df.setValue(new Date());
+        df.setDateFormat(dformat.toPattern());
+        df.setValue(cal.getTime());
         df.setImmediate(true);
 
-        df.addListener(new Property.ValueChangeListener() {
-            public void valueChange(ValueChangeEvent event) {
-                getMainWindow()
-                        .showNotification(event.getProperty().toString());
-            }
-        });
-
         addComponent(df);
 
+        final Label lbl = new Label(dformat.format(cal.getTime()));
+        lbl.setCaption("Selected date");
+
         InlineDateField idf = new InlineDateField("bar");
         idf.setResolution(DateField.RESOLUTION_MIN);
-        idf.setDateFormat("dd/MM/YYY HH:mm");
-        idf.setValue(new Date());
+        idf.setDateFormat(dformat.toPattern());
+        idf.setValue(cal.getTime());
         idf.setImmediate(true);
 
         idf.addListener(new Property.ValueChangeListener() {
             public void valueChange(ValueChangeEvent event) {
-                getMainWindow()
-                        .showNotification(event.getProperty().toString());
+                lbl.setValue(dformat.format(event.getProperty().getValue()));
             }
         });
 
         addComponent(idf);
+        addComponent(lbl);
     }
 
     @Override