From 0aa29b6bfb8a2c83e51a24617e3d1ae3c88fe2d9 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 30 Nov 2003 13:53:04 +0000 Subject: [PATCH] added wxRegConfig read test git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24687 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/console/console.cpp | 46 +++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/samples/console/console.cpp b/samples/console/console.cpp index 12fe283cf4..0348bc8b30 100644 --- a/samples/console/console.cpp +++ b/samples/console/console.cpp @@ -74,6 +74,7 @@ #define TEST_PRINTF #define TEST_REGCONF #define TEST_REGEX + #define TEST_REGEX #define TEST_REGISTRY #define TEST_SCOPEGUARD #define TEST_SNGLINST @@ -93,9 +94,7 @@ #undef TEST_ALL static const bool TEST_ALL = true; #else - #define TEST_HASH - #define TEST_HASHMAP - #define TEST_HASHSET + #define TEST_FILENAME static const bool TEST_ALL = false; #endif @@ -1061,6 +1060,11 @@ static void TestFileNameMakeAbsolute() wxPuts(_T("")); } +static void TestFileNameDirManip() +{ + // TODO: test AppendDir(), RemoveDir(), ... +} + static void TestFileNameComparison() { // TODO! @@ -3216,8 +3220,27 @@ rfg2 (void) static void TestRegConfWrite() { - wxRegConfig regconf(_T("console"), _T("wxwindows")); - regconf.Write(_T("Hello"), wxString(_T("world"))); + wxConfig *config = new wxConfig("myapp"); + config->SetPath("/group1"); + config->Write("entry1", "foo"); + config->SetPath("/group2"); + config->Write("entry1", "bar"); +} + +static void TestRegConfRead() +{ + wxConfig *config = new wxConfig("myapp"); + + wxString str; + long dummy; + config->SetPath("/"); + puts("Enumerating / subgroups:"); + bool bCont = config->GetFirstGroup(str, dummy); + while(bCont) + { + puts(str); + bCont = config->GetNextGroup(str, dummy); + } } #endif // TEST_REGCONF @@ -7229,15 +7252,6 @@ int main(int argc, char **argv) #endif // TEST_FILE #ifdef TEST_FILENAME - if ( 1 ) - { - wxFileName fn(_T("c:\\foo"), _T("bar.baz")); - DumpFileName(_T("Before Normalize():"), fn); - - fn.Normalize(); - DumpFileName(_T("After Normalize():"), fn); - } - if ( TEST_ALL ) { TestFileNameConstruction(); @@ -7246,6 +7260,7 @@ int main(int argc, char **argv) TestFileNameSplit(); TestFileNameTemp(); TestFileNameCwd(); + TestFileNameDirManip(); TestFileNameComparison(); TestFileNameOperations(); } @@ -7348,7 +7363,8 @@ int main(int argc, char **argv) #endif // TEST_PRINTF #ifdef TEST_REGCONF - TestRegConfWrite(); + //TestRegConfWrite(); + TestRegConfRead(); #endif // TEST_REGCONF #ifdef TEST_REGEX -- 2.45.2