X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/35c4b4da0a28029dc841147ef6fd183b87d2cc8f..59a14f698460525b36e6a6e63876e1a6723865b4:/tests/fileconf/fileconftest.cpp diff --git a/tests/fileconf/fileconftest.cpp b/tests/fileconf/fileconftest.cpp index fa10884e15..6f4aa5ff53 100644 --- a/tests/fileconf/fileconftest.cpp +++ b/tests/fileconf/fileconftest.cpp @@ -76,6 +76,7 @@ private: CPPUNIT_TEST( CreateEntriesAndSubgroup ); CPPUNIT_TEST( CreateSubgroupAndEntries ); CPPUNIT_TEST( DeleteLastGroup ); + CPPUNIT_TEST( DeleteAndRecreateGroup ); CPPUNIT_TEST_SUITE_END(); void Path(); @@ -93,6 +94,7 @@ private: void CreateEntriesAndSubgroup(); void CreateSubgroupAndEntries(); void DeleteLastGroup(); + void DeleteAndRecreateGroup(); static wxString ChangePath(wxFileConfig& fc, const wxChar *path) { @@ -512,5 +514,29 @@ void FileConfigTestCase::DeleteLastGroup() (void) ::wxRemoveFile(wxFileConfig::GetLocalFileName(_T("deleteconftest"))); } +void FileConfigTestCase::DeleteAndRecreateGroup() +{ + static const wxChar *confInitial = + _T("[First]\n") + _T("Value1=Foo\n") + _T("[Second]\n") + _T("Value2=Bar\n"); + + wxStringInputStream sis(confInitial); + wxFileConfig fc(sis); + + fc.DeleteGroup(_T("Second")); + wxVERIFY_FILECONFIG( _T("[First]\n") + _T("Value1=Foo\n"), + fc ); + + fc.Write(_T("Second/Value2"), _T("New")); + wxVERIFY_FILECONFIG( _T("[First]\n") + _T("Value1=Foo\n") + _T("[Second]\n") + _T("Value2=New\n"), + fc ); +} + #endif // wxUSE_FILECONFIG