RFR: 8090158: Wrong implementation of adjustValue in scrollBars
Ajit Ghaisas
aghaisas at openjdk.java.net
Tue Aug 24 11:20:25 UTC 2021
On Tue, 20 Jul 2021 09:12:05 GMT, Hadzic Samir <shadzic at openjdk.org> wrote:
> JBS bug: [JDK-8090158](https://bugs.openjdk.java.net/browse/JDK-8090158)
>
> The javadoc of the ScrollBar#adjustValue specifically says that it will adjust the value based on the block increment value. Therefore, there is no reason to stop at the given value when reaching an end.
Fix looks good.
I have few minor comments on the newly added unit tests.
modules/javafx.controls/src/test/java/test/javafx/scene/control/ScrollBarTest.java line 429:
> 427: scrollBar.setValue(90.0);
> 428: scrollBar.adjustValue(0.95); //This should block increment to the max value
> 429: assertEquals(scrollBar.getValue(), 100.0, 0.0);
Minor : First two parameters to assertEquals are - expected value and actual value respectively.
You should reorder scrollBar.getValue() and 100.0.
modules/javafx.controls/src/test/java/test/javafx/scene/control/ScrollBarTest.java line 442:
> 440: scrollBar.setMax(100.0);
> 441: scrollBar.setValue(10.0);
> 442: scrollBar.adjustValue(0.05); //This should block increment to the max value
Comment needs correction: This should decrement to the min value
modules/javafx.controls/src/test/java/test/javafx/scene/control/ScrollBarTest.java line 443:
> 441: scrollBar.setValue(10.0);
> 442: scrollBar.adjustValue(0.05); //This should block increment to the max value
> 443: assertEquals(scrollBar.getValue(), 0.0, 0.0);
Minor : First two parameters to assertEquals are - expected value and actual value respectively.
You should reorder scrollBar.getValue() and 0.0.
-------------
PR: https://git.openjdk.java.net/jfx/pull/582
More information about the openjfx-dev
mailing list