Skip to content

8273043: [TEST_BUG] Automate NimbusJTreeSelTextColor.java#5269

Closed
aivanov-jdk wants to merge 4 commits intoopenjdk:masterfrom
aivanov-jdk:treeSelColor
Closed

8273043: [TEST_BUG] Automate NimbusJTreeSelTextColor.java#5269
aivanov-jdk wants to merge 4 commits intoopenjdk:masterfrom
aivanov-jdk:treeSelColor

Conversation

@aivanov-jdk
Copy link
Member

@aivanov-jdk aivanov-jdk commented Aug 26, 2021

Automated NimbusJTreeSelTextColor.java test which is added under JDK-8271315.

It passes with the recent build of JDK 18.
It fails with JDK 18 build 7 where JDK-8266510 is not fixed yet:

Exception in thread "main" java.lang.RuntimeException: Unexpected color found: ff000000 at (4, 9);
foreground: ffffffff; background: ff39698a - check image.png
        at NimbusJTreeSelTextColor.checkColors(NimbusJTreeSelTextColor.java:106)
        at NimbusJTreeSelTextColor.main(NimbusJTreeSelTextColor.java:70)

The line is wrapped for readability. In this case the text is black instead of white.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8273043: [TEST_BUG] Automate NimbusJTreeSelTextColor.java

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5269/head:pull/5269
$ git checkout pull/5269

Update a local copy of the PR:
$ git checkout pull/5269
$ git pull https://git.openjdk.java.net/jdk pull/5269/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5269

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5269.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 26, 2021

👋 Welcome back aivanov! 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 openjdk bot added the rfr Pull request is ready for review label Aug 26, 2021
@openjdk
Copy link

openjdk bot commented Aug 26, 2021

@aivanov-jdk The following label will be automatically applied to this pull request:

  • swing

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 swing client-libs-dev@openjdk.org label Aug 26, 2021
@mlbridge
Copy link

mlbridge bot commented Aug 26, 2021

Webrevs

treeBounds.x += iconOffset;
treeBounds.width -= iconOffset;
treeBounds.width -= 2; // crop selection border on the right
BufferedImage image = robot.createScreenCapture(treeBounds);
Copy link
Member

Choose a reason for hiding this comment

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

Can we skip the usage of the robot and render it directly to the buffered image? probably this will allow running the test in a headless envirement?

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about it yet I didn't try that. It should work. Moreover, the test fails on macOS because the UI gets scaled, rendering to BufferedImage directly could avoid this problem.

@aivanov-jdk aivanov-jdk marked this pull request as draft August 26, 2021 21:53
@openjdk openjdk bot removed the rfr Pull request is ready for review label Aug 26, 2021
@pankaj-bansal
Copy link

I assume you must have tested this on headless environment and it must have passed. But is it really necessary to make this headless as we are showing JFrame and setting L&F. I mean these things mostly associate with headful environment.

@aivanov-jdk
Copy link
Member Author

aivanov-jdk commented Aug 27, 2021

I assume you must have tested this on headless environment and it must have passed.

Yes, the test passes. The only exception is macOS: the test fails there either way because the text is rendered with antialiasing and I can't disable font smoothing on macOS. Does anyone know how to disable it?

I'm thinking about skipping macOS altogher.

But is it really necessary to make this headless as we are showing JFrame and setting L&F. I mean these things mostly associate with headful environment.

We're not showing the frame unless -show option is passed to the test. This is mostly for debugging to see the frame and JTree. Showing the frame on a headless host will throw an exception.

There are more headless hosts which can run the test, so a headless test could be run easier and faster than a headful one.

@mrserb
Copy link
Member

mrserb commented Aug 27, 2021

Yes, the test passes. The only exception is macOS: the test fails there either way because the text is rendered with antialiasing and I can't disable font smoothing on macOS. Does anyone know how to disable it?

I'm thinking about skipping macOS altogher.

You can try to change the foregound color in the Nimbus defaults then render it, then compare the part of the images which have the text. If the images are identical then your color was ignored and the bug exists.

@aivanov-jdk aivanov-jdk marked this pull request as ready for review August 31, 2021 19:24
@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 31, 2021
@aivanov-jdk
Copy link
Member Author

Yes, the test passes. The only exception is macOS: the test fails there either way because the text is rendered with antialiasing and I can't disable font smoothing on macOS. Does anyone know how to disable it?
I'm thinking about skipping macOS altogher.

You can try to change the foregound color in the Nimbus defaults then render it, then compare the part of the images which have the text. If the images are identical then your color was ignored and the bug exists.

This should work, however, I think it's not worth the effort. Changing the defaults and comparing the two images entirely will make the test more complicated. Nimbus is a platform-independent Look and Feel, the issue is not specific to macOS. The problem is caught on Windows and Linux where one can easily disable text anti-aliasing.

@openjdk
Copy link

openjdk bot commented Sep 1, 2021

@aivanov-jdk 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:

8273043: [TEST_BUG] Automate NimbusJTreeSelTextColor.java

Reviewed-by: serb

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 61 new commits pushed to the master branch:

  • 1a5a2b6: 8271745: Correct block size for KW,KWP mode and use fixed IV for KWP mode for SunJCE
  • 2f01a6f: 8273157: Add convenience methods to Messager
  • 9689f61: 8272788: Nonleaf ranked locks should not be safepoint_check_never
  • 4ee0dac: 8273248: ProblemList java/lang/instrument/BootClassPath/BootClassPathTest.sh on all configs
  • 655ea6d: 8270489: Support archived heap objects in EpsilonGC
  • dacd197: 8273217: Make ParHeapInspectTask _safepoint_check_never
  • 02822e1: 8272377: assert preconditions that are ensured when created in add_final_edges
  • a58cf16: 8272563: assert(is_double_stack() && !is_virtual()) failed: type check
  • 0e14bf7: 8273176: handle latest VS2019 in abstract_vm_version
  • f1c5e26: 8273206: jdk/jfr/event/gc/collection/TestG1ParallelPhases.java fails after JDK-8159979
  • ... and 51 more: https://git.openjdk.java.net/jdk/compare/e43a907f20f99fa1f788fcbe2e99631dd01578d4...master

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 ready Pull request is ready to be integrated label Sep 1, 2021
@aivanov-jdk
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Sep 7, 2021

Going to push as commit 270a9d9.
Since your change was applied there have been 109 commits pushed to the master branch:

  • df05b4d: 8271923: [macos] the text color on the selected disabled tabbed pane button remains white making text unreadable
  • 2abf3b3: 8271340: Crash PhaseIdealLoop::clone_outer_loop
  • 99fb12c: 8271341: Opcode() != Op_If && Opcode() != Op_RangeCheck) || outcnt() == 2 assert failure with Test7179138_1.java
  • 041ae20: 8268558: [TESTBUG] Case 2 in TestP11KeyFactoryGetRSAKeySpec is skipped
  • 377b186: 8269119: C2: Avoid redundant memory barriers in Unsafe.copyMemory0 intrinsic
  • 70157c7: 8272135: jshell: Method cannot use its overloaded version
  • 5caa77b: 8263364: sun/net/www/http/KeepAliveStream/KeepAliveStreamCloseWithWrongContentLength.java wedged in getInputStream
  • a522d6b: 8273376: Zero: Disable vtable/itableStub gtests
  • 3cd95a2: 8231356: Fix broken ResourceObj::operator new[] in debug builds
  • 81c719b: 8273333: Zero should warn about unimplemented -XX:+LogTouchedMethods
  • ... and 99 more: https://git.openjdk.java.net/jdk/compare/e43a907f20f99fa1f788fcbe2e99631dd01578d4...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Sep 7, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Sep 7, 2021
@openjdk
Copy link

openjdk bot commented Sep 7, 2021

@aivanov-jdk Pushed as commit 270a9d9.

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

@aivanov-jdk aivanov-jdk deleted the treeSelColor branch May 24, 2022 11:43
@openjdk openjdk bot added the client client-libs-dev@openjdk.org label May 24, 2022
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 swing client-libs-dev@openjdk.org

Development

Successfully merging this pull request may close these issues.

3 participants