summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/dd/ScrolledDropTarget.java
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-08-30 17:24:36 +0300
committerArtur Signell <artur@vaadin.com>2012-08-30 17:24:36 +0300
commit7b25b3886ea95bc6495506fbe9472e45fcbde684 (patch)
tree0b93cb65dab437feb46720659a63b8f1ef48f7f4 /uitest/src/com/vaadin/tests/dd/ScrolledDropTarget.java
parent8941056349e302e687e40e94c13709e75f256d73 (diff)
downloadvaadin-framework-7b25b3886ea95bc6495506fbe9472e45fcbde684.tar.gz
vaadin-framework-7b25b3886ea95bc6495506fbe9472e45fcbde684.zip
Renamed tests -> uitest and tests/testbench -> uitest/src (#9299)
Diffstat (limited to 'uitest/src/com/vaadin/tests/dd/ScrolledDropTarget.java')
-rw-r--r--uitest/src/com/vaadin/tests/dd/ScrolledDropTarget.java70
1 files changed, 70 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/dd/ScrolledDropTarget.java b/uitest/src/com/vaadin/tests/dd/ScrolledDropTarget.java
new file mode 100644
index 0000000000..951b9a4a57
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/dd/ScrolledDropTarget.java
@@ -0,0 +1,70 @@
+package com.vaadin.tests.dd;
+
+import com.vaadin.event.dd.DragAndDropEvent;
+import com.vaadin.event.dd.DropHandler;
+import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
+import com.vaadin.shared.ui.dd.VerticalDropLocation;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.tests.util.Log;
+import com.vaadin.ui.AbstractSelect.AbstractSelectTargetDetails;
+import com.vaadin.ui.AbstractSelect.VerticalLocationIs;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.Table.TableDragMode;
+
+public class ScrolledDropTarget extends TestBase {
+ private final Log log = new Log(5);
+
+ @Override
+ protected void setup() {
+
+ Table table = new Table();
+ table.addContainerProperty("A", String.class, "");
+ for (int i = 0; i < 100; i++) {
+ table.addItem(new Object[] { Integer.toString(i) },
+ Integer.valueOf(i));
+ }
+
+ table.setDragMode(TableDragMode.ROW);
+ table.setDropHandler(new DropHandler() {
+ @Override
+ public AcceptCriterion getAcceptCriterion() {
+ return VerticalLocationIs.MIDDLE;
+ }
+
+ @Override
+ public void drop(DragAndDropEvent event) {
+ AbstractSelectTargetDetails targetDetails = (AbstractSelectTargetDetails) event
+ .getTargetDetails();
+ VerticalDropLocation dropLocation = targetDetails
+ .getDropLocation();
+ log.log("Drop at " + dropLocation + " relative to "
+ + targetDetails.getItemIdOver());
+ }
+ });
+
+ addComponent(table);
+ addComponent(new Button("Scroll body", new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ getMainWindow().executeJavaScript(
+ "document.body.style.overflow = 'auto';"
+ + "document.body.style.height = '200%';"
+ + "window.scrollTo(0,18)");
+ }
+ }));
+ addComponent(log);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Vertical location for drags should work even when the browser window is scrolled";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return Integer.valueOf(6021);
+ }
+
+}