Michael Stefaniuc : dplayx/tests: Add DirectPlayLobby COM tests.
Alexandre Julliard
julliard at winehq.org
Wed Apr 10 14:16:15 CDT 2013
Module: wine
Branch: master
Commit: f65c6af3b49f9dcca555331605e556dc28ac5be1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f65c6af3b49f9dcca555331605e556dc28ac5be1
Author: Michael Stefaniuc <mstefani at redhat.de>
Date: Tue Apr 9 22:35:51 2013 +0200
dplayx/tests: Add DirectPlayLobby COM tests.
---
dlls/dplayx/tests/dplayx.c | 79 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 79 insertions(+), 0 deletions(-)
diff --git a/dlls/dplayx/tests/dplayx.c b/dlls/dplayx/tests/dplayx.c
index 0e7aafb..1b871d0 100644
--- a/dlls/dplayx/tests/dplayx.c
+++ b/dlls/dplayx/tests/dplayx.c
@@ -6453,12 +6453,91 @@ static void test_COM(void)
ok(refcount == 0, "refcount == %u, expected 0\n", refcount);
}
+static void test_COM_dplobby(void)
+{
+ IDirectPlayLobby *dpl = (IDirectPlayLobby*)0xdeadbeef;
+ IDirectPlayLobbyA *dplA;
+ IDirectPlayLobby2A *dpl2A;
+ IDirectPlayLobby2 *dpl2;
+ IDirectPlayLobby3A *dpl3A;
+ IDirectPlayLobby3 *dpl3;
+ IUnknown *unk;
+ ULONG refcount;
+ HRESULT hr;
+
+ /* COM aggregation */
+ hr = CoCreateInstance(&CLSID_DirectPlayLobby, (IUnknown*)&dpl, CLSCTX_INPROC_SERVER,
+ &IID_IUnknown, (void**)&dpl);
+ ok(hr == CLASS_E_NOAGGREGATION || broken(hr == E_INVALIDARG),
+ "DirectPlayLobby create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr);
+ ok(!dpl || dpl == (IDirectPlayLobby*)0xdeadbeef, "dp4 = %p\n", dpl);
+
+ /* Invalid RIID */
+ hr = CoCreateInstance(&CLSID_DirectPlayLobby, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlay,
+ (void**)&dpl);
+ ok(hr == E_NOINTERFACE, "DirectPlayLobby create failed: %08x, expected E_NOINTERFACE\n", hr);
+
+ /* Different refcount for all DirectPlayLobby Interfaces */
+ hr = CoCreateInstance(&CLSID_DirectPlayLobby, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlayLobby,
+ (void**)&dpl);
+ ok(hr == S_OK, "DirectPlayLobby create failed: %08x, expected S_OK\n", hr);
+ refcount = IDirectPlayLobby_AddRef(dpl);
+ ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
+
+ hr = IDirectPlayLobby_QueryInterface(dpl, &IID_IDirectPlayLobbyA, (void**)&dplA);
+ ok(hr == S_OK, "QueryInterface for IID_IDirectPlayLobbyA failed: %08x\n", hr);
+ refcount = IDirectPlayLobby_AddRef(dplA);
+ todo_wine ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
+ IDirectPlayLobby_Release(dplA);
+
+ hr = IDirectPlayLobby_QueryInterface(dpl, &IID_IDirectPlayLobby2, (void**)&dpl2);
+ ok(hr == S_OK, "QueryInterface for IID_IDirectPlayLobby2 failed: %08x\n", hr);
+ refcount = IDirectPlayLobby_AddRef(dpl2);
+ todo_wine ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
+ IDirectPlayLobby_Release(dpl2);
+
+ hr = IDirectPlayLobby_QueryInterface(dpl, &IID_IDirectPlayLobby2A, (void**)&dpl2A);
+ ok(hr == S_OK, "QueryInterface for IID_IDirectPlayLobby2A failed: %08x\n", hr);
+ refcount = IDirectPlayLobby_AddRef(dpl2A);
+ todo_wine ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
+ IDirectPlayLobby_Release(dpl2A);
+
+ hr = IDirectPlayLobby_QueryInterface(dpl, &IID_IDirectPlayLobby3, (void**)&dpl3);
+ ok(hr == S_OK, "QueryInterface for IID_IDirectPlayLobby3 failed: %08x\n", hr);
+ refcount = IDirectPlayLobby_AddRef(dpl3);
+ todo_wine ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
+ IDirectPlayLobby_Release(dpl3);
+
+ hr = IDirectPlayLobby_QueryInterface(dpl, &IID_IDirectPlayLobby3A, (void**)&dpl3A);
+ ok(hr == S_OK, "QueryInterface for IID_IDirectPlayLobby3A failed: %08x\n", hr);
+ refcount = IDirectPlayLobby_AddRef(dpl3A);
+ todo_wine ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
+ IDirectPlayLobby_Release(dpl3A);
+
+ /* IDirectPlayLobby and IUnknown share a refcount */
+ hr = IDirectPlayX_QueryInterface(dpl, &IID_IUnknown, (void**)&unk);
+ ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
+ refcount = IDirectPlayLobby_AddRef(unk);
+ todo_wine ok(refcount == 4, "refcount == %u, expected 4\n", refcount);
+ IDirectPlayLobby_Release(unk);
+
+ IUnknown_Release(unk);
+ IDirectPlayLobby_Release(dpl3);
+ IDirectPlayLobby_Release(dpl3A);
+ IDirectPlayLobby_Release(dpl2);
+ IDirectPlayLobby_Release(dpl2A);
+ IDirectPlayLobby_Release(dpl);
+ refcount = IDirectPlayLobby_Release(dpl);
+ ok(refcount == 0, "refcount == %u, expected 0\n", refcount);
+}
+
START_TEST(dplayx)
{
CoInitialize( NULL );
test_COM();
+ test_COM_dplobby();
if (!winetest_interactive)
{
More information about the wine-cvs
mailing list