Negative values for "Foot/Inch/Fraction" are not formatted correctly
An interior design application to draw house plans & arrange furniture
Brought to you by:
puybaret
Steps to reproduce:
Expected behavior:
The next smaller value after 0'
is -0'0⅛"
Current behavior:
The next smaller value after 0'
is -1'11⅞"
If you just try to enter -0'0⅛"
it is changed to +0'0⅛"
Analysis:
Apparently the custom lengthFormat in LengthUnit.INCH.checkLocaleChange() is not expecting negative values. You can either change the implementation to work with negative values as well, or you just use the absolute value and add / remove the '-' separately in format()/parse().
Wow, how could I neglect negative values???
I fixed the LengthUnit.INCH class, and modified the JUnit test that tests conversion/parsing accordingly.
Thanks for reporting this issue. :-)
Maybe the name of the class LengthUnit was misleading - how could a length be negative (but I think it is the best name for its purpose). And if you look at the tooltip of a wall for example: it will never show a negative length. So it's easy to forget about negative values.
And as my plugin had a problem with INCH as well, which was just reported last week - I would assume that only a small amount of users has chosen that unit and ever encountered the problem.
Fixed in version 5.0