mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-15 13:59:40 +01:00
8339561: The test/jdk/java/awt/Paint/ListRepaint.java may fail after JDK-8327401
Backport-of: 0844745e7b
This commit is contained in:
committed by
Vitaly Provodin
parent
f5602eb3ab
commit
aa349d1d2d
@@ -146,6 +146,8 @@ java/awt/EventQueue/6980209/bug6980209.java 8198615 macosx-all
|
||||
java/awt/EventQueue/PushPopDeadlock/PushPopDeadlock.java 8024034 generic-all
|
||||
java/awt/grab/EmbeddedFrameTest1/EmbeddedFrameTest1.java 7080150 macosx-all
|
||||
java/awt/event/InputEvent/EventWhenTest/EventWhenTest.java 8168646 generic-all
|
||||
java/awt/List/KeyEventsTest/KeyEventsTest.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/OpaqueOverlappingChoice.java 8048171 generic-all
|
||||
java/awt/Mixing/AWT_Mixing/JMenuBarOverlapping.java 8159451 linux-all,windows-all,macosx-all
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 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,15 +25,24 @@
|
||||
* @test
|
||||
* @key headful
|
||||
* @summary To check proper WINDOW_EVENTS are triggered when Frame gains or losses the focus
|
||||
* @author Jitender(jitender.singh@eng.sun.com) area=AWT
|
||||
* @author yan
|
||||
* @library /lib/client
|
||||
* @build ExtendedRobot
|
||||
* @run main ActiveAWTWindowTest
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Button;
|
||||
import java.awt.Color;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Frame;
|
||||
import java.awt.TextField;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.event.WindowFocusListener;
|
||||
|
||||
public class ActiveAWTWindowTest {
|
||||
|
||||
@@ -47,12 +56,12 @@ public class ActiveAWTWindowTest {
|
||||
private boolean passed = true;
|
||||
private final int delay = 150;
|
||||
|
||||
public static void main(String[] args) {
|
||||
public static void main(String[] args) throws Exception {
|
||||
ActiveAWTWindowTest test = new ActiveAWTWindowTest();
|
||||
try {
|
||||
test.doTest();
|
||||
} finally {
|
||||
EventQueue.invokeLater(() -> {
|
||||
EventQueue.invokeAndWait(() -> {
|
||||
if (test.frame != null) {
|
||||
test.frame.dispose();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 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,9 +22,8 @@
|
||||
*/
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.KeyboardFocusManager;
|
||||
import java.awt.Frame;
|
||||
import java.awt.KeyboardFocusManager;
|
||||
import java.awt.List;
|
||||
import java.awt.Panel;
|
||||
import java.awt.Point;
|
||||
@@ -51,7 +50,7 @@ import jdk.test.lib.Platform;
|
||||
* @run main KeyEventsTest
|
||||
*/
|
||||
public class KeyEventsTest {
|
||||
TestState currentState;
|
||||
private volatile TestState currentState;
|
||||
final Object LOCK = new Object();
|
||||
final int ACTION_TIMEOUT = 500;
|
||||
|
||||
@@ -66,16 +65,14 @@ public class KeyEventsTest {
|
||||
r = new Robot();
|
||||
KeyEventsTest app = new KeyEventsTest();
|
||||
try {
|
||||
EventQueue.invokeAndWait(app::initAndShowGui);
|
||||
app.initAndShowGui();
|
||||
r.waitForIdle();
|
||||
r.delay(500);
|
||||
app.doTest();
|
||||
} finally {
|
||||
EventQueue.invokeAndWait(() -> {
|
||||
if (app.keyFrame != null) {
|
||||
app.keyFrame.dispose();
|
||||
}
|
||||
});
|
||||
if (app.keyFrame != null) {
|
||||
app.keyFrame.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,52 +181,51 @@ public class KeyEventsTest {
|
||||
throw new RuntimeException("Test failed - list isn't focus owner.");
|
||||
}
|
||||
|
||||
EventQueue.invokeAndWait(() -> {
|
||||
list.deselect(0);
|
||||
list.deselect(1);
|
||||
list.deselect(2);
|
||||
list.deselect(3);
|
||||
list.deselect(4);
|
||||
list.deselect(5);
|
||||
list.deselect(6);
|
||||
list.deselect(7);
|
||||
list.deselect(8);
|
||||
list.deselect(0);
|
||||
list.deselect(1);
|
||||
list.deselect(2);
|
||||
list.deselect(3);
|
||||
list.deselect(4);
|
||||
list.deselect(5);
|
||||
list.deselect(6);
|
||||
list.deselect(7);
|
||||
list.deselect(8);
|
||||
|
||||
int selectIndex = 0;
|
||||
int visibleIndex = 0;
|
||||
int selectIndex = 0;
|
||||
int visibleIndex = 0;
|
||||
|
||||
if (currentState.getScrollMoved()) {
|
||||
if (currentState.getKeyID() == KeyEvent.VK_PAGE_UP ||
|
||||
currentState.getKeyID() == KeyEvent.VK_HOME) {
|
||||
selectIndex = 8;
|
||||
visibleIndex = 8;
|
||||
} else if (currentState.getKeyID() == KeyEvent.VK_PAGE_DOWN ||
|
||||
currentState.getKeyID() == KeyEvent.VK_END) {
|
||||
selectIndex = 0;
|
||||
visibleIndex = 0;
|
||||
}
|
||||
} else {
|
||||
if (currentState.getKeyID() == KeyEvent.VK_PAGE_UP ||
|
||||
currentState.getKeyID() == KeyEvent.VK_HOME) {
|
||||
if (currentState.getSelectedMoved()) {
|
||||
selectIndex = 1;
|
||||
} else {
|
||||
selectIndex = 0;
|
||||
}
|
||||
visibleIndex = 0;
|
||||
} else if (currentState.getKeyID() == KeyEvent.VK_PAGE_DOWN ||
|
||||
currentState.getKeyID() == KeyEvent.VK_END) {
|
||||
if (currentState.getSelectedMoved()) {
|
||||
selectIndex = 7;
|
||||
} else {
|
||||
selectIndex = 8;
|
||||
}
|
||||
visibleIndex = 8;
|
||||
}
|
||||
if (currentState.getScrollMoved()) {
|
||||
if (currentState.getKeyID() == KeyEvent.VK_PAGE_UP ||
|
||||
currentState.getKeyID() == KeyEvent.VK_HOME) {
|
||||
selectIndex = 8;
|
||||
visibleIndex = 8;
|
||||
} else if (currentState.getKeyID() == KeyEvent.VK_PAGE_DOWN ||
|
||||
currentState.getKeyID() == KeyEvent.VK_END) {
|
||||
selectIndex = 0;
|
||||
visibleIndex = 0;
|
||||
}
|
||||
list.select(selectIndex);
|
||||
list.makeVisible(visibleIndex);
|
||||
});
|
||||
} else {
|
||||
if (currentState.getKeyID() == KeyEvent.VK_PAGE_UP ||
|
||||
currentState.getKeyID() == KeyEvent.VK_HOME) {
|
||||
if (currentState.getSelectedMoved()) {
|
||||
selectIndex = 1;
|
||||
} else {
|
||||
selectIndex = 0;
|
||||
}
|
||||
visibleIndex = 0;
|
||||
} else if (currentState.getKeyID() == KeyEvent.VK_PAGE_DOWN ||
|
||||
currentState.getKeyID() == KeyEvent.VK_END) {
|
||||
if (currentState.getSelectedMoved()) {
|
||||
selectIndex = 7;
|
||||
} else {
|
||||
selectIndex = 8;
|
||||
}
|
||||
visibleIndex = 8;
|
||||
}
|
||||
}
|
||||
list.select(selectIndex);
|
||||
list.makeVisible(visibleIndex);
|
||||
|
||||
|
||||
r.delay(10);
|
||||
r.waitForIdle();
|
||||
@@ -309,7 +305,7 @@ class TestState {
|
||||
private final boolean scrollMoved;
|
||||
private final int keyID;
|
||||
private final boolean template;
|
||||
private boolean action;
|
||||
private volatile boolean action;
|
||||
|
||||
public TestState(boolean multiple, boolean selectedMoved, boolean scrollMoved, int keyID, boolean template){
|
||||
this.multiple = multiple;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 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,28 +21,32 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Button;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Graphics;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 7090424
|
||||
* @author Sergey Bylokhov
|
||||
*/
|
||||
public final class ButtonRepaint extends Button {
|
||||
|
||||
public static void main(final String[] args) {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
final Frame frame = new Frame();
|
||||
frame.setSize(300, 300);
|
||||
frame.setLocationRelativeTo(null);
|
||||
ButtonRepaint button = new ButtonRepaint();
|
||||
frame.add(button);
|
||||
frame.setVisible(true);
|
||||
sleep();
|
||||
button.test();
|
||||
frame.dispose();
|
||||
Frame frame = new Frame();
|
||||
try {
|
||||
frame.setSize(300, 300);
|
||||
frame.setLocationRelativeTo(null);
|
||||
ButtonRepaint button = new ButtonRepaint();
|
||||
frame.add(button);
|
||||
frame.setVisible(true);
|
||||
sleep();
|
||||
button.test();
|
||||
} finally {
|
||||
frame.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 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,27 +21,32 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Checkbox;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Graphics;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 7090424
|
||||
* @author Sergey Bylokhov
|
||||
*/
|
||||
public final class CheckboxRepaint extends Checkbox {
|
||||
|
||||
public static void main(final String[] args) {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
final Frame frame = new Frame();
|
||||
frame.setSize(300, 300);
|
||||
frame.setLocationRelativeTo(null);
|
||||
CheckboxRepaint checkbox = new CheckboxRepaint();
|
||||
frame.add(checkbox);
|
||||
frame.setVisible(true);
|
||||
sleep();
|
||||
checkbox.test();
|
||||
frame.dispose();
|
||||
Frame frame = new Frame();
|
||||
try {
|
||||
frame.setSize(300, 300);
|
||||
frame.setLocationRelativeTo(null);
|
||||
CheckboxRepaint checkbox = new CheckboxRepaint();
|
||||
frame.add(checkbox);
|
||||
frame.setVisible(true);
|
||||
sleep();
|
||||
checkbox.test();
|
||||
} finally {
|
||||
frame.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 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
|
||||
@@ -30,21 +30,23 @@ import java.awt.Label;
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 7090424
|
||||
* @author Sergey Bylokhov
|
||||
*/
|
||||
public final class LabelRepaint extends Label {
|
||||
|
||||
public static void main(final String[] args) {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
final Frame frame = new Frame();
|
||||
frame.setSize(300, 300);
|
||||
frame.setLocationRelativeTo(null);
|
||||
LabelRepaint label = new LabelRepaint();
|
||||
frame.add(label);
|
||||
frame.setVisible(true);
|
||||
sleep();
|
||||
label.test();
|
||||
frame.dispose();
|
||||
Frame frame = new Frame();
|
||||
try {
|
||||
frame.setSize(300, 300);
|
||||
frame.setLocationRelativeTo(null);
|
||||
LabelRepaint label = new LabelRepaint();
|
||||
frame.add(label);
|
||||
frame.setVisible(true);
|
||||
sleep();
|
||||
label.test();
|
||||
} finally {
|
||||
frame.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 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
|
||||
@@ -30,26 +30,27 @@ import java.awt.List;
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 7090424
|
||||
* @author Sergey Bylokhov
|
||||
*/
|
||||
public final class ListRepaint extends List {
|
||||
|
||||
static ListRepaint listRepaint;
|
||||
static Frame frame;
|
||||
|
||||
public static void main(final String[] args) throws Exception {
|
||||
public static void main(final String[] args) {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
Frame frame = new Frame();
|
||||
try {
|
||||
EventQueue.invokeLater(ListRepaint::createAndShowGUI);
|
||||
frame.setSize(300, 300);
|
||||
frame.setLocationRelativeTo(null);
|
||||
ListRepaint list = new ListRepaint();
|
||||
list.add("1");
|
||||
list.add("2");
|
||||
list.add("3");
|
||||
list.add("4");
|
||||
list.select(0);
|
||||
frame.add(list);
|
||||
frame.setVisible(true);
|
||||
sleep();
|
||||
EventQueue.invokeAndWait(listRepaint::test);
|
||||
list.test();
|
||||
} finally {
|
||||
EventQueue.invokeAndWait(() -> {
|
||||
if (frame != null) {
|
||||
frame.dispose();
|
||||
frame = null;
|
||||
}
|
||||
});
|
||||
frame.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,22 +62,6 @@ public final class ListRepaint extends List {
|
||||
}
|
||||
}
|
||||
|
||||
static void createAndShowGUI() {
|
||||
frame = new Frame();
|
||||
frame.setSize(300, 300);
|
||||
frame.setLocationRelativeTo(null);
|
||||
|
||||
listRepaint = new ListRepaint();
|
||||
listRepaint.add("1");
|
||||
listRepaint.add("2");
|
||||
listRepaint.add("3");
|
||||
listRepaint.add("4");
|
||||
listRepaint.select(0);
|
||||
|
||||
frame.add(listRepaint);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(final Graphics g) {
|
||||
super.paint(g);
|
||||
|
||||
Reference in New Issue
Block a user