RFR: 8242553: IntegerSpinner and DoubleSpinner do not wrap around values correctly in some cases
Andy Goryachev
angorya at openjdk.org
Wed Mar 27 15:20:26 UTC 2024
On Sun, 24 Mar 2024 15:11:16 GMT, drmarmac <duke at 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.
If everyone is ok with modulo arithmetic.
Please clarify the expected behavior in the case of an integer spinner with {min=0; max=100; amountToStepBy=101} and initial value of 0. What should the increment action result in?
(0 + 101) % (100 - 0) + 0 = 1
the code in this PR produces no movement (0). Same for the decrement.
Is this correct?
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1431#issuecomment-2023034904
More information about the openjfx-dev
mailing list