ole32/tests: Move stream creation to test function that's using it.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2018-01-31 09:41:30 +03:00 committed by Alexandre Julliard
parent baa74bd862
commit b526f7a4e7
1 changed files with 8 additions and 9 deletions

View File

@ -43,16 +43,20 @@ do { \
} \
} while(0)
static void test_streamonhglobal(IStream *pStream)
static void test_streamonhglobal(void)
{
const char data[] = "Test String";
ULARGE_INTEGER ull;
IStream *pStream;
LARGE_INTEGER ll;
char buffer[128];
ULONG read;
STATSTG statstg;
HRESULT hr;
hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
ok(hr == S_OK, "Failed to create a stream, hr %#x.\n", hr);
ull.QuadPart = sizeof(data);
hr = IStream_SetSize(pStream, ull);
ok_ole_success(hr, "IStream_SetSize");
@ -293,6 +297,8 @@ static void test_streamonhglobal(IStream *pStream)
hr = IStream_SetSize(pStream, ull);
ok(hr == E_OUTOFMEMORY || broken(hr == S_OK), /* win9x */
"IStream_SetSize with large size should have returned E_OUTOFMEMORY instead of 0x%08x\n", hr);
IStream_Release(pStream);
}
static HRESULT WINAPI TestStream_QueryInterface(IStream *iface, REFIID riid, void **ppv)
@ -510,14 +516,7 @@ static void test_freed_hglobal(void)
START_TEST(hglobalstream)
{
HRESULT hr;
IStream *pStream;
hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
ok_ole_success(hr, "CreateStreamOnHGlobal");
test_streamonhglobal(pStream);
IStream_Release(pStream);
test_streamonhglobal();
test_copyto();
test_freed_hglobal();
}