mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8158801: [TEST_BUG] Mixing tests fail because of focus workaround trick
Reviewed-by: aivanov, prr, psadhukhan
This commit is contained in:
parent
1e357e9e97
commit
d02abfe765
@ -152,7 +152,6 @@ java/awt/event/InputEvent/EventWhenTest/EventWhenTest.java 8168646 generic-all
|
||||
java/awt/List/KeyEventsTest/KeyEventsTest.java 8201307 linux-all
|
||||
java/awt/List/NoEvents/ProgrammaticChange.java 8201307 linux-all
|
||||
java/awt/Paint/ListRepaint.java 8201307 linux-all
|
||||
java/awt/Mixing/AWT_Mixing/HierarchyBoundsListenerMixingTest.java 8049405 macosx-all
|
||||
java/awt/Mixing/AWT_Mixing/OpaqueOverlapping.java 8370584 windows-x64
|
||||
java/awt/Mixing/AWT_Mixing/OpaqueOverlappingChoice.java 8048171 generic-all
|
||||
java/awt/Mixing/AWT_Mixing/JMenuBarOverlapping.java 8159451 linux-all,windows-all,macosx-all
|
||||
@ -161,33 +160,7 @@ java/awt/Mixing/AWT_Mixing/JInternalFrameMoveOverlapping.java 6986109 windows-al
|
||||
java/awt/Mixing/AWT_Mixing/MixingPanelsResizing.java 8049405 generic-all
|
||||
java/awt/Mixing/AWT_Mixing/JComboBoxOverlapping.java 8049405 macosx-all
|
||||
java/awt/Mixing/AWT_Mixing/JPopupMenuOverlapping.java 8049405 macosx-all
|
||||
java/awt/Mixing/AWT_Mixing/JButtonInGlassPaneOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JButtonOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JColorChooserOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JEditorPaneInGlassPaneOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JEditorPaneOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JLabelInGlassPaneOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JLabelOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JListInGlassPaneOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JListOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JPanelInGlassPaneOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JPanelOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JProgressBarInGlassPaneOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JProgressBarOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JScrollBarInGlassPaneOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JScrollBarOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JSliderInGlassPaneOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JSliderOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JSpinnerInGlassPaneOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JSpinnerOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JTableInGlassPaneOverlapping.java 8158801,8357360 windows-all,linux-all
|
||||
java/awt/Mixing/AWT_Mixing/JTableOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JTextAreaInGlassPaneOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JTextAreaOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JTextFieldInGlassPaneOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JTextFieldOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JToggleButtonInGlassPaneOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JToggleButtonOverlapping.java 8158801 windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JTableInGlassPaneOverlapping.java 8357360 windows-all,linux-all
|
||||
java/awt/Mixing/NonOpaqueInternalFrame.java 7124549 macosx-all
|
||||
java/awt/Focus/ActualFocusedWindowTest/ActualFocusedWindowRetaining.java 6829264 generic-all
|
||||
java/awt/datatransfer/DragImage/MultiResolutionDragImageTest.java 8080982 generic-all
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2025, 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
|
||||
@ -25,12 +25,11 @@ import java.awt.Container;
|
||||
import java.awt.Point;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.SpringLayout;
|
||||
import javax.swing.SwingUtilities;
|
||||
import test.java.awt.regtesthelpers.Util;
|
||||
|
||||
/**
|
||||
* Base class for testing overlapping of Swing and AWT component put into GlassPane.
|
||||
@ -46,7 +45,6 @@ public abstract class GlassPaneOverlappingTestBase extends SimpleOverlappingTest
|
||||
*/
|
||||
protected boolean testResize = true;
|
||||
private JFrame f = null;
|
||||
private volatile Point ancestorLoc;
|
||||
|
||||
/**
|
||||
* Setups GlassPane with lightweight component returned by {@link SimpleOverlappingTestBase#getSwingComponent() }
|
||||
@ -83,6 +81,7 @@ public abstract class GlassPaneOverlappingTestBase extends SimpleOverlappingTest
|
||||
testedComponent.setBounds(0, 0, testedComponent.getPreferredSize().width, testedComponent.getPreferredSize().height);
|
||||
glassPane.add(testedComponent);
|
||||
|
||||
f.setLocationRelativeTo(null);
|
||||
f.setVisible(true);
|
||||
}
|
||||
|
||||
@ -94,6 +93,11 @@ public abstract class GlassPaneOverlappingTestBase extends SimpleOverlappingTest
|
||||
super(defaultClickValidation);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final boolean isMultiFramesTest() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run test by {@link OverlappingTestBase#clickAndBlink(java.awt.Robot, java.awt.Point) } validation for current lightweight component.
|
||||
* <p>Also resize component and repeat validation in the resized area.
|
||||
@ -106,40 +110,33 @@ public abstract class GlassPaneOverlappingTestBase extends SimpleOverlappingTest
|
||||
if (!super.performTest()) {
|
||||
return false;
|
||||
}
|
||||
if (testResize) {
|
||||
wasLWClicked = false;
|
||||
try {
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
testedComponent.setBounds(0, 0, testedComponent.getPreferredSize().width, testedComponent.getPreferredSize().height + 20);
|
||||
ancestorLoc = f.getLocationOnScreen();
|
||||
}
|
||||
});
|
||||
} catch (InterruptedException ex) {
|
||||
fail(ex.getMessage());
|
||||
} catch (InvocationTargetException ex) {
|
||||
fail(ex.getMessage());
|
||||
}
|
||||
Point lLoc = testedComponent.getLocationOnScreen();
|
||||
lLoc.translate(1, testedComponent.getPreferredSize().height + 1);
|
||||
|
||||
/* this is a workaround for certain jtreg(?) focus issue:
|
||||
tests fail starting after failing mixing tests but always pass alone.
|
||||
*/
|
||||
Util.waitForIdle(robot);
|
||||
ancestorLoc.translate(isOel7orLater() ? 5 : f.getWidth() / 2 - 15, 2);
|
||||
robot.mouseMove(ancestorLoc.x, ancestorLoc.y);
|
||||
Util.waitForIdle(robot);
|
||||
robot.mousePress(InputEvent.BUTTON1_MASK);
|
||||
robot.delay(50);
|
||||
robot.mouseRelease(InputEvent.BUTTON1_MASK);
|
||||
Util.waitForIdle(robot);
|
||||
|
||||
clickAndBlink(robot, lLoc);
|
||||
return wasLWClicked;
|
||||
} else {
|
||||
if (!testResize) {
|
||||
return true;
|
||||
}
|
||||
|
||||
wasLWClicked = false;
|
||||
try {
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
testedComponent.setBounds(0, 0,
|
||||
testedComponent.getPreferredSize().width,
|
||||
testedComponent.getPreferredSize().height + 20);
|
||||
}
|
||||
});
|
||||
} catch (InterruptedException | InvocationTargetException ex) {
|
||||
fail(ex.getMessage());
|
||||
}
|
||||
Point lLoc = testedComponent.getLocationOnScreen();
|
||||
lLoc.translate(1, testedComponent.getPreferredSize().height + 1);
|
||||
clickAndBlink(robot, lLoc);
|
||||
|
||||
return wasLWClicked;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void cleanup() {
|
||||
f.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2025, 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
|
||||
@ -64,7 +64,6 @@ public class JComboBoxOverlapping extends OverlappingTestBase {
|
||||
frame = new JFrame("Mixing : Dropdown Overlapping test");
|
||||
frame.getContentPane().setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.Y_AXIS));
|
||||
frame.setSize(200, 200);
|
||||
frame.setVisible(true);
|
||||
|
||||
cb = new JComboBox(petStrings);
|
||||
cb.setPreferredSize(new Dimension(frame.getContentPane().getWidth(), 20));
|
||||
@ -79,6 +78,7 @@ public class JComboBoxOverlapping extends OverlappingTestBase {
|
||||
|
||||
frame.add(cb);
|
||||
propagateAWTControls(frame);
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2025, 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
|
||||
@ -34,7 +34,6 @@ import test.java.awt.regtesthelpers.Util;
|
||||
|
||||
/**
|
||||
* AWT/Swing overlapping test for {@link javax.swing.JInternalFrame } component during move.
|
||||
* <p>See <a href="http://monaco.sfbay.sun.com/detail.jsf?cr=6985399">CR6768230</a> for details and base class for test info.
|
||||
*/
|
||||
/*
|
||||
* @test
|
||||
@ -117,6 +116,7 @@ public class JInternalFrameMoveOverlapping extends OverlappingTestBase {
|
||||
JFrame frame = new JFrame("Test Window");
|
||||
frame.setSize(300, 300);
|
||||
frame.setContentPane(desktopPane);
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.setVisible(true);
|
||||
|
||||
locTopFrame = topFrame.getLocationOnScreen();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2025, 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
|
||||
@ -75,6 +75,7 @@ public class JInternalFrameOverlapping extends OverlappingTestBase {
|
||||
JFrame frame = new JFrame("Test Window");
|
||||
frame.setSize(300, 300);
|
||||
frame.setContentPane(desktopPane);
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.setVisible(true);
|
||||
JInternalFrame bottomFrame = new JInternalFrame("bottom frame", false, false, false, false);
|
||||
bottomFrame.setSize(220, 220);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2025, 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
|
||||
@ -22,7 +22,6 @@
|
||||
*/
|
||||
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.Point;
|
||||
import java.awt.Robot;
|
||||
@ -30,12 +29,14 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuBar;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JSeparator;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import test.java.awt.regtesthelpers.Util;
|
||||
|
||||
/**
|
||||
@ -72,7 +73,6 @@ public class JMenuBarOverlapping extends OverlappingTestBase {
|
||||
frame = new JFrame("Mixing : Dropdown Overlapping test");
|
||||
frame.setLayout(new GridLayout(0,1));
|
||||
frame.setSize(200, 200);
|
||||
frame.setVisible(true);
|
||||
|
||||
menuBar = new JMenuBar();
|
||||
JMenu menu = new JMenu("Test Menu");
|
||||
@ -104,6 +104,7 @@ public class JMenuBarOverlapping extends OverlappingTestBase {
|
||||
frame.setJMenuBar(menuBar);
|
||||
|
||||
propagateAWTControls(frame);
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2025, 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
|
||||
@ -22,17 +22,18 @@
|
||||
*/
|
||||
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Point;
|
||||
import java.awt.Robot;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.SpringLayout;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import test.java.awt.regtesthelpers.Util;
|
||||
|
||||
/**
|
||||
@ -82,6 +83,7 @@ public class JPopupMenuOverlapping extends OverlappingTestBase {
|
||||
item.addActionListener(menuListener);
|
||||
}
|
||||
propagateAWTControls(frame);
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.setVisible(true);
|
||||
loc = frame.getContentPane().getLocationOnScreen();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2025, 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
|
||||
@ -95,6 +95,7 @@ public class JScrollPaneOverlapping extends OverlappingTestBase {
|
||||
});
|
||||
|
||||
f.getContentPane().add(scrollPane);
|
||||
f.setLocationRelativeTo(null);
|
||||
f.setVisible(true);
|
||||
propagateAWTControls(p);
|
||||
// JButton b = new JButton("Space extender");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2025, 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
|
||||
@ -89,6 +89,7 @@ public class JSplitPaneOverlapping extends OverlappingTestBase {
|
||||
|
||||
frame.getContentPane().add(splitPane);
|
||||
frame.pack();
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2025, 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
|
||||
@ -26,9 +26,11 @@ import java.awt.Dimension;
|
||||
import java.awt.Point;
|
||||
import java.awt.Robot;
|
||||
import java.awt.event.InputEvent;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.SpringLayout;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import test.java.awt.regtesthelpers.Util;
|
||||
|
||||
/**
|
||||
@ -65,6 +67,7 @@ public class MixingFrameResizing extends OverlappingTestBase {
|
||||
frame = new JFrame("Mixing : Frame Resizing test");
|
||||
frame.setLayout(new SpringLayout());
|
||||
frame.setSize(50, 50);
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.setVisible(true);
|
||||
propagateAWTControls(frame);
|
||||
Util.waitTillShown(frame);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2025, 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
|
||||
@ -22,10 +22,23 @@
|
||||
*/
|
||||
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Button;
|
||||
import java.awt.Color;
|
||||
import java.awt.Panel;
|
||||
import java.awt.Point;
|
||||
import java.awt.Robot;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.event.InputEvent;
|
||||
import javax.swing.*;
|
||||
import java.io.*;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import test.java.awt.regtesthelpers.Util;
|
||||
|
||||
/**
|
||||
@ -130,6 +143,7 @@ public class MixingPanelsResizing {
|
||||
frame.add(jPanel, BorderLayout.NORTH);
|
||||
|
||||
frame.pack();
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
});
|
||||
@ -298,6 +312,7 @@ public class MixingPanelsResizing {
|
||||
failureMessage = whyFailed;
|
||||
mainThread.interrupt();
|
||||
}//fail()
|
||||
|
||||
static class TestPassedException extends RuntimeException {
|
||||
}
|
||||
}// class JButtonInGlassPane
|
||||
class TestPassedException extends RuntimeException {
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2025, 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
|
||||
@ -56,13 +56,13 @@ public class OpaqueOverlapping extends OverlappingTestBase {
|
||||
|
||||
{
|
||||
useClickValidation = false;
|
||||
failMessage = "Opacity test mismatchs";
|
||||
failMessage = "Opacity test mismatches";
|
||||
|
||||
// CR 6994264 (Choice autohides dropdown on Solaris 10)
|
||||
skipClassNames = new String[] { "Choice" };
|
||||
}
|
||||
private String testSeq;
|
||||
private final static String checkSeq = "010000101";
|
||||
private static final String checkSeq = "010000101";
|
||||
private Point heavyLoc;
|
||||
private JButton light;
|
||||
private Frame frame = null;
|
||||
@ -89,6 +89,7 @@ public class OpaqueOverlapping extends OverlappingTestBase {
|
||||
panel.add(light);
|
||||
frame.add(panel);
|
||||
frame.setBounds(50, 50, 400, 400);
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.setVisible(true);
|
||||
|
||||
currentAwtControl.addMouseListener(new MouseAdapter() {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2025, 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
|
||||
@ -34,6 +34,7 @@ import java.awt.Robot;
|
||||
import java.awt.Scrollbar;
|
||||
import java.awt.TextField;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
@ -171,6 +172,7 @@ public abstract class OverlappingTestBase {
|
||||
frame.getContentPane().setBackground(AWT_BACKGROUND_COLOR);
|
||||
frame.setSize(size, size);
|
||||
frame.setUndecorated(true);
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.setVisible(true);
|
||||
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
p[0] = frame.getLocation();
|
||||
@ -259,6 +261,9 @@ public abstract class OverlappingTestBase {
|
||||
embedder.setBackground(Color.RED);
|
||||
embedder.setPreferredSize(new Dimension(150, 150));
|
||||
container.add(embedder);
|
||||
if (container instanceof Window) {
|
||||
((Window) container).setLocationRelativeTo(null);
|
||||
}
|
||||
container.setVisible(true); // create peer
|
||||
|
||||
long frameWindow = 0;
|
||||
@ -301,6 +306,7 @@ public abstract class OverlappingTestBase {
|
||||
EmbeddedFrame eframe = (EmbeddedFrame) eframeCtor.newInstance(frameWindow);
|
||||
setupControl(eframe);
|
||||
eframe.setSize(new Dimension(150, 150));
|
||||
eframe.setLocationRelativeTo(null);
|
||||
eframe.setVisible(true);
|
||||
// System.err.println(eframe.getSize());
|
||||
} catch (Exception ex) {
|
||||
@ -682,6 +688,7 @@ public abstract class OverlappingTestBase {
|
||||
failureMessage = whyFailed;
|
||||
mainThread.interrupt();
|
||||
}//fail()
|
||||
|
||||
static class TestPassedException extends RuntimeException {
|
||||
}
|
||||
}// class LWComboBox
|
||||
class TestPassedException extends RuntimeException {
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2025, 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,10 +21,21 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.regex.*;
|
||||
import javax.swing.*;
|
||||
import java.awt.Point;
|
||||
import java.awt.Robot;
|
||||
import java.awt.event.FocusAdapter;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.SpringLayout;
|
||||
|
||||
import test.java.awt.regtesthelpers.Util;
|
||||
|
||||
/**
|
||||
@ -55,6 +66,10 @@ public abstract class SimpleOverlappingTestBase extends OverlappingTestBase {
|
||||
this.useDefaultClickValidation = defaultClickValidation;
|
||||
}
|
||||
|
||||
protected boolean isMultiFramesTest(){
|
||||
return true;
|
||||
}
|
||||
|
||||
public SimpleOverlappingTestBase() {
|
||||
this(true);
|
||||
}
|
||||
@ -114,6 +129,7 @@ public abstract class SimpleOverlappingTestBase extends OverlappingTestBase {
|
||||
|
||||
propagateAWTControls(f);
|
||||
|
||||
f.setLocationRelativeTo(null);
|
||||
f.setVisible(true);
|
||||
}
|
||||
|
||||
@ -140,21 +156,29 @@ public abstract class SimpleOverlappingTestBase extends OverlappingTestBase {
|
||||
/* this is a workaround for certain jtreg(?) focus issue:
|
||||
tests fail starting after failing mixing tests but always pass alone.
|
||||
*/
|
||||
JFrame ancestor = (JFrame)(testedComponent.getTopLevelAncestor());
|
||||
if( ancestor != null ) {
|
||||
Point ancestorLoc = ancestor.getLocationOnScreen();
|
||||
ancestorLoc.translate(isOel7orLater() ? 5 :
|
||||
ancestor.getWidth() / 2 - 15, 2);
|
||||
robot.mouseMove(ancestorLoc.x, ancestorLoc.y);
|
||||
Util.waitForIdle(robot);
|
||||
robot.mousePress(InputEvent.BUTTON1_MASK);
|
||||
robot.delay(50);
|
||||
robot.mouseRelease(InputEvent.BUTTON1_MASK);
|
||||
Util.waitForIdle(robot);
|
||||
JFrame ancestor = (JFrame) (testedComponent.getTopLevelAncestor());
|
||||
if (ancestor != null) {
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
ancestor.addFocusListener(new FocusAdapter() {
|
||||
@Override public void focusGained(FocusEvent e) {
|
||||
latch.countDown();
|
||||
}
|
||||
});
|
||||
ancestor.requestFocus();
|
||||
try {
|
||||
if (!latch.await(1L, TimeUnit.SECONDS)) {
|
||||
throw new RuntimeException(
|
||||
"Ancestor frame didn't receive focus");
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
clickAndBlink(robot, lLoc);
|
||||
Util.waitForIdle(robot);
|
||||
if (ancestor != null && isMultiFramesTest()) {
|
||||
ancestor.dispose();
|
||||
}
|
||||
|
||||
return wasLWClicked;
|
||||
}
|
||||
@ -172,5 +196,4 @@ public abstract class SimpleOverlappingTestBase extends OverlappingTestBase {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user