From the beginning Drag&Drop has been hard to implement in Java. JDK 1.1 had no Drag&Drop support at all and the first steps taken with JDK 1.2 were far from satisfying. In JDK 1.3 Drag&Drop has matured, but there are still problems with stability. That Drag&Drop is so hard to get right is partly due to the fundamental difference in the way Drag&Drop is implemented by the underlying systems. Another reason is the goal to support Drag&Drop between Java and the underlying system and not just between Java applications.
As a result Drag&Drop for Java is implemented "native", meaning at the level of the operating system, so the events involved can be neither interpreted, nor generated by QF-Test. Hence Drag&Drop cannot be replayed directly.
Even so QF-Test has support for Drag&Drop, at least for JDK 1.3 and above. Direct recording of
Drag&Drop is supported with JDK 1.4 and above. Replay of Drag&Drop is achieved through the
special 'Mouse events'
DROP_TO as well as
DRAG_OVER. To replay these events, QF-Test makes use of the AWT
Robot that was added to Java with version 1.3. The AWT Robot makes it possible to
generate "hard" events at system level. These "hard" events actually move the mouse
cursor across the screen and can trigger a Drag&Drop operation.
Using Drag&Drop together with the [Shift] and or [Control] key is also supported. To simulate a Drag&Drop with the [Control] key pressed, change the 'Modifiers' attributes of the
DROP_TO events to
include the Control modifier by adding 2 to the current value. It is even possible to
simulate the [Shift] or [Control] key being
pressed or released during the drag operation by changing the 'Modifiers' of only
some of the events.
As mentioned above, Drag&Drop used to be a bit unstable on some systems. In some cases with older JDKs the use of the AWT Robot to simulate Drag&Drop could crash the SUT or even the whole system. Nowadays the situation is much better. The introduction of mouse movement interpolation helped improve the reliability of Drag&Drop replay a lot. Please see subsection 22.214.171.124 for details.
Note On Windows simulating Drag&Drop may conflict with some mouse drivers. In case of problems reduce the speed of the mouse cursor to 50% in the mouse settings of the control panel.
|Last update: 12/3/2020
Copyright © 1999-2020 Quality First Software GmbH