summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorAnna Koskinen <Ansku@users.noreply.github.com>2020-03-26 14:55:49 +0200
committerGitHub <noreply@github.com>2020-03-26 14:55:49 +0200
commit76291c6ff3bf9b54118e0f03b02cf62c7c897a20 (patch)
tree82d979a3e35377ab9094a7dbc134cc4cf93d2563 /uitest
parent65e8228464237fbbced0829df112e8f6b03f36d3 (diff)
downloadvaadin-framework-76291c6ff3bf9b54118e0f03b02cf62c7c897a20.tar.gz
vaadin-framework-76291c6ff3bf9b54118e0f03b02cf62c7c897a20.zip
Add setters to Criterion to fix serialization. (#11926) (#11931)
Fixes #11909
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/dnd/CriterionSerialization.java59
1 files changed, 59 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/dnd/CriterionSerialization.java b/uitest/src/main/java/com/vaadin/tests/dnd/CriterionSerialization.java
new file mode 100644
index 0000000000..3cc508f64b
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/dnd/CriterionSerialization.java
@@ -0,0 +1,59 @@
+package com.vaadin.tests.dnd;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.dnd.DragSourceExtension;
+import com.vaadin.ui.dnd.DropTargetExtension;
+
+public class CriterionSerialization extends AbstractTestUIWithLog {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ Button button = new Button();
+ button.setCaption("drag me");
+ button.setId("drag");
+ DragSourceExtension<Button> dragSource = new DragSourceExtension<>(
+ button);
+ dragSource.setPayload("test", "value");
+ dragSource.addDragStartListener(e -> {
+ log("drag started");
+ });
+ dragSource.addDragEndListener(e -> {
+ log("drag ended");
+ });
+
+ Button dropArea1 = new Button();
+ dropArea1.setCaption("drop here works");
+ dropArea1.setId("dropWorks");
+ DropTargetExtension<Button> dropTarget = new DropTargetExtension<>(
+ dropArea1);
+ dropTarget.addDropListener(e -> {
+ log("dropArea1 drop listener invoked (expected to happen)");
+ });
+ dropTarget.setDropCriterion("test", "value");
+
+ Button dropArea2 = new Button();
+ dropArea2.setCaption("drop here fails");
+ dropArea2.setId("dropFails");
+ DropTargetExtension<Button> dropTarget2 = new DropTargetExtension<>(
+ dropArea2);
+ dropTarget2.addDropListener(e -> {
+ log("dropArea2 drop listener invoked (should not happen)");
+ });
+ dropTarget2.setDropCriterion("test", "value2");
+
+ getLayout().addComponents(button, dropArea1, dropArea2);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Dropping the draggable button on the button without matching "
+ + "Criterion should not trigger drop listener.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 11909;
+ }
+}