Nikolay Sivov : shlwapi/tests: Add some tests for memory stream.

Alexandre Julliard julliard at winehq.org
Fri Sep 7 16:49:26 CDT 2018


Module: wine
Branch: master
Commit: 917b2a36419c949aacb869b63ea4644374ee94b7
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=917b2a36419c949aacb869b63ea4644374ee94b7

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri Sep  7 14:55:59 2018 +0300

shlwapi/tests: Add some tests for memory stream.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 7d0cd61..560a822 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();
 }




More information about the wine-cvs mailing list