8081454: [TESTBUG]Some java/awt/Mixing tests fail in OEL 7 only

Reviewed-by: yan
This commit is contained in:
Semyon Sadetsky 2017-04-20 08:38:15 -07:00
parent 24f0d7ebfd
commit 74a79f79a1
4 changed files with 31 additions and 14 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2017 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
@ -128,7 +128,7 @@ public abstract class GlassPaneOverlappingTestBase extends SimpleOverlappingTest
tests fail starting after failing mixing tests but always pass alone.
*/
Util.waitForIdle(robot);
ancestorLoc.translate(f.getWidth()/2-15, 2);
ancestorLoc.translate(isOel7() ? 5 : f.getWidth() / 2 - 15, 2);
robot.mouseMove(ancestorLoc.x, ancestorLoc.y);
Util.waitForIdle(robot);
robot.mousePress(InputEvent.BUTTON1_MASK);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2017, 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
@ -85,7 +85,7 @@ public class HierarchyBoundsListenerMixingTest {
components[i].addHierarchyBoundsListener(listener);
frame.add(components[i]);
}
frame.setSize(300, 300);
frame.setBounds(100, 100, 300, 300);
frame.setVisible(true);
}
@ -391,8 +391,8 @@ public class HierarchyBoundsListenerMixingTest {
private int resizeCount = 0;
private boolean passed = true;
private boolean moveTriggered = false;
private boolean resizeTriggered = false;
private volatile boolean moveTriggered = false;
private volatile boolean resizeTriggered = false;
private final Object moveLock = new Object();
private final Object resizeLock = new Object();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2017, 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,7 +21,6 @@
* questions.
*/
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Robot;
@ -30,6 +29,7 @@ import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import test.java.awt.regtesthelpers.Util;
@ -55,16 +55,18 @@ public class JComboBoxOverlapping extends OverlappingTestBase {
private boolean lwClicked = false;
private Point loc;
private Point loc2;
private JComboBox cb;
private JFrame frame;
{testEmbeddedFrame = true;}
protected void prepareControls() {
final JFrame frame = new JFrame("Mixing : Dropdown Overlapping test");
frame = new JFrame("Mixing : Dropdown Overlapping test");
frame.getContentPane().setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.Y_AXIS));
frame.setSize(200, 200);
frame.setVisible(true);
final JComboBox cb = new JComboBox(petStrings);
cb = new JComboBox(petStrings);
cb.setPreferredSize(new Dimension(frame.getContentPane().getWidth(), 20));
cb.addActionListener(new ActionListener() {
@ -78,8 +80,6 @@ public class JComboBoxOverlapping extends OverlappingTestBase {
frame.add(cb);
propagateAWTControls(frame);
frame.setVisible(true);
loc = cb.getLocationOnScreen();
loc2 = frame.getContentPane().getLocationOnScreen();
}
@Override
@ -87,6 +87,16 @@ public class JComboBoxOverlapping extends OverlappingTestBase {
// run robot
Robot robot = Util.createRobot();
robot.setAutoDelay(ROBOT_DELAY);
robot.waitForIdle();
robot.delay(200);
try {
SwingUtilities.invokeAndWait(() -> {
loc = cb.getLocationOnScreen();
loc2 = frame.getContentPane().getLocationOnScreen();
});
} catch (Exception e) {
throw new RuntimeException(e);
}
loc2.translate(75, 75);
pixelPreCheck(robot, loc2, currentAwtControl);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2017 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
@ -142,7 +142,8 @@ public abstract class SimpleOverlappingTestBase extends OverlappingTestBase {
JFrame ancestor = (JFrame)(testedComponent.getTopLevelAncestor());
if( ancestor != null ) {
Point ancestorLoc = ancestor.getLocationOnScreen();
ancestorLoc.translate(ancestor.getWidth()/2-15, 2);
ancestorLoc.translate(isOel7() ? 5 :
ancestor.getWidth() / 2 - 15, 2);
robot.mouseMove(ancestorLoc.x, ancestorLoc.y);
Util.waitForIdle(robot);
robot.mousePress(InputEvent.BUTTON1_MASK);
@ -157,5 +158,11 @@ public abstract class SimpleOverlappingTestBase extends OverlappingTestBase {
return wasLWClicked;
}
public boolean isOel7() {
return System.getProperty("os.name").toLowerCase()
.contains("linux") && System.getProperty("os.version")
.toLowerCase().contains("el7");
}
}