Nikolay Sivov : gameux/tests: Simplify initial test skipping.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Feb 24 10:33:24 CST 2015


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sat Feb 21 20:25:30 2015 +0300

gameux/tests: Simplify initial test skipping.

---

 dlls/gameux/tests/gamestatistics.c | 59 +++++++++++++++-----------------------
 1 file changed, 23 insertions(+), 36 deletions(-)

diff --git a/dlls/gameux/tests/gamestatistics.c b/dlls/gameux/tests/gamestatistics.c
index 663ed53..90a16f7 100644
--- a/dlls/gameux/tests/gamestatistics.c
+++ b/dlls/gameux/tests/gamestatistics.c
@@ -161,24 +161,6 @@ static BOOL _isFileExists(LPCWSTR lpFile)
 /*******************************************************************************
  * test routines
  */
-static void test_create(BOOL* gameStatisticsAvailable)
-{
-    HRESULT hr;
-
-    IGameStatisticsMgr* gsm = NULL;
-    *gameStatisticsAvailable = FALSE;
-
-    /* interface available up from Win7 */
-    hr = CoCreateInstance( &CLSID_GameStatistics, NULL, CLSCTX_INPROC_SERVER, &IID_IGameStatisticsMgr, (LPVOID*)&gsm);
-    if(gsm)
-    {
-        ok( hr == S_OK, "IGameStatisticsMgr creating failed (result: 0x%08x)\n", hr);
-        *gameStatisticsAvailable = TRUE;
-        IGameStatisticsMgr_Release(gsm);
-    }
-    else
-        win_skip("IGameStatisticsMgr cannot be created\n");
-}
 static void test_gamestatisticsmgr( void )
 {
     static const GUID guidApplicationId = { 0x17A6558E, 0x60BE, 0x4078, { 0xB6, 0x6F, 0x9C, 0x3A, 0xDA, 0x2A, 0x32, 0xE6 } };
@@ -411,28 +393,33 @@ static void test_gamestatisticsmgr( void )
 START_TEST(gamestatistics)
 {
     HRESULT hr;
-    BOOL gameStatisticsAvailable;
+    IGameStatisticsMgr* gsm;
+    IGameExplorer *ge;
 
-    if(_loadDynamicRoutines())
+    if (!_loadDynamicRoutines())
     {
-        hr = CoInitialize( NULL );
-        ok( hr == S_OK, "failed to init COM\n");
-
-        test_create(&gameStatisticsAvailable);
-
-        if(gameStatisticsAvailable)
-        {
-            IGameExplorer *ge;
+        /* this is not a failure, because a procedure loaded by address
+         * is always available on systems which has gameux.dll */
+        win_skip("too old system, cannot load required dynamic procedures\n");
+        return;
+    }
 
-            test_register_game(&ge);
-            test_gamestatisticsmgr();
-            test_unregister_game(ge);
-        }
+    hr = CoInitialize( NULL );
+    ok(hr == S_OK, "failed to init COM\n");
 
+    /* interface available up from Win7 */
+    hr = CoCreateInstance(&CLSID_GameStatistics, NULL, CLSCTX_INPROC_SERVER, &IID_IGameStatisticsMgr, (void**)&gsm);
+    if (FAILED(hr))
+    {
+        win_skip("IGameStatisticsMgr is not supported.\n");
         CoUninitialize();
+        return;
     }
-    else
-        /* this is not a failure, because a procedure loaded by address
-         * is always available on systems which has gameux.dll */
-        win_skip("too old system, cannot load required dynamic procedures\n");
+    IGameStatisticsMgr_Release(gsm);
+
+    test_register_game(&ge);
+    test_gamestatisticsmgr();
+    test_unregister_game(ge);
+
+    CoUninitialize();
 }




More information about the wine-cvs mailing list