oleaut32/tests: Add more safearray tests.

This commit is contained in:
André Hentschel 2011-02-07 20:44:43 +01:00 committed by Alexandre Julliard
parent ae3e768a2e
commit 1a37f6e940
1 changed files with 20 additions and 3 deletions

View File

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