Compare commits

..

10 Commits
1368 ... 1379

Author SHA1 Message Date
Vitaly Provodin
5b6652871d updated JTreg exclude list 2021-03-17 12:05:08 +07:00
Vitaly Provodin
10069846d5 Follow-up to 8221852: reporting actual error when unprivileged symlink creation fails
fix the misprint
2021-03-12 15:47:01 +07:00
Roman Shevchenko
f06f9fe734 Follow-up to 8221852: reporting actual error when unprivileged symlink creation fails
... for a reason other that ERROR_INVALID_PARAMETER.
2021-03-11 12:16:11 +03:00
Vitaly Provodin
348e538d10 updated JTreg exclude list
JBR-3167 excluding java2d tests causing Xwayland crash
2021-03-09 06:37:34 +07:00
Dmitry Batrak
5b9ff9a29e JBR-2766 java/awt/Window/MinimumSizeDPIVariation/MinimumSizeDPIVariation.java: Wrong size 2021-03-02 19:42:44 +03:00
Dmitry Batrak
62b04983f2 JBR-3157 Maximized window with custom decorations isn't focused on showing 2021-03-02 19:00:15 +03:00
Vitaly Provodin
c40b9c8b9e JBR-1505 add jdk.jcmd module into JBR 2021-03-02 05:43:59 +07:00
Artem Semenov
46dfaeecc9 JR-CR-760:
JBR-3144 Extend test for list with list nested in Heavy Weight Window popup
2021-02-24 14:25:30 +03:00
Alexey Ushakov
e03c9829e3 JBR-3066 jbr 11_10 (1145-88) crashes on IDEA startup, jbr 11_09 (1145-77) works fine
Optimised failure handling
2021-02-20 06:57:05 -08:00
Alexey Ushakov
97c0e96a5a JBR-3066 jbr 11_10 (1145-88) crashes on IDEA startup, jbr 11_09 (1145-77) works fine
Optimised failure handling
2021-02-20 02:57:25 -08:00
15 changed files with 381 additions and 66 deletions

View File

@@ -1,18 +1,18 @@
diff --git modules.list modules.list
index e23d793..368d022 100644
index 33375b527c4..76539cbc0e0 100644
--- modules.list
+++ modules.list
@@ -54,4 +54,7 @@ jdk.security.jgss,
jdk.unsupported,
@@ -55,4 +55,7 @@ jdk.unsupported,
jdk.xml.dom,
jdk.zipfs,
-jdk.hotspot.agent
+jdk.hotspot.agent,
jdk.hotspot.agent,
-jdk.jcmd
+jdk.jcmd,
+jcef,
+gluegen.rt,
+jogl.all
diff --git src/java.desktop/share/classes/module-info.java src/java.desktop/share/classes/module-info.java
index b663b38..3e9acdc 100644
index b663b382f52..3e9acdc0c27 100644
--- src/java.desktop/share/classes/module-info.java
+++ src/java.desktop/share/classes/module-info.java
@@ -109,7 +109,11 @@ module java.desktop {

View File

@@ -54,4 +54,5 @@ jdk.security.jgss,
jdk.unsupported,
jdk.xml.dom,
jdk.zipfs,
jdk.hotspot.agent
jdk.hotspot.agent,
jdk.jcmd

View File

@@ -944,9 +944,12 @@ class WindowsNativeDispatcher {
CreateSymbolicLink0(linkBuffer.address(),
targetBuffer.address(), flags);
return;
} catch (WindowsException ignored) {
} catch (WindowsException xx) {
// Will fail with ERROR_INVALID_PARAMETER for Windows
// builds older than 14972.
if (xx.lastError() != ERROR_INVALID_PARAMETER) {
x = xx;
}
}
}
throw x;

View File

@@ -234,6 +234,7 @@ public class LWWindowPeer
setOpaque(getTarget().isOpaque());
updateInsets(platformWindow.getInsets());
if (getSurfaceData() == null) {
replaceSurfaceData(false);
}
@@ -310,7 +311,6 @@ public class LWWindowPeer
}
}
}
updateInsets(platformWindow.getInsets());
}
@Override

View File

@@ -89,7 +89,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
private static native void nativeSetNSWindowStyleBits(long nsWindowPtr, int mask, int data);
private static native void nativeSetNSWindowMenuBar(long nsWindowPtr, long menuBarPtr);
private static native Insets nativeGetNSWindowInsets(long nsWindowPtr);
private static native void nativeSetNSWindowBounds(long nsWindowPtr, double x, double y, double w, double h, boolean wait);
private static native void nativeSetNSWindowBounds(long nsWindowPtr, double x, double y, double w, double h);
private static native void nativeSetNSWindowLocationByPlatform(long nsWindowPtr);
private static native void nativeSetNSWindowStandardFrame(long nsWindowPtr,
double x, double y, double w, double h);
@@ -683,7 +683,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
@Override // PlatformWindow
public void setBounds(int x, int y, int w, int h) {
execute(ptr -> AWTThreading.executeWaitToolkit(wait -> nativeSetNSWindowBounds(ptr, x, y, w, h, wait)));
execute(ptr -> nativeSetNSWindowBounds(ptr, x, y, w, h));
}
public void setMaximizedBounds(int x, int y, int w, int h) {

View File

@@ -1292,10 +1292,10 @@ JNF_COCOA_EXIT(env);
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: nativeSetNSWindowBounds
* Signature: (JDDDDZ)V
* Signature: (JDDDD)V
*/
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetNSWindowBounds
(JNIEnv *env, jclass clazz, jlong windowPtr, jdouble originX, jdouble originY, jdouble width, jdouble height, jboolean wait)
(JNIEnv *env, jclass clazz, jlong windowPtr, jdouble originX, jdouble originY, jdouble width, jdouble height)
{
JNF_COCOA_ENTER(env);
@@ -1303,7 +1303,7 @@ JNF_COCOA_ENTER(env);
// TODO: not sure we need displayIfNeeded message in our view
NSWindow *nsWindow = OBJC(windowPtr);
[ThreadUtilities performOnMainThreadWaiting:(BOOL)wait block:^(){
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
AWTWindow *window = (AWTWindow*)[nsWindow delegate];

View File

@@ -82,17 +82,24 @@ p_hb_face_destroy_type p_hb_face_destroy;
p_hb_ot_tag_to_language_type p_hb_ot_tag_to_language;
static int initialisedHBAPI = 0;
static int initialisationFailed = 0;
int initHBAPI() {
if (initialisedHBAPI) {
return initialisedHBAPI;
}
if (initialisationFailed) {
return 0;
}
#if !defined(_WIN32) && !defined(__APPLE__)
void* libharfbuzz = NULL;
libharfbuzz = dlopen(JHARFBUZZ_DLL, RTLD_LOCAL | RTLD_LAZY);
if (libharfbuzz == NULL) {
initialisationFailed = 1;
CHECK_NULL_RETURN(libharfbuzz = dlopen(HARFBUZZ_DLL, RTLD_LOCAL | RTLD_LAZY), 0);
initialisationFailed = 0;
}
p_hb_buffer_create = (p_hb_buffer_create_type)dlsym(libharfbuzz, "hb_buffer_create");

View File

@@ -780,24 +780,6 @@ AwtFrame::Show()
} else {
::ShowWindow(hwnd, SW_SHOWMAXIMIZED);
}
// [tav] Workaround for unclear platform behaviour.
// When a custom decor frame is being shown maximized at the moment
// some another AWT window is still foreground - the frame can go
// in background when shown if:
// 1) the other AWT window is closed the moment after frame's show
// 2) some another maximized window is behind the frame, it steals activation
if (HasCustomDecoration()) {
HWND fgHWnd = ::GetForegroundWindow();
if (fgHWnd != NULL &&
GetComponent(fgHWnd) != NULL && // it's awt window
IsFocusableWindow() &&
IsAutoRequestFocus() &&
!::IsWindow(GetModalBlocker(GetHWnd())))
{
::SetForegroundWindow(GetHWnd());
}
}
}
else if (m_isInputMethodWindow) {
// Don't activate input methow window
@@ -1462,16 +1444,6 @@ void AwtFrame::__SetState(AwtFrame* f, int state, float factorX, float factorY)
f->setIconic(iconify);
f->setZoomed(zoom);
// [tav] With custom decor enabled, MS Win will send WM_SIZE msg w/o SIZE_MAXIMIZED param set
// before the frame will be shown. The msg handler will drop the maximized state in response.
// In order to prevent that, we set the maximized state on the native frame in advance.
if (zoom && f->HasCustomDecoration()) {
WINDOWPLACEMENT wp;
::GetWindowPlacement(f->GetHWnd(), &wp);
wp.showCmd = SW_SHOWMAXIMIZED;
::SetWindowPlacement(f->GetHWnd(), &wp);
}
}
}
}

View File

@@ -2248,7 +2248,16 @@ void AwtWindow::RecalcNonClient()
//
void AwtWindow::RedrawNonClient()
{
::SetWindowPos(GetHWnd(), (HWND) NULL, 0, 0, 0, 0, SwpFrameChangeFlags|SWP_ASYNCWINDOWPOS);
UINT flags = SwpFrameChangeFlags;
if (!HasCustomDecoration()) {
// With custom decorations enabled, SetWindowPos call below can cause WM_SIZE message being sent.
// If we're coming here from WFramePeer.initialize (as part of 'setResizable' call),
// WM_SIZE message processing can happen concurrently with window flags update done as part of
// 'setState' call), and lead to inconsistent state.
// So, we disable asynchronous processing in case we have custom decorations to avoid the race condition.
flags |= SWP_ASYNCWINDOWPOS;
}
::SetWindowPos(GetHWnd(), (HWND) NULL, 0, 0, 0, 0, flags);
}
int AwtWindow::GetScreenImOn() {

5
test/jdk/jb/java/a11y/AccessibleComponentTest.java Executable file → Normal file
View File

@@ -1,11 +1,10 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
import java.awt.*;
import java.security.PublicKey;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.CountDownLatch;
import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;

163
test/jdk/jb/java/a11y/AccessibleJListTest.java Executable file → Normal file
View File

@@ -8,14 +8,13 @@
*/
import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.*;
import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
public class AccessibleJListTest extends AccessibleComponentTest {
@@ -24,8 +23,8 @@ public class AccessibleJListTest extends AccessibleComponentTest {
public static void main(String[] args) throws Exception {
a11yTest = new AccessibleJListTest();
countDownLatch = a11yTest.createCountDownLatch();
countDownLatch = a11yTest.createCountDownLatch();
SwingUtilities.invokeLater(((AccessibleJListTest) a11yTest)::createSimpleList);
countDownLatch.await();
@@ -33,6 +32,22 @@ public class AccessibleJListTest extends AccessibleComponentTest {
throw new RuntimeException(a11yTest.exceptionString);
}
countDownLatch = a11yTest.createCountDownLatch();
SwingUtilities.invokeLater(((AccessibleJListTest) a11yTest)::createSimpleListRenderer);
countDownLatch.await();
if (!testResult) {
throw new RuntimeException(a11yTest.exceptionString);
}
countDownLatch = a11yTest.createCountDownLatch();
SwingUtilities.invokeLater(((AccessibleJListTest) a11yTest)::createSimpleListNamed);
countDownLatch.await();
if (!testResult) {
throw new RuntimeException(a11yTest.exceptionString);
}
countDownLatch = a11yTest.createCountDownLatch();
SwingUtilities.invokeLater(((AccessibleJListTest) a11yTest)::createCombobox);
countDownLatch.await();
@@ -48,6 +63,14 @@ public class AccessibleJListTest extends AccessibleComponentTest {
if (!testResult) {
throw new RuntimeException(a11yTest.exceptionString);
}
countDownLatch = a11yTest.createCountDownLatch();
SwingUtilities.invokeLater(((AccessibleJListTest) a11yTest)::createPushButtonHeavyWeight);
countDownLatch.await();
if (!testResult) {
throw new RuntimeException(a11yTest.exceptionString);
}
}
@java.lang.Override
@@ -72,6 +95,44 @@ public class AccessibleJListTest extends AccessibleComponentTest {
super.createUI(frame, "Accessible JList test");
}
public void createSimpleListRenderer() {
INSTRUCTIONS = "INSTRUCTIONS:\n"
+ "Check a11y of JList with renderer in a simple Window.\n\n"
+ "Turn screen reader on, and Tab to the list.\n"
+ "Press the up and down arrow buttons to move through the list.\n\n"
+ "If you can hear menu items tab further and press PASS, otherwise press FAIL.\n";
JPanel frame = new JPanel();
JList<String> list = new JList<>(NAMES);
list.setCellRenderer(new AccessibleJListTestRenderer());
frame.setLayout(new FlowLayout());
frame.add(list);
exceptionString = "Accessible JList with renderer simple list test failed!";
super.createUI(frame, "Accessible JList test");
}
public void createSimpleListNamed() {
INSTRUCTIONS = "INSTRUCTIONS:\n"
+ "Check a11y of named JList in a simple Window.\n\n"
+ "Turn screen reader on, and Tab to the list.\n"
+ "Press the tab button to move to second list.\n\n"
+ "If you can hear second list name the \"Second liste\" tab further and press PASS, otherwise press FAIL.\n";
JPanel frame = new JPanel();
JList<String> list = new JList<>(NAMES);
JList<String> secondList = new JList<>(NAMES);
secondList.getAccessibleContext().setAccessibleName("Second liste");
frame.setLayout(new FlowLayout());
frame.add(list);
frame.add(secondList);
exceptionString = "Accessible JList simple list nnamed test failed!";
super.createUI(frame, "Accessible JList test");
}
public void createCombobox() {
INSTRUCTIONS = "INSTRUCTIONS:\n"
+ "Check a11y of JList in a combobox.\n\n"
@@ -91,7 +152,7 @@ public class AccessibleJListTest extends AccessibleComponentTest {
public void createPushButton() {
INSTRUCTIONS = "INSTRUCTIONS:\n"
+ "Check a11y of JList in a popup.\n\n"
+ "Check a11y of JList in a popup with simple window.\n\n"
+ "Turn screen reader on, and Tab to the show button and press space.\n"
+ "Press the up and down arrow buttons to move through the list.\n\n"
+ "If you can hear popup menu items tab further and press PASS, otherwise press FAIL.\n";
@@ -136,7 +197,93 @@ public class AccessibleJListTest extends AccessibleComponentTest {
frame.setLayout(new FlowLayout());
frame.add(button);
exceptionString = "Accessible JList push button test failed!";
exceptionString = "Accessible JList push button with simple window test failed!";
super.createUI(frame, "Accessible JList test");
}
}
public void createPushButtonHeavyWeight() {
INSTRUCTIONS = "INSTRUCTIONS:\n"
+ "Check a11y of JList in a popup with heavy weight window.\n\n"
+ "Turn screen reader on, and Tab to the show button and press space.\n"
+ "Press the up and down arrow buttons to move through the list.\n\n"
+ "If you can hear popup menu items tab further and press PASS, otherwise press FAIL.\n";
JPanel frame = new JPanel();
JButton button = new JButton("show");
button.setPreferredSize(new Dimension(100, 35));
button.addActionListener(new ActionListener() {
private Popup popup = null;
final Runnable dispose = () -> {
popup.hide();
popup = null;
button.requestFocus();
button.setText("show");
};
@Override
public void actionPerformed(ActionEvent e) {
if (popup == null) {
Rectangle bounds = frame.getBounds();
PopupFactory factory = PopupFactory.getSharedInstance();
JList<String> winList = new JList<>(NAMES);
winList.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
dispose.run();
}
}
});
popup = factory.getPopup(frame, winList, bounds.x + bounds.width + 20, bounds.y);
Window c = SwingUtilities.getWindowAncestor(winList);
if (c != null) {
c.setAutoRequestFocus(true);
c.setFocusableWindowState(true);
}
popup.show();
button.setText("hide (ESC)");
} else {
dispose.run();
}
}
});
frame.setLayout(new FlowLayout());
frame.add(button);
exceptionString = "Accessible JList push button with heavy weight window test failed!";
super.createUI(frame, "Accessible JList test");
}
public static class AccessibleJListTestRenderer extends JPanel implements ListCellRenderer {
private JLabel labelAJT = new JLabel("AJL");
private JLabel itemName = new JLabel();
AccessibleJListTestRenderer() {
super(new FlowLayout());
setFocusable(false);
layoutComponents();
}
private void layoutComponents() {
add(labelAJT);
add(itemName);
}
@Override
public Dimension getPreferredSize() {
Dimension size = super.getPreferredSize();
return new Dimension(Math.min(size.width, 245), size.height);
}
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
itemName.setText(((String) value));
getAccessibleContext().setAccessibleName(labelAJT.getText() + ", " + itemName.getText());
return this;
}
}
}

45
test/jdk/jb/java/a11y/AccessibleJTableTest.java Executable file → Normal file
View File

@@ -13,6 +13,14 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
public class AccessibleJTableTest extends AccessibleComponentTest {
private static final String[] columnNames = {"One", "Two", "Three"};
private static final String[][] data = {
{"One1", "Two1", "Three1"},
{"One2", "Two2", "Three2"},
{"One3", "Two3", "Three3"},
{"One4", "Two4", "Three4"},
{"One5", "Two5", "Three5"}
};
@Override
public CountDownLatch createCountDownLatch() {
@@ -27,14 +35,6 @@ public class AccessibleJTableTest extends AccessibleComponentTest {
+ "On MacOS, use the up and down arrow buttons to move through rows, and VoiceOver fast navigation to move through columns.\n\n"
+ "If you can hear table cells tab further and press PASS, otherwise press FAIL.\n";
final String[] columnNames = {"One", "Two", "Three"};
String[][] data = {
{"One1", "Two1", "Three1"},
{"One2", "Two2", "Three2"},
{"One3", "Two3", "Three3"},
{"One4", "Two4", "Three4"},
{"One5", "Two5", "Three5"}
};
JTable table = new JTable(data, columnNames);
JPanel panel = new JPanel();
panel.setLayout(new FlowLayout());
@@ -45,13 +45,42 @@ public class AccessibleJTableTest extends AccessibleComponentTest {
super.createUI(panel, "AccessibleJTableTest");
}
public void createUINamed() {
INSTRUCTIONS = "INSTRUCTIONS:\n"
+ "Check a11y of named JTable in a simple Window.\n\n"
+ "Turn screen reader on, and Tab to the table.\n"
+ "Press the tab button to move to second table.\n\n"
+ "If you can hear second table name the \"Second table\" tab further and press PASS, otherwise press FAIL.\n";
JTable table = new JTable(data, columnNames);
JTable secondTable = new JTable(data, columnNames);
secondTable.getAccessibleContext().setAccessibleName("Second table");
JPanel panel = new JPanel();
panel.setLayout(new FlowLayout());
JScrollPane scrollPane = new JScrollPane(table);
JScrollPane secondScrollPane = new JScrollPane(secondTable);
panel.add(scrollPane);
panel.add(secondScrollPane);
panel.setFocusable(false);
exceptionString = "AccessibleJTable test failed!";
super.createUI(panel, "AccessibleJTableTest");
}
public static void main(String[] args) throws Exception {
AccessibleJTableTest test = new AccessibleJTableTest();
countDownLatch = test.createCountDownLatch();
SwingUtilities.invokeAndWait(test::createUI);
countDownLatch.await(15, TimeUnit.MINUTES);
if (!testResult) {
throw new RuntimeException(exceptionString);
}
countDownLatch = test.createCountDownLatch();
SwingUtilities.invokeAndWait(test::createUINamed);
countDownLatch.await(15, TimeUnit.MINUTES);
if (!testResult) {
throw new RuntimeException(exceptionString);
}
}
}

View File

@@ -29,6 +29,7 @@ public class AccessibleJTreeTest extends AccessibleComponentTest {
+ "Press the arrow buttons to move through the tree.\n\n"
+ "If you can hear tree components tab further and press PASS, otherwise press FAIL.\n";
String root = "Root";
String[] nodes = new String[] {"One node", "Two node"};
String[][] leafs = new String[][]{{"leaf 1.1", "leaf 1.2", "leaf 1.3", "leaf 1.4"},
{"leaf 2.1", "leaf 2.2", "leaf 2.3", "leaf 2.4"}};
@@ -50,13 +51,14 @@ public class AccessibleJTreeTest extends AccessibleComponentTest {
super.createUI(panel, "AccessibleJTreeTest");
}
public void createSampleTreeInvisibleRoot() {
public void createSampleTreeUnvisableRoot() {
INSTRUCTIONS = "INSTRUCTIONS:\n"
+ "Check a11y of JTree with invisible root in a simple Window.\n\n"
+ "Check a11y of JTree with unvisable root in a simple Window.\n\n"
+ "Turn screen reader on, and Tab to the tree.\n"
+ "Press the arrow buttons to move through the tree.\n\n"
+ "If you can hear tree components tab further and press PASS, otherwise press FAIL.\n";
String root = "Root";
String[] nodes = new String[] {"One node", "Two node"};
String[][] leafs = new String[][]{{"leaf 1.1", "leaf 1.2", "leaf 1.3", "leaf 1.4"},
{"leaf 2.1", "leaf 2.2", "leaf 2.3", "leaf 2.4"}};
@@ -77,13 +79,48 @@ public class AccessibleJTreeTest extends AccessibleComponentTest {
super.createUI(panel, "AccessibleJTreeTest");
}
public void createRendererTree() {
public void createSampleTreeNamed() {
INSTRUCTIONS = "INSTRUCTIONS:\n"
+ "Check a11y of named JTree in a simple Window.\n\n"
+ "Turn screen reader on, and Tab to the tree.\n"
+ "Press the tab button to move to second tree.\\n\n"
+ "If you can hear second tree name the \"Second tree\" tab further and press PASS, otherwise press FAIL.\n";
String root = "Root";
String[] nodes = new String[] {"One node", "Two node"};
String[][] leafs = new String[][]{{"leaf 1.1", "leaf 1.2", "leaf 1.3", "leaf 1.4"},
{"leaf 2.1", "leaf 2.2", "leaf 2.3", "leaf 2.4"}};
Hashtable<String, String[]> data = new Hashtable<String, String[]>();
for (int i = 0; i < nodes.length; i++) {
data.put(nodes[i], leafs[i]);
}
JTree tree = new JTree(data);
JTree secondTree = new JTree(data);
secondTree.getAccessibleContext().setAccessibleName("Second tree");
tree.setRootVisible(true);
JPanel panel = new JPanel();
panel.setLayout(new FlowLayout());
JScrollPane scrollPane = new JScrollPane(tree);
JScrollPane secondScrollPane = new JScrollPane(secondTree);
panel.add(scrollPane);
panel.add(secondScrollPane);
panel.setFocusable(false);
exceptionString = "AccessibleJTree named test failed!";
super.createUI(panel, "AccessibleJTreeTest");
}
public void createRendererTree() {
INSTRUCTIONS = "INSTRUCTIONS:\n"
+ "Check a11y of JTree using renderer in a simple Window.\n\n"
+ "Turn screen reader on, and Tab to the tree.\n"
+ "Press the arrow buttons to move through the tree.\n\n"
+ "If you can hear tree components tab further and press PASS, otherwise press FAIL.\n";
String root = "Root";
String[] nodes = new String[] {"One node", "Two node"};
String[][] leafs = new String[][]{{"leaf 1.1", "leaf 1.2", "leaf 1.3", "leaf 1.4"},
{"leaf 2.1", "leaf 2.2", "leaf 2.3", "leaf 2.4"}};
@@ -108,6 +145,7 @@ public class AccessibleJTreeTest extends AccessibleComponentTest {
public static void main(String[] args) throws Exception {
AccessibleJTreeTest test = new AccessibleJTreeTest();
countDownLatch = test.createCountDownLatch();
SwingUtilities.invokeAndWait(test::createSampleTree);
AccessibleComponentTest.countDownLatch.await(15, TimeUnit.MINUTES);
@@ -116,7 +154,15 @@ public class AccessibleJTreeTest extends AccessibleComponentTest {
}
countDownLatch = test.createCountDownLatch();
SwingUtilities.invokeAndWait(test::createSampleTreeInvisibleRoot);
SwingUtilities.invokeAndWait(test::createSampleTreeNamed);
AccessibleComponentTest.countDownLatch.await(15, TimeUnit.MINUTES);
if (!testResult) {
throw new RuntimeException(exceptionString);
}
countDownLatch = test.createCountDownLatch();
SwingUtilities.invokeAndWait(test::createSampleTreeUnvisableRoot);
AccessibleComponentTest.countDownLatch.await(15, TimeUnit.MINUTES);
if (!testResult) {
throw new RuntimeException(exceptionString);

View File

@@ -0,0 +1,98 @@
/*
* Copyright 2021 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.lang.reflect.Method;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
/**
* @test
* @summary Regression test for JBR-3157 Maximized window with custom decorations isn't focused on showing
* @key headful
*/
public class MaximizedCustomDecorationsTest {
private static final CompletableFuture<Boolean> frame2Focused = new CompletableFuture<>();
private static Robot robot;
private static JFrame frame1;
private static JFrame frame2;
private static JButton button;
public static void main(String[] args) throws Exception {
robot = new Robot();
try {
SwingUtilities.invokeAndWait(MaximizedCustomDecorationsTest::initUI);
robot.delay(1000);
clickOn(button);
frame2Focused.get(5, TimeUnit.SECONDS);
} finally {
SwingUtilities.invokeAndWait(MaximizedCustomDecorationsTest::disposeUI);
}
}
private static void initUI() {
frame1 = new JFrame("MaximizedCustomDecorationsTest");
button = new JButton("Open maximized frame");
button.addActionListener(e -> {
frame1.dispose();
frame2 = new JFrame("Frame with custom decorations");
enableCustomDecorations(frame2);
frame2.addWindowFocusListener(new WindowAdapter() {
@Override
public void windowGainedFocus(WindowEvent e) {
frame2Focused.complete(true);
}
});
frame2.setExtendedState(Frame.MAXIMIZED_BOTH);
frame2.setVisible(true);
});
frame1.add(button);
frame1.pack();
frame1.setVisible(true);
}
private static void enableCustomDecorations(Window window) {
try {
Method setHasCustomDecoration = Window.class.getDeclaredMethod("setHasCustomDecoration");
setHasCustomDecoration.setAccessible(true);
setHasCustomDecoration.invoke(window);
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
private static void disposeUI() {
if (frame1 != null) frame1.dispose();
if (frame2 != null) frame2.dispose();
}
private static void clickAt(int x, int y) {
robot.mouseMove(x, y);
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
}
private static void clickOn(Component component) {
Point location = component.getLocationOnScreen();
clickAt(location.x + component.getWidth() / 2, location.y + component.getHeight() / 2);
}
}

View File

@@ -699,6 +699,10 @@ java/awt/xembed/server/RunTestXEmbed.java
sun/awt/datatransfer/SuplementaryCharactersTransferTest.java 8011371 generic-all
sun/awt/shell/ShellFolderMemoryLeak.java 8197794 windows-all
# Fedora & ArchLinux (Wayland)
sun/java2d/AcceleratedXORModeTest.java JBR-3167 linux-5.10.12-200.fc33.x86_64,linux-5.11.6-arch1-1
sun/java2d/ClassCastExceptionForInvalidSurface.java JBR-3167 linux-5.10.12-200.fc33.x86_64,linux-5.11.6-arch1-1
sun/java2d/DirectX/OnScreenRenderingResizeTest/OnScreenRenderingResizeTest.java 8022403 generic-all
sun/java2d/DirectX/OverriddenInsetsTest/OverriddenInsetsTest.java 8196102 generic-all
sun/java2d/DirectX/RenderingToCachedGraphicsTest/RenderingToCachedGraphicsTest.java 8196180 windows-all,linux-all,macosx-all