dplayx/tests: Add DirectPlayLobby COM tests.

This commit is contained in:
Michael Stefaniuc 2013-04-09 22:35:51 +02:00 committed by Alexandre Julliard
parent b669664c4c
commit f65c6af3b4
1 changed files with 79 additions and 0 deletions

View File

@ -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)
{