Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
91b705dc
Commit
91b705dc
authored
Feb 28, 2022
by
Eric Pouech
Committed by
Alexandre Julliard
Feb 28, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gameux/tests: Enable compilation with long types.
Signed-off-by:
Eric Pouech
<
eric.pouech@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3350d094
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
29 deletions
+28
-29
Makefile.in
dlls/gameux/tests/Makefile.in
+0
-1
gameexplorer.c
dlls/gameux/tests/gameexplorer.c
+8
-8
gamestatistics.c
dlls/gameux/tests/gamestatistics.c
+20
-20
No files found.
dlls/gameux/tests/Makefile.in
View file @
91b705dc
EXTRADEFS
=
-DWINE_NO_LONG_TYPES
TESTDLL
=
gameux.dll
IMPORTS
=
uuid shlwapi oleaut32 ole32 advapi32 shell32
...
...
dlls/gameux/tests/gameexplorer.c
View file @
91b705dc
...
...
@@ -102,25 +102,25 @@ static void test_add_remove_game(void)
memcpy
(
&
guid
,
&
defaultGUID
,
sizeof
(
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%08
l
x)
\n
"
,
hr
);
ok
(
memcmp
(
&
guid
,
&
defaultGUID
,
sizeof
(
guid
))
==
0
,
"AddGame unexpectedly modified GUID
\n
"
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IGameExplorer_RemoveGame
(
ge
,
guid
);
ok
(
SUCCEEDED
(
hr
),
"IGameExplorer::RemoveGame failed (error 0x%08x)
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"IGameExplorer::RemoveGame failed (error 0x%08
l
x)
\n
"
,
hr
);
}
/* try to register game with empty guid */
memcpy
(
&
guid
,
&
GUID_NULL
,
sizeof
(
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%08
l
x)
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IGameExplorer_RemoveGame
(
ge
,
guid
);
ok
(
SUCCEEDED
(
hr
),
"IGameExplorer::RemoveGame failed (error 0x%08x)
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"IGameExplorer::RemoveGame failed (error 0x%08
l
x)
\n
"
,
hr
);
}
}
...
...
@@ -157,12 +157,12 @@ static void test_install_uninstall_game(void)
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%08
l
x)
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IGameExplorer2_UninstallGame
(
ge2
,
sExeName
);
ok
(
SUCCEEDED
(
hr
),
"IGameExplorer2::UninstallGame failed (error 0x%08x)
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"IGameExplorer2::UninstallGame failed (error 0x%08
l
x)
\n
"
,
hr
);
}
IGameExplorer2_Release
(
ge2
);
...
...
@@ -188,13 +188,13 @@ START_TEST(gameexplorer)
HRESULT
hr
;
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 %#
l
x.
\n
"
,
hr
);
trace
(
"Running multithreaded tests.
\n
"
);
run_tests
();
CoUninitialize
();
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 %#
l
x.
\n
"
,
hr
);
trace
(
"Running apartment threaded tests.
\n
"
);
run_tests
();
CoUninitialize
();
...
...
dlls/gameux/tests/gamestatistics.c
View file @
91b705dc
...
...
@@ -50,13 +50,13 @@ static void test_register_game(IGameExplorer **explorer)
PathRemoveFileSpecW
(
pathW
);
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%08
l
x
\n
"
,
hr
);
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
);
ok
(
hr
==
S_OK
,
"got 0x%08
l
x
\n
"
,
hr
);
SysFreeString
(
bstrExeName
);
SysFreeString
(
bstrExePath
);
...
...
@@ -72,7 +72,7 @@ static void test_unregister_game(IGameExplorer *ge)
if
(
!
ge
)
return
;
hr
=
IGameExplorer_RemoveGame
(
ge
,
gameInstanceId
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got 0x%08
l
x
\n
"
,
hr
);
IGameExplorer_Release
(
ge
);
}
...
...
@@ -164,13 +164,13 @@ static void test_gamestatisticsmgr( void )
win_skip
(
"gameux is partially stubbed, skipping tests
\n
"
);
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%08
l
x
\n
"
,
hr
);
ok
(
gs
==
NULL
,
"Expected output pointer to be NULL, got %s
\n
"
,
(
gs
==
(
void
*
)
0xdeadbeef
?
"deadbeef"
:
"neither NULL nor deadbeef"
));
/* now, allow them to be created */
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%
l
x
\n
"
,
hr
);
ok
(
gs
!=
NULL
,
"GetGameStatistics did not return valid interface pointer
\n
"
);
if
(
gs
)
{
...
...
@@ -197,16 +197,16 @@ static void test_gamestatisticsmgr( void )
/* create name of statistics file */
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%
l
x)
\n
"
,
hr
);
trace
(
"statistics file path: %s
\n
"
,
wine_dbgstr_w
(
lpStatisticsFile
));
ok
(
_isFileExists
(
lpStatisticsFile
)
==
FALSE
,
"statistics file %s already exists
\n
"
,
wine_dbgstr_w
(
lpStatisticsFile
));
/* write sample statistics */
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%
l
x
\n
"
,
hr
);
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%
l
x
\n
"
,
hr
);
/* check what happen if string is too long */
sTooLongString
=
CoTaskMemAlloc
(
sizeof
(
WCHAR
)
*
(
uMaxCategoryLength
+
2
));
...
...
@@ -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) */
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%
l
x
\n
"
,
hr
);
CoTaskMemFree
(
sTooLongString
);
ok
(
IGameStatistics_SetCategoryTitle
(
gs
,
0
,
L"Category0"
)
==
S_OK
,
"setting category title failed: Category0
\n
"
);
...
...
@@ -224,32 +224,32 @@ static void test_gamestatisticsmgr( void )
/* check what happen if any string is NULL */
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%
l
x)
\n
"
,
hr
);
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%
l
x)
\n
"
,
hr
);
/* check what happen if any string is too long */
sTooLongString
=
CoTaskMemAlloc
(
sizeof
(
WCHAR
)
*
(
uMaxNameLength
+
2
));
memset
(
sTooLongString
,
'a'
,
sizeof
(
WCHAR
)
*
(
uMaxNameLength
+
1
));
sTooLongString
[
uMaxNameLength
+
1
]
=
0
;
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%
l
x)
\n
"
,
hr
);
CoTaskMemFree
(
sTooLongString
);
sTooLongString
=
CoTaskMemAlloc
(
sizeof
(
WCHAR
)
*
(
uMaxValueLength
+
2
));
memset
(
sTooLongString
,
'a'
,
sizeof
(
WCHAR
)
*
(
uMaxValueLength
+
1
));
sTooLongString
[
uMaxValueLength
+
1
]
=
0
;
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%
l
x)
\n
"
,
hr
);
CoTaskMemFree
(
sTooLongString
);
/* check what happen on too big index of category or statistic */
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%
l
x)
\n
"
,
hr
);
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%
l
x)
\n
"
,
hr
);
ok
(
IGameStatistics_SetStatistic
(
gs
,
0
,
0
,
L"Statistic00"
,
L"Value00"
)
==
S_OK
,
"setting statistic failed: name=Statistic00, value=Value00
\n
"
);
...
...
@@ -274,11 +274,11 @@ static void test_gamestatisticsmgr( void )
ok
(
IGameStatistics_SetCategoryTitle
(
gs
,
0
,
L"Category0a"
)
==
S_OK
,
"setting category title failed: Category0a
\n
"
);
hr
=
IGameStatistics_Release
(
gs
);
ok
(
SUCCEEDED
(
hr
),
"releasing IGameStatistics returned error: 0x%08x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"releasing IGameStatistics returned error: 0x%08
l
x
\n
"
,
hr
);
/* try to read written statistics */
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%08
l
x
\n
"
,
hr
);
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
"
);
...
...
@@ -350,17 +350,17 @@ static void test_gamestatisticsmgr( void )
CoTaskMemFree
(
lpValue
);
hr
=
IGameStatistics_Release
(
gs
);
ok
(
SUCCEEDED
(
hr
),
"releasing IGameStatistics returned error: 0x%x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"releasing IGameStatistics returned error: 0x%
l
x
\n
"
,
hr
);
/* test of removing game statistics from underlying storage */
ok
(
_isFileExists
(
lpStatisticsFile
)
==
TRUE
,
"statistics file %s does not exists
\n
"
,
wine_dbgstr_w
(
lpStatisticsFile
));
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%
l
x
\n
"
,
hr
);
ok
(
_isFileExists
(
lpStatisticsFile
)
==
FALSE
,
"statistics file %s still exists
\n
"
,
wine_dbgstr_w
(
lpStatisticsFile
));
}
hr
=
IGameStatisticsMgr_Release
(
gsm
);
ok
(
SUCCEEDED
(
hr
),
"releasing IGameStatisticsMgr returned error: 0x%x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"releasing IGameStatisticsMgr returned error: 0x%
l
x
\n
"
,
hr
);
CoTaskMemFree
(
lpStatisticsFile
);
}
...
...
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