ole32/tests: Add PropVariantCopy() test for BSTR with embedded null.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2019-12-18 12:06:52 +03:00 committed by Alexandre Julliard
parent adcb5f98d8
commit 126cf25617
1 changed files with 13 additions and 0 deletions

View File

@ -367,6 +367,19 @@ static void test_copy(void)
hr = PropVariantClear(&propvarDst); hr = PropVariantClear(&propvarDst);
ok(hr == S_OK, "PropVariantClear(...VT_BSTR...) failed\n"); ok(hr == S_OK, "PropVariantClear(...VT_BSTR...) failed\n");
/* BSTR with embedded null */
propvarSrc.vt = VT_BSTR;
U(propvarSrc).bstrVal = SysAllocStringLen(L"Test Str\0ing", 12);
hr = PropVariantCopy(&propvarDst, &propvarSrc);
ok(hr == S_OK, "Failed to copy propvar, hr %#x.\n", hr);
ok(SysStringLen(U(propvarDst).bstrVal) == 8, "Unexpected copy length.\n");
ok(SysStringLen(U(propvarSrc).bstrVal) == 12, "Unexpected source length.\n");
ok(!lstrcmpW(U(propvarSrc).bstrVal, U(propvarDst).bstrVal), "BSTR not copied properly\n");
hr = PropVariantClear(&propvarSrc);
ok(hr == S_OK, "Failed to clear propvar, hr %#x.\n", hr);
hr = PropVariantClear(&propvarDst);
ok(hr == S_OK, "Failed to clear propvar, hr %#x.\n", hr);
propvarSrc.vt = VT_LPWSTR; propvarSrc.vt = VT_LPWSTR;
U(propvarSrc).pwszVal = wszTestString; U(propvarSrc).pwszVal = wszTestString;
hr = PropVariantCopy(&propvarDst, &propvarSrc); hr = PropVariantCopy(&propvarDst, &propvarSrc);