On Sun, 24 Mar 2024 15:11:16 GMT, drmarmac <d...@openjdk.org> wrote:

> This PR should fix the issue and cover all relevant cases with new tests.
> 
> Note: This involves a small behavior change, as can be seen in 
> dblSpinner_testWrapAround_decrement_twoSteps() in SpinnerTest.java:749. With 
> this change the wraparound behavior is similar to that of the IntegerSpinner.

The code, as currently suggested, effectively calculates `x(i+1) = (x(i) + 
amountToStepBy) MOD (max - min + 1)`.
I'd say this is the modulo value we actually want, because x=min and x=max 
should both be included. Look at a simpler example, which would not work with a 
`MOD (max-min)` formula:

min=0; max=2; amountToStepBy=1, initial=0 => 0, 1, 2, 0, 1, ...
min=0; max=2; amountToStepBy=2, initial=0 => 0, 2, 0, 2, 0, ...
min=0; max=2; amountToStepBy=3, initial=0 => 0, 0, 0, 0, 0, ...
min=0; max=2; amountToStepBy=4, initial=0 => 0, 1, 2, 0, 1, ...


So your example should result in `min=0; max=100; amountToStepBy=101, initial=0 
=> 0, 0, 0, 0...`, which it currently does.

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

PR Comment: https://git.openjdk.org/jfx/pull/1431#issuecomment-2023513947

Reply via email to