RFR: 8090123: Items are no longer visible when collection is changed [v7]
Karthik P K
kpk at openjdk.org
Tue Mar 7 07:22:41 UTC 2023
On Tue, 7 Mar 2023 00:23:48 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
> Have you run the test this on all platforms?
I have run the test in Mac and Windows multiple times. No failures found.
> tests/system/src/test/java/test/robot/javafx/scene/ChoiceBoxScrollUpOnCollectionChangeTest.java line 62:
>
>> 60: * There is 1 test in this file.
>> 61: * Steps for testChoicBoxScrollOnCollectionChange()
>> 62: * 1. Create a ChoiceBox and add 50 items to it.
>
> Minor: the comment is wrong now (you add 150 items).
Updated comment
> tests/system/src/test/java/test/robot/javafx/scene/ChoiceBoxScrollUpOnCollectionChangeTest.java line 143:
>
>> 141:
>> 142: double rowHeight = ContextMenuContentShim.getContextMenuRowHeight(popup);
>> 143: double screenHeight = Screen.getPrimary().getBounds().getHeight();
>
> I think using `getVisualBounds()` would be better.
Updated code to use `getVisualBounds()`
> tests/system/src/test/java/test/robot/javafx/scene/ChoiceBoxScrollUpOnCollectionChangeTest.java line 144:
>
>> 142: double rowHeight = ContextMenuContentShim.getContextMenuRowHeight(popup);
>> 143: double screenHeight = Screen.getPrimary().getBounds().getHeight();
>> 144: scrollChoiceBox((int) (screenHeight / rowHeight));
>
> This seems to work, but it might be more robust to use `Math.ceil()` before casting to int, especially if you make the change to use the visual bounds.
Updated code to use `Math.ceil()`
-------------
PR: https://git.openjdk.org/jfx/pull/1039
More information about the openjfx-dev
mailing list