--- old/test/java/awt/image/multiresolution/MultiResolutionTrayIconTest/MultiResolutionTrayIconTest.html 2016-02-29 15:07:20.802777792 +0300 +++ new/test/java/awt/image/multiresolution/MultiResolutionTrayIconTest/MultiResolutionTrayIconTest.html 2016-02-29 15:07:20.662777799 +0300 @@ -26,16 +26,20 @@ MultiResolutionTrayIconTest - + -To run test please push "Start" (if system tray is not supported, push "Pass"). -Two tray icons will appear (note: sometimes they can go to the tray icons pool). +The test checks if a correct resolution variant is used for the tray icon +when a multi-resolution image is used for its creation. -Please check if both of them have correct size and -the same colouring (white rectagle in a blue mount). In this case please push "Pass". +Please use "show icons" / "hide icons" button to show / hide the tray icons. -Otherwise (if the 2nd red-white small icon appears) please push "Fail". +The expected behavior: +- when "auto size" is selected, two equal white-blue icons must appear + (having the same size and colouring) +- when "auto size" is deselected, the 2nd icon must be a small white-red one. + +If the test behaves as expected, then please push "Pass"; otherwise "Fail". --- old/test/java/awt/image/multiresolution/MultiResolutionTrayIconTest/MultiResolutionTrayIconTest.java 2016-02-29 15:07:21.222777774 +0300 +++ new/test/java/awt/image/multiresolution/MultiResolutionTrayIconTest/MultiResolutionTrayIconTest.java 2016-02-29 15:07:21.082777780 +0300 @@ -26,6 +26,7 @@ @test @bug 8150176 @ignore 8150176 + @summary Check if correct resolution variant is used for tray icon. @author a.stepanov @run applet/manual=yesno MultiResolutionTrayIconTest.html @@ -40,28 +41,35 @@ public class MultiResolutionTrayIconTest extends Applet { - private SystemTray tray; - private TrayIcon icon, iconMRI; + private volatile SystemTray tray; + private volatile TrayIcon icon, iconMRI; + private Button b; - public void init() { this.setLayout(new BorderLayout()); } + public void init() { this.setLayout(new GridLayout(1, 2)); } public void start() { boolean trayIsSupported = SystemTray.isSupported(); - Button b = new Button("Start"); + tray = SystemTray.getSystemTray(); + b = new Button("show icons"); + Checkbox auto = new Checkbox("auto size", true); if (trayIsSupported) { prepareIcons(); + b.addActionListener(new ActionListener() { @Override - public void actionPerformed(ActionEvent e) { doTest(); } + public void actionPerformed(ActionEvent e) { + doTest(auto.getState()); + } }); } else { b.setLabel("not supported"); b.setEnabled(false); System.out.println("system tray is not supported"); } - add(b, BorderLayout.CENTER); + add(auto); + add(b); validate(); setVisible(true); @@ -81,7 +89,6 @@ private void prepareIcons() { - tray = SystemTray.getSystemTray(); Dimension d = tray.getTrayIconSize(); int w = d.width, h = d.height; @@ -94,23 +101,35 @@ iconMRI = new TrayIcon(mri); } - private void doTest() { - - if (tray.getTrayIcons().length > 0) { return; } // icons were added already + private void showIcons() { try { tray.add(icon); tray.add(iconMRI); + b.setLabel("hide icons"); } catch (Exception e) { throw new RuntimeException(e); } } - public void stop() { + private void removeIcons() { // check for null, just in case if (tray != null) { tray.remove(icon); tray.remove(iconMRI); + b.setLabel("show icons"); } } + + private void doTest(boolean autoSize) { + + if (tray.getTrayIcons().length > 0) { // icons were added already + removeIcons(); + } else { + iconMRI.setImageAutoSize(autoSize); + showIcons(); + } + } + + public void stop() { removeIcons(); } }