# HG changeset patch # User arusakov # Date 1476456560 -10800 # Fri Oct 14 17:49:20 2016 +0300 # Node ID 4bea3b4e8c642d1e6c358c4769a6d6f75b092c25 # Parent 138876450c3a258bed85f3c9c4834f9676aab0fc 8167159: [PIT][TEST_BUG] java/awt/image/multiresolution/MultiResolutionIcon/MultiResIconTest.java diff --git a/test/java/awt/image/multiresolution/MultiResolutionIcon/MultiResIconTest.java b/test/java/awt/image/multiresolution/MultiResolutionIcon/MultiResIconTest.java --- a/test/java/awt/image/multiresolution/MultiResolutionIcon/MultiResIconTest.java +++ b/test/java/awt/image/multiresolution/MultiResolutionIcon/MultiResIconTest.java @@ -25,11 +25,13 @@ * @test * @key headful * @bug 8149371 + * @requires (os.family == "linux" | os.family == "mac") * @summary multi-res. image: -Dsun.java2d.uiScale does not work for Window * icons (some ambiguity for Window.setIconImages()?) * @run main/othervm/manual -Dsun.java2d.uiScale=2 MultiResIconTest */ import java.awt.Color; +import java.awt.EventQueue; import java.awt.Graphics; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -58,7 +60,8 @@ private static JDialog f; private static CountDownLatch latch; private static TestFrame frame; - + private static boolean testPassed = true; + private static BufferedImage generateImage(int x, Color c) { BufferedImage img = new BufferedImage(x, x, BufferedImage.TYPE_INT_RGB); @@ -70,15 +73,6 @@ return img; } - public MultiResIconTest() { - try { - latch = new CountDownLatch(1); - createUI(); - latch.await(); - } catch (Exception ex) { - } - } - private static void createUI() throws Exception { SwingUtilities.invokeAndWait(() -> { frame = new TestFrame(); @@ -115,10 +109,10 @@ failButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { + testPassed = false; latch.countDown(); f.dispose(); frame.dispose(); - throw new RuntimeException("Test Failed"); } }); gbc.gridx = 1; @@ -191,8 +185,12 @@ } } - public static void main(String[] args) { - new MultiResIconTest(); + public static void main(String[] args) throws Exception { + latch = new CountDownLatch(1); + new MultiResIconTest().createUI(); + latch.await(); + if (!testPassed) { + throw new RuntimeException("Test Failed"); + } } } -