summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/main/java/com/vaadin/v7/tests/components/slider/SliderFeedback.java43
-rw-r--r--uitest/src/main/java/com/vaadin/v7/tests/components/slider/SliderTest.java79
-rw-r--r--uitest/src/test/java/com/vaadin/v7/tests/components/slider/SliderFeedbackTest.java44
3 files changed, 166 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/slider/SliderFeedback.java b/uitest/src/main/java/com/vaadin/v7/tests/components/slider/SliderFeedback.java
new file mode 100644
index 0000000000..66b4cbf509
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/v7/tests/components/slider/SliderFeedback.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.v7.tests.components.slider;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Slider;
+
+public class SliderFeedback extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ Slider slider = new Slider(0, 5);
+ slider.setWidth(800, Unit.PIXELS);
+ slider.setMin(0);
+ slider.setMax(1e12);
+ addComponent(slider);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Slider feedback popup should display the correct value";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 18192;
+ }
+
+}
diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/slider/SliderTest.java b/uitest/src/main/java/com/vaadin/v7/tests/components/slider/SliderTest.java
new file mode 100644
index 0000000000..305ce91fbe
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/v7/tests/components/slider/SliderTest.java
@@ -0,0 +1,79 @@
+package com.vaadin.v7.tests.components.slider;
+
+import java.util.LinkedHashMap;
+
+import com.vaadin.tests.components.abstractfield.LegacyAbstractFieldTest;
+import com.vaadin.v7.shared.ui.slider.SliderOrientation;
+import com.vaadin.v7.ui.Slider;
+
+public class SliderTest extends LegacyAbstractFieldTest<Slider> {
+
+ private Command<Slider, Double> minCommand = new Command<Slider, Double>() {
+ @Override
+ public void execute(Slider c, Double value, Object data) {
+ c.setMin(value);
+ }
+ };
+
+ private Command<Slider, Double> maxCommand = new Command<Slider, Double>() {
+ @Override
+ public void execute(Slider c, Double value, Object data) {
+ c.setMax(value);
+ }
+ };
+
+ private Command<Slider, SliderOrientation> orientationCommand = new Command<Slider, SliderOrientation>() {
+ @Override
+ public void execute(Slider c, SliderOrientation value, Object data) {
+ c.setOrientation(value);
+ }
+ };
+ private Command<Slider, Integer> resolutionCommand = new Command<Slider, Integer>() {
+ @Override
+ public void execute(Slider c, Integer value, Object data) {
+ c.setResolution(value);
+ }
+ };
+
+ @Override
+ protected Class<Slider> getTestClass() {
+ return Slider.class;
+ }
+
+ @Override
+ protected void createActions() {
+ super.createActions();
+
+ createMinSelect(CATEGORY_FEATURES);
+ createMaxSelect(CATEGORY_FEATURES);
+ createResolutionSelect(CATEGORY_FEATURES);
+ createOrientationSelect(CATEGORY_FEATURES);
+ }
+
+ private void createResolutionSelect(String category) {
+ createSelectAction("Resolution", category, createIntegerOptions(10),
+ "1", resolutionCommand);
+
+ }
+
+ private void createOrientationSelect(String category) {
+ LinkedHashMap<String, SliderOrientation> options = new LinkedHashMap<String, SliderOrientation>();
+ options.put("Horizontal", SliderOrientation.HORIZONTAL);
+ options.put("Vertical", SliderOrientation.VERTICAL);
+ createSelectAction("Orientation", category, options, "Horizontal",
+ orientationCommand);
+
+ }
+
+ private void createMaxSelect(String category) {
+ createSelectAction("Max", category, createDoubleOptions(100), "0",
+ maxCommand);
+ }
+
+ private void createMinSelect(String category) {
+ createSelectAction("Min", category, createDoubleOptions(100), "0",
+ minCommand);
+
+ }
+
+}
diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/slider/SliderFeedbackTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/slider/SliderFeedbackTest.java
new file mode 100644
index 0000000000..4dd556fc27
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/v7/tests/components/slider/SliderFeedbackTest.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.v7.tests.components.slider;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class SliderFeedbackTest extends MultiBrowserTest {
+
+ @Test
+ public void testValueGreaterThanMaxInt() {
+ openTestURL();
+
+ WebElement handle = findElement(By.className("v-slider-handle"));
+ new Actions(driver).dragAndDropBy(handle, 400, 0).perform();
+ testBench().waitForVaadin();
+
+ double value = Double.valueOf(
+ findElement(By.className("v-slider-feedback")).getText());
+
+ // Allow for some tolerance due to, you guessed it, IE8
+ assertLessThan("Unexpected feedback value {1} < {0}", 505000000000.0,
+ value);
+ assertGreater("Unexpected feedback value {1} > {0}", 510000000000.0,
+ value);
+ }
+}