diff --git a/samples/console/console.cpp b/samples/console/console.cpp
index b1e455d071..0a7d991fe8 100644
--- a/samples/console/console.cpp
+++ b/samples/console/console.cpp
@@ -120,9 +120,7 @@
#define TEST_MODULE
#define TEST_PATHLIST
#define TEST_PRINTF
- #define TEST_REGCONF
#define TEST_REGEX
- #define TEST_REGISTRY
#else // #if TEST_ALL
#define TEST_DATETIME
#define TEST_VOLUME
@@ -1927,155 +1925,6 @@ rfg2 (void)
#endif // TEST_PRINTF
-// ----------------------------------------------------------------------------
-// registry and related stuff
-// ----------------------------------------------------------------------------
-
-// this is for MSW only
-#ifndef __WXMSW__
- #undef TEST_REGCONF
- #undef TEST_REGISTRY
-#endif
-
-#ifdef TEST_REGCONF
-
-#include "wx/confbase.h"
-#include "wx/msw/regconf.h"
-
-#if 0
-static void TestRegConfWrite()
-{
- wxConfig *config = new wxConfig(wxT("myapp"));
- config->SetPath(wxT("/group1"));
- config->Write(wxT("entry1"), wxT("foo"));
- config->SetPath(wxT("/group2"));
- config->Write(wxT("entry1"), wxT("bar"));
-}
-#endif
-
-static void TestRegConfRead()
-{
- wxRegConfig *config = new wxRegConfig(wxT("myapp"));
-
- wxString str;
- long dummy;
- config->SetPath(wxT("/"));
- wxPuts(wxT("Enumerating / subgroups:"));
- bool bCont = config->GetFirstGroup(str, dummy);
- while(bCont)
- {
- wxPuts(str);
- bCont = config->GetNextGroup(str, dummy);
- }
-}
-
-#endif // TEST_REGCONF
-
-#ifdef TEST_REGISTRY
-
-#include "wx/msw/registry.h"
-
-// I chose this one because I liked its name, but it probably only exists under
-// NT
-static const wxChar *TESTKEY =
- wxT("HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\Control\\CrashControl");
-
-static void TestRegistryRead()
-{
- wxPuts(wxT("*** testing registry reading ***"));
-
- wxRegKey key(TESTKEY);
- wxPrintf(wxT("The test key name is '%s'.\n"), key.GetName().c_str());
- if ( !key.Open() )
- {
- wxPuts(wxT("ERROR: test key can't be opened, aborting test."));
-
- return;
- }
-
- size_t nSubKeys, nValues;
- if ( key.GetKeyInfo(&nSubKeys, NULL, &nValues, NULL) )
- {
- wxPrintf(wxT("It has %u subkeys and %u values.\n"), nSubKeys, nValues);
- }
-
- wxPrintf(wxT("Enumerating values:\n"));
-
- long dummy;
- wxString value;
- bool cont = key.GetFirstValue(value, dummy);
- while ( cont )
- {
- wxPrintf(wxT("Value '%s': type "), value.c_str());
- switch ( key.GetValueType(value) )
- {
- case wxRegKey::Type_None: wxPrintf(wxT("ERROR (none)")); break;
- case wxRegKey::Type_String: wxPrintf(wxT("SZ")); break;
- case wxRegKey::Type_Expand_String: wxPrintf(wxT("EXPAND_SZ")); break;
- case wxRegKey::Type_Binary: wxPrintf(wxT("BINARY")); break;
- case wxRegKey::Type_Dword: wxPrintf(wxT("DWORD")); break;
- case wxRegKey::Type_Multi_String: wxPrintf(wxT("MULTI_SZ")); break;
- default: wxPrintf(wxT("other (unknown)")); break;
- }
-
- wxPrintf(wxT(", value = "));
- if ( key.IsNumericValue(value) )
- {
- long val;
- key.QueryValue(value, &val);
- wxPrintf(wxT("%ld"), val);
- }
- else // string
- {
- wxString val;
- key.QueryValue(value, val);
- wxPrintf(wxT("'%s'"), val.c_str());
-
- key.QueryRawValue(value, val);
- wxPrintf(wxT(" (raw value '%s')"), val.c_str());
- }
-
- wxPutchar('\n');
-
- cont = key.GetNextValue(value, dummy);
- }
-}
-
-static void TestRegistryAssociation()
-{
- /*
- The second call to deleteself genertaes an error message, with a
- messagebox saying .flo is crucial to system operation, while the .ddf
- call also fails, but with no error message
- */
-
- wxRegKey key;
-
- key.SetName(wxT("HKEY_CLASSES_ROOT\\.ddf") );
- key.Create();
- key = wxT("ddxf_auto_file") ;
- key.SetName(wxT("HKEY_CLASSES_ROOT\\.flo") );
- key.Create();
- key = wxT("ddxf_auto_file") ;
- key.SetName(wxT("HKEY_CLASSES_ROOT\\ddxf_auto_file\\DefaultIcon"));
- key.Create();
- key = wxT("program,0") ;
- key.SetName(wxT("HKEY_CLASSES_ROOT\\ddxf_auto_file\\shell\\open\\command"));
- key.Create();
- key = wxT("program \"%1\"") ;
-
- key.SetName(wxT("HKEY_CLASSES_ROOT\\.ddf") );
- key.DeleteSelf();
- key.SetName(wxT("HKEY_CLASSES_ROOT\\.flo") );
- key.DeleteSelf();
- key.SetName(wxT("HKEY_CLASSES_ROOT\\ddxf_auto_file\\DefaultIcon"));
- key.DeleteSelf();
- key.SetName(wxT("HKEY_CLASSES_ROOT\\ddxf_auto_file\\shell\\open\\command"));
- key.DeleteSelf();
-}
-
-#endif // TEST_REGISTRY
-
// ----------------------------------------------------------------------------
// FTP
// ----------------------------------------------------------------------------
@@ -2621,22 +2470,10 @@ int main(int argc, char **argv)
TestPrintf();
#endif // TEST_PRINTF
-#ifdef TEST_REGCONF
- #if 0
- TestRegConfWrite();
- #endif
- TestRegConfRead();
-#endif // TEST_REGCONF
-
#if defined TEST_REGEX && TEST_INTERACTIVE
TestRegExInteractive();
#endif // defined TEST_REGEX && TEST_INTERACTIVE
-#ifdef TEST_REGISTRY
- TestRegistryRead();
- TestRegistryAssociation();
-#endif // TEST_REGISTRY
-
#ifdef TEST_DATETIME
#if TEST_INTERACTIVE
TestDateTimeInteractive();
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 3fc0cd9d42..04af2f1b25 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -62,6 +62,7 @@ TEST_OBJECTS = \
test_base64.o \
test_cmdlinetest.o \
test_fileconf.o \
+ test_regconf.o \
test_datetimetest.o \
test_evthandler.o \
test_evtsource.o \
@@ -382,6 +383,9 @@ test_cmdlinetest.o: $(srcdir)/cmdline/cmdlinetest.cpp $(TEST_ODEP)
test_fileconf.o: $(srcdir)/config/fileconf.cpp $(TEST_ODEP)
$(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/config/fileconf.cpp
+test_regconf.o: $(srcdir)/config/regconf.cpp $(TEST_ODEP)
+ $(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/config/regconf.cpp
+
test_datetimetest.o: $(srcdir)/datetime/datetimetest.cpp $(TEST_ODEP)
$(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/datetime/datetimetest.cpp
diff --git a/tests/config/config.cpp b/tests/config/config.cpp
index 1f2d22470d..dad0dd2a4b 100644
--- a/tests/config/config.cpp
+++ b/tests/config/config.cpp
@@ -7,7 +7,10 @@
// Copyright: (c) 2007 Marcin Wojdyr
///////////////////////////////////////////////////////////////////////////////
-// see also tests/fileconf/fileconftest.cpp for wxFileConfig specific tests
+// NOTE: this test is compiled in test_gui because it uses wxColour for
+// its testing purpose.
+// See also tests/config/fileconf.cpp for wxFileConfig specific tests and
+// tests/config/regconf.cpp for wxRegConfig specific tests.
// ----------------------------------------------------------------------------
// headers
diff --git a/tests/config/regconf.cpp b/tests/config/regconf.cpp
new file mode 100644
index 0000000000..1994823ee1
--- /dev/null
+++ b/tests/config/regconf.cpp
@@ -0,0 +1,85 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name: tests/config/regconf.cpp
+// Purpose: wxRegConfig unit test
+// Author: Francesco Montorsi (extracted from console sample)
+// Created: 2010-06-02
+// RCS-ID: $Id$
+// Copyright: (c) 2010 wxWidgets team
+///////////////////////////////////////////////////////////////////////////////
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "testprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#if wxUSE_CONFIG && wxUSE_REGKEY
+
+#ifndef WX_PRECOMP
+#endif // WX_PRECOMP
+
+#include "wx/msw/regconf.h"
+
+// ----------------------------------------------------------------------------
+// test class
+// ----------------------------------------------------------------------------
+
+class RegConfigTestCase : public CppUnit::TestCase
+{
+public:
+ RegConfigTestCase() { }
+
+private:
+ CPPUNIT_TEST_SUITE( RegConfigTestCase );
+ CPPUNIT_TEST( ReadWrite );
+ CPPUNIT_TEST_SUITE_END();
+
+ void ReadWrite();
+
+ DECLARE_NO_COPY_CLASS(RegConfigTestCase)
+};
+
+// register in the unnamed registry so that these tests are run by default
+CPPUNIT_TEST_SUITE_REGISTRATION( RegConfigTestCase );
+
+// also include in it's own registry so that these tests can be run alone
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( RegConfigTestCase, "RegConfigTestCase" );
+
+void RegConfigTestCase::ReadWrite()
+{
+ wxString app = wxT("wxRegConfigTestCase");
+ wxString vendor = wxT("wxWidgets");
+
+ // NOTE: we use wxCONFIG_USE_LOCAL_FILE explicitly to test wxRegConfig
+ // with something different from the default value wxCONFIG_USE_GLOBAL_FILE
+ wxConfigBase *config = new wxRegConfig(app, vendor, wxT(""), wxT(""),
+ wxCONFIG_USE_LOCAL_FILE);
+
+ // test writing
+ config->SetPath(wxT("/group1"));
+ CPPUNIT_ASSERT( config->Write(wxT("entry1"), wxT("foo")) );
+ config->SetPath(wxT("/group2"));
+ CPPUNIT_ASSERT( config->Write(wxT("entry1"), wxT("bar")) );
+
+ // test reading
+ wxString str;
+ long dummy;
+
+ config->SetPath(wxT("/"));
+ CPPUNIT_ASSERT( config->GetFirstGroup(str, dummy) );
+ CPPUNIT_ASSERT( str == "group1" );
+ CPPUNIT_ASSERT( config->Read(wxT("group1/entry1"), wxT("INVALID DEFAULT")) == "foo" );
+ CPPUNIT_ASSERT( config->GetNextGroup(str, dummy) );
+ CPPUNIT_ASSERT( str == "group2" );
+ CPPUNIT_ASSERT( config->Read(wxT("group2/entry1"), wxT("INVALID DEFAULT")) == "bar" );
+
+ config->DeleteAll();
+ delete config;
+}
+
+#endif // wxUSE_CONFIG && wxUSE_REGKEY
+
diff --git a/tests/makefile.bcc b/tests/makefile.bcc
index fe93077865..bfc3d4729f 100644
--- a/tests/makefile.bcc
+++ b/tests/makefile.bcc
@@ -46,6 +46,7 @@ TEST_OBJECTS = \
$(OBJS)\test_base64.obj \
$(OBJS)\test_cmdlinetest.obj \
$(OBJS)\test_fileconf.obj \
+ $(OBJS)\test_regconf.obj \
$(OBJS)\test_datetimetest.obj \
$(OBJS)\test_evthandler.obj \
$(OBJS)\test_evtsource.obj \
@@ -424,6 +425,9 @@ $(OBJS)\test_cmdlinetest.obj: .\cmdline\cmdlinetest.cpp
$(OBJS)\test_fileconf.obj: .\config\fileconf.cpp
$(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) .\config\fileconf.cpp
+$(OBJS)\test_regconf.obj: .\config\regconf.cpp
+ $(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) .\config\regconf.cpp
+
$(OBJS)\test_datetimetest.obj: .\datetime\datetimetest.cpp
$(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) .\datetime\datetimetest.cpp
diff --git a/tests/makefile.gcc b/tests/makefile.gcc
index f93cc1b112..a6bff86db0 100644
--- a/tests/makefile.gcc
+++ b/tests/makefile.gcc
@@ -38,6 +38,7 @@ TEST_OBJECTS = \
$(OBJS)\test_base64.o \
$(OBJS)\test_cmdlinetest.o \
$(OBJS)\test_fileconf.o \
+ $(OBJS)\test_regconf.o \
$(OBJS)\test_datetimetest.o \
$(OBJS)\test_evthandler.o \
$(OBJS)\test_evtsource.o \
@@ -405,6 +406,9 @@ $(OBJS)\test_cmdlinetest.o: ./cmdline/cmdlinetest.cpp
$(OBJS)\test_fileconf.o: ./config/fileconf.cpp
$(CXX) -c -o $@ $(TEST_CXXFLAGS) $(CPPDEPS) $<
+$(OBJS)\test_regconf.o: ./config/regconf.cpp
+ $(CXX) -c -o $@ $(TEST_CXXFLAGS) $(CPPDEPS) $<
+
$(OBJS)\test_datetimetest.o: ./datetime/datetimetest.cpp
$(CXX) -c -o $@ $(TEST_CXXFLAGS) $(CPPDEPS) $<
diff --git a/tests/makefile.vc b/tests/makefile.vc
index 0b787b683a..ec487a111a 100644
--- a/tests/makefile.vc
+++ b/tests/makefile.vc
@@ -40,6 +40,7 @@ TEST_OBJECTS = \
$(OBJS)\test_base64.obj \
$(OBJS)\test_cmdlinetest.obj \
$(OBJS)\test_fileconf.obj \
+ $(OBJS)\test_regconf.obj \
$(OBJS)\test_datetimetest.obj \
$(OBJS)\test_evthandler.obj \
$(OBJS)\test_evtsource.obj \
@@ -550,6 +551,9 @@ $(OBJS)\test_cmdlinetest.obj: .\cmdline\cmdlinetest.cpp
$(OBJS)\test_fileconf.obj: .\config\fileconf.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) .\config\fileconf.cpp
+$(OBJS)\test_regconf.obj: .\config\regconf.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) .\config\regconf.cpp
+
$(OBJS)\test_datetimetest.obj: .\datetime\datetimetest.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) .\datetime\datetimetest.cpp
diff --git a/tests/makefile.wat b/tests/makefile.wat
index 90a8887763..c530ed3563 100644
--- a/tests/makefile.wat
+++ b/tests/makefile.wat
@@ -276,6 +276,7 @@ TEST_OBJECTS = &
$(OBJS)\test_base64.obj &
$(OBJS)\test_cmdlinetest.obj &
$(OBJS)\test_fileconf.obj &
+ $(OBJS)\test_regconf.obj &
$(OBJS)\test_datetimetest.obj &
$(OBJS)\test_evthandler.obj &
$(OBJS)\test_evtsource.obj &
@@ -462,6 +463,9 @@ $(OBJS)\test_cmdlinetest.obj : .AUTODEPEND .\cmdline\cmdlinetest.cpp
$(OBJS)\test_fileconf.obj : .AUTODEPEND .\config\fileconf.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_CXXFLAGS) $<
+$(OBJS)\test_regconf.obj : .AUTODEPEND .\config\regconf.cpp
+ $(CXX) -bt=nt -zq -fo=$^@ $(TEST_CXXFLAGS) $<
+
$(OBJS)\test_datetimetest.obj : .AUTODEPEND .\datetime\datetimetest.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_CXXFLAGS) $<
diff --git a/tests/test.bkl b/tests/test.bkl
index 34e0e723c1..d2b98b8df8 100644
--- a/tests/test.bkl
+++ b/tests/test.bkl
@@ -37,6 +37,7 @@
base64/base64.cpp
cmdline/cmdlinetest.cpp
config/fileconf.cpp
+ config/regconf.cpp
datetime/datetimetest.cpp
events/evthandler.cpp
events/evtsource.cpp
diff --git a/tests/test_test.dsp b/tests/test_test.dsp
index b79c58606a..7810710c57 100644
--- a/tests/test_test.dsp
+++ b/tests/test_test.dsp
@@ -405,6 +405,10 @@ SOURCE=.\thread\queue.cpp
# End Source File
# Begin Source File
+SOURCE=.\config\regconf.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\regex\regextest.cpp
# End Source File
# Begin Source File
diff --git a/tests/test_vc7_test.vcproj b/tests/test_vc7_test.vcproj
index 6237a140f1..55ebe2fdf2 100644
--- a/tests/test_vc7_test.vcproj
+++ b/tests/test_vc7_test.vcproj
@@ -739,6 +739,9 @@
+
+
diff --git a/tests/test_vc8_test.vcproj b/tests/test_vc8_test.vcproj
index c3b9d9b5e2..81a40fe0d7 100644
--- a/tests/test_vc8_test.vcproj
+++ b/tests/test_vc8_test.vcproj
@@ -1059,6 +1059,10 @@
RelativePath=".\thread\queue.cpp"
>
+
+
diff --git a/tests/test_vc9_test.vcproj b/tests/test_vc9_test.vcproj
index 7b1b284d9d..910861d3fb 100644
--- a/tests/test_vc9_test.vcproj
+++ b/tests/test_vc9_test.vcproj
@@ -44,7 +44,7 @@
Name="VCCLCompilerTool"
AdditionalOptions="/MP"
Optimization="0"
- AdditionalIncludeDirectories=".\..\lib\vc_lib\mswud;.\..\include;F:\cppunit\include;."
+ AdditionalIncludeDirectories=".\..\lib\vc_lib\mswud;.\..\include;.;F:\cppunit\include"
PreprocessorDefinitions="WIN32;_DEBUG;__WXMSW__;_UNICODE;_CONSOLE;wxUSE_GUI=0"
ExceptionHandling="1"
BasicRuntimeChecks="3"
@@ -1023,6 +1023,10 @@
RelativePath=".\thread\queue.cpp"
>
+
+
diff --git a/tests/test_vc9_test_gui.vcproj b/tests/test_vc9_test_gui.vcproj
index 207f762fa9..875693c515 100644
--- a/tests/test_vc9_test_gui.vcproj
+++ b/tests/test_vc9_test_gui.vcproj
@@ -1,16 +1,10 @@
-
-
-
-
-