oleaut32/tests: Add more safearray tests

André Hentschel nerv at dawncrow.de
Mon Feb 7 13:44:43 CST 2011


ok, last patch was totally wrong...
---
 dlls/oleaut32/tests/safearray.c |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/dlls/oleaut32/tests/safearray.c b/dlls/oleaut32/tests/safearray.c
index 97ba9dd..849bd01 100644
--- a/dlls/oleaut32/tests/safearray.c
+++ b/dlls/oleaut32/tests/safearray.c
@@ -1590,13 +1590,30 @@ static void test_SafeArrayCopy(void)
   hres = SafeArrayAllocDescriptor(1, &sa);
   ok(hres == S_OK, "SafeArrayAllocDescriptor failed with error 0x%08x\n", hres);
 
+  sa->cbElements = 16;
+  hres = SafeArrayCopy(sa, &sa2);
+  ok(hres == S_OK, "SafeArrayCopy failed with error 0x%08x\n", hres);
+  ok(sa != sa2, "SafeArrayCopy performed shallow copy\n");
+
+  hres = SafeArrayDestroy(sa2);
+  ok(hres == S_OK, "got 0x%08x\n", hres);
+  hres = SafeArrayDestroy(sa);
+  ok(hres == S_OK, "got 0x%08x\n", hres);
+
+  sa2 = (void*)0xdeadbeef;
+  hres = SafeArrayCopy(NULL, &sa2);
+  ok(hres == S_OK, "SafeArrayCopy failed with error 0x%08x\n", hres);
+  ok(!sa2, "SafeArrayCopy didn't return NULL for output array\n");
+
+  hres = SafeArrayAllocDescriptor(1, &sa);
+  ok(hres == S_OK, "SafeArrayAllocDescriptor failed with error 0x%08x\n", hres);
+
+  sa2 = (void*)0xdeadbeef;
   hres = SafeArrayCopy(sa, &sa2);
   ok(hres == E_INVALIDARG,
     "SafeArrayCopy with empty array should have failed with error E_INVALIDARG instead of 0x%08x\n",
     hres);
-  sa->cbElements = 16;
-  hres = SafeArrayCopy(sa, &sa2);
-  ok(hres == S_OK, "SafeArrayCopy failed with error 0x%08x\n", hres);
+  ok(!sa2, "SafeArrayCopy didn't return NULL for output array\n");
 
   hres = SafeArrayDestroy(sa2);
   ok(hres == S_OK, "got 0x%08x\n", hres);
-- 

Best Regards, André Hentschel



More information about the wine-patches mailing list