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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * 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. tests fail starting after failing mixing tests but always pass alone.
*/ */
Util.waitForIdle(robot); 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); robot.mouseMove(ancestorLoc.x, ancestorLoc.y);
Util.waitForIdle(robot); Util.waitForIdle(robot);
robot.mousePress(InputEvent.BUTTON1_MASK); 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -85,7 +85,7 @@ public class HierarchyBoundsListenerMixingTest {
components[i].addHierarchyBoundsListener(listener); components[i].addHierarchyBoundsListener(listener);
frame.add(components[i]); frame.add(components[i]);
} }
frame.setSize(300, 300); frame.setBounds(100, 100, 300, 300);
frame.setVisible(true); frame.setVisible(true);
} }
@ -391,8 +391,8 @@ public class HierarchyBoundsListenerMixingTest {
private int resizeCount = 0; private int resizeCount = 0;
private boolean passed = true; private boolean passed = true;
private boolean moveTriggered = false; private volatile boolean moveTriggered = false;
private boolean resizeTriggered = false; private volatile boolean resizeTriggered = false;
private final Object moveLock = new Object(); private final Object moveLock = new Object();
private final Object resizeLock = 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -21,7 +21,6 @@
* questions. * questions.
*/ */
import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Point; import java.awt.Point;
import java.awt.Robot; import java.awt.Robot;
@ -30,6 +29,7 @@ import java.awt.event.ActionListener;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
import javax.swing.JComboBox; import javax.swing.JComboBox;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import test.java.awt.regtesthelpers.Util; import test.java.awt.regtesthelpers.Util;
@ -55,16 +55,18 @@ public class JComboBoxOverlapping extends OverlappingTestBase {
private boolean lwClicked = false; private boolean lwClicked = false;
private Point loc; private Point loc;
private Point loc2; private Point loc2;
private JComboBox cb;
private JFrame frame;
{testEmbeddedFrame = true;} {testEmbeddedFrame = true;}
protected void prepareControls() { 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.getContentPane().setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.Y_AXIS));
frame.setSize(200, 200); frame.setSize(200, 200);
frame.setVisible(true); frame.setVisible(true);
final JComboBox cb = new JComboBox(petStrings); cb = new JComboBox(petStrings);
cb.setPreferredSize(new Dimension(frame.getContentPane().getWidth(), 20)); cb.setPreferredSize(new Dimension(frame.getContentPane().getWidth(), 20));
cb.addActionListener(new ActionListener() { cb.addActionListener(new ActionListener() {
@ -78,8 +80,6 @@ public class JComboBoxOverlapping extends OverlappingTestBase {
frame.add(cb); frame.add(cb);
propagateAWTControls(frame); propagateAWTControls(frame);
frame.setVisible(true); frame.setVisible(true);
loc = cb.getLocationOnScreen();
loc2 = frame.getContentPane().getLocationOnScreen();
} }
@Override @Override
@ -87,6 +87,16 @@ public class JComboBoxOverlapping extends OverlappingTestBase {
// run robot // run robot
Robot robot = Util.createRobot(); Robot robot = Util.createRobot();
robot.setAutoDelay(ROBOT_DELAY); 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); loc2.translate(75, 75);
pixelPreCheck(robot, loc2, currentAwtControl); 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * 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()); JFrame ancestor = (JFrame)(testedComponent.getTopLevelAncestor());
if( ancestor != null ) { if( ancestor != null ) {
Point ancestorLoc = ancestor.getLocationOnScreen(); 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); robot.mouseMove(ancestorLoc.x, ancestorLoc.y);
Util.waitForIdle(robot); Util.waitForIdle(robot);
robot.mousePress(InputEvent.BUTTON1_MASK); robot.mousePress(InputEvent.BUTTON1_MASK);
@ -157,5 +158,11 @@ public abstract class SimpleOverlappingTestBase extends OverlappingTestBase {
return wasLWClicked; return wasLWClicked;
} }
public boolean isOel7() {
return System.getProperty("os.name").toLowerCase()
.contains("linux") && System.getProperty("os.version")
.toLowerCase().contains("el7");
}
} }