8137101: [TEST_BUG] javax/swing/plaf/basic/BasicHTML/4251579/bug4251579.java failure due to timing
Reviewed-by: azvegint
This commit is contained in:
parent
a066c7bed0
commit
dcdb1b6aaa
@ -745,8 +745,6 @@ javax/swing/JEditorPane/6917744/bug6917744.java 8213124 macosx-all
|
||||
javax/swing/JRootPane/4670486/bug4670486.java 8042381 macosx-all
|
||||
javax/swing/JPopupMenu/4634626/bug4634626.java 8017175 macosx-all
|
||||
|
||||
javax/swing/plaf/basic/BasicHTML/4251579/bug4251579.java 8137101 linux-x64
|
||||
|
||||
sanity/client/SwingSet/src/ToolTipDemoTest.java 8225012 windows-all,macosx-all
|
||||
sanity/client/SwingSet/src/ScrollPaneDemoTest.java 8225013 linux-all
|
||||
sanity/client/SwingSet/src/ButtonDemoScreenshotTest.java 8265770 macosx-all
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 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
|
||||
@ -27,54 +27,68 @@
|
||||
* @key headful
|
||||
* @bug 4251579
|
||||
* @summary Tests if style sheets are working in JLabel
|
||||
* @author Denis Sharypov
|
||||
* @run main bug4251579
|
||||
*/
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Point;
|
||||
import java.awt.Robot;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.JLabel;
|
||||
|
||||
public class bug4251579 {
|
||||
|
||||
private static JLabel htmlComponent;
|
||||
private static JFrame mainFrame;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
final Robot robot = new Robot();
|
||||
robot.setAutoDelay(50);
|
||||
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
try {
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
createAndShowGUI();
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void run() {
|
||||
createAndShowGUI();
|
||||
}
|
||||
});
|
||||
|
||||
robot.waitForIdle();
|
||||
robot.waitForIdle();
|
||||
robot.delay(1000);
|
||||
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
boolean passed = false;
|
||||
@Override
|
||||
public void run() {
|
||||
boolean passed = false;
|
||||
|
||||
Point p = htmlComponent.getLocationOnScreen();
|
||||
Dimension d = htmlComponent.getSize();
|
||||
int x0 = p.x;
|
||||
int y = p.y + d.height / 2;
|
||||
Point p = htmlComponent.getLocationOnScreen();
|
||||
Dimension d = htmlComponent.getSize();
|
||||
int x0 = p.x;
|
||||
int y = p.y + d.height / 2;
|
||||
|
||||
for (int x = x0; x < x0 + d.width; x++) {
|
||||
if (robot.getPixelColor(x, y).equals(Color.blue)) {
|
||||
passed = true;
|
||||
break;
|
||||
for (int x = x0; x < x0 + d.width; x++) {
|
||||
if (robot.getPixelColor(x, y).equals(Color.blue)) {
|
||||
passed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!passed) {
|
||||
throw new RuntimeException("Test failed.");
|
||||
}
|
||||
if (!passed) {
|
||||
throw new RuntimeException("Test failed.");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} finally {
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
if (mainFrame != null) {
|
||||
mainFrame.dispose();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static void createAndShowGUI() {
|
||||
@ -86,12 +100,13 @@ public class bug4251579 {
|
||||
+ "<P class=\"blue\"> should be rendered with BLUE class definition</P>"
|
||||
+ "</body>";
|
||||
|
||||
JFrame mainFrame = new JFrame("bug4251579");
|
||||
mainFrame = new JFrame("bug4251579");
|
||||
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
htmlComponent = new JLabel(htmlText);
|
||||
mainFrame.getContentPane().add(htmlComponent);
|
||||
|
||||
mainFrame.setLocationRelativeTo(null);
|
||||
mainFrame.pack();
|
||||
mainFrame.setVisible(true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user