< prev index next >

test/jdk/java/awt/TrayIcon/DisposeInActionEventTest/DisposeInActionEventTest.java

Print this page
rev 51542 : 8210039: move OSInfo to top level testlibrary
Reviewed-by: duke


  21  * questions.
  22  */
  23 
  24 
  25 /*
  26   test
  27   @bug 6299866
  28   @summary Tests that no NPE is thrown when the tray icon is disposed from the
  29   handler of action event caused by clicking on this icon.
  30   @library ../../regtesthelpers
  31   @build Sysout
  32   @author artem.ananiev: area=awt.tray
  33   @run applet/manual=yesno DisposeInActionEventTest.html
  34 */
  35 
  36 import java.applet.*;
  37 
  38 import java.awt.*;
  39 import java.awt.image.*;
  40 
  41 import jdk.testlibrary.OSInfo;
  42 import test.java.awt.regtesthelpers.Sysout;
  43 
  44 public class DisposeInActionEventTest extends Applet {
  45     private boolean traySupported;
  46 
  47     private SystemTray systemTray;
  48     private TrayIcon trayIcon;
  49 
  50     public void init() {
  51         this.setLayout(new BorderLayout());
  52 
  53         String[] instructions;
  54         traySupported = SystemTray.isSupported();
  55         if (!traySupported) {
  56             instructions = new String[]{
  57                     "The test cannot be run because SystemTray is not supported.",
  58                     "Simply press PASS button."
  59             };
  60         } else {
  61             String clickInstruction;
  62             if (OSInfo.getOSType().equals(OSInfo.OSType.MACOSX)) {
  63                 clickInstruction = "right";
  64             } else {
  65                 clickInstruction = "left";
  66             }
  67             instructions = new String[]{
  68                     "When the test starts, it adds the icon to the tray aread. If you",
  69                     "  don't see a tray icon, please, make sure that the tray area",
  70                     "  (also called Taskbar Status Area on MS Windows, Notification",
  71                     "  Area on Gnome or System Tray on KDE) is visible.",
  72                     "Double-click with " + clickInstruction + " button on the tray icon to trigger the",
  73                     "  action event. Brief information about action events is printed",
  74                     "  below. After each action event the tray icon is removed from",
  75                     "  the tray and then added back in a second.",
  76                     "The test performs some automatic checks when removing the icon. If",
  77                     "  something is wrong the corresponding message is displayed below.",
  78                     "  Repeat double-clicks several times. If no 'Test FAILED' messages",
  79                     "  are printed, press PASS button else FAIL button."
  80             };
  81         }
  82         Sysout.createDialogWithInstructions(instructions);




  21  * questions.
  22  */
  23 
  24 
  25 /*
  26   test
  27   @bug 6299866
  28   @summary Tests that no NPE is thrown when the tray icon is disposed from the
  29   handler of action event caused by clicking on this icon.
  30   @library ../../regtesthelpers
  31   @build Sysout
  32   @author artem.ananiev: area=awt.tray
  33   @run applet/manual=yesno DisposeInActionEventTest.html
  34 */
  35 
  36 import java.applet.*;
  37 
  38 import java.awt.*;
  39 import java.awt.image.*;
  40 
  41 import jdk.test.lib.Platform;
  42 import test.java.awt.regtesthelpers.Sysout;
  43 
  44 public class DisposeInActionEventTest extends Applet {
  45     private boolean traySupported;
  46 
  47     private SystemTray systemTray;
  48     private TrayIcon trayIcon;
  49 
  50     public void init() {
  51         this.setLayout(new BorderLayout());
  52 
  53         String[] instructions;
  54         traySupported = SystemTray.isSupported();
  55         if (!traySupported) {
  56             instructions = new String[]{
  57                     "The test cannot be run because SystemTray is not supported.",
  58                     "Simply press PASS button."
  59             };
  60         } else {
  61             String clickInstruction;
  62             if (Platform.isOSX()) {
  63                 clickInstruction = "right";
  64             } else {
  65                 clickInstruction = "left";
  66             }
  67             instructions = new String[]{
  68                     "When the test starts, it adds the icon to the tray aread. If you",
  69                     "  don't see a tray icon, please, make sure that the tray area",
  70                     "  (also called Taskbar Status Area on MS Windows, Notification",
  71                     "  Area on Gnome or System Tray on KDE) is visible.",
  72                     "Double-click with " + clickInstruction + " button on the tray icon to trigger the",
  73                     "  action event. Brief information about action events is printed",
  74                     "  below. After each action event the tray icon is removed from",
  75                     "  the tray and then added back in a second.",
  76                     "The test performs some automatic checks when removing the icon. If",
  77                     "  something is wrong the corresponding message is displayed below.",
  78                     "  Repeat double-clicks several times. If no 'Test FAILED' messages",
  79                     "  are printed, press PASS button else FAIL button."
  80             };
  81         }
  82         Sysout.createDialogWithInstructions(instructions);


< prev index next >