]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/propgrid/tests.cpp
Test wxPropertyGrid::DoubleToString()
[wxWidgets.git] / samples / propgrid / tests.cpp
index 3eafa29d971afd5ef0c84bf2864d849d0754009d..9ab65f06ee48d2efdd5f28b92ef1969250587add 100644 (file)
@@ -878,6 +878,27 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
             RT_FAILURE();
     }
 
+    {
+        RT_START_TEST(DoubleToString)
+
+        // Locale-specific decimal separator
+        wxString sep = wxString::Format("%g", 1.1)[1];
+
+        wxString s;
+
+        if ( wxPropertyGrid::DoubleToString(s, 123.123, 2, true) !=
+                wxString::Format("123%s12", sep.c_str()) )
+            RT_FAILURE();
+        if ( wxPropertyGrid::DoubleToString(s, -123.123, 4, false) !=
+                wxString::Format("-123%s1230", sep.c_str()) )
+            RT_FAILURE();
+        if ( wxPropertyGrid::DoubleToString(s, -0.02, 1, false) !=
+                wxString::Format("0%s0", sep) )
+            RT_FAILURE();
+        if ( wxPropertyGrid::DoubleToString(s, -0.000123, 3, true) != "0" )
+            RT_FAILURE();
+    }
+
     {
         wxPropertyGridPage* page1;
         wxPropertyGridPage* page2;