Skip to content

8051591: Test javax/swing/JTabbedPane/8007563/Test8007563.java fails #20791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

kumarabhi006
Copy link
Contributor

@kumarabhi006 kumarabhi006 commented Aug 30, 2024

Test was failing on multiple platforms mainly windows and linux and was problemlisted for all platforms. Increased the delay from 200ms to 500 ms to fetch the correct background color using robot. Now test passed for multiple iteration (~50 times) in CI pipeline for all platforms. Wild imports are expanded and test is pulled out of an extra level of folder.
Test removed from Problem-list file as well.

CI testing link is posted in JBS.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8051591: Test javax/swing/JTabbedPane/8007563/Test8007563.java fails (Bug - P3)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20791/head:pull/20791
$ git checkout pull/20791

Update a local copy of the PR:
$ git checkout pull/20791
$ git pull https://git.openjdk.org/jdk.git pull/20791/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 20791

View PR using the GUI difftool:
$ git pr show -t 20791

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20791.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 30, 2024

👋 Welcome back abhiscxk! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Aug 30, 2024

@kumarabhi006 This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8051591: Test javax/swing/JTabbedPane/8007563/Test8007563.java fails

Reviewed-by: honkar, dnguyen, psadhukhan

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 294 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 30, 2024
@openjdk
Copy link

openjdk bot commented Aug 30, 2024

@kumarabhi006 The following label will be automatically applied to this pull request:

  • client

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the client client-libs-dev@openjdk.org label Aug 30, 2024
@mlbridge
Copy link

mlbridge bot commented Aug 30, 2024

Webrevs

Copy link
Contributor

@honkar-jdk honkar-jdk left a comment

Choose a reason for hiding this comment

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

      SecondaryLoop secondaryLoop =
               Toolkit.getDefaultToolkit().getSystemEventQueue()
                       .createSecondaryLoop();
       new Thread() {
           @Override
           public void run() {
               try {
                   Thread.sleep(200);
               } catch (InterruptedException e) {
               }
               secondaryLoop.exit();
               invokeLater(Test8007563.this);
           }
       }.start();
       secondaryLoop.enter();

I'm not sure if the SecondaryLoop code is required for this test or it can be simplified?

@kumarabhi006
Copy link
Contributor Author

kumarabhi006 commented Sep 3, 2024

I'm not sure if the SecondaryLoop code is required for this test or it can be simplified?

I have tried simplifying the test code and removed SecondaryLoop code. Tested the current changes in CI across all platforms and no failure observed. Posted the CI link in JBS.

@kumarabhi006
Copy link
Contributor Author

@prsadhuk As we were discussing about the test change and removal of SecondaryLoop change, I tested the current changes without the fix proposed in JDK-8007563 and test failed which is correct. After applying the fix, test is able to pass.

@kumarabhi006
Copy link
Contributor Author

@prsadhuk Ran the test with uiscale of 2 and test passed across all platforms.

@prsadhuk
Copy link
Contributor

prsadhuk commented Sep 3, 2024

@prsadhuk As we were discussing about the test change and removal of SecondaryLoop change, I tested the current changes without the fix proposed in JDK-8007563 and test failed which is correct. After applying the fix, test is able to pass.

Secondary loop was added for JDK-8078269 not for JDK-8007563 so you need to check if test fail without Secondary loop without that fix and passes with the fix..

@kumarabhi006
Copy link
Contributor Author

Secondary loop was added for JDK-8078269 not for JDK-8007563 so you need to check if test fail without Secondary loop without that fix and passes with the fix..

I tested without the fix for JDK-8078269 for different scenarion:

  1. Old test i.e. with SecondaryLoop with Thread.sleep(200) Test Failed for Windows platform

  2. Old test i.e. with SecondaryLoop with Thread.sleep(500) Test Passed

  3. Changed test i.e without SecondaryLoop with added robot.delay(200) Test Failed for Windows platform

  4. Changed test i.e. without SecondaryLoop with added robot.delay(500) Test Passed

Since the old test with longer delay (500 ms) and changed test with delay of 500 ms passed without the fix of JDK-8078269, looks like the reason for failure could be less delay.

@prsadhuk
Copy link
Contributor

prsadhuk commented Sep 3, 2024

I am not sure why secondary loop was added in the testcase for JDK-8078269..
JDK-8078269 issue was TabbedPane.tabAreaBackground should have precedence over setBackground but it was not working after JDK-8007563..
The 8007563 tests for non-opaque case whereas 8078269 issue was for opaque.
It seems if we put UIManager.put("TabbedPane.tabAreaBackground", Color.GREEN); then the tabbedpane areas where there are no tabs are not GREEN but RED...
Seems like we need a new testcase for JDK-8078269 and do away with secondary loop in 8007563 testcase..

@kumarabhi006
Copy link
Contributor Author

I am not sure why secondary loop was added in the testcase for JDK-8078269..

That is unclear to me as well.

JDK-8078269 issue was TabbedPane.tabAreaBackground should have precedence over setBackground but it was not working after JDK-8007563.. The 8007563 tests for non-opaque case whereas 8078269 issue was for opaque. It seems if we put UIManager.put("TabbedPane.tabAreaBackground", Color.GREEN); then the tabbedpane areas where there are no tabs are not GREEN but RED... Seems like we need a new testcase for JDK-8078269 and do away with secondary loop in 8007563 testcase..

This issue still exists with the existing implementation in MetalTabbedPaneUI. If we add UIManager.put("TabbedPane.tabAreaBackground", Color.GREEN); to the existing test then the expected output is that the tabbedpane areas where there are no tabs should be GREEN but it is RED and the reason is the background color instance check of UIResource at L905. Since background is an instance of Color object the condition evaluates to false and the graphic's object color is set to the background of component which is RED.

I think removal of SecondaryLoop should be ok for this PR. And for JDK-8078269 as you suggested we may need a new test case which checks for the UIManager.put("TabbedPane.tabAreaBackground", Color.GREEN); as the property is not tested here.

@prsadhuk
Copy link
Contributor

prsadhuk commented Sep 3, 2024

I am not sure why secondary loop was added in the testcase for JDK-8078269..

That is unclear to me as well.

JDK-8078269 issue was TabbedPane.tabAreaBackground should have precedence over setBackground but it was not working after JDK-8007563.. The 8007563 tests for non-opaque case whereas 8078269 issue was for opaque. It seems if we put UIManager.put("TabbedPane.tabAreaBackground", Color.GREEN); then the tabbedpane areas where there are no tabs are not GREEN but RED... Seems like we need a new testcase for JDK-8078269 and do away with secondary loop in 8007563 testcase..

This issue still exists with the existing implementation in MetalTabbedPaneUI. If we add UIManager.put("TabbedPane.tabAreaBackground", Color.GREEN); to the existing test then the expected output is that the tabbedpane areas where there are no tabs should be GREEN but it is RED and the reason is the background color instance check of UIResource at L905. Since background is an instance of Color object the condition evaluates to false and the graphic's object color is set to the background of component which is RED.

I think removal of SecondaryLoop should be ok for this PR. And for JDK-8078269 as you suggested we may need a new test case which checks for the UIManager.put("TabbedPane.tabAreaBackground", Color.GREEN); as the property is not tested here.

As per
https://mail.openjdk.org/pipermail/swing-dev/2015-May/004521.html
secondary loop was added for

Also inappropriate design chosen for the 8007563 reg test code affected test results stability. It also has been fixed.

I guess because pre-2018 our tests was run in samevm mode so there might be some stability issue and since it has been changed to othervm mode by default since '18, I guess this loop is not needed.
Also, as per the discussion for the webrev, it seems the "background" color, if set, was given precedence over property or in other words if background color instance check of UIResource means if background color is not set by user and is set by L&F which in case of MetalL&F is "TabbedPane.background", controlShadow, which is UIResource and in this case if TabbedPane.tabAreaBackground is set, TabbedPane.tabAreaBackground will take precedence

but if background Color set by user as is in this case in the testcase, it will not be instance of UIResource but Color so background color will take precedence

Copy link
Contributor

@DamonGuy DamonGuy left a comment

Choose a reason for hiding this comment

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

I tested this myself and it does seem to be stable and pass consistently. Looks like the extra delay works.

Following the logic regarding the precedence of the different sources of background color, it does seem like Prasanta is correct when glancing over the different sources of colors.

Worth noting, I think it'd be good to rename the test since we're removing it from the problemlist and moving the test to a new location anyway. Maybe rename it to JTabbedPaneBackgroundColorTest or something similar to be more descriptive.

@kumarabhi006
Copy link
Contributor Author

Worth noting, I think it'd be good to rename the test since we're removing it from the problemlist and moving the test to a new location anyway. Maybe rename it to JTabbedPaneBackgroundColorTest or something similar to be more descriptive.

I didn't pay attention that the file is recognized as a new file when it has moved to new location. This may be due to the recent changes in test where it has been almost changed except few lines and is recognized as new file.
Renamed the test now.

@prsadhuk
Copy link
Contributor

prsadhuk commented Sep 4, 2024

Seems like closed test 4690946 where the UI property "TabbedPane.tabAreaBackground" was added in webrev.0 is moved to open and renamed as javax/swing/JTabbedPane/TestJTabbedPaneOpaqueColor.java..Any idea why the test is only for windows and linux? Can it be extended for macos too? Is JDK-7148101 still valid?

@kumarabhi006
Copy link
Contributor Author

Seems like closed test 4690946 where the UI property "TabbedPane.tabAreaBackground" was added in webrev.0 is moved to open and renamed as javax/swing/JTabbedPane/TestJTabbedPaneOpaqueColor.java..Any idea why the test is only for windows and linux? Can it be extended for macos too? Is JDK-7148101 still valid?

closed test 4690946 was moved to open for the issue JDK-8226990 and was tested against the windows and linux platform only because the issue was reported for Nimbus and GTK L&F. See the discussion here.
For Aqua separate bug was filed JDK-8331619 and PR raised. But this bug was closed as were unable to verify the native behavior for TabbedPane.

Can it be extended for macos too?

Do you mean TestJTabbedPaneOpaqueColor Test ? I guess it can be extended for Mac but we need to restrict the testing only for Metal and Nimbus L&F on Mac machine.

@kumarabhi006
Copy link
Contributor Author

Is JDK-7148101 still valid?

Yes, issue still exists for mac machine.

@prsadhuk
Copy link
Contributor

prsadhuk commented Sep 4, 2024

Is JDK-7148101 still valid?

Yes, issue still exists for mac machine.

Issue is for AquaL&F which as per your verification in JDK-8331619 and #19170 is not an issue it seems..

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 4, 2024
@kumarabhi006
Copy link
Contributor Author

Is JDK-7148101 still valid?

Yes, issue still exists for mac machine.

Issue is for AquaL&F which as per your verification in JDK-8331619 and #19170 is not an issue it seems..

Yes, for Aqua L&F we were not able to verify the native behavior.
I think bug4690946.java test needs to be removed from closed problemlist.

@prsadhuk
Copy link
Contributor

prsadhuk commented Sep 4, 2024

Is JDK-7148101 still valid?

Yes, issue still exists for mac machine.

Issue is for AquaL&F which as per your verification in JDK-8331619 and #19170 is not an issue it seems..

Yes, for Aqua L&F we were not able to verify the native behavior. I think bug4690946.java test needs to be removed from closed problemlist.

Yes already raised the PR for removal..

Copy link
Contributor

@DamonGuy DamonGuy left a comment

Choose a reason for hiding this comment

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

Since the other issue in question is separate, then this fix looks good.

Copy link
Contributor

@honkar-jdk honkar-jdk left a comment

Choose a reason for hiding this comment

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

LGTM other than the minor test changes mentioned below.

*/

public class TestJTabbedPaneBackgroundColor {
private static final ArrayList<String> LIST = new ArrayList<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it can be changed to a non-final static var

Suggested change
private static final ArrayList<String> LIST = new ArrayList<>();
private static ArrayList<String> lafList = new ArrayList<>();


public static void main(String[] args) throws Exception {
robot = new Robot();
robot.setAutoDelay(200);
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be removed as there no Robot mouse or key events.
robot.setAutoDelay(200);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Sep 6, 2024
@kumarabhi006
Copy link
Contributor Author

@prsadhuk Minor update after you reviewed. Please re-review the PR.

Copy link
Contributor

@honkar-jdk honkar-jdk left a comment

Choose a reason for hiding this comment

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

LGTM.
Suggestion:: Adding a consolidated note listing the JBS ids & corresponding tests related to JTabbedPane background issue in this PR or JBS might be helpful for future reference (avoids scrolling through PR comments).

  1. JDK-8051591 - Test javax/swing/JTabbedPane/8007563/Test8007563.java => test/jdk/javax/swing/JTabbedPane/TestJTabbedPaneBackgroundColor.java
    ...
    so on.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 7, 2024
@bridgekeeper
Copy link

bridgekeeper bot commented Oct 5, 2024

@kumarabhi006 This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@kumarabhi006
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Oct 10, 2024

Going to push as commit 780de00.
Since your change was applied there have been 758 commits pushed to the master branch:

  • 313f4a9: 8340809: Open source few more AWT PopupMenu tests
  • 9d621d3: 8338884: java/nio/file/attribute/BasicFileAttributeView/CreationTime.java#tmp fails on alinux3
  • 475f8f9: 8341859: Optimize ClassFile Benchmark Write
  • c850ecb: 8341755: Optimize argNames in InnerClassLambdaMetafactory
  • 172f744: 8340985: Open source some Desktop related tests
  • e7045e9: 8341684: Typo in External Specifications link of java.util.Currency
  • 49c7148: 8341366: Suspicious check in Locale.getDisplayName(Locale inLocale)
  • 52eded4: 8341170: Open source several Choice related tests (part 2)
  • a45abf1: 8341860: ProblemList applications/ctw/modules/java_base_2.java on linux-x64
  • 593c27e: 8341535: sun/awt/font/TestDevTransform.java fails with RuntimeException: Different rendering
  • ... and 748 more: https://git.openjdk.org/jdk/compare/6a3d045221c338fefec9bd59245324eae60b156b...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Oct 10, 2024
@openjdk openjdk bot closed this Oct 10, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Oct 10, 2024
@openjdk
Copy link

openjdk bot commented Oct 10, 2024

@kumarabhi006 Pushed as commit 780de00.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client client-libs-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants