/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
test %W% %E%
@bug 4874070 7146550
@summary Tests basic DnD functionality
@author Your Name: Alexey Utkin area=dnd
@run applet ImageDecoratedDnDNegative.html
*/
//Declare things used in the test, like buttons and labels here
public void init() {
//Create instructions for the user here, as well as set up
// the environment -- set the layout manager, add buttons,
// etc.
this.setLayout(new BorderLayout());
String[] instructions =
{
"Automatic test.",
"A Frame, which contains a yellow button labeled \"Drag ME!\" and ",
"a red panel, will appear below. ",
"1. The button would be clicked and dragged to the red panel. ",
"2. When the mouse enters the red panel during the drag, the panel ",
"should turn yellow. On the systems that supports pictured drag, ",
"the image under the drag-cursor should appear (ancor is shifted ",
"from top-left corner of the picture inside the picture to 10pt in both dimensions ). ",
"In WIN32 systems the image under cursor would be visible ONLY over ",
"the drop targets with activated extended OLE D\'n\'D support (that are ",
"the desktop and IE ).",
"3. The mouse would be released.",
"The panel should turn red again and a yellow button labeled ",
"\"Drag ME!\" should appear inside the panel. You should be able ",
"to repeat this operation multiple times."
};
}//End init()
public void moveTo(
Robot r,
Point b,
Point e)
{
for(int i=0; i<count; ++i){
c.setLocation(
r.mouseMove(
(int)c.getX(),
(int)c.getY());
r.delay(5);
}
r.mouseMove(
r.delay(5);
}
public void start() {
f.setLayout(new BorderLayout());
dragSource = new DnDSource("Drag ME! (" + (DragSource.isDragImageSupported()?"with ":"without") + " image)" );
f.setVisible(true);
try {
sourcePoint.x,
sourcePoint.y);
sourcePoint.y + d.height);
for(int i = 2; i < 5; ++i){
}
} catch( Exception e){
e.printStackTrace();
throw new RuntimeException("test failed: drop was not successful with exception " + e);
}
}// start()
}// class DnDAcceptanceTest
/**
* *************************************************
* Standard Test Machinery
* DO NOT modify anything below -- it's a standard
* chunk of code whose purpose is to make user
* interaction uniform, and thereby make it simpler
* to read and understand someone else's test.
* **************************************************
*/
class Sysout {
println("Any messages for the tester will display here.");
}
public static void createDialog() {
println("Any messages for the tester will display here.");
}
}
}
}// Sysout class
//DO NOT call this directly, go through Sysout
pack();
show();
}// TestDialog()
//DO NOT call this directly, go through Sysout
//Clear out any current instructions
//Go down array of instruction strings
//chop up each into pieces maxSringLength long
remainingStr = instructions[i];
//if longer than max then chop off first max chars to print
//Try to chop on a word boundary
int posOfSpace = remainingStr.
}
//else just print
else {
remainingStr = "";
}
}// while
}// for
}//printInstructions()
//DO NOT call this directly, go through Sysout
}
}// TestDialog class