Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
2062a483
Commit
2062a483
authored
Feb 21, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
Feb 24, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gameux/tests: Simplify test game registering, add intermediate test checks.
parent
300c2ded
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
41 deletions
+23
-41
gamestatistics.c
dlls/gameux/tests/gamestatistics.c
+23
-41
No files found.
dlls/gameux/tests/gamestatistics.c
View file @
2062a483
...
...
@@ -30,7 +30,6 @@
/*******************************************************************************
* utilities
*/
static
IGameExplorer
*
ge
=
NULL
;
static
WCHAR
sExeName
[
MAX_PATH
]
=
{
0
};
static
GUID
gameInstanceId
;
static
HRESULT
WINAPI
(
*
pSHGetFolderPathW
)(
HWND
,
int
,
HANDLE
,
DWORD
,
LPWSTR
);
...
...
@@ -52,65 +51,50 @@ static BOOL _loadDynamicRoutines(void)
if
(
!
pSHGetFolderPathW
)
return
FALSE
;
return
TRUE
;
}
/*******************************************************************************
* _registerGame
* Registers test suite executable as game in Games Explorer. Required to test
* game statistics.
*/
static
HRESULT
_registerGame
(
void
)
{
static
void
test_register_game
(
IGameExplorer
**
explorer
)
{
HRESULT
hr
;
WCHAR
sExePath
[
MAX_PATH
];
WCHAR
pathW
[
MAX_PATH
];
BSTR
bstrExeName
,
bstrExePath
;
DWORD
dwExeNameLen
;
/* prepare path to binary */
dwExeNameLen
=
GetModuleFileNameW
(
NULL
,
sExeName
,
sizeof
(
sExeName
)
/
sizeof
(
sExeName
[
0
]));
hr
=
(
dwExeNameLen
!=
0
?
S_OK
:
E_FAIL
);
lstrcpynW
(
sExePath
,
sExeName
,
StrRChrW
(
sExeName
,
NULL
,
'\\'
)
-
sExeName
+
1
);
bstrExeName
=
SysAllocString
(
sExeName
);
if
(
!
bstrExeName
)
hr
=
E_OUTOFMEMORY
;
bstrExePath
=
SysAllocString
(
sExePath
);
if
(
!
bstrExePath
)
hr
=
E_OUTOFMEMORY
;
GetModuleFileNameW
(
NULL
,
sExeName
,
sizeof
(
sExeName
)
/
sizeof
(
sExeName
[
0
]));
if
(
SUCCEEDED
(
hr
))
{
gameInstanceId
=
GUID_NULL
;
hr
=
CoCreateInstance
(
&
CLSID_GameExplorer
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IGameExplorer
,
(
LPVOID
*
)
&
ge
);
}
lstrcpyW
(
pathW
,
sExeName
);
PathRemoveFileSpecW
(
pathW
);
if
(
SUCCEEDED
(
hr
))
hr
=
IGameExplorer_AddGame
(
ge
,
bstrExeName
,
bstrExePath
,
GIS_CURRENT_USER
,
&
gameInstanceId
);
hr
=
CoCreateInstance
(
&
CLSID_GameExplorer
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IGameExplorer
,
(
void
**
)
explorer
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
if
(
FAILED
(
hr
)
&&
ge
)
{
IGameExplorer_Release
(
ge
);
ge
=
NULL
;
}
gameInstanceId
=
GUID_NULL
;
bstrExeName
=
SysAllocString
(
sExeName
);
bstrExePath
=
SysAllocString
(
pathW
);
hr
=
IGameExplorer_AddGame
(
*
explorer
,
bstrExeName
,
bstrExePath
,
GIS_CURRENT_USER
,
&
gameInstanceId
)
;
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
SysFreeString
(
bstrExeName
);
SysFreeString
(
bstrExePath
);
return
hr
;
}
/*******************************************************************************
* _unregisterGame
* Unregisters test suite from Games Explorer.
*/
static
HRESULT
_unregisterGame
(
void
)
{
static
void
test_unregister_game
(
IGameExplorer
*
ge
)
{
HRESULT
hr
;
if
(
!
ge
)
return
E_FAIL
;
if
(
!
ge
)
return
;
hr
=
IGameExplorer_RemoveGame
(
ge
,
gameInstanceId
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
IGameExplorer_Release
(
ge
);
ge
=
NULL
;
return
hr
;
}
/*******************************************************************************
* _buildStatisticsFilePath
* Creates path to file containing statistics of game with given id.
...
...
@@ -438,13 +422,11 @@ START_TEST(gamestatistics)
if
(
gameStatisticsAvailable
)
{
hr
=
_registerGame
();
ok
(
hr
==
S_OK
,
"cannot register game in Game Explorer (error: 0x%x)
\n
"
,
hr
);
IGameExplorer
*
ge
;
test_register_game
(
&
ge
);
test_gamestatisticsmgr
();
hr
=
_unregisterGame
();
ok
(
hr
==
S_OK
,
"cannot unregister game from Game Explorer (error: 0x%x)
\n
"
,
hr
);
test_unregister_game
(
ge
);
}
CoUninitialize
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment