Alexandre Julliard : comcat/tests: Skip tests if we can' t create a test category.
Alexandre Julliard
julliard at winehq.org
Mon Jan 26 10:13:32 CST 2009
Module: wine
Branch: master
Commit: 6996a9c83f365d110247ca6f494ebd6805c16490
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6996a9c83f365d110247ca6f494ebd6805c16490
Author: Alexandre Julliard <julliard at winehq.org>
Date: Sun Jan 25 17:08:20 2009 +0100
comcat/tests: Skip tests if we can't create a test category.
---
dlls/comcat/tests/comcat.c | 43 +++++++++++++++++++++++--------------------
1 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/dlls/comcat/tests/comcat.c b/dlls/comcat/tests/comcat.c
index 80f774c..49e5afe 100644
--- a/dlls/comcat/tests/comcat.c
+++ b/dlls/comcat/tests/comcat.c
@@ -31,19 +31,19 @@
#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x \n", hr)
-static void register_testentry(void)
+static BOOL register_testentry(void)
{
- HKEY hkey,hkey2;
-
- RegCreateKeyA(HKEY_CLASSES_ROOT,"CLSID\\{deadcafe-beed-bead-dead-cafebeaddead}",
- &hkey);
- RegSetValueA(hkey,NULL,REG_SZ,"ComCat Test key",16);
- RegCreateKeyA(hkey,
- "Implemented Categories\\{deadcafe-0000-0000-0000-000000000000}",
- &hkey2);
-
+ HKEY hkey = 0, hkey2 = 0;
+ DWORD ret;
+
+ ret = RegCreateKeyA(HKEY_CLASSES_ROOT,"CLSID\\{deadcafe-beed-bead-dead-cafebeaddead}", &hkey);
+ if (!ret) ret = RegSetValueA(hkey,NULL,REG_SZ,"ComCat Test key",16);
+ if (!ret) ret = RegCreateKeyA(hkey,
+ "Implemented Categories\\{deadcafe-0000-0000-0000-000000000000}",
+ &hkey2);
RegCloseKey(hkey);
RegCloseKey(hkey2);
+ return !ret;
}
static void unregister_testentry(void)
@@ -106,19 +106,22 @@ static void do_enum(void)
hr = IEnumGUID_Next(pIEnum,1,the_guid, &fetched);
ok (fetched == 0,"Fetched wrong number of guids %u\n",fetched);
IEnumGUID_Release(pIEnum);
-
- register_testentry();
- hr = ICatInformation_EnumClassesOfCategories(pICat, 1, the_cat, -1, NULL,
- &pIEnum);
- ok_ole_success(hr,"ICatInformation_EnumClassesOfCategories");
- hr = IEnumGUID_Next(pIEnum,1,the_guid, &fetched);
- ok (fetched == 1,"Fetched wrong number of guids %u\n",fetched);
- ok (IsEqualGUID(the_guid,&wanted_guid),"Guids do not match\n");
+ if (register_testentry())
+ {
+ hr = ICatInformation_EnumClassesOfCategories(pICat, 1, the_cat, -1, NULL, &pIEnum);
+ ok_ole_success(hr,"ICatInformation_EnumClassesOfCategories");
+
+ hr = IEnumGUID_Next(pIEnum,1,the_guid, &fetched);
+ ok (fetched == 1,"Fetched wrong number of guids %u\n",fetched);
+ ok (IsEqualGUID(the_guid,&wanted_guid),"Guids do not match\n");
+
+ IEnumGUID_Release(pIEnum);
+ unregister_testentry();
+ }
+ else skip( "Could not register the test category\n" );
- IEnumGUID_Release(pIEnum);
ICatInformation_Release(pICat);
- unregister_testentry();
OleUninitialize();
}
More information about the wine-cvs
mailing list