propsys: Add test for saving/loading an empty property store.

Vincent Povirk madewokherd at gmail.com
Tue May 29 09:42:40 CDT 2012


-------------- next part --------------
From c93f1a9018899250c9392a2fc8dfb95aaa24e88a Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Wed, 23 May 2012 14:01:34 -0500
Subject: [PATCH] propsys: Add test for saving/loading an empty property
 store.

---
 dlls/propsys/tests/propstore.c |   53 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/dlls/propsys/tests/propstore.c b/dlls/propsys/tests/propstore.c
index 5c1b021..01500dd 100644
--- a/dlls/propsys/tests/propstore.c
+++ b/dlls/propsys/tests/propstore.c
@@ -196,11 +196,64 @@ static void test_inmemorystore(void)
     IPropertyStoreCache_Release(propcache);
 }
 
+static void test_persistserialized(void)
+{
+    IPropertyStore *propstore;
+    IPersistSerializedPropStorage *serialized;
+    HRESULT hr;
+    SERIALIZEDPROPSTORAGE *result;
+    DWORD result_size;
+
+    hr = CoCreateInstance(&CLSID_InMemoryPropertyStore, NULL, CLSCTX_INPROC_SERVER,
+        &IID_IPropertyStore, (void**)&propstore);
+    ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
+
+    hr = IPropertyStore_QueryInterface(propstore, &IID_IPersistSerializedPropStorage,
+        (void**)&serialized);
+    todo_wine ok(hr == S_OK, "QueryInterface failed, hr=%x\n", hr);
+
+    if (FAILED(hr))
+    {
+        skip("IPersistSerializedPropStorage not supported\n");
+        return;
+    }
+
+    hr = IPersistSerializedPropStorage_GetPropertyStorage(serialized, NULL, &result_size);
+    ok(hr == E_POINTER, "GetPropertyStorage failed, hr=%x\n", hr);
+
+    hr = IPersistSerializedPropStorage_GetPropertyStorage(serialized, &result, NULL);
+    ok(hr == E_POINTER, "GetPropertyStorage failed, hr=%x\n", hr);
+
+    hr = IPersistSerializedPropStorage_GetPropertyStorage(serialized, &result, &result_size);
+    ok(hr == S_OK, "GetPropertyStorage failed, hr=%x\n", hr);
+
+    if (SUCCEEDED(hr))
+    {
+        ok(result_size == 0, "expected 0 bytes, got %i\n", result_size);
+
+        CoTaskMemFree(result);
+    }
+
+    hr = IPersistSerializedPropStorage_SetPropertyStorage(serialized, NULL, 4);
+    ok(hr == E_POINTER, "SetPropertyStorage failed, hr=%x\n", hr);
+
+    hr = IPersistSerializedPropStorage_SetPropertyStorage(serialized, NULL, 0);
+    ok(hr == S_OK, "SetPropertyStorage failed, hr=%x\n", hr);
+
+    hr = IPropertyStore_GetCount(propstore, &result_size);
+    ok(hr == S_OK, "GetCount failed, hr=%x\n", hr);
+    ok(result_size == 0, "expecting 0, got %d\n", result_size);
+
+    IPropertyStore_Release(propstore);
+    IPersistSerializedPropStorage_Release(serialized);
+}
+
 START_TEST(propstore)
 {
     CoInitialize(NULL);
 
     test_inmemorystore();
+    test_persistserialized();
 
     CoUninitialize();
 }
-- 
1.7.9.5


More information about the wine-patches mailing list