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 6260659 |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
4 |
@summary File Name set programmatically in FileDialog is overridden during navigation, XToolkit |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
5 |
@author Dmitry.Cherepanov@SUN.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 FileNameOverrideTest.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 |
import java.io.IOException; |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
19 |
|
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
20 |
public class FileNameOverrideTest extends Applet implements ActionListener { |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
21 |
private final static String fileName = "input"; |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
22 |
private final static String clickDirName = "Directory for double click"; |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
23 |
private final static String dirPath = "."; |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
24 |
private Button showBtn; |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
25 |
private FileDialog fd; |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
26 |
|
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
27 |
public void init() { |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
28 |
this.setLayout(new GridLayout(1, 1)); |
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 |
fd = new FileDialog(new Frame(), "Open"); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
31 |
|
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
32 |
showBtn = new Button("Show File Dialog"); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
33 |
showBtn.addActionListener(this); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
34 |
add(showBtn); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
35 |
|
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
36 |
try { |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
37 |
File tmpFileUp = new File(dirPath + File.separator + fileName); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
38 |
File tmpDir = new File(dirPath + File.separator + clickDirName); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
39 |
File tmpFileIn = new File(tmpDir.getAbsolutePath() + File.separator + fileName); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
40 |
tmpDir.mkdir(); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
41 |
tmpFileUp.createNewFile(); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
42 |
tmpFileIn.createNewFile(); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
43 |
} catch (IOException ex) { |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
44 |
throw new RuntimeException("Cannot create test folder", ex); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
45 |
} |
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 |
String[] instructions = { |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
48 |
"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
|
49 |
"2) Double-click on '" + clickDirName + "' and click OK.", |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
50 |
"3) See result of the test below" |
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 |
Sysout.createDialogWithInstructions(instructions); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
53 |
}//End init() |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
54 |
|
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
55 |
public void start() { |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
56 |
setSize(200, 200); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
57 |
show(); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
58 |
}// start() |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
59 |
|
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
60 |
public void actionPerformed(ActionEvent e) { |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
61 |
if (e.getSource() == showBtn) { |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
62 |
fd.setFile(fileName); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
63 |
fd.setDirectory(dirPath); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
64 |
fd.setVisible(true); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
65 |
String output = fd.getFile(); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
66 |
if (fileName.equals(output)) { |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
67 |
Sysout.println("TEST PASSED"); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
68 |
} else { |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
69 |
Sysout.println("TEST FAILED (output file - " + output + ")"); |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
70 |
} |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
71 |
} |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
72 |
} |
1c69a0857cfb
6998877: After double-click on the folder names , FileNameOverrideTest FAILED
serb
parents:
diff
changeset
|
73 |
}// class ManualYesNoTest |