dplayx/tests: Add DirectPlay COM tests.
This commit is contained in:
parent
7eaafd0141
commit
d09d061157
|
@ -17,6 +17,7 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
#include "wine/test.h"
|
||||
#include <stdio.h>
|
||||
#define INITGUID
|
||||
|
@ -6364,17 +6365,98 @@ static void test_host_migration(void)
|
|||
|
||||
}
|
||||
|
||||
static void test_COM(void)
|
||||
{
|
||||
IDirectPlay2A *dp2A;
|
||||
IDirectPlay2 *dp2;
|
||||
IDirectPlay3A *dp3A;
|
||||
IDirectPlay3 *dp3;
|
||||
IDirectPlay4A *dp4A;
|
||||
IDirectPlay4 *dp4 = (IDirectPlay4*)0xdeadbeef;
|
||||
IUnknown *unk;
|
||||
ULONG refcount;
|
||||
HRESULT hr;
|
||||
|
||||
/* COM aggregation */
|
||||
hr = CoCreateInstance(&CLSID_DirectPlay, (IUnknown*)&dp4, CLSCTX_INPROC_SERVER, &IID_IUnknown,
|
||||
(void**)&dp4);
|
||||
ok(hr == CLASS_E_NOAGGREGATION,
|
||||
"DirectPlay create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr);
|
||||
ok(!dp4, "dp4 = %p\n", dp4);
|
||||
|
||||
/* Invalid RIID */
|
||||
hr = CoCreateInstance(&CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlayLobby,
|
||||
(void**)&dp4);
|
||||
ok(hr == E_NOINTERFACE, "DirectPlay create failed: %08x, expected E_NOINTERFACE\n", hr);
|
||||
|
||||
/* Different refcount for all DirectPlay Interfaces */
|
||||
hr = CoCreateInstance(&CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlay4,
|
||||
(void**)&dp4);
|
||||
ok(hr == S_OK, "DirectPlay create failed: %08x, expected S_OK\n", hr);
|
||||
refcount = IDirectPlayX_AddRef(dp4);
|
||||
todo_wine ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
|
||||
|
||||
hr = IDirectPlayX_QueryInterface(dp4, &IID_IDirectPlay2A, (void**)&dp2A);
|
||||
ok(hr == S_OK, "QueryInterface for IID_IDirectPlay2A failed: %08x\n", hr);
|
||||
refcount = IDirectPlay2_AddRef(dp2A);
|
||||
todo_wine ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
|
||||
IDirectPlay2_Release(dp2A);
|
||||
|
||||
hr = IDirectPlayX_QueryInterface(dp4, &IID_IDirectPlay2, (void**)&dp2);
|
||||
ok(hr == S_OK, "QueryInterface for IID_IDirectPlay2 failed: %08x\n", hr);
|
||||
refcount = IDirectPlay2_AddRef(dp2);
|
||||
todo_wine ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
|
||||
IDirectPlay2_Release(dp2);
|
||||
|
||||
hr = IDirectPlayX_QueryInterface(dp4, &IID_IDirectPlay3A, (void**)&dp3A);
|
||||
ok(hr == S_OK, "QueryInterface for IID_IDirectPlay3A failed: %08x\n", hr);
|
||||
refcount = IDirectPlay3_AddRef(dp3A);
|
||||
todo_wine ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
|
||||
IDirectPlay3_Release(dp3A);
|
||||
|
||||
hr = IDirectPlayX_QueryInterface(dp4, &IID_IDirectPlay3, (void**)&dp3);
|
||||
ok(hr == S_OK, "QueryInterface for IID_IDirectPlay3 failed: %08x\n", hr);
|
||||
refcount = IDirectPlay3_AddRef(dp3);
|
||||
todo_wine ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
|
||||
IDirectPlay3_Release(dp3);
|
||||
|
||||
hr = IDirectPlayX_QueryInterface(dp4, &IID_IDirectPlay4A, (void**)&dp4A);
|
||||
ok(hr == S_OK, "QueryInterface for IID_IDirectPlay4A failed: %08x\n", hr);
|
||||
refcount = IDirectPlayX_AddRef(dp4A);
|
||||
todo_wine ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
|
||||
IDirectPlayX_Release(dp4A);
|
||||
|
||||
hr = IDirectPlayX_QueryInterface(dp4, &IID_IUnknown, (void**)&unk);
|
||||
ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
|
||||
refcount = IUnknown_AddRef(unk);
|
||||
todo_wine ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
|
||||
refcount = IUnknown_Release(unk);
|
||||
todo_wine ok(refcount == 1, "refcount == %u, expected 1\n", refcount);
|
||||
|
||||
IUnknown_Release(unk);
|
||||
IDirectPlayX_Release(dp4A);
|
||||
IDirectPlay3_Release(dp3);
|
||||
IDirectPlay3_Release(dp3A);
|
||||
IDirectPlay2_Release(dp2);
|
||||
IDirectPlay2_Release(dp2A);
|
||||
IDirectPlayX_Release(dp4);
|
||||
refcount = IDirectPlayX_Release(dp4);
|
||||
todo_wine ok(refcount == 0, "refcount == %u, expected 0\n", refcount);
|
||||
}
|
||||
|
||||
|
||||
START_TEST(dplayx)
|
||||
{
|
||||
CoInitialize( NULL );
|
||||
|
||||
test_COM();
|
||||
|
||||
if (!winetest_interactive)
|
||||
{
|
||||
skip("Run in interactive mode to run dplayx tests.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CoInitialize( NULL );
|
||||
|
||||
trace("Running in interactive mode, tests will take a while\n");
|
||||
|
||||
test_DirectPlayCreate();
|
||||
|
|
Loading…
Reference in New Issue