Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "SWTBot/GSOC dragndrop"
(→DragSource and DropTarget object) |
|||
Line 3: | Line 3: | ||
== Requirements == | == Requirements == | ||
− | * Usage must be consistent with current SWTBot APIs. We can expect a method on AbstractSWTBot. | + | * Usage must be consistent with current SWTBot APIs (<pre>widget.action()</pre>). We can expect a method on AbstractSWTBot. |
* Usage must be homogeneous in SWTBot, and must be the same for all possible controls and concepts | * Usage must be homogeneous in SWTBot, and must be the same for all possible controls and concepts | ||
* It must support SWT and GEF | * It must support SWT and GEF | ||
Line 39: | Line 39: | ||
* This must be supported by Test Recorder and Generator (addition of rules) <span style="color:#FF0000;font-weight:bold">NO</span> | * This must be supported by Test Recorder and Generator (addition of rules) <span style="color:#FF0000;font-weight:bold">NO</span> | ||
* It should support the concept of path (allow intermediary drags to before a drop) <span style="color:#FF0000;font-weight:bold">NO</span> | * It should support the concept of path (allow intermediary drags to before a drop) <span style="color:#FF0000;font-weight:bold">NO</span> | ||
+ | * Support for Transfer in order to test drops coming from external applications. <span style="color:#FF0000;font-weight:bold">NO</span> | ||
+ | |||
=== DNDUtils === | === DNDUtils === | ||
Line 59: | Line 61: | ||
* This must be supported by Test Recorder and Generator (addition of rules) <span style="color:#FF0000;font-weight:bold">NO</span> | * This must be supported by Test Recorder and Generator (addition of rules) <span style="color:#FF0000;font-weight:bold">NO</span> | ||
* It should support the concept of path (allow intermediary drags to before a drop) <span style="color:#FF0000;font-weight:bold">NO</span> | * It should support the concept of path (allow intermediary drags to before a drop) <span style="color:#FF0000;font-weight:bold">NO</span> | ||
+ | * Support for Transfer in order to test drops coming from external applications. <span style="color:#FF0000;font-weight:bold">NO</span> | ||
=== DragSource and DropTarget object === | === DragSource and DropTarget object === | ||
Line 70: | Line 73: | ||
DragAndDrop(source,target); | DragAndDrop(source,target); | ||
</source> | </source> | ||
+ | |||
+ | Requirements support: | ||
+ | * Usage must be consistent with current SWTBot APIs. <span style="color:#FF0000;font-weight:bold">NO</span> | ||
+ | * Usage must be homogeneous in SWTBot, and must be the same for all possible controls and concepts <span style="color:#00FF00;font-weight:bold">YES</span> | ||
+ | * It must support SWT and GEF | ||
+ | * This must be supported by Test Recorder and Generator (addition of rules) | ||
+ | * It should support the concept of path (allow intermediary drags to before a drop) | ||
+ | * Support for Transfer in order to test drops coming from external applications. |
Revision as of 05:04, 5 July 2013
This page contains various thoughts/proposals/snippets developed in order to support Drag'n'Drop in SWTBot in a smart and efficient way. Most of this was produced by Rohit AGRAWAL as part of Google Summer of Code 2013. See Rohit's proposal.
Contents
Requirements
- Usage must be consistent with current SWTBot APIs (
widget.action()
). We can expect a method on AbstractSWTBot. - Usage must be homogeneous in SWTBot, and must be the same for all possible controls and concepts
- It must support SWT and GEF
- This must be supported by Test Recorder and Generator (addition of rules)
Optional, if supported those features should be considered as secondary, and should not be necessary to deal with simple DND API.
- It should support the concept of path (allow intermediary drags to before a drop)
- Support for Transfer in order to test drops coming from external applications.
Main use-cases
So far, here are the 2 main use-cases that were identified based on community feedback:
- Drag'n'Drop of Tree elements
- Drag'n'Drop of GEF elements
Proposals
AbstractSWTBot<? extends Widget> dragAndDrop
This is a patch that was proposed early on https://bugs.eclipse.org/bugs/show_bug.cgi?id=285271: Example:
final SWTBotTree sourceTree = bot.tree(0); final SWTBotTree targetTree = bot.tree(1); final SWTBotTreeItem sourceItem = sourceTree.getTreeItem("Drag Source name 0"); final SWTBotTreeItem targetItem = targetTree.getTreeItem("Drop Target name 0"); sourceItem.dragAndDrop(targetItem);
Requirements support:
- Usage must be consistent with current SWTBot APIs. YES
- Usage must be homogeneous in SWTBot, and must be the same for all possible controls and concepts YES
- It must support SWT and GEF NO
- This must be supported by Test Recorder and Generator (addition of rules) NO
- It should support the concept of path (allow intermediary drags to before a drop) NO
- Support for Transfer in order to test drops coming from external applications. NO
DNDUtils
This is the workaround that has been extensively used so far. It's an utility class that is attached to https://bugs.eclipse.org/bugs/show_bug.cgi?id=285271:
final SWTBotTree sourceTree = bot.tree(0); final SWTBotTree targetTree = bot.tree(1); final SWTBotTreeItem sourceItem = sourceTree.getTreeItem("Drag Source name 0"); final SWTBotTreeItem targetItem = targetTree.getTreeItem("Drop Target name 0"); DNDUtils.dragAndDrop(sourceItem, targetItem)
Requirements support:
- Usage must be consistent with current SWTBot APIs. NO
- Usage must be homogeneous in SWTBot, and must be the same for all possible controls and concepts YES
- It must support SWT and GEF YES
- This must be supported by Test Recorder and Generator (addition of rules) NO
- It should support the concept of path (allow intermediary drags to before a drop) NO
- Support for Transfer in order to test drops coming from external applications. NO
DragSource and DropTarget object
This API is somewhat similar to how DND is implemented in SWT.
DragSource source = new DragSource(dragWidget, operations); DropTarget target = new DropTarget(dropWidget, operations); source.setTransfer(dragTransferType); target.setTransfer(dropTransferType); DragAndDrop(source,target);
Requirements support:
- Usage must be consistent with current SWTBot APIs. NO
- Usage must be homogeneous in SWTBot, and must be the same for all possible controls and concepts YES
- It must support SWT and GEF
- This must be supported by Test Recorder and Generator (addition of rules)
- It should support the concept of path (allow intermediary drags to before a drop)
- Support for Transfer in order to test drops coming from external applications.