aboutsummaryrefslogtreecommitdiffstats
path: root/server/tests
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-12-18 16:45:45 +0200
committerArtur Signell <artur@vaadin.com>2012-12-18 16:45:45 +0200
commit90da2e172af7ae095b1ada5bc7dafc4986b36217 (patch)
treec531ea97dd87938c10250e74c55bb25ba711da8d /server/tests
parenta6ffd484283353825470988bf2d13093685d2761 (diff)
downloadvaadin-framework-90da2e172af7ae095b1ada5bc7dafc4986b36217.tar.gz
vaadin-framework-90da2e172af7ae095b1ada5bc7dafc4986b36217.zip
Update buffered field value if it has not been changed (#8192)
Change-Id: I70501fe0813d014304fac71b6b80f94d0fdee9da
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java
index 2f1b1f9dbc..cd77101ac3 100644
--- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java
+++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java
@@ -44,6 +44,41 @@ public class AbstractFieldValueConversions extends TestCase {
assertEquals("abc", paulaBean.getFirstName());
}
+ public void testNonmodifiedBufferedFieldConversion() {
+ VaadinSession.setCurrent(new VaadinSession(null));
+ TextField tf = new TextField("salary");
+ tf.setBuffered(true);
+ tf.setLocale(new Locale("en", "US"));
+ ObjectProperty<Integer> ds = new ObjectProperty<Integer>(123456789);
+ tf.setPropertyDataSource(ds);
+ assertEquals((Integer) 123456789, ds.getValue());
+ assertEquals("123,456,789", tf.getValue());
+ tf.setLocale(new Locale("fi", "FI"));
+ assertEquals((Integer) 123456789, ds.getValue());
+ assertEquals("123" + FORMATTED_SPACE + "456" + FORMATTED_SPACE + "789",
+ tf.getValue());
+
+ }
+
+ public void testModifiedBufferedFieldConversion() {
+ VaadinSession.setCurrent(new VaadinSession(null));
+ TextField tf = new TextField("salary");
+ tf.setBuffered(true);
+ tf.setLocale(new Locale("en", "US"));
+ ObjectProperty<Integer> ds = new ObjectProperty<Integer>(123456789);
+ tf.setPropertyDataSource(ds);
+ assertEquals((Integer) 123456789, ds.getValue());
+ assertEquals("123,456,789", tf.getValue());
+ tf.setValue("123,123");
+ assertEquals((Integer) 123456789, ds.getValue());
+ assertEquals("123,123", tf.getValue());
+
+ tf.setLocale(new Locale("fi", "FI"));
+ assertEquals((Integer) 123456789, ds.getValue());
+ // Value should not be updated when field is buffered
+ assertEquals("123,123", tf.getValue());
+ }
+
public void testStringIdentityConversion() {
TextField tf = new TextField();
tf.setConverter(new Converter<String, String>() {