< prev index next >
test/java/awt/image/multiresolution/MultiResolutionIcon/MultiResIconTest.java
Print this page
rev 15820 : 8167159: [PIT][TEST_BUG] java/awt/image/multiresolution/MultiResolutionIcon/MultiResIconTest.java
*** 23,37 ****
--- 23,39 ----
/**
* @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;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
*** 56,65 ****
--- 58,68 ----
private static JButton passButton;
private static JButton failButton;
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);
Graphics g = img.getGraphics();
*** 68,86 ****
g.setColor(Color.WHITE);
g.fillRect(x / 3, x / 3, x / 3, x / 3);
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();
f = new JDialog(frame);
f.setTitle("Instruction Dialog");
--- 71,80 ----
*** 113,126 ****
failButton = new JButton("Fail");
failButton.setActionCommand("Fail");
failButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
latch.countDown();
f.dispose();
frame.dispose();
- throw new RuntimeException("Test Failed");
}
});
gbc.gridx = 1;
gbc.gridy = 0;
resultButtonPanel.add(passButton, gbc);
--- 107,120 ----
failButton = new JButton("Fail");
failButton.setActionCommand("Fail");
failButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
+ testPassed = false;
latch.countDown();
f.dispose();
frame.dispose();
}
});
gbc.gridx = 1;
gbc.gridy = 0;
resultButtonPanel.add(passButton, gbc);
*** 189,198 ****
public void paint(Graphics gr) {
gr.drawImage(IMG, 0, 0, this);
}
}
! public static void main(String[] args) {
! new MultiResIconTest();
}
}
-
--- 183,196 ----
public void paint(Graphics gr) {
gr.drawImage(IMG, 0, 0, this);
}
}
! public static void main(String[] args) throws Exception {
! latch = new CountDownLatch(1);
! new MultiResIconTest().createUI();
! latch.await();
! if (!testPassed) {
! throw new RuntimeException("Test Failed");
! }
}
}
< prev index next >