Skip to content
Permalink
Browse files
8241791: [TESTBUG] Test failing with exception "java.lang.Unsupported…
…OperationException"

Reviewed-by: serb
  • Loading branch information
Pankaj Bansal committed Mar 30, 2020
1 parent cf22b4e commit 1ef1131ab1ccba22300c055843513e1231c48785
Showing 1 changed file with 10 additions and 14 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
/**
* @test
* @key headful
* @bug 8150176 8151773 8150176
* @bug 8150176 8151773 8150176 8241791
* @summary Check if correct resolution variant is used for tray icon.
* @run main/manual/othervm -Dsun.java2d.uiScale=2 MultiResolutionTrayIconTest
*/
@@ -73,7 +73,11 @@ public static void createUI() throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
mainFrame = new JFrame("TrayIcon Test");
boolean trayIsSupported = SystemTray.isSupported();
if (!SystemTray.isSupported()) {
System.out.println("system tray is not supported");
latch.countDown();
return;
}
tray = SystemTray.getSystemTray();
Dimension d = tray.getTrayIconSize();
icon = new TrayIcon(createIcon(d.width, d.height));
@@ -98,16 +102,9 @@ public void run() {
mainControlPanel.add(instructionText, gbc);
startButton = new JButton("Start");
startButton.setActionCommand("Start");
if (trayIsSupported) {

startButton.addActionListener((ActionEvent e) -> {
doTest();
});
} else {
startButton.setEnabled(false);
System.out.println("system tray is not supported");
latch.countDown();
}
startButton.addActionListener((ActionEvent e) -> {
doTest();
});
gbc.gridx = 0;
gbc.gridy = 0;
resultButtonPanel.add(startButton, gbc);
@@ -195,4 +192,3 @@ private static void removeIcon() {
}
}
}

0 comments on commit 1ef1131

Please sign in to comment.