From 6b225d5a632496431550ebd31379660384fc2eaf Mon Sep 17 00:00:00 2001 From: Amos Shi Date: Wed, 8 May 2024 06:00:14 +0000 Subject: [PATCH] 8253980: javax/swing/plaf/synth/7158712/bug7158712.java fails on windows Reviewed-by: mbaesken Backport-of: bdd5782a67ac4b72a7dab5ea6eee3b38a864ffbf --- test/jdk/ProblemList.txt | 1 - .../swing/plaf/synth/7158712/bug7158712.java | 20 +++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 9d7fa261bb2..c5cb076dcbd 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -715,7 +715,6 @@ javax/swing/JTabbedPane/TabProb.java 8236635 linux-all javax/swing/text/GlyphPainter2/6427244/bug6427244.java 8208566 macosx-all javax/swing/JRootPane/4670486/bug4670486.java 8042381 macosx-all javax/swing/JButton/8151303/PressedIconTest.java 8266246 macosx-aarch64 -javax/swing/plaf/synth/7158712/bug7158712.java 8238720 windows-all javax/swing/plaf/basic/BasicComboPopup/JComboBoxPopupLocation/JComboBoxPopupLocation.java 8238720 windows-all javax/swing/plaf/basic/BasicComboPopup/7072653/bug7072653.java 8238720 windows-all java/awt/Robot/HiDPIScreenCapture/ScreenCaptureGtkTest.java 8282270 linux-all diff --git a/test/jdk/javax/swing/plaf/synth/7158712/bug7158712.java b/test/jdk/javax/swing/plaf/synth/7158712/bug7158712.java index 2ef8899bf40..845ab6ef8e2 100644 --- a/test/jdk/javax/swing/plaf/synth/7158712/bug7158712.java +++ b/test/jdk/javax/swing/plaf/synth/7158712/bug7158712.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012,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 @@ -27,13 +27,19 @@ * @bug 7158712 * @summary Synth Property "ComboBox.popupInsets" is ignored * @library ../../../regtesthelpers - * @author Pavel Porvatov + * @run main/othervm -Dsun.java2d.uiScale=1 bug7158712 */ -import javax.swing.*; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; import javax.swing.plaf.basic.BasicComboPopup; import javax.swing.plaf.synth.SynthLookAndFeel; -import java.awt.*; +import javax.swing.UIManager; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Robot; +import java.awt.Point; import java.awt.event.InputEvent; import java.io.ByteArrayInputStream; import java.util.concurrent.Callable; @@ -59,7 +65,7 @@ public class bug7158712 { public static void main(String[] args) throws Exception { Robot robot = new Robot(); - robot.setAutoDelay(500); + robot.setAutoDelay(100); SynthLookAndFeel laf = new SynthLookAndFeel(); @@ -67,7 +73,7 @@ public static void main(String[] args) throws Exception { UIManager.setLookAndFeel(laf); - EventQueue.invokeAndWait(new Runnable() { + SwingUtilities.invokeAndWait(new Runnable() { public void run() { comboBox = new JComboBox<>( new String[]{"Very Looooooooooooooooooooong Text Item 1", "Item 2"}); @@ -83,6 +89,7 @@ public void run() { }); robot.waitForIdle(); + robot.delay(1000); Point comboBoxLocation = Util.invokeOnEDT(new Callable() { @Override @@ -99,6 +106,7 @@ public Point call() throws Exception { @Override public void run() { BasicComboPopup popup = (BasicComboPopup) comboBox.getAccessibleContext().getAccessibleChild(0); + popup.show(); Point popupPoint = popup.getLocationOnScreen(); Point comboBoxPoint = comboBox.getLocationOnScreen();