[PATCH] shlwapi/tests: Add some tests for memory stream.

Nikolay Sivov nsivov at codeweavers.com
Fri Sep 7 06:55:59 CDT 2018


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/shlwapi/tests/istream.c | 38 ++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/dlls/shlwapi/tests/istream.c b/dlls/shlwapi/tests/istream.c
index 7d0cd617dd..560a822e2c 100644
--- a/dlls/shlwapi/tests/istream.c
+++ b/dlls/shlwapi/tests/istream.c
@@ -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();
 }
-- 
2.18.0




More information about the wine-devel mailing list