author | sangheki |
Thu, 24 Mar 2016 23:07:06 -0700 | |
changeset 37194 | 96cc74bd293b |
parent 31660 | 1a4e2e5c15e1 |
permissions | -rw-r--r-- |
443
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
1 |
/* |
9035
1255eb81cc2f
7033660: Update copyright year to 2011 on any files changed in 2011
ohair
parents:
7806
diff
changeset
|
2 |
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. |
443
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
4 |
* |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
8 |
* |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
13 |
* accompanied this code). |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
14 |
* |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
18 |
* |
5506 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
443
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
22 |
*/ |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
23 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
24 |
import java.awt.*; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
25 |
import java.awt.event.*; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
26 |
import javax.swing.*; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
27 |
import java.io.*; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
28 |
import java.util.logging.*; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
29 |
import sun.awt.WindowIDProvider; |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
9035
diff
changeset
|
30 |
import sun.awt.AWTAccessor; |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
9035
diff
changeset
|
31 |
import sun.awt.AWTAccessor.ComponentAccessor; |
443
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
32 |
import java.awt.dnd.*; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
33 |
import java.awt.datatransfer.*; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
34 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
35 |
public abstract class TestXEmbedServer { |
7806
ad4062c4253d
6560348: PIT : java/awt/xembed/server/RunTestXEmbed.java fails
ptisnovs
parents:
5506
diff
changeset
|
36 |
// vertical position of server AND client windows |
ad4062c4253d
6560348: PIT : java/awt/xembed/server/RunTestXEmbed.java fails
ptisnovs
parents:
5506
diff
changeset
|
37 |
private static final int VERTICAL_POSITION = 200; |
ad4062c4253d
6560348: PIT : java/awt/xembed/server/RunTestXEmbed.java fails
ptisnovs
parents:
5506
diff
changeset
|
38 |
|
443
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
39 |
private static final Logger log = Logger.getLogger("test.xembed"); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
40 |
Frame f; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
41 |
Canvas client; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
42 |
Button toFocus; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
43 |
Button b_modal; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
44 |
JButton b_close; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
45 |
JDialog modal_d; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
46 |
JFrame dummy; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
47 |
Container clientCont; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
48 |
boolean passed; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
49 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
50 |
public boolean isPassed() { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
51 |
return passed; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
52 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
53 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
54 |
public TestXEmbedServer(boolean manual) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
55 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
56 |
// Enable testing extensions in XEmbed server |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
57 |
System.setProperty("sun.awt.xembed.testing", "true"); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
58 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
59 |
f = new Frame("Main frame"); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
60 |
f.addWindowListener(new WindowAdapter() { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
61 |
public void windowClosing(WindowEvent e) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
62 |
synchronized(TestXEmbedServer.this) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
63 |
TestXEmbedServer.this.notifyAll(); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
64 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
65 |
dummy.dispose(); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
66 |
f.dispose(); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
67 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
68 |
}); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
69 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
70 |
f.setLayout(new BorderLayout()); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
71 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
72 |
Container bcont = new Container(); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
73 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
74 |
toFocus = new Button("Click to focus server"); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
75 |
final TextField tf = new TextField(20); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
76 |
tf.setName("0"); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
77 |
DragSource ds = new DragSource(); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
78 |
final DragSourceListener dsl = new DragSourceAdapter() { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
79 |
public void dragDropEnd(DragSourceDropEvent dsde) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
80 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
81 |
}; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
82 |
final DragGestureListener dgl = new DragGestureListener() { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
83 |
public void dragGestureRecognized(DragGestureEvent dge) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
84 |
dge.startDrag(null, new StringSelection(tf.getText()), dsl); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
85 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
86 |
}; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
87 |
ds.createDefaultDragGestureRecognizer(tf, DnDConstants.ACTION_COPY, dgl); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
88 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
89 |
final DropTargetListener dtl = new DropTargetAdapter() { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
90 |
public void drop(DropTargetDropEvent dtde) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
91 |
dtde.acceptDrop(DnDConstants.ACTION_COPY); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
92 |
try { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
93 |
tf.setText(tf.getText() + (String)dtde.getTransferable().getTransferData(DataFlavor.stringFlavor)); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
94 |
} catch (Exception e) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
95 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
96 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
97 |
}; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
98 |
final DropTarget dt = new DropTarget(tf, dtl); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
99 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
100 |
Button b_add = new Button("Add client"); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
101 |
b_add.addActionListener(new ActionListener() { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
102 |
public void actionPerformed(ActionEvent e) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
103 |
addClient(); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
104 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
105 |
}); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
106 |
Button b_remove = new Button("Remove client"); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
107 |
b_remove.addActionListener(new ActionListener() { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
108 |
public void actionPerformed(ActionEvent e) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
109 |
if (clientCont.getComponentCount() != 0) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
110 |
clientCont.remove(clientCont.getComponentCount()-1); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
111 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
112 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
113 |
}); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
114 |
b_close = new JButton("Close modal dialog"); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
115 |
b_close.addActionListener(new ActionListener() { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
116 |
public void actionPerformed(ActionEvent e) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
117 |
modal_d.dispose(); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
118 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
119 |
}); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
120 |
b_modal = new Button("Show modal dialog"); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
121 |
b_modal.addActionListener(new ActionListener() { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
122 |
public void actionPerformed(ActionEvent e) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
123 |
modal_d = new JDialog(f, "Modal dialog", true); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
124 |
modal_d.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
125 |
modal_d.setBounds(0, 100, 200, 50); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
126 |
modal_d.getContentPane().add(b_close); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
127 |
modal_d.validate(); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
128 |
modal_d.show(); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
129 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
130 |
}); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
131 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
132 |
bcont.add(tf); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
133 |
bcont.add(toFocus); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
134 |
bcont.add(b_add); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
135 |
bcont.add(b_remove); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
136 |
bcont.add(b_modal); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
137 |
if (manual) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
138 |
Button pass = new Button("Pass"); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
139 |
pass.addActionListener(new ActionListener() { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
140 |
public void actionPerformed(ActionEvent e) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
141 |
passed = true; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
142 |
synchronized(TestXEmbedServer.this) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
143 |
TestXEmbedServer.this.notifyAll(); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
144 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
145 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
146 |
}); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
147 |
bcont.add(pass); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
148 |
Button fail = new Button("Fail"); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
149 |
fail.addActionListener(new ActionListener() { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
150 |
public void actionPerformed(ActionEvent e) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
151 |
passed = false; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
152 |
synchronized(TestXEmbedServer.this) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
153 |
TestXEmbedServer.this.notifyAll(); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
154 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
155 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
156 |
}); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
157 |
bcont.add(fail); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
158 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
159 |
b_modal.setName("2"); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
160 |
bcont.setLayout(new FlowLayout()); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
161 |
f.add(bcont, BorderLayout.NORTH); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
162 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
163 |
clientCont = Box.createVerticalBox(); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
164 |
f.add(clientCont, BorderLayout.CENTER); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
165 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
166 |
dummy = new JFrame("Dummy"); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
167 |
dummy.getContentPane().add(new JButton("Button")); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
168 |
dummy.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); |
7806
ad4062c4253d
6560348: PIT : java/awt/xembed/server/RunTestXEmbed.java fails
ptisnovs
parents:
5506
diff
changeset
|
169 |
dummy.setBounds(0, VERTICAL_POSITION, 100, 100); |
443
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
170 |
dummy.setVisible(true); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
171 |
|
7806
ad4062c4253d
6560348: PIT : java/awt/xembed/server/RunTestXEmbed.java fails
ptisnovs
parents:
5506
diff
changeset
|
172 |
f.setBounds(300, VERTICAL_POSITION, 800, 300); |
443
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
173 |
f.setVisible(true); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
174 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
175 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
176 |
public abstract Process startClient(Rectangle bounds[], long window); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
177 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
178 |
public void addClient() { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
179 |
client = new Canvas() { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
180 |
public void paint(Graphics g) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
181 |
super.paint(g); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
182 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
183 |
}; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
184 |
client.setBackground(new Color(30, 220, 40)); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
185 |
clientCont.add(client); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
186 |
clientCont.validate(); |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
9035
diff
changeset
|
187 |
final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
9035
diff
changeset
|
188 |
WindowIDProvider pid = (WindowIDProvider)acc.getPeer(client); |
443
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
189 |
log.fine("Added XEmbed server(Canvas) with X window ID " + pid.getWindow()); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
190 |
Rectangle toFocusBounds = toFocus.getBounds(); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
191 |
toFocusBounds.setLocation(toFocus.getLocationOnScreen()); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
192 |
f.validate(); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
193 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
194 |
// KDE doesn't accept clicks on title as activation - click below title |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
195 |
Rectangle fbounds = f.getBounds(); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
196 |
fbounds.y += f.getInsets().top; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
197 |
fbounds.height -= f.getInsets().top; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
198 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
199 |
Process proc = startClient(new Rectangle[] {fbounds, dummy.getBounds(), toFocusBounds, |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
200 |
new Rectangle(b_modal.getLocationOnScreen(), b_modal.getSize()), |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
201 |
new Rectangle(10, 130, 20, 20)}, pid.getWindow()); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
202 |
new ClientWatcher(client, proc, clientCont).start(); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
203 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
204 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
205 |
public void dispose() { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
206 |
f.dispose(); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
207 |
f = null; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
208 |
dummy.dispose(); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
209 |
dummy = null; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
210 |
if (modal_d != null) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
211 |
modal_d.dispose(); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
212 |
modal_d = null; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
213 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
214 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
215 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
216 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
217 |
class ClientWatcher extends Thread { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
218 |
private Process clientProcess; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
219 |
private Canvas client; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
220 |
private Container parent; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
221 |
public ClientWatcher(Canvas client, Process proc, Container parent) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
222 |
this.client = client; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
223 |
this.clientProcess = proc; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
224 |
this.parent = parent; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
225 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
226 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
227 |
public void run() { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
228 |
try { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
229 |
clientProcess.waitFor(); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
230 |
} catch (InterruptedException ie) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
231 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
232 |
parent.remove(client); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
233 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
234 |
} |