RFR: 8129123: ComboBox popup list view does not scrollTo when ComboBox value/selection is set

Jeanette Winzenburg fastegal at openjdk.java.net
Fri Apr 3 12:06:51 UTC 2020


On Thu, 2 Apr 2020 23:28:19 GMT, Craig Cavanaugh <github.com+636962+ccavanaugh at openjdk.org> wrote:

>> Can you please provide a unit test? One that fails before your fix and passes after your fix.
>
>> Can you please provide a unit test? One that fails before your fix and passes after your fix.
> 
> I can provide a manual test the next couple of days that demonstrates it before and after, but I'm not sure how to
> create an automated unit test because the issue is visual.

A quick snippet of how-to write a unit test (for setup see other tests in controls) that will fail before and  pass
after the change:

    @Test
    public void testScrollInSkin() {
        int index = 50;
        comboBox.getSelectionModel().select(index);
        comboBox.show();
        VirtualFlow<IndexedCell<?>> virtualFlow = getFlow();
        int first = virtualFlow.getFirstVisibleCell().getIndex();
        int last = virtualFlow.getLastVisibleCell().getIndex();
        assertTrue(" visible range [" + first + ", " + last + "] must include " + index,
                first <= index  && index <= last);
    }

    protected VirtualFlow<IndexedCell<?>> getFlow() {
        VirtualFlow<IndexedCell<?>> virtualFlow = (VirtualFlow<IndexedCell<?>>)
                VirtualFlowTestUtils.getVirtualFlow(comboBox);
        return virtualFlow;
    }

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

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


More information about the openjfx-dev mailing list