On Thu, 21 Jan 2021 23:15:09 GMT, Kevin Rushforth <[email protected]> wrote:

>> By using the anchor location facility of PopupWindows we can avoid 
>> miscalculation of the
>> menu's height entirely.
>> This fix also cleans up some documentation issues.
>> This fix introduces tests that check the correct positioning (test_position_)
>> test_position_withCSS reproduces the problem that is fixed with this patch.
>> The other test_position_ cases serve as "proof" that no regressions are 
>> introduces.
>> They work before and after the fix is introduced.
>
> modules/javafx.controls/src/test/java/test/javafx/scene/control/ContextMenuTest.java
>  line 686:
> 
>> 684:     private String createStylesheet() {
>> 685:         try {
>> 686:             File f = 
>> File.createTempFile("test_position_showOnTopWithCSS", ".css");
> 
> There is no need to create a temporary file for this css resource, since its 
> contents are fixed. Instead, you should add 
> `test_position_showOnTopWithCSS.css` to the repo under 
> [`modules/javafx.controls/src/test/resources/test/javafx/scene/control/`](https://github.com/openjdk/jfx/tree/master/modules/javafx.controls/src/test/resources/test/javafx/scene/control).
>  Then you can just do this:
> 
>     return 
> ContextMenuTest.class.getResource("test_position_showOnTopWithCSS.css").toExternalForm();

Thanks for pointing this out. I took the example from the bug entry (where it 
was nice to have everything in one file). But in the test it is of course much 
more elegant to use a .css file from the resources.
Adapted the test accordingly.

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

PR: https://git.openjdk.java.net/jfx/pull/383

Reply via email to