Skip to content
Permalink
Browse files
8015602: [macosx] Test javax/swing/SpringLayout/4726194/bug4726194.ja…
…va fails on MacOSX

Reviewed-by: psadhukhan, pbansal
  • Loading branch information
mrserb committed Oct 27, 2020
1 parent 1d245c6 commit dc85a3fe816a74cca4f427bb8f24dfa9717b4c01
Showing with 37 additions and 20 deletions.
  1. +37 −20 test/jdk/javax/swing/SpringLayout/4726194/bug4726194.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2020, 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,13 +25,22 @@
* @test
* @bug 4726194 7124209
* @summary Tests for 4726194
* @author Phil Milne
*/
import java.awt.*;
import java.lang.reflect.InvocationTargetException;
import java.util.*;

import java.awt.Font;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.swing.*;

import javax.swing.BorderFactory;
import javax.swing.JTextField;
import javax.swing.Spring;
import javax.swing.SpringLayout;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import static javax.swing.UIManager.getInstalledLookAndFeels;

public class bug4726194 {

@@ -40,22 +49,29 @@ public class bug4726194 {
private static int[] FAIL = new int[3];
private static boolean TEST_DUPLICATES = false;

public static void main(String[] args) {
try {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
int minLevel = 2;
int maxLevel = 2;
for (int i = minLevel; i <= maxLevel; i++) {
test(i, true);
test(i, false);
}
public static void main(String[] args) throws Exception {
for (final UIManager.LookAndFeelInfo laf : getInstalledLookAndFeels()) {
SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf));
SwingUtilities.invokeAndWait(() -> {
int minLevel = 2;
int maxLevel = 2;
for (int i = minLevel; i <= maxLevel; i++) {
test(i, true);
test(i, false);
}
});
} catch (InterruptedException | InvocationTargetException ex) {
ex.printStackTrace();
throw new RuntimeException("FAILED: SwingUtilities.invokeAndWait method failed!");
}
}

private static void setLookAndFeel(UIManager.LookAndFeelInfo laf) {
try {
System.out.println("LookAndFeel: " + laf.getClassName());
UIManager.setLookAndFeel(laf.getClassName());
} catch (UnsupportedLookAndFeelException ignored){
System.out.println("Unsupported LookAndFeel: " + laf.getClassName());
} catch (ClassNotFoundException | InstantiationException |
IllegalAccessException e) {
throw new RuntimeException(e);
}
}

@@ -64,6 +80,7 @@ public static void test(int level, boolean horizontal) {
String[] constraints = horizontal ? hConstraints : vConstraints;
test(level, constraints, result, Arrays.asList(new Object[level]));
JTextField tf = new JTextField("");
tf.setBorder(BorderFactory.createEmptyBorder());
tf.setFont(new Font("Dialog", Font.PLAIN, 6));
System.out.print("\t\t");
for (int j = 0; j < constraints.length; j++) {

3 comments on commit dc85a3f

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on dc85a3f Oct 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RealCLanger
Copy link
Contributor

@RealCLanger RealCLanger commented on dc85a3f Oct 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk11u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on dc85a3f Oct 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RealCLanger @RealCLanger the backport was successfully created on the branch RealCLanger-backport-dc85a3fe in my personal fork of openjdk/jdk11u-dev. To create a pull request with this backport targeting openjdk/jdk11u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

this pull request contains a backport of commit dc85a3fe from the openjdk/jdk repository.

The commit being backported was authored by Sergey Bylokhov on 27 Oct 2020 and was reviewed by Prasanta Sadhukhan and Pankaj Bansal.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk11u-dev:

$ git fetch https://github.com/openjdk-bots/jdk11u-dev RealCLanger-backport-dc85a3fe:RealCLanger-backport-dc85a3fe
$ git checkout RealCLanger-backport-dc85a3fe
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk11u-dev RealCLanger-backport-dc85a3fe

Please sign in to comment.