Add a registry key deletion test that fails with WoW64

This commit is contained in:
Dimitri Schoolwerth
2017-05-05 19:28:15 +04:00
parent 69e4f491b2
commit a963edca41

View File

@@ -35,6 +35,7 @@ public:
private:
CPPUNIT_TEST_SUITE( RegConfigTestCase );
CPPUNIT_TEST( ReadWrite );
CPPUNIT_TEST( DeleteRegistryKeyFromRedirectedView );
CPPUNIT_TEST_SUITE_END();
void ReadWrite();
@@ -80,5 +81,25 @@ void RegConfigTestCase::ReadWrite()
delete config;
}
void RegConfigTestCase::DeleteRegistryKeyFromRedirectedView()
{
if ( !wxIsPlatform64Bit() )
{
// Test needs WoW64.
return;
}
// Test inside a key that's known to be redirected and is in HKCU so that
// admin rights are not required (unlike with HKLM).
wxRegKey key(wxRegKey::HKCU, "SOFTWARE\\Classes\\CLSID\\wxWidgetsTestKey",
sizeof(void *) == 4
? wxRegKey::WOW64ViewMode_64
: wxRegKey::WOW64ViewMode_32);
CPPUNIT_ASSERT( key.Create() );
CPPUNIT_ASSERT( key.DeleteSelf() );
CPPUNIT_ASSERT( !key.Exists() );
}
#endif // wxUSE_CONFIG && wxUSE_REGKEY