Module: wine Branch: master Commit: b526f7a4e7a018e254cb2dd424dd8ea4bc7d9e78 URL: https://source.winehq.org/git/wine.git/?a=commit;h=b526f7a4e7a018e254cb2dd42...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Wed Jan 31 09:41:30 2018 +0300
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
---
dlls/ole32/tests/hglobalstream.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/dlls/ole32/tests/hglobalstream.c b/dlls/ole32/tests/hglobalstream.c index e20d81b..6a0498a 100644 --- a/dlls/ole32/tests/hglobalstream.c +++ b/dlls/ole32/tests/hglobalstream.c @@ -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(); }