diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2013-02-11 17:04:15 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-02-18 17:11:50 +0000 |
commit | c4a0bc318ec9c6b41d652e7020ee39784cc1eb10 (patch) | |
tree | d9decb3f9b52f9b15a580b5e4cc7e3a0b7fde539 /uitest | |
parent | f3ad9cad8d3c12e3e25574569186d52c79c4f2a1 (diff) | |
download | vaadin-framework-c4a0bc318ec9c6b41d652e7020ee39784cc1eb10.tar.gz vaadin-framework-c4a0bc318ec9c6b41d652e7020ee39784cc1eb10.zip |
Properly pass the AbstractField internal value to shared state in Slider and ProgressIndicator (#10921)
* In case of a null value, 0 is stored to shared state. This is consistent with how CheckBox is already implemented.
* This somewhat hacky solution should be replaced with a better one once AbstractField itself is migrated. See #11064.
Change-Id: I2b313af8491a6deccdc7a509dcd1b718482cdcd4
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/slider/SliderValueFromDataSource.html | 32 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/slider/SliderValueFromDataSource.java | 59 |
2 files changed, 91 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/slider/SliderValueFromDataSource.html b/uitest/src/com/vaadin/tests/components/slider/SliderValueFromDataSource.html new file mode 100644 index 0000000000..8b5a7067e4 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/slider/SliderValueFromDataSource.html @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="http://localhost:8070/" /> +<title>SliderValueFromDataSource</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">SliderValueFromDataSource</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/SliderValueFromDataSource?restartApplication</td> + <td></td> +</tr> +<tr> + <td>assertAttribute</td> + <td>vaadin=runSliderValueFromDataSource::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VProgressIndicator[0]/domChild[0]/domChild[0]@style</td> + <td>regex:.*(width|WIDTH): 50%.*</td> +</tr> +<tr> + <td>assertAttribute</td> + <td>vaadin=runSliderValueFromDataSource::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VSlider[0]/domChild[2]/domChild[0]@style</td> + <td>regex:.*(margin-left|MARGIN-LEFT): 94px.*</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/slider/SliderValueFromDataSource.java b/uitest/src/com/vaadin/tests/components/slider/SliderValueFromDataSource.java new file mode 100644 index 0000000000..141dc5baf4 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/slider/SliderValueFromDataSource.java @@ -0,0 +1,59 @@ +package com.vaadin.tests.components.slider; + +import com.vaadin.data.Item; +import com.vaadin.data.util.BeanItem; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.ProgressIndicator; +import com.vaadin.ui.Slider; + +public class SliderValueFromDataSource extends AbstractTestUI { + + public static class TestBean { + + private double doubleValue = 10.0; + private float floatValue = 0.5f; + + public double getDoubleValue() { + return doubleValue; + } + + public void setDoubleValue(double doubleValue) { + this.doubleValue = doubleValue; + } + + public float getFloatValue() { + return floatValue; + } + + public void setFloatValue(float floatValue) { + this.floatValue = floatValue; + } + } + + @Override + protected void setup(VaadinRequest request) { + Item item = new BeanItem<TestBean>(new TestBean()); + + Slider slider = new Slider(0, 20); + slider.setWidth("200px"); + slider.setPropertyDataSource(item.getItemProperty("doubleValue")); + addComponent(slider); + + ProgressIndicator pi = new ProgressIndicator(); + pi.setPollingInterval(60 * 1000); + pi.setWidth("200px"); + pi.setPropertyDataSource(item.getItemProperty("floatValue")); + addComponent(pi); + } + + @Override + protected String getTestDescription() { + return "Slider and ProgressIndicator do not properly pass a value from data source to the client"; + } + + @Override + protected Integer getTicketNumber() { + return 10921; + } +} |