> Very similar to https://github.com/openjdk/jfx/pull/1829, this PR removes the 
> questionable behavior that the `MouseEventFirer` may create a temporary 
> `Stage` for your `Node`.
> 
> Take the following test code:
> 
> Button button = new Button("Button");
> MouseEventFirer mouse = new MouseEventFirer(button);
> mouse.fireMousePressAndRelease();
> mouse.fireMousePressAndRelease();
> mouse.dispose()
> 
> What it does is to create a `Stage` in the first method. The second method 
> does not. This is not immediately clear.
> That is also the reason why the dispose method exists. To MAY clean it up. Or 
> forget to call it.
> 
> 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 MouseEventFirer and rather 
> use it in the Test code before calling the Util methods.
> 
> For the example above, this would result in:
> 
> Button button = new Button("Button");
> stageLoader = new StageLoader(button );
> MouseEventFirer mouse = new MouseEventFirer(button);
> mouse.fireMousePressAndRelease();
> mouse.fireMousePressAndRelease();
> 
> 
> There were only two real tests that did not have a `Stage` yet. So most of 
> the tests already had a good setup and this could never run.

Marius Hanl has updated the pull request incrementally with one additional 
commit since the last revision:

  improve test

-------------

Changes:
  - all: https://git.openjdk.org/jfx/pull/2124/files
  - new: https://git.openjdk.org/jfx/pull/2124/files/7733e2f5..2083f3de

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jfx&pr=2124&range=01
 - incr: https://webrevs.openjdk.org/?repo=jfx&pr=2124&range=00-01

  Stats: 50 lines in 1 file changed: 50 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jfx/pull/2124.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/2124/head:pull/2124

PR: https://git.openjdk.org/jfx/pull/2124

Reply via email to