]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/config/fileconf.cpp
Resolve ambiguity between GetClientXXX() methods in wxOSX wxComboBox.
[wxWidgets.git] / tests / config / fileconf.cpp
index d1cd56b40d2157ea8f08e0b5923975c734d747e0..7a9c2d73f6df23713f1fde6591a9e1da94754af5 100644 (file)
@@ -81,6 +81,8 @@ private:
         CPPUNIT_TEST( DeleteAndRecreateGroup );
         CPPUNIT_TEST( AddToExistingRoot );
         CPPUNIT_TEST( ReadNonExistent );
+        CPPUNIT_TEST( ReadEmpty );
+        CPPUNIT_TEST( ReadFloat );
     CPPUNIT_TEST_SUITE_END();
 
     void Path();
@@ -103,6 +105,8 @@ private:
     void DeleteAndRecreateGroup();
     void AddToExistingRoot();
     void ReadNonExistent();
+    void ReadEmpty();
+    void ReadFloat();
 
 
     static wxString ChangePath(wxFileConfig& fc, const wxChar *path)
@@ -127,7 +131,7 @@ private:
 // register in the unnamed registry so that these tests are run by default
 CPPUNIT_TEST_SUITE_REGISTRATION( FileConfigTestCase );
 
-// also include in it's own registry so that these tests can be run alone
+// also include in its own registry so that these tests can be run alone
 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( FileConfigTestCase, "FileConfigTestCase" );
 
 void FileConfigTestCase::Path()
@@ -649,5 +653,32 @@ void FileConfigTestCase::ReadNonExistent()
     CPPUNIT_ASSERT( !fc.Read("URL", &url) );
 }
 
+void FileConfigTestCase::ReadEmpty()
+{
+    static const char *confTest = "";
+
+    wxStringInputStream sis(confTest);
+    wxFileConfig fc(sis);
+}
+
+void FileConfigTestCase::ReadFloat()
+{
+    static const char *confTest =
+        "x=1.234\n"
+        "y=-9876.5432\n"
+        "z=2e+308\n"
+    ;
+
+    wxStringInputStream sis(confTest);
+    wxFileConfig fc(sis);
+
+    float f;
+    CPPUNIT_ASSERT( fc.Read("x", &f) );
+    CPPUNIT_ASSERT_EQUAL( 1.234f, f );
+
+    CPPUNIT_ASSERT( fc.Read("y", &f) );
+    CPPUNIT_ASSERT_EQUAL( -9876.5432f, f );
+}
+
 #endif // wxUSE_FILECONFIG