Skip to content
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

8264952: [TestBug] Controls unit tests - ControlTest and SpinnerTest fail for non US Locale #476

Closed
wants to merge 1 commit into from

Conversation

@aghaisas
Copy link
Collaborator

@aghaisas aghaisas commented Apr 22, 2021

This PR fixes controls unit test failures that are observed with German locale.

Fix :
Code added to use US locale while running SpinnerTest and DatePicker test & restore locale to default after these tests are executed.

test.javafx.scene.control.ControlTest.testRT18097 fails for DatePicker control. Fixing DatePickerTest fixes this. This reveals the fact that our unit tests run in a single VM and any test that changes the Locale setting should restore it to the default at the end.


Progress

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

Issue

  • JDK-8264952: [TestBug] Controls unit tests - ControlTest and SpinnerTest fail for non US Locale

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 476

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

Using diff file

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

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Apr 22, 2021

👋 Welcome back aghaisas! 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 label Apr 22, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Apr 22, 2021

Webrevs

@kevinrushforth kevinrushforth self-requested a review Apr 22, 2021
Copy link
Member

@kevinrushforth kevinrushforth left a comment

This looks good. Saving and restoring global state in this manner represents a best practice. Two questions:

  1. In the description you said that test.javafx.scene.control.ControlTest.testRT18097 fails without your fix and passes with this fix. This suggests that something in that test only works with the "out of the box" default Locale. Do you know why?
  2. We have one test in javafx.base where we set the default Locale. Can you file a follow-on testbug to save and restore the Locale there, too?

@openjdk
Copy link

@openjdk openjdk bot commented Apr 22, 2021

@aghaisas 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:

8264952: [TestBug] Controls unit tests - ControlTest and SpinnerTest fail for non US Locale

Reviewed-by: kcr

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 1 new commit pushed to the master branch:

  • dffdc6f: 8265758: [TestBug] Remove ignored unit test from CustomMenuItemTest

Please see this link for an up-to-date comparison between the source branch of this pull request and 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 ready label Apr 22, 2021
@kevinrushforth
Copy link
Member

@kevinrushforth kevinrushforth commented Apr 22, 2021

Btw, the test I mentioned above in javafx.base is test.javafx.util.converter.LocalDateTimeStringConverterTest.

@aghaisas
Copy link
Collaborator Author

@aghaisas aghaisas commented Apr 23, 2021

This looks good. Saving and restoring global state in this manner represents a best practice. Two questions:

1. In the description you said that `test.javafx.scene.control.ControlTest.testRT18097` fails without your fix and passes with this fix. This suggests that something in that test only works with the "out of the box" default Locale. Do you know why?

DatePickerTest was not restoring the Locale to the system specific locale at the end of it. ControlsTest is run after DatePickerTest in our test run.

test.javafx.scene.control.ControlTest.testRT18097 creates a DatePicker control and tests its properties. It fails for showWeekNumbersProperty. This property is initialized from the resource bundle for country specific value. Hence, the test fails if we set Locale to US (which expects showWeekNumbersProperty to be false) and System locale is GB or DE (which sets showWeekNumbersProperty to true from the resource bundle)

2. We have one test in `javafx.base` where we set the default Locale. Can you file a follow-on testbug to save and restore the Locale there, too?

I have filed JDK-8265828 for this.

@aghaisas
Copy link
Collaborator Author

@aghaisas aghaisas commented Apr 23, 2021

/integrate

@openjdk openjdk bot closed this Apr 23, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Apr 23, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Apr 23, 2021

@aghaisas Since your change was applied there have been 5 commits pushed to the master branch:

  • 27e57d3: 8265469: Allow to build media and webkit for Linux-AArch64
  • dfda00d: 8265514: Openjfx controls running tests broken (Eclipse)
  • 1b407cc: 8239880: CSS tests should cleanup any global state they modify
  • fab638a: 8265425: Hard failure when building OpenJFX for Linux AArch64
  • dffdc6f: 8265758: [TestBug] Remove ignored unit test from CustomMenuItemTest

Your commit was automatically rebased without conflicts.

Pushed as commit b50ce94.

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

@aghaisas aghaisas deleted the locale_test_fix branch Jul 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants