From: Jaakko Salli Date: Mon, 27 Dec 2010 11:25:53 +0000 (+0000) Subject: Test wxPropertyGrid::DoubleToString() X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/6ea6c5127ce319a7dfeff43b4ff238e63bc825bb Test wxPropertyGrid::DoubleToString() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66457 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/samples/propgrid/tests.cpp b/samples/propgrid/tests.cpp index 3eafa29d97..9ab65f06ee 100644 --- a/samples/propgrid/tests.cpp +++ b/samples/propgrid/tests.cpp @@ -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;