Index: test/unit/lib/redmine/i18n_test.rb =================================================================== --- test/unit/lib/redmine/i18n_test.rb (révision 3905) +++ test/unit/lib/redmine/i18n_test.rb (copie de travail) @@ -259,4 +259,41 @@ end assert_equal str_fr, l(:general_lang_name) end + + def test_localize_hours_truncate_decimals_if_integer + set_language_if_valid 'fr' + + assert_equal "121.50 heures", l_hours('121.49999') + + # Decimals rounded to 2 after the decimal point + assert_equal "122.45 heures", l_hours('122.4521') + + # Rounded to upper value + assert_equal "123.46 heures", l_hours('123.458') + + assert_equal "124 heures", l_hours('124.0') + + assert_equal "125 heures", l_hours('125.00') + + assert_equal "126 heures", l_hours('126.0000') + + # Far decimals disappear in the rounding + assert_equal "455 heures", l_hours('455.00001') + + # Rounded to upper value + assert_equal "456 heures", l_hours('455.999999') + + set_language_if_valid('en') + end + + def test_localize_negative_hours + set_language_if_valid 'fr' + + assert_equal "-1 heure", l_hours('-1.00001') + assert_equal "-1.46 heure", l_hours('-1.456') + assert_equal "-457 heures", l_hours('-457.00001') + assert_equal "-459 heures", l_hours('-458.99999') + + set_language_if_valid('en') + end end