Menu

#577 Negative values for "Foot/Inch/Fraction" are not formatted correctly

v_4.x
closed
None
5
2015-10-06
2015-02-08
No

Steps to reproduce:

  1. Open preferences and select unit "Foot/Inch/Fraction"
  2. Create a wall starting at 0':0'
  3. Open the wall editor and decrease the X value of the starting point using the spinner.

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().

Discussion

  • Emmanuel Puybaret

    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. :-)

     
  • Tobias Liefke

    Tobias Liefke - 2015-02-08

    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.

     
  • Emmanuel Puybaret

    Fixed in version 5.0

     
  • Emmanuel Puybaret

    • status: open --> closed
     

Log in to post a comment.