From 96427780894897c84646ba1a8060309b79ac4e25 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Fri, 16 Sep 2011 11:20:18 +0200 Subject: [PATCH] propsys/tests: Added InitVariantFromGUIDAsString tests. --- dlls/propsys/tests/Makefile.in | 2 +- dlls/propsys/tests/propsys.c | 59 ++++++++++++++++++++++++++++++++++++++++++ include/propvarutil.h | 2 ++ 3 files changed, 62 insertions(+), 1 deletion(-) diff --git a/dlls/propsys/tests/Makefile.in b/dlls/propsys/tests/Makefile.in index 8db4008dacf..312a3a977bd 100644 --- a/dlls/propsys/tests/Makefile.in +++ b/dlls/propsys/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = propsys.dll -IMPORTS = propsys ole32 +IMPORTS = propsys ole32 oleaut32 C_SRCS = \ propsys.c diff --git a/dlls/propsys/tests/propsys.c b/dlls/propsys/tests/propsys.c index e0895f3b607..1e633481786 100644 --- a/dlls/propsys/tests/propsys.c +++ b/dlls/propsys/tests/propsys.c @@ -24,10 +24,13 @@ #include #include +#define NONAMELESSUNION + #include "windef.h" #include "winbase.h" #include "objbase.h" #include "propsys.h" +#include "propvarutil.h" #include "initguid.h" #include "wine/test.h" @@ -46,6 +49,13 @@ static char *show_guid(const GUID *guid, char *buf) return buf; } +static int strcmp_wa(LPCWSTR strw, const char *stra) +{ + CHAR buf[512]; + WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL); + return lstrcmpA(stra, buf); +} + static void test_PSStringFromPropertyKey(void) { static const WCHAR fillerW[] = {'X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X', @@ -450,9 +460,58 @@ static void test_PSRefreshPropertySchema(void) CoUninitialize(); } +static void test_InitPropVariantFromGUIDAsString(void) +{ + PROPVARIANT propvar; + VARIANT var; + HRESULT hres; + int i; + + const struct { + REFGUID guid; + const char *str; + } testcases[] = { + {&IID_NULL, "{00000000-0000-0000-0000-000000000000}" }, + {&dummy_guid, "{DEADBEEF-DEAD-BEEF-DEAD-BEEFCAFEBABE}" }, + }; + + hres = InitPropVariantFromGUIDAsString(NULL, &propvar); + ok(hres == E_FAIL, "InitPropVariantFromGUIDAsString returned %x\n", hres); + + if(0) { + /* Returns strange data on Win7, crashes on older systems */ + InitVariantFromGUIDAsString(NULL, &var); + + /* Crashes on windows */ + InitPropVariantFromGUIDAsString(&IID_NULL, NULL); + InitVariantFromGUIDAsString(&IID_NULL, NULL); + } + + for(i=0; i