shlwapi/tests: Add some tests for memory stream.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2018-09-07 14:55:59 +03:00 committed by Alexandre Julliard
parent 1505905290
commit 917b2a3641
1 changed files with 38 additions and 0 deletions

View File

@ -733,6 +733,43 @@ static void test_SHCreateStreamOnFileEx_CopyTo(void)
DeleteFileW( dstFileName );
}
static void test_SHCreateMemStream(void)
{
static const BYTE initial[10];
IStream *stream, *stream2;
IUnknown *unk;
char buff[10];
HRESULT hr;
stream = SHCreateMemStream(initial, 0);
ok(stream != NULL, "Failed to create a stream.\n");
IStream_Release(stream);
stream = SHCreateMemStream(NULL, 10);
ok(stream != NULL, "Failed to create a stream.\n");
IStream_Release(stream);
stream = SHCreateMemStream(NULL, 0);
ok(stream != NULL, "Failed to create a stream.\n");
hr = IStream_QueryInterface(stream, &IID_ISequentialStream, (void **)&unk);
todo_wine
ok(hr == S_OK || broken(hr == E_NOINTERFACE) /* WinXP */, "Failed to QI, hr %#x.\n", hr);
if (unk)
IUnknown_Release(unk);
hr = IStream_Read(stream, buff, sizeof(buff), NULL);
todo_wine
ok(hr == S_FALSE || broken(hr == S_OK) /* WinXP */, "Unexpected hr %#x.\n", hr);
hr = IStream_Clone(stream, &stream2);
todo_wine
ok(hr == S_OK || broken(hr == E_NOTIMPL) /* < Win8 */, "Failed to clone a stream, hr %#x.\n", hr);
if (hr == S_OK)
IStream_Release(stream2);
IStream_Release(stream);
}
START_TEST(istream)
{
@ -773,4 +810,5 @@ START_TEST(istream)
}
test_SHCreateStreamOnFileEx_CopyTo();
test_SHCreateMemStream();
}