./test/java/awt/xembed/server/TestXEmbedServer.java

Print this page
rev 3189 : Testcase correction.


  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  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.
  22  */
  23 
  24 import java.awt.*;
  25 import java.awt.event.*;
  26 import javax.swing.*;
  27 import java.io.*;
  28 import java.util.logging.*;
  29 import sun.awt.WindowIDProvider;
  30 import java.awt.dnd.*;
  31 import java.awt.datatransfer.*;
  32 
  33 public abstract class TestXEmbedServer {



  34     private static final Logger log = Logger.getLogger("test.xembed");
  35     Frame f;
  36     Canvas client;
  37     Button toFocus;
  38     Button b_modal;
  39     JButton b_close;
  40     JDialog modal_d;
  41     JFrame dummy;
  42     Container clientCont;
  43     boolean passed;
  44 
  45     public boolean isPassed() {
  46         return passed;
  47     }
  48 
  49     public TestXEmbedServer(boolean manual) {
  50 
  51         // Enable testing extensions in XEmbed server
  52         System.setProperty("sun.awt.xembed.testing", "true");
  53 


 144             fail.addActionListener(new ActionListener() {
 145                     public void actionPerformed(ActionEvent e) {
 146                         passed = false;
 147                         synchronized(TestXEmbedServer.this) {
 148                             TestXEmbedServer.this.notifyAll();
 149                         }
 150                     }
 151                 });
 152             bcont.add(fail);
 153         }
 154         b_modal.setName("2");
 155         bcont.setLayout(new FlowLayout());
 156         f.add(bcont, BorderLayout.NORTH);
 157 
 158         clientCont = Box.createVerticalBox();
 159         f.add(clientCont, BorderLayout.CENTER);
 160 
 161         dummy = new JFrame("Dummy");
 162         dummy.getContentPane().add(new JButton("Button"));
 163         dummy.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
 164         dummy.setBounds(0, 0, 100, 100);
 165         dummy.setVisible(true);
 166 
 167         f.setBounds(300, 0, 800, 300);
 168         f.setVisible(true);
 169     }
 170 
 171     public abstract Process startClient(Rectangle bounds[], long window);
 172 
 173     public void addClient() {
 174         client = new Canvas() {
 175                 public void paint(Graphics g) {
 176                     super.paint(g);
 177                 }
 178             };
 179         client.setBackground(new Color(30, 220, 40));
 180         clientCont.add(client);
 181         clientCont.validate();
 182         WindowIDProvider pid = (WindowIDProvider)client.getPeer();
 183         log.fine("Added XEmbed server(Canvas) with X window ID " + pid.getWindow());
 184         Rectangle toFocusBounds = toFocus.getBounds();
 185         toFocusBounds.setLocation(toFocus.getLocationOnScreen());
 186         f.validate();
 187 




  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  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.
  22  */
  23 
  24 import java.awt.*;
  25 import java.awt.event.*;
  26 import javax.swing.*;
  27 import java.io.*;
  28 import java.util.logging.*;
  29 import sun.awt.WindowIDProvider;
  30 import java.awt.dnd.*;
  31 import java.awt.datatransfer.*;
  32 
  33 public abstract class TestXEmbedServer {
  34     // vertical position of server AND client windows
  35     private static final int VERTICAL_POSITION = 200;
  36 
  37     private static final Logger log = Logger.getLogger("test.xembed");
  38     Frame f;
  39     Canvas client;
  40     Button toFocus;
  41     Button b_modal;
  42     JButton b_close;
  43     JDialog modal_d;
  44     JFrame dummy;
  45     Container clientCont;
  46     boolean passed;
  47 
  48     public boolean isPassed() {
  49         return passed;
  50     }
  51 
  52     public TestXEmbedServer(boolean manual) {
  53 
  54         // Enable testing extensions in XEmbed server
  55         System.setProperty("sun.awt.xembed.testing", "true");
  56 


 147             fail.addActionListener(new ActionListener() {
 148                     public void actionPerformed(ActionEvent e) {
 149                         passed = false;
 150                         synchronized(TestXEmbedServer.this) {
 151                             TestXEmbedServer.this.notifyAll();
 152                         }
 153                     }
 154                 });
 155             bcont.add(fail);
 156         }
 157         b_modal.setName("2");
 158         bcont.setLayout(new FlowLayout());
 159         f.add(bcont, BorderLayout.NORTH);
 160 
 161         clientCont = Box.createVerticalBox();
 162         f.add(clientCont, BorderLayout.CENTER);
 163 
 164         dummy = new JFrame("Dummy");
 165         dummy.getContentPane().add(new JButton("Button"));
 166         dummy.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
 167         dummy.setBounds(0, VERTICAL_POSITION, 100, 100);
 168         dummy.setVisible(true);
 169 
 170         f.setBounds(300, VERTICAL_POSITION, 800, 300);
 171         f.setVisible(true);
 172     }
 173 
 174     public abstract Process startClient(Rectangle bounds[], long window);
 175 
 176     public void addClient() {
 177         client = new Canvas() {
 178                 public void paint(Graphics g) {
 179                     super.paint(g);
 180                 }
 181             };
 182         client.setBackground(new Color(30, 220, 40));
 183         clientCont.add(client);
 184         clientCont.validate();
 185         WindowIDProvider pid = (WindowIDProvider)client.getPeer();
 186         log.fine("Added XEmbed server(Canvas) with X window ID " + pid.getWindow());
 187         Rectangle toFocusBounds = toFocus.getBounds();
 188         toFocusBounds.setLocation(toFocus.getLocationOnScreen());
 189         f.validate();
 190