diff options
author | Anna Koskinen <Ansku@users.noreply.github.com> | 2020-03-26 10:51:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-26 10:51:19 +0200 |
commit | b1ff64c6fd97359056adfccf7dc06eb3116e9e10 (patch) | |
tree | 45aeb8c3f059213b2a43544a67298e617e4f5439 /uitest | |
parent | f96263b21c3440f02d55c6d37a89a354c3093bdb (diff) | |
download | vaadin-framework-b1ff64c6fd97359056adfccf7dc06eb3116e9e10.tar.gz vaadin-framework-b1ff64c6fd97359056adfccf7dc06eb3116e9e10.zip |
Add setters to Criterion to fix serialization. (#11926)
Fixes #11909
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/main/java/com/vaadin/tests/dnd/CriterionSerialization.java | 59 |
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; + } +} |