[PATCH] Test StringFromGUID2

Michael Karcher wine at mkarcher.dialup.fu-berlin.de
Tue May 20 02:23:46 CDT 2008


Test the behaviour of StringFromGUID2 for sufficiently sized and undersized
buffers.
---
 dlls/ole32/tests/compobj.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c
index 89cf9b9..9e7c135 100644
--- a/dlls/ole32/tests/compobj.c
+++ b/dlls/ole32/tests/compobj.c
@@ -197,6 +197,27 @@ static void test_CLSIDFromString(void)
     ok(IsEqualCLSID(&clsid, &CLSID_NULL), "clsid wasn't equal to CLSID_NULL\n");
 }
 
+void test_StringFromGUID2()
+{
+  WCHAR str[50];
+  int len;
+  /* Test corner cases for buffer size */
+  len = StringFromGUID2(&CLSID_CDeviceMoniker,str,50);
+  ok(len == 39, "len: %d (expected 39)",len);
+  ok(!lstrcmpiW(str, wszCLSID_CDeviceMoniker),"string wan't equal for CLSID_CDeviceMoniker\n");
+
+  memset(str,0,sizeof str);
+  len = StringFromGUID2(&CLSID_CDeviceMoniker,str,39);
+  ok(len == 39, "len: %d (expected 39)",len);
+  ok(!lstrcmpiW(str, wszCLSID_CDeviceMoniker),"string wan't equal for CLSID_CDeviceMoniker\n");
+
+  len = StringFromGUID2(&CLSID_CDeviceMoniker,str,38);
+  ok(len == 0, "len: %d (expected 0)",len);
+
+  len = StringFromGUID2(&CLSID_CDeviceMoniker,str,30);
+  ok(len == 0, "len: %d (expected 0)",len);
+}
+
 static void test_CoCreateInstance(void)
 {
     REFCLSID rclsid = &CLSID_MyComputer;
@@ -1008,6 +1029,7 @@ START_TEST(compobj)
     test_ProgIDFromCLSID();
     test_CLSIDFromProgID();
     test_CLSIDFromString();
+    test_StringFromGUID2();
     test_CoCreateInstance();
     test_ole_menu();
     test_CoGetClassObject();
-- 
1.5.5.1




More information about the wine-patches mailing list