gameux/tests: Add basic test for InstallGame and UninstallGame.
This commit is contained in:
parent
d02a6ab2b1
commit
7c121d53ae
|
@ -368,7 +368,7 @@ static void _validateGameRegistryKey(int line,
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Test routines
|
* Test routines
|
||||||
*/
|
*/
|
||||||
static void test_create(BOOL* gameExplorerAvailable)
|
static void test_create(BOOL* gameExplorerAvailable, BOOL* gameExplorer2Available)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
|
@ -391,6 +391,7 @@ static void test_create(BOOL* gameExplorerAvailable)
|
||||||
if(ge2)
|
if(ge2)
|
||||||
{
|
{
|
||||||
ok( hr == S_OK, "IGameExplorer2 creating failed (result false)\n");
|
ok( hr == S_OK, "IGameExplorer2 creating failed (result false)\n");
|
||||||
|
*gameExplorer2Available = TRUE;
|
||||||
IGameExplorer2_Release(ge2);
|
IGameExplorer2_Release(ge2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -477,21 +478,61 @@ static void test_add_remove_game(void)
|
||||||
IGameExplorer_Release(ge);
|
IGameExplorer_Release(ge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void test_install_uninstall_game(void)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
IGameExplorer2* ge2 = NULL;
|
||||||
|
WCHAR sExeName[MAX_PATH];
|
||||||
|
WCHAR sExePath[MAX_PATH];
|
||||||
|
DWORD dwExeNameLen;
|
||||||
|
|
||||||
|
hr = CoCreateInstance(&CLSID_GameExplorer, NULL, CLSCTX_INPROC_SERVER, &IID_IGameExplorer2, (LPVOID*)&ge2);
|
||||||
|
ok(ge2 != NULL, "cannot create coclass IGameExplorer2\n");
|
||||||
|
ok(hr == S_OK, "cannot create coclass IGameExplorer2\n");
|
||||||
|
|
||||||
|
if(ge2)
|
||||||
|
{
|
||||||
|
/* prepare path to binary */
|
||||||
|
dwExeNameLen = GetModuleFileNameW(NULL, sExeName, sizeof (sExeName) / sizeof (sExeName[0]));
|
||||||
|
ok(dwExeNameLen != 0, "GetModuleFileNameW returned invalid value\n");
|
||||||
|
lstrcpynW(sExePath, sExeName, StrRChrW(sExeName, NULL, '\\') - sExeName + 1);
|
||||||
|
|
||||||
|
trace("prepared EXE name: %s\n", wine_dbgstr_w(sExeName));
|
||||||
|
trace("prepared EXE path: %s\n", wine_dbgstr_w(sExePath));
|
||||||
|
|
||||||
|
|
||||||
|
hr = IGameExplorer2_InstallGame(ge2, sExeName, sExePath, GIS_CURRENT_USER);
|
||||||
|
todo_wine ok(SUCCEEDED(hr), "IGameExplorer2::InstallGame failed (error 0x%08x)\n", hr);
|
||||||
|
|
||||||
|
if(SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
hr = IGameExplorer2_UninstallGame(ge2, sExeName);
|
||||||
|
todo_wine ok(SUCCEEDED(hr), "IGameExplorer2::UninstallGame failed (error 0x%08x)\n", hr);
|
||||||
|
}
|
||||||
|
|
||||||
|
IGameExplorer2_Release(ge2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(gameexplorer)
|
START_TEST(gameexplorer)
|
||||||
{
|
{
|
||||||
HRESULT r;
|
HRESULT r;
|
||||||
BOOL gameExplorerAvailable = FALSE;
|
BOOL gameExplorerAvailable = FALSE;
|
||||||
|
BOOL gameExplorer2Available = FALSE;
|
||||||
|
|
||||||
if(_loadDynamicRoutines())
|
if(_loadDynamicRoutines())
|
||||||
{
|
{
|
||||||
r = CoInitialize( NULL );
|
r = CoInitialize( NULL );
|
||||||
ok( r == S_OK, "failed to init COM\n");
|
ok( r == S_OK, "failed to init COM\n");
|
||||||
|
|
||||||
test_create(&gameExplorerAvailable);
|
test_create(&gameExplorerAvailable, &gameExplorer2Available);
|
||||||
|
|
||||||
if(gameExplorerAvailable)
|
if(gameExplorerAvailable)
|
||||||
test_add_remove_game();
|
test_add_remove_game();
|
||||||
|
|
||||||
|
if(gameExplorer2Available)
|
||||||
|
test_install_uninstall_game();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* this is not a failure, because both procedures loaded by address
|
/* this is not a failure, because both procedures loaded by address
|
||||||
|
|
|
@ -27,5 +27,14 @@ xmlns="urn:schemas-microsoft-com:GameDescription.v1">
|
||||||
<Version>
|
<Version>
|
||||||
<VersionNumber versionNumber="1.0.0.0"/>
|
<VersionNumber versionNumber="1.0.0.0"/>
|
||||||
</Version>
|
</Version>
|
||||||
|
<ExtendedProperties>
|
||||||
|
<GameTasks>
|
||||||
|
<Play>
|
||||||
|
<Primary>
|
||||||
|
<FileTask path="gameux_crosstest.exe" arguments="" />
|
||||||
|
</Primary>
|
||||||
|
</Play>
|
||||||
|
</GameTasks>
|
||||||
|
</ExtendedProperties>
|
||||||
</GameDefinition>
|
</GameDefinition>
|
||||||
</GameDefinitionFile>
|
</GameDefinitionFile>
|
||||||
|
|
Loading…
Reference in New Issue