Module: wine Branch: master Commit: 6fe6a43a6c9c540f3d07f613b7d573c76ca3de91 URL: http://source.winehq.org/git/wine.git/?a=commit;h=6fe6a43a6c9c540f3d07f613b7...
Author: Vincent Povirk vincent@codeweavers.com Date: Wed May 23 14:01:34 2012 -0500
propsys: Add test for saving/loading an empty property store.
---
dlls/propsys/tests/propstore.c | 53 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 53 insertions(+), 0 deletions(-)
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(); }