diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-12-18 07:50:21 +0000 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2012-12-18 07:50:21 +0000 |
commit | 1617dbc9298826d112309aa6accc29bdcf64423b (patch) | |
tree | fea49b2e5325a0e671951cbfb8b90ddd6eaae6d8 /server/tests | |
parent | 3d9070537506575ae67485522aa4961a21b38906 (diff) | |
parent | 47bd15b914b90d600f7082d828e14ddc97b69ecd (diff) | |
download | vaadin-framework-1617dbc9298826d112309aa6accc29bdcf64423b.tar.gz vaadin-framework-1617dbc9298826d112309aa6accc29bdcf64423b.zip |
Merge "Support float fields with FieldGroup (#10553)"
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java index 9338d74f05..698e9bcee4 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java @@ -15,6 +15,33 @@ import com.vaadin.ui.TextField; public class DefaultConverterFactory extends TestCase { + public static class FloatBean { + float f1; + Float f2; + + public FloatBean(float f1, Float f2) { + this.f1 = f1; + this.f2 = f2; + } + + public float getF1() { + return f1; + } + + public void setF1(float f1) { + this.f1 = f1; + } + + public Float getF2() { + return f2; + } + + public void setF2(Float f2) { + this.f2 = f2; + } + + } + Person paulaBean = new Person("Paula", "Brilliant", "paula@brilliant.com", 34, Sex.FEMALE, new Address("Paula street 1", 12345, "P-town", Country.FINLAND)); @@ -25,6 +52,21 @@ public class DefaultConverterFactory extends TestCase { paulaBean.setRent(rent); } + public void testFloatConversion() { + VaadinSession sess = new VaadinSession(null); + VaadinSession.setCurrent(sess); + + TextField tf = new TextField(); + tf.setLocale(new Locale("en", "US")); + tf.setPropertyDataSource(new MethodProperty<Integer>(new FloatBean(12f, + 23f), "f2")); + assertEquals("23", tf.getValue()); + tf.setValue("24"); + assertEquals("24", tf.getValue()); + assertEquals(24f, tf.getConvertedValue()); + assertEquals(24f, tf.getPropertyDataSource().getValue()); + } + public void testDefaultNumberConversion() { VaadinSession app = new VaadinSession(null); VaadinSession.setCurrent(app); |