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
683502f4
Commit
683502f4
authored
Aug 23, 2010
by
Mariusz Pluciński
Committed by
Alexandre Julliard
Aug 23, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gameux/tests: Add tests for AddGame and RemoveGame methods.
parent
c8193717
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
140 additions
and
5 deletions
+140
-5
Makefile.in
dlls/gameux/tests/Makefile.in
+2
-1
gameexplorer.c
dlls/gameux/tests/gameexplorer.c
+82
-4
rsrc.rc
dlls/gameux/tests/rsrc.rc
+26
-0
test.gdf.xml
dlls/gameux/tests/test.gdf.xml
+30
-0
No files found.
dlls/gameux/tests/Makefile.in
View file @
683502f4
...
...
@@ -3,11 +3,12 @@ TOPOBJDIR = ../../..
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
TESTDLL
=
gameux.dll
IMPORTS
=
ole32
IMPORTS
=
uuid shlwapi oleaut32
ole32
C_SRCS
=
\
gameexplorer.c
\
gamestatistics.c
RC_SRCS
=
rsrc.rc
@MAKE_TEST_RULES@
dlls/gameux/tests/gameexplorer.c
View file @
683502f4
...
...
@@ -20,18 +20,20 @@
#define COBJMACROS
#include "initguid.h"
#include "windows.h"
#include "ole2.h"
#include "objsafe.h"
#include "objbase.h"
#include "shlwapi.h"
#include "shobjidl.h"
#include "initguid.h"
#include "gameux.h"
#include "wine/test.h"
static
void
test_create
(
void
)
static
void
test_create
(
BOOL
*
gameExplorerAvailable
)
{
HRESULT
hr
;
...
...
@@ -43,6 +45,7 @@ static void test_create( void )
if
(
ge
)
{
ok
(
hr
==
S_OK
,
"IGameExplorer creating failed (result false)
\n
"
);
*
gameExplorerAvailable
=
TRUE
;
IGameExplorer_Release
(
ge
);
}
else
...
...
@@ -59,14 +62,89 @@ static void test_create( void )
win_skip
(
"IGameExplorer2 cannot be created
\n
"
);
}
static
void
test_add_remove_game
(
void
)
{
static
const
GUID
defaultGUID
=
{
0x01234567
,
0x89AB
,
0xCDEF
,
{
0x01
,
0x23
,
0x45
,
0x67
,
0x89
,
0xAB
,
0xCD
,
0xEF
}};
HRESULT
hr
;
IGameExplorer
*
ge
=
NULL
;
WCHAR
sExeName
[
MAX_PATH
];
WCHAR
sExePath
[
MAX_PATH
];
BSTR
bstrExeName
=
NULL
,
bstrExePath
=
NULL
;
DWORD
dwExeNameLen
;
GUID
guid
;
hr
=
CoCreateInstance
(
&
CLSID_GameExplorer
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IGameExplorer
,
(
LPVOID
*
)
&
ge
);
ok
(
ge
!=
NULL
,
"cannot create coclass IGameExplorer
\n
"
);
ok
(
hr
==
S_OK
,
"cannot create coclass IGameExplorer
\n
"
);
if
(
ge
)
{
/* 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
);
bstrExeName
=
SysAllocString
(
sExeName
);
ok
(
bstrExeName
!=
NULL
,
"cannot allocate string for exe name
\n
"
);
bstrExePath
=
SysAllocString
(
sExePath
);
ok
(
bstrExePath
!=
NULL
,
"cannot allocate string for exe path
\n
"
);
if
(
bstrExeName
&&
bstrExePath
)
{
trace
(
"prepared EXE name: %s
\n
"
,
wine_dbgstr_w
(
bstrExeName
));
trace
(
"prepared EXE path: %s
\n
"
,
wine_dbgstr_w
(
bstrExePath
));
/* try to register game with provided guid */
memcpy
(
&
guid
,
&
defaultGUID
,
sizeof
(
guid
));
hr
=
IGameExplorer_AddGame
(
ge
,
bstrExeName
,
bstrExePath
,
GIS_CURRENT_USER
,
&
guid
);
todo_wine
ok
(
SUCCEEDED
(
hr
),
"IGameExplorer::AddGame failed (error 0x%08x)
\n
"
,
hr
);
ok
(
memcmp
(
&
guid
,
&
defaultGUID
,
sizeof
(
guid
))
==
0
,
"AddGame unexpectedly modified GUID
\n
"
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IGameExplorer_RemoveGame
(
ge
,
guid
);
todo_wine
ok
(
SUCCEEDED
(
hr
),
"IGameExplorer::RemoveGame failed (error 0x%08x)
\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
);
todo_wine
ok
(
SUCCEEDED
(
hr
),
"IGameExplorer::AddGame failed (error 0x%08x)
\n
"
,
hr
);
todo_wine
ok
(
memcmp
(
&
guid
,
&
GUID_NULL
,
sizeof
(
guid
))
!=
0
,
"AddGame did not modify GUID
\n
"
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IGameExplorer_RemoveGame
(
ge
,
guid
);
todo_wine
ok
(
SUCCEEDED
(
hr
),
"IGameExplorer::RemoveGame failed (error 0x%08x)
\n
"
,
hr
);
}
}
/* free allocated resources */
SysFreeString
(
bstrExePath
);
SysFreeString
(
bstrExeName
);
IGameExplorer_Release
(
ge
);
}
}
START_TEST
(
gameexplorer
)
{
HRESULT
r
;
BOOL
gameExplorerAvailable
=
FALSE
;
r
=
CoInitialize
(
NULL
);
ok
(
r
==
S_OK
,
"failed to init COM
\n
"
);
test_create
();
test_create
(
&
gameExplorerAvailable
);
if
(
gameExplorerAvailable
)
test_add_remove_game
();
CoUninitialize
();
}
dlls/gameux/tests/rsrc.rc
0 → 100644
View file @
683502f4
/*
* Resources script for GameUX testing
*
* Copyright (C) 2010 Mariusz Pluciński
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "windef.h"
#include "winuser.h"
#include <gameux.h>
LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT
ID_GDF_XML DATA "test.gdf.xml"
dlls/gameux/tests/test.gdf.xml
0 → 100644
View file @
683502f4
<?xml version="1.0" encoding="utf-8"?>
<!--
Example Game Definition File
Copyright (C) 2010 Mariusz Pluciński
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
-->
<GameDefinitionFile
xmlns:baseTypes=
"urn:schemas-microsoft-com:GamesExplorerBaseTypes.v1"
xmlns=
"urn:schemas-microsoft-com:GameDescription.v1"
>
<GameDefinition
gameID=
"{17A6558E-60BE-4078-B66F-9C3ADA2A32E6}"
>
<Name>
Example Game
</Name>
<Version>
<VersionNumber
versionNumber=
"1.0.0.0"
/>
</Version>
</GameDefinition>
</GameDefinitionFile>
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