8328299: Convert DnDFileGroupDescriptor.html applet test to main
Reviewed-by: psadhukhan, tr
This commit is contained in:
parent
725d87bbc2
commit
75195aab49
@ -784,7 +784,6 @@ java/awt/event/MouseEvent/SpuriousExitEnter/SpuriousExitEnter_2.java 7131438,802
|
||||
java/awt/Modal/WsDisabledStyle/CloseBlocker/CloseBlocker.java 7187741 linux-all,macosx-all
|
||||
java/awt/xembed/server/TestXEmbedServerJava.java 8001150,8004031 generic-all
|
||||
java/awt/Modal/PrintDialogsTest/PrintDialogsTest.java 8068378 generic-all
|
||||
java/awt/dnd/DnDFileGroupDescriptor/DnDFileGroupDescriptor.html 8080185 macosx-all,linux-all
|
||||
java/awt/event/MouseEvent/AltGraphModifierTest/AltGraphModifierTest.java 8162380 generic-all
|
||||
java/awt/image/VolatileImage/VolatileImageConfigurationTest.java 8171069 macosx-all,linux-all
|
||||
java/awt/Modal/InvisibleParentTest/InvisibleParentTest.java 8172245 linux-all
|
||||
|
@ -1,43 +0,0 @@
|
||||
<!--
|
||||
Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
|
||||
This code is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License version 2 only, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
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.
|
||||
-->
|
||||
|
||||
<html>
|
||||
<!--
|
||||
@test
|
||||
@bug 6242241
|
||||
@summary Tests basic DnD functionality in an applet
|
||||
@author Your Name: Alexey Utkin area=dnd
|
||||
@run applet/manual=yesno DnDFileGroupDescriptor.html
|
||||
-->
|
||||
<head>
|
||||
<title> DnDToWordpadTest </title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>DnDFileGroupDescriptor<br>Bug ID: 6242241</h1>
|
||||
|
||||
<p> See the dialog box (usually in upper left corner) for instructions</p>
|
||||
|
||||
<APPLET CODE="DnDFileGroupDescriptor.class" WIDTH=200 HEIGHT=200></APPLET>
|
||||
</body>
|
||||
</html>
|
@ -1,188 +1,80 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Panel;
|
||||
|
||||
/*
|
||||
test
|
||||
@bug 6242241
|
||||
@summary Tests basic DnD functionality in an applet
|
||||
@requires (os.family == "windows")
|
||||
@author Your Name: Alexey Utkin area=dnd
|
||||
@run applet/manual=yesno DnDFileGroupDescriptor.html
|
||||
*/
|
||||
* @test
|
||||
* @bug 6242241
|
||||
* @summary Tests TransferFlavor that supports DnD of MS Outlook attachments.
|
||||
* @requires (os.family == "windows")
|
||||
* @library /java/awt/regtesthelpers
|
||||
* @build PassFailJFrame
|
||||
* @run main/manual DnDFileGroupDescriptor
|
||||
*/
|
||||
|
||||
import java.applet.Applet;
|
||||
import java.awt.*;
|
||||
public class DnDFileGroupDescriptor {
|
||||
private static final String INSTRUCTIONS = """
|
||||
When the test starts, a RED panel appears.
|
||||
1. Start MS Outlook program. Find and open the mail form with attachments.
|
||||
|
||||
public class DnDFileGroupDescriptor extends Applet {
|
||||
public void init() {
|
||||
setLayout(new BorderLayout());
|
||||
2. Select attachments from the mail and drag into a red field of applet.
|
||||
When the mouse enters the field during the process of drag, the application
|
||||
should change the cursor form to OLE-copy and field color to yellow.
|
||||
|
||||
String[] instructions = {
|
||||
"The applet window contains a red field.",
|
||||
"1. Start MS Outlook program. Find and open ",
|
||||
" the mail form with attachments.",
|
||||
"2. Select attachments from the mail and drag into a red field of applet.",
|
||||
" When the mouse enters the field during the drag, the application ",
|
||||
" should change the cursor form to OLE-copy and field color to yellow.",
|
||||
"3. Release the mouse button (drop attachments) over the field.",
|
||||
"",
|
||||
"File paths in temporary folder should appear.",
|
||||
"",
|
||||
"You should be able to repeat this operation multiple times.",
|
||||
"Please, select \"Pass\" just in case of success or \"Fail\" for another."
|
||||
};
|
||||
Sysout.createDialogWithInstructions( instructions );
|
||||
3. Release the mouse button (drop attachments) over the field.
|
||||
File paths in temporary folder should appear.
|
||||
You should be able to repeat this operation multiple times.
|
||||
|
||||
If the above is the case then press PASS, else FAIL.
|
||||
""";
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
PassFailJFrame.builder()
|
||||
.title("Test Instructions")
|
||||
.instructions(INSTRUCTIONS)
|
||||
.rows((int) INSTRUCTIONS.lines().count() + 2)
|
||||
.columns(40)
|
||||
.testUI(DnDFileGroupDescriptor::createUI)
|
||||
.build()
|
||||
.awaitAndCheck();
|
||||
}
|
||||
|
||||
public void start() {
|
||||
Panel mainPanel;
|
||||
Component dropTarget;
|
||||
|
||||
mainPanel = new Panel();
|
||||
private static Frame createUI() {
|
||||
Frame frame = new Frame("Test MS Outlook Mail Attachments DnD");
|
||||
Panel mainPanel = new Panel();
|
||||
mainPanel.setLayout(new BorderLayout());
|
||||
|
||||
mainPanel.setBackground(Color.blue);
|
||||
dropTarget = new DnDTarget(Color.red, Color.yellow);
|
||||
|
||||
Component dropTarget = new DnDTarget(Color.RED, Color.YELLOW);
|
||||
mainPanel.add(dropTarget, "Center");
|
||||
add(mainPanel);
|
||||
|
||||
setSize(200,200);
|
||||
frame.add(mainPanel);
|
||||
frame.setSize(400, 200);
|
||||
frame.setAlwaysOnTop(true);
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************
|
||||
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
|
||||
{
|
||||
private static TestDialog dialog;
|
||||
|
||||
public static void createDialogWithInstructions( String[] instructions )
|
||||
{
|
||||
dialog = new TestDialog( new Frame(), "Instructions" );
|
||||
dialog.printInstructions( instructions );
|
||||
dialog.show();
|
||||
println( "Any messages for the tester will display here." );
|
||||
}
|
||||
|
||||
public static void createDialog( )
|
||||
{
|
||||
dialog = new TestDialog( new Frame(), "Instructions" );
|
||||
String[] defInstr = { "Instructions will appear here. ", "" } ;
|
||||
dialog.printInstructions( defInstr );
|
||||
dialog.show();
|
||||
println( "Any messages for the tester will display here." );
|
||||
}
|
||||
|
||||
|
||||
public static void printInstructions( String[] instructions )
|
||||
{
|
||||
dialog.printInstructions( instructions );
|
||||
}
|
||||
|
||||
|
||||
public static void println( String messageIn )
|
||||
{
|
||||
dialog.displayMessage( messageIn );
|
||||
}
|
||||
|
||||
}// Sysout class
|
||||
|
||||
class TestDialog extends Dialog
|
||||
{
|
||||
|
||||
TextArea instructionsText;
|
||||
TextArea messageText;
|
||||
int maxStringLength = 80;
|
||||
|
||||
//DO NOT call this directly, go through Sysout
|
||||
public TestDialog( Frame frame, String name )
|
||||
{
|
||||
super( frame, name );
|
||||
int scrollBoth = TextArea.SCROLLBARS_BOTH;
|
||||
instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
|
||||
add( "North", instructionsText );
|
||||
|
||||
messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
|
||||
add("South", messageText);
|
||||
|
||||
pack();
|
||||
|
||||
show();
|
||||
}// TestDialog()
|
||||
|
||||
//DO NOT call this directly, go through Sysout
|
||||
public void printInstructions( String[] instructions )
|
||||
{
|
||||
//Clear out any current instructions
|
||||
instructionsText.setText( "" );
|
||||
|
||||
//Go down array of instruction strings
|
||||
|
||||
String printStr, remainingStr;
|
||||
for( int i=0; i < instructions.length; i++ )
|
||||
{
|
||||
//chop up each into pieces maxSringLength long
|
||||
remainingStr = instructions[ i ];
|
||||
while( remainingStr.length() > 0 )
|
||||
{
|
||||
//if longer than max then chop off first max chars to print
|
||||
if( remainingStr.length() >= maxStringLength )
|
||||
{
|
||||
//Try to chop on a word boundary
|
||||
int posOfSpace = remainingStr.
|
||||
lastIndexOf( ' ', maxStringLength - 1 );
|
||||
|
||||
if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
|
||||
|
||||
printStr = remainingStr.substring( 0, posOfSpace + 1 );
|
||||
remainingStr = remainingStr.substring( posOfSpace + 1 );
|
||||
}
|
||||
//else just print
|
||||
else
|
||||
{
|
||||
printStr = remainingStr;
|
||||
remainingStr = "";
|
||||
}
|
||||
|
||||
instructionsText.append( printStr + "\n" );
|
||||
|
||||
}// while
|
||||
|
||||
}// for
|
||||
|
||||
}//printInstructions()
|
||||
|
||||
//DO NOT call this directly, go through Sysout
|
||||
public void displayMessage( String messageIn )
|
||||
{
|
||||
messageText.append( messageIn + "\n" );
|
||||
}
|
||||
|
||||
}// TestDialog class
|
||||
|
Loading…
Reference in New Issue
Block a user