jfx
jfx copied to clipboard
8359598: [TestBug] VirtualFlowTestUtils should not create a temporary Stage
Currently, the VirtualFlowTestUtils used ONLY for tests has many utility methods to get and do something with the VirtualFlow of Virtualized Controls.
It has one flaw: It may creates a temporary Stage with the StageLoader, when the Control was never inside a Scene (and Stage) yet. This is done to get the VirtualFlow, which is not possible otherwise.
Take the following test code:
VirtualFlowTestUtils.clickOnRow(tableView, 2);
VirtualFlowTestUtils.clickOnRow(tableView, 4);
What it does it to create a Stage for the first method and dispose it after. And create another Stage for the second method and dispose it after.
This does not test a realistic scenario and the chance is quite high that developers used that methods without even knowing that it contains such logic.
So the idea is to remove the StageLoader code from VirtualFlowTestUtils and rather use it in the Test code before calling the Util methods.
For the example above, this would result in:
stageLoader = new StageLoader(tableView);
VirtualFlowTestUtils.clickOnRow(tableView, 2);
VirtualFlowTestUtils.clickOnRow(tableView, 4);
The stageLoader should be disposed in an @AfterEach.
Note: Nearly all touched tests are indeed much older test code. New tests are not affected and already use it correcty.
Sometimes a call to Toolkit.getToolkit().firePulse(); was needed. Previously, creating a new Stage for every call to the util methods did that implicitly.
Progress
- [ ] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
- [x] Change must not contain extraneous whitespace
- [x] Commit message must refer to an issue
Issue
- JDK-8359598: [TestBug] VirtualFlowTestUtils should not create a temporary Stage (Enhancement - P4)
Reviewing
Using git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1829/head:pull/1829
$ git checkout pull/1829
Update a local copy of the PR:
$ git checkout pull/1829
$ git pull https://git.openjdk.org/jfx.git pull/1829/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1829
View PR using the GUI difftool:
$ git pr show -t 1829
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1829.diff
Using Webrev
:wave: Welcome back mhanl! 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.
@Maran23 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:
8359598: [TestBug] VirtualFlowTestUtils should not create a temporary Stage
Reviewed-by: angorya
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 18 new commits pushed to the master branch:
- ff408b1c6f449ded20323298d235f4a05dcd71bf: 8361713: JavaFX API docs overview is missing an intro section
- 04c5e40cc116cb42150572959b53d1e465700e0e: 8357594: Additional geometry-based Text/TextFlow APIs
- 203c049a671ca00e6012dfedd6aa9848e2584b85: 8357714: AudioClip.play crash on macOS when loading resource from jar
- ... and 15 more: https://git.openjdk.org/jfx/compare/fd30c94893156644c0d803b3e7fd8c9731d65fe6...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.
/integrate
Going to push as commit a574d92053a72fce4d30556160282fc801ad5218.
Since your change was applied there have been 18 commits pushed to the master branch:
- ff408b1c6f449ded20323298d235f4a05dcd71bf: 8361713: JavaFX API docs overview is missing an intro section
- 04c5e40cc116cb42150572959b53d1e465700e0e: 8357594: Additional geometry-based Text/TextFlow APIs
- 203c049a671ca00e6012dfedd6aa9848e2584b85: 8357714: AudioClip.play crash on macOS when loading resource from jar
- ... and 15 more: https://git.openjdk.org/jfx/compare/fd30c94893156644c0d803b3e7fd8c9731d65fe6...master
Your commit was automatically rebased without conflicts.
@Maran23 Pushed as commit a574d92053a72fce4d30556160282fc801ad5218.
:bulb: You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.