Commit 91b705dc authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

gameux/tests: Enable compilation with long types.

parent 3350d094
EXTRADEFS = -DWINE_NO_LONG_TYPES
TESTDLL = gameux.dll TESTDLL = gameux.dll
IMPORTS = uuid shlwapi oleaut32 ole32 advapi32 shell32 IMPORTS = uuid shlwapi oleaut32 ole32 advapi32 shell32
......
...@@ -102,25 +102,25 @@ static void test_add_remove_game(void) ...@@ -102,25 +102,25 @@ static void test_add_remove_game(void)
memcpy(&guid, &defaultGUID, sizeof (guid)); memcpy(&guid, &defaultGUID, sizeof (guid));
hr = IGameExplorer_AddGame(ge, bstrExeName, bstrExePath, GIS_CURRENT_USER, &guid); hr = IGameExplorer_AddGame(ge, bstrExeName, bstrExePath, GIS_CURRENT_USER, &guid);
ok(SUCCEEDED(hr), "IGameExplorer::AddGame failed (error 0x%08x)\n", hr); ok(SUCCEEDED(hr), "IGameExplorer::AddGame failed (error 0x%08lx)\n", hr);
ok(memcmp(&guid, &defaultGUID, sizeof (guid)) == 0, "AddGame unexpectedly modified GUID\n"); ok(memcmp(&guid, &defaultGUID, sizeof (guid)) == 0, "AddGame unexpectedly modified GUID\n");
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
{ {
hr = IGameExplorer_RemoveGame(ge, guid); hr = IGameExplorer_RemoveGame(ge, guid);
ok(SUCCEEDED(hr), "IGameExplorer::RemoveGame failed (error 0x%08x)\n", hr); ok(SUCCEEDED(hr), "IGameExplorer::RemoveGame failed (error 0x%08lx)\n", hr);
} }
/* try to register game with empty guid */ /* try to register game with empty guid */
memcpy(&guid, &GUID_NULL, sizeof (guid)); memcpy(&guid, &GUID_NULL, sizeof (guid));
hr = IGameExplorer_AddGame(ge, bstrExeName, bstrExePath, GIS_CURRENT_USER, &guid); hr = IGameExplorer_AddGame(ge, bstrExeName, bstrExePath, GIS_CURRENT_USER, &guid);
ok(SUCCEEDED(hr), "IGameExplorer::AddGame failed (error 0x%08x)\n", hr); ok(SUCCEEDED(hr), "IGameExplorer::AddGame failed (error 0x%08lx)\n", hr);
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
{ {
hr = IGameExplorer_RemoveGame(ge, guid); hr = IGameExplorer_RemoveGame(ge, guid);
ok(SUCCEEDED(hr), "IGameExplorer::RemoveGame failed (error 0x%08x)\n", hr); ok(SUCCEEDED(hr), "IGameExplorer::RemoveGame failed (error 0x%08lx)\n", hr);
} }
} }
...@@ -157,12 +157,12 @@ static void test_install_uninstall_game(void) ...@@ -157,12 +157,12 @@ static void test_install_uninstall_game(void)
hr = IGameExplorer2_InstallGame(ge2, sExeName, sExePath, GIS_CURRENT_USER); hr = IGameExplorer2_InstallGame(ge2, sExeName, sExePath, GIS_CURRENT_USER);
ok(SUCCEEDED(hr), "IGameExplorer2::InstallGame failed (error 0x%08x)\n", hr); ok(SUCCEEDED(hr), "IGameExplorer2::InstallGame failed (error 0x%08lx)\n", hr);
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
{ {
hr = IGameExplorer2_UninstallGame(ge2, sExeName); hr = IGameExplorer2_UninstallGame(ge2, sExeName);
ok(SUCCEEDED(hr), "IGameExplorer2::UninstallGame failed (error 0x%08x)\n", hr); ok(SUCCEEDED(hr), "IGameExplorer2::UninstallGame failed (error 0x%08lx)\n", hr);
} }
IGameExplorer2_Release(ge2); IGameExplorer2_Release(ge2);
...@@ -188,13 +188,13 @@ START_TEST(gameexplorer) ...@@ -188,13 +188,13 @@ START_TEST(gameexplorer)
HRESULT hr; HRESULT hr;
hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
ok(hr == S_OK, "Failed to initialize COM, hr %#x.\n", hr); ok(hr == S_OK, "Failed to initialize COM, hr %#lx.\n", hr);
trace("Running multithreaded tests.\n"); trace("Running multithreaded tests.\n");
run_tests(); run_tests();
CoUninitialize(); CoUninitialize();
hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
ok(hr == S_OK, "Failed to initialize COM, hr %#x.\n", hr); ok(hr == S_OK, "Failed to initialize COM, hr %#lx.\n", hr);
trace("Running apartment threaded tests.\n"); trace("Running apartment threaded tests.\n");
run_tests(); run_tests();
CoUninitialize(); CoUninitialize();
......
...@@ -50,13 +50,13 @@ static void test_register_game(IGameExplorer **explorer) ...@@ -50,13 +50,13 @@ static void test_register_game(IGameExplorer **explorer)
PathRemoveFileSpecW(pathW); PathRemoveFileSpecW(pathW);
hr = CoCreateInstance(&CLSID_GameExplorer, NULL, CLSCTX_INPROC_SERVER, &IID_IGameExplorer, (void**)explorer); hr = CoCreateInstance(&CLSID_GameExplorer, NULL, CLSCTX_INPROC_SERVER, &IID_IGameExplorer, (void**)explorer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08lx\n", hr);
gameInstanceId = GUID_NULL; gameInstanceId = GUID_NULL;
bstrExeName = SysAllocString(sExeName); bstrExeName = SysAllocString(sExeName);
bstrExePath = SysAllocString(pathW); bstrExePath = SysAllocString(pathW);
hr = IGameExplorer_AddGame(*explorer, bstrExeName, bstrExePath, GIS_CURRENT_USER, &gameInstanceId); hr = IGameExplorer_AddGame(*explorer, bstrExeName, bstrExePath, GIS_CURRENT_USER, &gameInstanceId);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08lx\n", hr);
SysFreeString(bstrExeName); SysFreeString(bstrExeName);
SysFreeString(bstrExePath); SysFreeString(bstrExePath);
...@@ -72,7 +72,7 @@ static void test_unregister_game(IGameExplorer *ge) ...@@ -72,7 +72,7 @@ static void test_unregister_game(IGameExplorer *ge)
if (!ge) return; if (!ge) return;
hr = IGameExplorer_RemoveGame(ge, gameInstanceId); hr = IGameExplorer_RemoveGame(ge, gameInstanceId);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08lx\n", hr);
IGameExplorer_Release(ge); IGameExplorer_Release(ge);
} }
...@@ -164,13 +164,13 @@ static void test_gamestatisticsmgr( void ) ...@@ -164,13 +164,13 @@ static void test_gamestatisticsmgr( void )
win_skip("gameux is partially stubbed, skipping tests\n"); win_skip("gameux is partially stubbed, skipping tests\n");
return; return;
} }
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "GetGameStatistics returned unexpected value: 0x%08x\n", hr); ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "GetGameStatistics returned unexpected value: 0x%08lx\n", hr);
ok(gs == NULL, "Expected output pointer to be NULL, got %s\n", ok(gs == NULL, "Expected output pointer to be NULL, got %s\n",
(gs == (void *)0xdeadbeef ? "deadbeef" : "neither NULL nor deadbeef")); (gs == (void *)0xdeadbeef ? "deadbeef" : "neither NULL nor deadbeef"));
/* now, allow them to be created */ /* now, allow them to be created */
hr = IGameStatisticsMgr_GetGameStatistics(gsm, sExeName, GAMESTATS_OPEN_OPENORCREATE, &openResult, &gs); hr = IGameStatisticsMgr_GetGameStatistics(gsm, sExeName, GAMESTATS_OPEN_OPENORCREATE, &openResult, &gs);
ok(SUCCEEDED(hr), "GetGameStatistics returned error: 0x%x\n", hr); ok(SUCCEEDED(hr), "GetGameStatistics returned error: 0x%lx\n", hr);
ok(gs!=NULL, "GetGameStatistics did not return valid interface pointer\n"); ok(gs!=NULL, "GetGameStatistics did not return valid interface pointer\n");
if(gs) if(gs)
{ {
...@@ -197,16 +197,16 @@ static void test_gamestatisticsmgr( void ) ...@@ -197,16 +197,16 @@ static void test_gamestatisticsmgr( void )
/* create name of statistics file */ /* create name of statistics file */
hr = _buildStatisticsFilePath(&guidApplicationId, &lpStatisticsFile); hr = _buildStatisticsFilePath(&guidApplicationId, &lpStatisticsFile);
ok(SUCCEEDED(hr), "cannot build path to game statistics (error 0x%x)\n", hr); ok(SUCCEEDED(hr), "cannot build path to game statistics (error 0x%lx)\n", hr);
trace("statistics file path: %s\n", wine_dbgstr_w(lpStatisticsFile)); trace("statistics file path: %s\n", wine_dbgstr_w(lpStatisticsFile));
ok(_isFileExists(lpStatisticsFile) == FALSE, "statistics file %s already exists\n", wine_dbgstr_w(lpStatisticsFile)); ok(_isFileExists(lpStatisticsFile) == FALSE, "statistics file %s already exists\n", wine_dbgstr_w(lpStatisticsFile));
/* write sample statistics */ /* write sample statistics */
hr = IGameStatistics_SetCategoryTitle(gs, wMaxCategories, NULL); hr = IGameStatistics_SetCategoryTitle(gs, wMaxCategories, NULL);
ok(hr==E_INVALIDARG, "setting category title invalid value: 0x%x\n", hr); ok(hr==E_INVALIDARG, "setting category title invalid value: 0x%lx\n", hr);
hr = IGameStatistics_SetCategoryTitle(gs, wMaxCategories, L"Category0"); hr = IGameStatistics_SetCategoryTitle(gs, wMaxCategories, L"Category0");
ok(hr==E_INVALIDARG, "setting category title invalid value: 0x%x\n", hr); ok(hr==E_INVALIDARG, "setting category title invalid value: 0x%lx\n", hr);
/* check what happen if string is too long */ /* check what happen if string is too long */
sTooLongString = CoTaskMemAlloc(sizeof(WCHAR)*(uMaxCategoryLength+2)); sTooLongString = CoTaskMemAlloc(sizeof(WCHAR)*(uMaxCategoryLength+2));
...@@ -215,7 +215,7 @@ static void test_gamestatisticsmgr( void ) ...@@ -215,7 +215,7 @@ static void test_gamestatisticsmgr( void )
/* when string is too long, Windows returns S_FALSE, but saves string (stripped to expected number of characters) */ /* when string is too long, Windows returns S_FALSE, but saves string (stripped to expected number of characters) */
hr = IGameStatistics_SetCategoryTitle(gs, 0, sTooLongString); hr = IGameStatistics_SetCategoryTitle(gs, 0, sTooLongString);
ok(hr==S_FALSE, "setting category title invalid result: 0x%x\n", hr); ok(hr==S_FALSE, "setting category title invalid result: 0x%lx\n", hr);
CoTaskMemFree(sTooLongString); CoTaskMemFree(sTooLongString);
ok(IGameStatistics_SetCategoryTitle(gs, 0, L"Category0")==S_OK, "setting category title failed: Category0\n"); ok(IGameStatistics_SetCategoryTitle(gs, 0, L"Category0")==S_OK, "setting category title failed: Category0\n");
...@@ -224,32 +224,32 @@ static void test_gamestatisticsmgr( void ) ...@@ -224,32 +224,32 @@ static void test_gamestatisticsmgr( void )
/* check what happen if any string is NULL */ /* check what happen if any string is NULL */
hr = IGameStatistics_SetStatistic(gs, 0, 0, NULL, L"Value00"); hr = IGameStatistics_SetStatistic(gs, 0, 0, NULL, L"Value00");
ok(hr == S_FALSE, "setting statistic returned unexpected value: 0x%x)\n", hr); ok(hr == S_FALSE, "setting statistic returned unexpected value: 0x%lx)\n", hr);
hr = IGameStatistics_SetStatistic(gs, 0, 0, L"Statistic00", NULL); hr = IGameStatistics_SetStatistic(gs, 0, 0, L"Statistic00", NULL);
ok(hr == S_OK, "setting statistic returned unexpected value: 0x%x)\n", hr); ok(hr == S_OK, "setting statistic returned unexpected value: 0x%lx)\n", hr);
/* check what happen if any string is too long */ /* check what happen if any string is too long */
sTooLongString = CoTaskMemAlloc(sizeof(WCHAR)*(uMaxNameLength+2)); sTooLongString = CoTaskMemAlloc(sizeof(WCHAR)*(uMaxNameLength+2));
memset(sTooLongString, 'a', sizeof(WCHAR)*(uMaxNameLength+1)); memset(sTooLongString, 'a', sizeof(WCHAR)*(uMaxNameLength+1));
sTooLongString[uMaxNameLength+1]=0; sTooLongString[uMaxNameLength+1]=0;
hr = IGameStatistics_SetStatistic(gs, 0, 0, sTooLongString, L"Value00"); hr = IGameStatistics_SetStatistic(gs, 0, 0, sTooLongString, L"Value00");
ok(hr == S_FALSE, "setting statistic returned unexpected value: 0x%x)\n", hr); ok(hr == S_FALSE, "setting statistic returned unexpected value: 0x%lx)\n", hr);
CoTaskMemFree(sTooLongString); CoTaskMemFree(sTooLongString);
sTooLongString = CoTaskMemAlloc(sizeof(WCHAR)*(uMaxValueLength+2)); sTooLongString = CoTaskMemAlloc(sizeof(WCHAR)*(uMaxValueLength+2));
memset(sTooLongString, 'a', sizeof(WCHAR)*(uMaxValueLength+1)); memset(sTooLongString, 'a', sizeof(WCHAR)*(uMaxValueLength+1));
sTooLongString[uMaxValueLength+1]=0; sTooLongString[uMaxValueLength+1]=0;
hr = IGameStatistics_SetStatistic(gs, 0, 0, L"Statistic00", sTooLongString); hr = IGameStatistics_SetStatistic(gs, 0, 0, L"Statistic00", sTooLongString);
ok(hr == S_FALSE, "setting statistic returned unexpected value: 0x%x)\n", hr); ok(hr == S_FALSE, "setting statistic returned unexpected value: 0x%lx)\n", hr);
CoTaskMemFree(sTooLongString); CoTaskMemFree(sTooLongString);
/* check what happen on too big index of category or statistic */ /* check what happen on too big index of category or statistic */
hr = IGameStatistics_SetStatistic(gs, wMaxCategories, 0, L"Statistic00", L"Value00"); hr = IGameStatistics_SetStatistic(gs, wMaxCategories, 0, L"Statistic00", L"Value00");
ok(hr == E_INVALIDARG, "setting statistic returned unexpected value: 0x%x)\n", hr); ok(hr == E_INVALIDARG, "setting statistic returned unexpected value: 0x%lx)\n", hr);
hr = IGameStatistics_SetStatistic(gs, 0, wMaxStatsPerCategory, L"Statistic00", L"Value00"); hr = IGameStatistics_SetStatistic(gs, 0, wMaxStatsPerCategory, L"Statistic00", L"Value00");
ok(hr == E_INVALIDARG, "setting statistic returned unexpected value: 0x%x)\n", hr); ok(hr == E_INVALIDARG, "setting statistic returned unexpected value: 0x%lx)\n", hr);
ok(IGameStatistics_SetStatistic(gs, 0, 0, L"Statistic00", L"Value00")==S_OK, ok(IGameStatistics_SetStatistic(gs, 0, 0, L"Statistic00", L"Value00")==S_OK,
"setting statistic failed: name=Statistic00, value=Value00\n"); "setting statistic failed: name=Statistic00, value=Value00\n");
...@@ -274,11 +274,11 @@ static void test_gamestatisticsmgr( void ) ...@@ -274,11 +274,11 @@ static void test_gamestatisticsmgr( void )
ok(IGameStatistics_SetCategoryTitle(gs, 0, L"Category0a")==S_OK, "setting category title failed: Category0a\n"); ok(IGameStatistics_SetCategoryTitle(gs, 0, L"Category0a")==S_OK, "setting category title failed: Category0a\n");
hr = IGameStatistics_Release(gs); hr = IGameStatistics_Release(gs);
ok(SUCCEEDED(hr), "releasing IGameStatistics returned error: 0x%08x\n", hr); ok(SUCCEEDED(hr), "releasing IGameStatistics returned error: 0x%08lx\n", hr);
/* try to read written statistics */ /* try to read written statistics */
hr = IGameStatisticsMgr_GetGameStatistics(gsm, sExeName, GAMESTATS_OPEN_OPENORCREATE, &openResult, &gs); hr = IGameStatisticsMgr_GetGameStatistics(gsm, sExeName, GAMESTATS_OPEN_OPENORCREATE, &openResult, &gs);
ok(SUCCEEDED(hr), "GetGameStatistics returned error: 0x%08x\n", hr); ok(SUCCEEDED(hr), "GetGameStatistics returned error: 0x%08lx\n", hr);
ok(openResult == GAMESTATS_OPEN_OPENED, "GetGameStatistics returned invalid open result: 0x%x\n", openResult); ok(openResult == GAMESTATS_OPEN_OPENED, "GetGameStatistics returned invalid open result: 0x%x\n", openResult);
ok(gs!=NULL, "GetGameStatistics did not return valid interface pointer\n"); ok(gs!=NULL, "GetGameStatistics did not return valid interface pointer\n");
...@@ -350,17 +350,17 @@ static void test_gamestatisticsmgr( void ) ...@@ -350,17 +350,17 @@ static void test_gamestatisticsmgr( void )
CoTaskMemFree(lpValue); CoTaskMemFree(lpValue);
hr = IGameStatistics_Release(gs); hr = IGameStatistics_Release(gs);
ok(SUCCEEDED(hr), "releasing IGameStatistics returned error: 0x%x\n", hr); ok(SUCCEEDED(hr), "releasing IGameStatistics returned error: 0x%lx\n", hr);
/* test of removing game statistics from underlying storage */ /* test of removing game statistics from underlying storage */
ok(_isFileExists(lpStatisticsFile) == TRUE, "statistics file %s does not exists\n", wine_dbgstr_w(lpStatisticsFile)); ok(_isFileExists(lpStatisticsFile) == TRUE, "statistics file %s does not exists\n", wine_dbgstr_w(lpStatisticsFile));
hr = IGameStatisticsMgr_RemoveGameStatistics(gsm, sExeName); hr = IGameStatisticsMgr_RemoveGameStatistics(gsm, sExeName);
ok(SUCCEEDED(hr), "cannot remove game statistics, error: 0x%x\n", hr); ok(SUCCEEDED(hr), "cannot remove game statistics, error: 0x%lx\n", hr);
ok(_isFileExists(lpStatisticsFile) == FALSE, "statistics file %s still exists\n", wine_dbgstr_w(lpStatisticsFile)); ok(_isFileExists(lpStatisticsFile) == FALSE, "statistics file %s still exists\n", wine_dbgstr_w(lpStatisticsFile));
} }
hr = IGameStatisticsMgr_Release(gsm); hr = IGameStatisticsMgr_Release(gsm);
ok(SUCCEEDED(hr), "releasing IGameStatisticsMgr returned error: 0x%x\n", hr); ok(SUCCEEDED(hr), "releasing IGameStatisticsMgr returned error: 0x%lx\n", hr);
CoTaskMemFree(lpStatisticsFile); CoTaskMemFree(lpStatisticsFile);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment