comctl32/dpa: Check for DPA_LoadStream() presence. Merge original test function with save tests

Nikolay Sivov bunglehead at gmail.com
Wed Sep 16 04:11:13 CDT 2009


Changelog:
    - Check for DPA_LoadStream() presence. Merge original test function with save tests.

>From f60b081fa6af9dd8e67010928f86d4910ae8a438 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Wed, 16 Sep 2009 13:00:40 +0400
Subject: Check for DPA_LoadStream() presence. Merge original test function with save tests.

---
 dlls/comctl32/tests/dpa.c |   61 ++++++++++----------------------------------
 1 files changed, 14 insertions(+), 47 deletions(-)

diff --git a/dlls/comctl32/tests/dpa.c b/dlls/comctl32/tests/dpa.c
index 6acb55b..022460a 100644
--- a/dlls/comctl32/tests/dpa.c
+++ b/dlls/comctl32/tests/dpa.c
@@ -551,6 +551,12 @@ static void test_DPA_LoadStream(void)
     ULONG written, ret;
     HDPA dpa;
 
+    if(!pDPA_LoadStream)
+    {
+        win_skip("DPA_LoadStream() not available. Skipping stream tests.\n");
+        return;
+    }
+
     hRes = CoInitialize(NULL);
     if (hRes != S_OK)
     {
@@ -655,9 +661,12 @@ static void test_DPA_SaveStream(void)
     static const WCHAR szStg[] = { 'S','t','g',0 };
     IStorage* pStg = NULL;
     IStream* pStm = NULL;
-    DWORD dwMode;
+    DWORD dwMode, dw;
     HRESULT hRes;
     ULONG ret;
+    INT i;
+    BOOL rc;
+    LARGE_INTEGER liZero;
 
     if(!pDPA_SaveStream)
     {
@@ -694,60 +703,19 @@ if (0) {
     expect(E_INVALIDARG, hRes);
 }
 
-    pDPA_Destroy(dpa);
-
-    ret = IStream_Release(pStm);
-    ok(!ret, "ret=%d\n", ret);
-
-    ret = IStorage_Release(pStg);
-    ok(!ret, "ret=%d\n", ret);
-
-    CoUninitialize();
-}
-
-static void test_dpa_stream(void)
-{
-    HDPA dpa;
-    HRESULT hRes;
-    INT ret, i;
-    BOOL rc;
-
-    static const WCHAR szStg[] = { 'S','t','g',0 };
-    IStorage* pStg = NULL;
-    IStream* pStm = NULL;
-    LARGE_INTEGER liZero;
-    DWORD dwMode, dw;
-
-    if(!pDPA_SaveStream)
-    {
-        win_skip("DPA_SaveStream() not available. Skipping stream tests.\n");
-        return;
-    }
-
-    hRes = CoInitialize(NULL);
-    if (hRes != S_OK)
-    {
-        ok(0, "hResult: %d\n", hRes);
-        return;
-    }
-
-    dpa = pDPA_Create(0);
-
+    /* saving/loading */
     for (i = 0; i < 6; i++)
     {
         ret = pDPA_InsertPtr(dpa, i, (PVOID)(i+1));
         ok(ret == i, "ret=%d\n", ret);
     }
 
-    dwMode = STGM_DIRECT|STGM_CREATE|STGM_READWRITE|STGM_SHARE_EXCLUSIVE;
-    hRes = StgCreateDocfile(NULL, dwMode|STGM_DELETEONRELEASE, 0, &pStg);
-    expect(S_OK, hRes);
-
-    hRes = IStorage_CreateStream(pStg, szStg, dwMode, 0, 0, &pStm);
+    liZero.QuadPart = 0;
+    hRes = IStream_Seek(pStm, liZero, STREAM_SEEK_SET, NULL);
     expect(S_OK, hRes);
 
     hRes = pDPA_SaveStream(dpa, CB_Save, pStm, (void*)0xdeadbeef);
-    ok(hRes == S_OK, "hRes=0x%x\n", hRes);
+    expect(S_OK, hRes);
     pDPA_Destroy(dpa);
 
     liZero.QuadPart = 0;
@@ -786,5 +754,4 @@ START_TEST(dpa)
     test_DPA_DestroyCallback();
     test_DPA_LoadStream();
     test_DPA_SaveStream();
-    test_dpa_stream();
 }
-- 
1.5.6.5





More information about the wine-patches mailing list