Skip to content

Commit

Permalink
8253980: javax/swing/plaf/synth/7158712/bug7158712.java fails on windows
Browse files Browse the repository at this point in the history
Reviewed-by: mbaesken
Backport-of: bdd5782
  • Loading branch information
Amos Shi committed May 8, 2024
1 parent b9cb572 commit 6b225d5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
1 change: 0 additions & 1 deletion test/jdk/ProblemList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 14 additions & 6 deletions test/jdk/javax/swing/plaf/synth/7158712/bug7158712.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -59,15 +65,15 @@ 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();

laf.load(new ByteArrayInputStream(SYNTH_XML.getBytes("UTF8")), bug7158712.class);

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"});
Expand All @@ -83,6 +89,7 @@ public void run() {
});

robot.waitForIdle();
robot.delay(1000);

Point comboBoxLocation = Util.invokeOnEDT(new Callable<Point>() {
@Override
Expand All @@ -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();
Expand Down

1 comment on commit 6b225d5

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.