]> git.saurik.com Git - wxWidgets.git/commitdiff
Unicode logic fixes for AddEntries
authorRyan Norton <wxprojects@comcast.net>
Sun, 21 Nov 2004 19:21:17 +0000 (19:21 +0000)
committerRyan Norton <wxprojects@comcast.net>
Sun, 21 Nov 2004 19:21:17 +0000 (19:21 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30683 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

tests/fileconf/fileconftest.cpp

index 7b8216b75ed542b68bbfd6c354669c55e32e8eb6..766e2accaf4ea098ec78f99a7fab249d1bc89043 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "wx/fileconf.h"
 #include "wx/sstream.h"
+#include "wx/wfstream.h"
 
 #include "wx/cppunit.h"
 
@@ -44,7 +45,9 @@ _T("[root/group2]\n")
 class FileConfigTestCase : public CppUnit::TestCase
 {
 public:
-    FileConfigTestCase() { }
+    FileConfigTestCase() 
+    {
+    }
 
 private:
     CPPUNIT_TEST_SUITE( FileConfigTestCase );
@@ -84,9 +87,23 @@ private:
 
     static wxString Dump(wxFileConfig& fc)
     {
-        wxStringOutputStream sos;
-        fc.Save(sos);
-        return wxTextFile::Translate(sos.GetString(), wxTextFileType_Unix);
+        wxFileOutputStream* pOutFile = new wxFileOutputStream(_T("outconf.txt"));
+        fc.Save(*pOutFile);
+        delete pOutFile;
+
+        wxFileInputStream* pInFile = new wxFileInputStream(_T("outconf.txt"));
+        char* szOut = new char[pInFile->GetSize()];
+        pInFile->Read(szOut, pInFile->GetSize());
+
+        wxString realString = wxTextFile::Translate(
+                                     wxString(szOut, wxConvLocal, pInFile->GetSize()), 
+                                     wxTextFileType_Unix
+                                                   );
+
+        delete szOut;
+        delete pInFile;
+
+        return realString;
     }
 
     void CheckGroupEntries(const wxFileConfig& fc,