author | serb |
Tue, 05 Apr 2011 16:50:11 +0400 | |
changeset 9198 | 1c69a0857cfb |
child 21596 | 0e3a39f29dbc |
permissions | -rw-r--r-- |
9198
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
1 |
/* |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
2 |
test |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
3 |
@bug 6998877 |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
4 |
@summary After double-click on the folder names, FileNameOverrideTest FAILED |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
5 |
@author Sergey.Bylokhov@oracle.com area=awt.filedialog |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
6 |
@library ../../regtesthelpers |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
7 |
@build Sysout |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
8 |
@run applet/manual=yesno SaveFileNameOverrideTest.html |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
9 |
*/ |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
10 |
|
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
11 |
import test.java.awt.regtesthelpers.Sysout; |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
12 |
|
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
13 |
import java.applet.Applet; |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
14 |
import java.awt.*; |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
15 |
import java.awt.event.ActionEvent; |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
16 |
import java.awt.event.ActionListener; |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
17 |
import java.io.File; |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
18 |
|
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
19 |
public class SaveFileNameOverrideTest extends Applet implements ActionListener { |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
20 |
private final static String clickDirName = "Directory for double click"; |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
21 |
private final static String dirPath = "."; |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
22 |
private Button showBtn; |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
23 |
private FileDialog fd; |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
24 |
|
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
25 |
public void init() { |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
26 |
this.setLayout(new GridLayout(1, 1)); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
27 |
|
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
28 |
fd = new FileDialog(new Frame(), "Save", FileDialog.SAVE); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
29 |
|
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
30 |
showBtn = new Button("Show File Dialog"); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
31 |
showBtn.addActionListener(this); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
32 |
add(showBtn); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
33 |
|
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
34 |
File tmpDir = new File(dirPath + File.separator + clickDirName); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
35 |
tmpDir.mkdir(); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
36 |
|
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
37 |
String[] instructions = { |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
38 |
"1) Click on 'Show File Dialog' button. A file dialog will come up.", |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
39 |
"2) Double-click on '" + clickDirName + "' and click OK.", |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
40 |
"3) See result of the test below" |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
41 |
}; |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
42 |
|
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
43 |
Sysout.createDialogWithInstructions(instructions); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
44 |
|
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
45 |
}//End init() |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
46 |
|
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
47 |
public void start() { |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
48 |
setSize(200, 200); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
49 |
show(); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
50 |
}// start() |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
51 |
|
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
52 |
public void actionPerformed(ActionEvent e) { |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
53 |
if (e.getSource() == showBtn) { |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
54 |
fd.setFile("input"); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
55 |
fd.setDirectory(dirPath); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
56 |
fd.setVisible(true); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
57 |
String output = fd.getFile(); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
58 |
if ("input".equals(output)) { |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
59 |
Sysout.println("TEST PASSED"); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
60 |
} else { |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
61 |
Sysout.println("TEST FAILED (output file - " + output + ")"); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
62 |
} |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
63 |
} |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
64 |
} |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
65 |
}// class ManualYesNoTest |