Skip to content
Permalink
Browse files
8250804: Can't set the application icon image for Unity WM on Linux.
Reviewed-by: serb, pbansal, kizune
  • Loading branch information
Alexander Zvegintsev committed Mar 6, 2021
1 parent fa43f92 commit 2afbd5dafc8b7ad72a69d6b33c49ea9eb5ddfd69
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
@@ -852,7 +852,6 @@ java/awt/dnd/DnDFileGroupDescriptor/DnDFileGroupDescriptor.html 8080185 macosx-a
javax/swing/JTabbedPane/4666224/bug4666224.html 8144124 macosx-all
java/awt/event/MouseEvent/AltGraphModifierTest/AltGraphModifierTest.java 8162380 generic-all
java/awt/Window/TranslucentJAppletTest/TranslucentJAppletTest.java 8163086 macosx-all
java/awt/image/multiresolution/MultiResolutionIcon/IconTest.java 8250804 macosx-all,linux-all
java/awt/image/VolatileImage/VolatileImageConfigurationTest.java 8171069 macosx-all,linux-all
java/awt/Modal/InvisibleParentTest/InvisibleParentTest.java 8172245 linux-all
java/awt/print/Dialog/RestoreActiveWindowTest/RestoreActiveWindowTest.java 8185429 macosx-all
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 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
@@ -21,19 +21,19 @@
* questions.
*/

/**
/*
* @test
* @bug 8147648 8163160
* @summary [hidpi] multiresolution image: wrong resolution variant is used as
* icon in the Unity panel
* @requires os.family == "linux"
* @run main/manual/othervm -Dsun.java2d.uiScale=2 IconTest
*/
import java.awt.Color;
import java.awt.Graphics;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BaseMultiResolutionImage;
@@ -59,6 +59,8 @@ public class IconTest {
private static JFrame f;
private static CountDownLatch latch;

private static volatile boolean failed;

private static BufferedImage generateImage(int scale, Color c) {
int x = SZ * scale;
BufferedImage img = new BufferedImage(x, x, BufferedImage.TYPE_INT_RGB);
@@ -91,8 +93,10 @@ public void run() {
GridBagConstraints gbc = new GridBagConstraints();
String instructions
= "<html>INSTRUCTIONS:<br>"
+ "Check if test button icon and unity icon are both "
+ "blue with green border.<br><br>"
+ "Check if test button icon and unity icon<br>"
+ "(icon in a side dock, if present)<br>"
+ "are both blue with green border.<br><br>"
+ "NB: Icon in the top bar may be presented in grayscale.<br><br>"
+ "If Icon color is blue press pass"
+ " else press fail.<br><br></html>";

@@ -120,13 +124,10 @@ public void run() {
});
failButton = new JButton("Fail");
failButton.setActionCommand("Fail");
failButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
latch.countDown();
f.dispose();
throw new RuntimeException("Test Failed");
}
failButton.addActionListener(e -> {
failed = true;
latch.countDown();
f.dispose();
});
gbc.gridx = 1;
gbc.gridy = 0;
@@ -159,6 +160,10 @@ public static void main(String[] args) throws Exception {
latch = new CountDownLatch(1);
createUI();
latch.await();

if (failed) {
throw new RuntimeException("Test Failed");
}
}
}

0 comments on commit 2afbd5d

Please sign in to comment.