André Hentschel : oleaut32/tests: Add more safearray tests.

Alexandre Julliard julliard at winehq.org
Tue Feb 8 17:23:46 CST 2011


Module: wine
Branch: master
Commit: 1a37f6e9405c0fe97d59847f8fcd7cda619276b9
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1a37f6e9405c0fe97d59847f8fcd7cda619276b9

Author: André Hentschel <nerv at dawncrow.de>
Date:   Mon Feb  7 20:44:43 2011 +0100

oleaut32/tests: Add more safearray tests.

---

 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);




More information about the wine-cvs mailing list