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

Alexandre Julliard julliard at winehq.org
Wed Sep 16 16:01:01 CDT 2009


Module: wine
Branch: master
Commit: 69bcb112f92f78c8db832852d338b3bbd7e56428
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=69bcb112f92f78c8db832852d338b3bbd7e56428

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Wed Sep 16 13:00:40 2009 +0400

comctl32/dpa: 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();
 }




More information about the wine-cvs mailing list