aboutsummaryrefslogtreecommitdiffstats
path: root/server/tests
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-12-18 11:22:28 +0200
committerArtur Signell <artur@vaadin.com>2012-12-18 11:43:36 +0200
commit1f4c5f8ee28ba7ce6b5a3c490ff5cf70849f1807 (patch)
tree5b1a6a86d9448cd1327a41e06f1228117c47dcb7 /server/tests
parent510435d377a50dcb73f9367ab4f783d408310456 (diff)
downloadvaadin-framework-1f4c5f8ee28ba7ce6b5a3c490ff5cf70849f1807.tar.gz
vaadin-framework-1f4c5f8ee28ba7ce6b5a3c490ff5cf70849f1807.zip
Do not update data model when locale changes (#10562, #8192)
Change-Id: I84e00c9e73d69bb398a8e9cc2c6bdb7fa60d3907
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java22
1 files changed, 22 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 16c7c4060d..2f1b1f9dbc 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
@@ -26,6 +26,12 @@ public class AbstractFieldValueConversions extends TestCase {
34, Sex.FEMALE, new Address("Paula street 1", 12345, "P-town",
Country.FINLAND));
+ /**
+ * Java uses a non-breaking space (ascii 160) instead of space when
+ * formatting
+ */
+ private static final char FORMATTED_SPACE = 160;
+
public void testWithoutConversion() {
TextField tf = new TextField();
tf.setPropertyDataSource(new MethodProperty<String>(paulaBean,
@@ -87,6 +93,22 @@ public class AbstractFieldValueConversions extends TestCase {
assertEquals("42", tf.getValue());
}
+ public void testChangeReadOnlyFieldLocale() {
+ VaadinSession.setCurrent(new VaadinSession(null));
+
+ TextField tf = new TextField("salary");
+ tf.setLocale(new Locale("en", "US"));
+ ObjectProperty<Integer> ds = new ObjectProperty<Integer>(123456789);
+ ds.setReadOnly(true);
+ 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 testBooleanNullConversion() {
CheckBox cb = new CheckBox();
cb.setConverter(new Converter<Boolean, Boolean>() {