Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion test/jdk/ProblemList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,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/image/VolatileImage/VolatileImageConfigurationTest.java 8171069 macosx-all,linux-all
java/awt/Modal/InvisibleParentTest/InvisibleParentTest.java 8172245 linux-all
java/awt/Frame/FrameStateTest/FrameStateTest.java 8203920 macosx-all,linux-all
Expand Down

This file was deleted.

248 changes: 70 additions & 178 deletions test/jdk/java/awt/dnd/DnDFileGroupDescriptor/DnDFileGroupDescriptor.java
Original file line number Diff line number Diff line change
@@ -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.
*/

/*
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
*/

import java.applet.Applet;
import java.awt.*;

public class DnDFileGroupDescriptor extends Applet {
public void init() {
setLayout(new BorderLayout());
* 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;

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 );
/*
* @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
*/

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.

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.

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