Ismael Barros : dplayx: Tests for GroupOwner.

Alexandre Julliard julliard at winehq.org
Wed Aug 20 08:13:59 CDT 2008


Module: wine
Branch: master
Commit: 1278ea3aea523027bb079f3800117aa5641b2396
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1278ea3aea523027bb079f3800117aa5641b2396

Author: Ismael Barros <razielmine at gmail.com>
Date:   Tue Aug  5 03:56:28 2008 +0200

dplayx: Tests for GroupOwner.

---

 dlls/dplayx/tests/dplayx.c |   77 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 77 insertions(+), 0 deletions(-)

diff --git a/dlls/dplayx/tests/dplayx.c b/dlls/dplayx/tests/dplayx.c
index 95b1d0e..0205994 100644
--- a/dlls/dplayx/tests/dplayx.c
+++ b/dlls/dplayx/tests/dplayx.c
@@ -3398,6 +3398,82 @@ static void test_CreateGroup(void)
 
 }
 
+/* GroupOwner */
+
+static void test_GroupOwner(void)
+{
+
+    LPDIRECTPLAY4 pDP[2];
+    DPSESSIONDESC2 dpsd;
+    DPID dpid[2], idGroup, idOwner;
+    HRESULT hr;
+    UINT i;
+
+
+    for (i=0; i<2; i++)
+    {
+        CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
+                          &IID_IDirectPlay4A, (LPVOID*) &pDP[i] );
+    }
+    ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
+    dpsd.dwSize = sizeof(DPSESSIONDESC2);
+    dpsd.guidApplication = appGuid;
+    dpsd.dwMaxPlayers = 10;
+    idGroup = 0;
+    idOwner = 0;
+
+    /* Service provider not initialized */
+    hr = IDirectPlayX_GetGroupOwner( pDP[0], idGroup, &idOwner );
+    todo_wine checkHR( DPERR_UNINITIALIZED, hr );
+    check( 0, idOwner );
+
+    if ( hr == DP_OK )
+    {
+        skip( "GetGroupOwner not implemented\n" );
+        return;
+    }
+
+
+    for (i=0; i<2; i++)
+        init_TCPIP_provider( pDP[i], "127.0.0.1", 0 );
+
+    hr = IDirectPlayX_Open( pDP[0], &dpsd, DPOPEN_CREATE );
+    checkHR( DP_OK, hr );
+    hr = IDirectPlayX_EnumSessions( pDP[1], &dpsd, 0, EnumSessions_cb_join,
+                                    (LPVOID) pDP[1], 0 );
+    checkHR( DP_OK, hr );
+
+    for (i=0; i<2; i++)
+    {
+        hr = IDirectPlayX_CreatePlayer( pDP[i], &dpid[i],
+                                        NULL, NULL, NULL, 0, 0 );
+        checkHR( DP_OK, hr );
+    }
+
+    /* Invalid group */
+    hr = IDirectPlayX_GetGroupOwner( pDP[0], idGroup, &idOwner );
+    checkHR( DPERR_INVALIDGROUP, hr );
+
+    hr = IDirectPlayX_CreateGroup( pDP[0], &idGroup, NULL, NULL, 0, 0 );
+    checkHR( DP_OK, hr );
+
+    /* Fails, because we need a lobby session */
+    hr = IDirectPlayX_GetGroupOwner( pDP[0], idGroup, &idOwner );
+    checkHR( DPERR_UNSUPPORTED, hr );
+
+
+    /* TODO:
+     * - Make this work
+     * - Check migration of the ownership of a group
+     *   when the owner leaves
+     */
+
+
+    IDirectPlayX_Release( pDP[0] );
+    IDirectPlayX_Release( pDP[1] );
+
+}
+
 
 START_TEST(dplayx)
 {
@@ -3421,6 +3497,7 @@ START_TEST(dplayx)
     test_GetPlayerFlags();
 
     test_CreateGroup();
+    test_GroupOwner();
 
     CoUninitialize();
 }




More information about the wine-cvs mailing list