summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/serialization
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2015-02-18 14:42:20 +0200
committerHenri Sara <hesara@vaadin.com>2015-05-11 12:05:18 +0300
commitcb9a01738a179a58d4d72bbffbc837f1445e3802 (patch)
tree0cfe901dcc1bfe786a68e659afd1882a8d54aec5 /uitest/src/com/vaadin/tests/serialization
parentf3aa03f54824682816295b6c0aa29862a4469a3d (diff)
downloadvaadin-framework-cb9a01738a179a58d4d72bbffbc837f1445e3802.tar.gz
vaadin-framework-cb9a01738a179a58d4d72bbffbc837f1445e3802.zip
Converted javascript tests to TB4 and added date tests (#16797, #16786)
Change-Id: I0ac58945d70676135d982f5b829b065b96b1ffa4
Diffstat (limited to 'uitest/src/com/vaadin/tests/serialization')
-rw-r--r--uitest/src/com/vaadin/tests/serialization/SerializerTest.java21
-rw-r--r--uitest/src/com/vaadin/tests/serialization/SerializerTestTest.java10
2 files changed, 29 insertions, 2 deletions
diff --git a/uitest/src/com/vaadin/tests/serialization/SerializerTest.java b/uitest/src/com/vaadin/tests/serialization/SerializerTest.java
index f8a2dcaf76..d1af180d4e 100644
--- a/uitest/src/com/vaadin/tests/serialization/SerializerTest.java
+++ b/uitest/src/com/vaadin/tests/serialization/SerializerTest.java
@@ -51,7 +51,7 @@ import elemental.json.JsonValue;
@Widgetset("com.vaadin.tests.widgetset.TestingWidgetSet")
public class SerializerTest extends AbstractTestUI {
- private Log log = new Log(50);
+ private Log log = new Log(80);
@Override
protected void setup(VaadinRequest request) {
@@ -63,7 +63,7 @@ public class SerializerTest extends AbstractTestUI {
log.setNumberLogRows(false);
addComponent(log);
- SerializerTestRpc rpc = testExtension
+ final SerializerTestRpc rpc = testExtension
.getRpcProxy(SerializerTestRpc.class);
SerializerTestState state = testExtension.getState();
@@ -263,12 +263,15 @@ public class SerializerTest extends AbstractTestUI {
rpc.sendDate(new Date(1));
rpc.sendDate(new Date(2013 - 1900, 5 - 1, 31, 11, 12, 13));
+ rpc.sendDateArray(new Date[] { new Date(2013 - 1900, 1, 1),
+ new Date(2012 - 1900, 1, 1) });
state.jsonNull = Json.createNull();
state.jsonString = Json.create("a string");
state.jsonBoolean = Json.create(false);
rpc.sendJson(Json.create(true), Json.createNull(), Json.create("JSON"));
+ state.dateArray = new Date[] { new Date(1), new Date(2) };
state.date1 = new Date(1);
state.date2 = new Date(2013 - 1900, 5 - 1, 31, 11, 12, 13);
@@ -469,6 +472,20 @@ public class SerializerTest extends AbstractTestUI {
}
@Override
+ public void sendDateArray(Date[] dateArray) {
+ DateFormat format = DateFormat.getDateTimeInstance(
+ DateFormat.LONG, DateFormat.FULL,
+ new Locale("en", "fi"));
+ format.setTimeZone(TimeZone.getTimeZone("UTC"));
+ String dates = "";
+
+ for (Date date : dateArray) {
+ dates += " " + format.format(date);
+ }
+ log.log("sendDateArray: " + dates);
+ }
+
+ @Override
public void sendJson(JsonValue value1, JsonValue value2,
JsonString string) {
log.log("sendJson: " + value1.toJson() + ", " + value2.toJson()
diff --git a/uitest/src/com/vaadin/tests/serialization/SerializerTestTest.java b/uitest/src/com/vaadin/tests/serialization/SerializerTestTest.java
index 8f1bcb6266..b2eb0e6b01 100644
--- a/uitest/src/com/vaadin/tests/serialization/SerializerTestTest.java
+++ b/uitest/src/com/vaadin/tests/serialization/SerializerTestTest.java
@@ -30,6 +30,9 @@ public class SerializerTestTest extends MultiBrowserTest {
Assert.assertEquals(
"sendJson: {\"b\":false,\"s\":\"JSON\"}, null, \"value\"",
getLogRow(logRow++));
+ Assert.assertEquals(
+ "sendDateArray: January 31, 2013 10:00:00 PM UTC January 31, 2012 10:00:00 PM UTC",
+ getLogRow(logRow++));
Assert.assertEquals("sendDate: May 31, 2013 8:12:13 AM UTC",
getLogRow(logRow++));
Assert.assertEquals("sendDate: January 1, 1970 12:00:00 AM UTC",
@@ -80,6 +83,13 @@ public class SerializerTestTest extends MultiBrowserTest {
"sendBoolean: false, false, [false, false, true, false, true, true]",
getLogRow(logRow++));
Assert.assertEquals("sendBeanSubclass: 43", getLogRow(logRow++));
+ Assert.assertEquals(
+ "state.dateArray: Thu Jan 01 02:00:00 GMT+200 1970 Thu Jan 01 02:00:00 GMT+200 1970",
+ getLogRow(logRow++));
+ Assert.assertEquals("state.date2: Fri May 31 11:12:13 GMT+300 2013",
+ getLogRow(logRow++));
+ Assert.assertEquals("state.date1: Thu Jan 01 02:00:00 GMT+200 1970",
+ getLogRow(logRow++));
Assert.assertEquals("state.jsonBoolean: false", getLogRow(logRow++));
Assert.assertEquals("state.jsonString: a string", getLogRow(logRow++));
Assert.assertEquals("state.jsonNull: NULL", getLogRow(logRow++));