[gnome-calculator] Add Rack Units to the unit conversions



commit 25301eacafda4cc1f0c416683ab16c652f69e33d
Author: Robert Roth <robert roth off gmail com>
Date:   Thu Jan 30 23:27:31 2020 +0000

    Add Rack Units to the unit conversions

 lib/unit.vala            | 1 +
 tests/test-equation.vala | 2 ++
 2 files changed, 3 insertions(+)
---
diff --git a/lib/unit.vala b/lib/unit.vala
index a211a769..edc67a96 100644
--- a/lib/unit.vala
+++ b/lib/unit.vala
@@ -42,6 +42,7 @@ public class UnitManager : Object
         length_category.add_unit (new Unit ("parsec", _("Parsecs"), dpgettext2 (null, "unit-format", "%s 
pc"), "30857000000000000x", "x/30857000000000000", dpgettext2 (null, "unit-symbols", "parsec,parsecs,pc")));
         length_category.add_unit (new Unit ("lightyear", _("Light Years"), dpgettext2 (null, "unit-format", 
"%s ly"), "9460730472580800x", "x/9460730472580800", dpgettext2 (null, "unit-symbols", 
"lightyear,lightyears,ly")));
         length_category.add_unit (new Unit ("astronomical-unit", _("Astronomical Units"), dpgettext2 (null, 
"unit-format", "%s au"), "149597870691x", "x/149597870691", dpgettext2 (null, "unit-symbols", "au")));
+        length_category.add_unit (new Unit ("rack-unit", _("Rack Units"), dpgettext2 (null, "unit-format", 
"%sU"), "x/22.49718785151856", "22.49718785151856x", dpgettext2 (null, "unit-symbols", "U")));
         length_category.add_unit (new Unit ("nautical-mile", _("Nautical Miles"), dpgettext2 (null, 
"unit-format", "%s nmi"), "1852x", "x/1852", dpgettext2 (null, "unit-symbols", "nmi")));
         length_category.add_unit (new Unit ("mile", _("Miles"), dpgettext2 (null, "unit-format", "%s mi"), 
"1609.344x", "x/1609.344", dpgettext2 (null, "unit-symbols", "mile,miles,mi")));
         length_category.add_unit (new Unit ("kilometer", _("Kilometers"), dpgettext2 (null, "unit-format", 
"%s km"), "1000x", "x/1000", dpgettext2 (null, "unit-symbols", "kilometer,kilometers,km,kms")));
diff --git a/tests/test-equation.vala b/tests/test-equation.vala
index 80a86d87..cc4e6db4 100644
--- a/tests/test-equation.vala
+++ b/tests/test-equation.vala
@@ -136,6 +136,8 @@ private void test_conversions ()
     test ("1 meter in mm", "1000", 0);
     test ("1m in mm", "1000", 0);
     test ("1 inch in cm", "2.54", 0);
+    test ("44.45 mm in U", "1", 0);
+    test ("1 U in inch", "1.75", 0);
 
     /* Area */
     test ("1m² in mm²", "1000000", 0);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]