[PATCH] Test StringFromGUID2 (try 2)

Michael Karcher wine at mkarcher.dialup.fu-berlin.de
Tue May 20 03:31:26 CDT 2008


Test the behaviour of StringFromGUID2 for sufficiently sized and undersized
buffers.

This updated patch fixes indentation and tests a case wine currently
gets wrong. Please disregard the the first patch.
---
 dlls/ole32/tests/compobj.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c
index ad0a4cf..da665cf 100644
--- a/dlls/ole32/tests/compobj.c
+++ b/dlls/ole32/tests/compobj.c
@@ -197,6 +197,32 @@ 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)\n",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)\n",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)\n",len);
+
+    len = StringFromGUID2(&CLSID_CDeviceMoniker,str,30);
+    ok(len == 0, "len: %d (expected 0)\n",len);
+
+    /* -1 is an invalid length, wine returns size */
+    len = StringFromGUID2(&CLSID_CDeviceMoniker,str,-1);
+    todo_wine
+    ok(len == 0, "len: %d (expected 0)\n",len);
+}
+
 static void test_CoCreateInstance(void)
 {
     REFCLSID rclsid = &CLSID_MyComputer;
@@ -1008,6 +1034,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