]> git.saurik.com Git - wxWidgets.git/commitdiff
Test wxPropertyGrid::DoubleToString()
authorJaakko Salli <jaakko.salli@dnainternet.net>
Mon, 27 Dec 2010 11:25:53 +0000 (11:25 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Mon, 27 Dec 2010 11:25:53 +0000 (11:25 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66457 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

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;