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
b1389448
Commit
b1389448
authored
Jan 07, 2009
by
Stefan Dösinger
Committed by
Alexandre Julliard
Jan 09, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddrawex: Add a refcount test.
parent
ae4e8244
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
120 additions
and
0 deletions
+120
-0
Makefile.in
dlls/ddrawex/tests/Makefile.in
+1
-0
ddrawex.c
dlls/ddrawex/tests/ddrawex.c
+119
-0
No files found.
dlls/ddrawex/tests/Makefile.in
View file @
b1389448
...
...
@@ -6,6 +6,7 @@ TESTDLL = ddrawex.dll
IMPORTS
=
user32 gdi32 kernel32
CTESTS
=
\
ddrawex.c
\
surface.c
@MAKE_TEST_RULES@
...
...
dlls/ddrawex/tests/ddrawex.c
0 → 100644
View file @
b1389448
/*
* Unit tests for ddrawex specific things
*
* 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
*/
#define COBJMACROS
#include <assert.h>
#include "wine/test.h"
#include "windef.h"
#include "winbase.h"
#include "ddraw.h"
#include "ddrawex.h"
#include "unknwn.h"
static
IDirectDrawFactory
*
factory
;
static
HRESULT
(
WINAPI
*
pDllGetClassObject
)(
REFCLSID
rclsid
,
REFIID
riid
,
LPVOID
*
ppv
);
static
IDirectDraw
*
createDD
(
void
)
{
HRESULT
hr
;
IDirectDraw
*
dd
;
hr
=
IDirectDrawFactory_CreateDirectDraw
(
factory
,
NULL
,
NULL
,
DDSCL_NORMAL
,
0
,
0
,
&
dd
);
ok
(
hr
==
DD_OK
,
"Failed to create an IDirectDraw interface, hr = 0x%08x
\n
"
,
hr
);
return
SUCCEEDED
(
hr
)
?
dd
:
NULL
;
}
static
ULONG
get_ref
(
IUnknown
*
o
)
{
IUnknown_AddRef
(
o
);
return
IUnknown_Release
(
o
);
}
static
void
RefCountTest
(
void
)
{
IDirectDraw
*
dd1
=
createDD
();
IDirectDraw2
*
dd2
;
IDirectDraw3
*
dd3
;
IDirectDraw4
*
dd4
;
ULONG
ref
;
ref
=
get_ref
((
IUnknown
*
)
dd1
);
ok
(
ref
==
1
,
"A new ddraw object's refcount is %u, expected 1
\n
"
,
ref
);
IDirectDraw_AddRef
(
dd1
);
ref
=
get_ref
((
IUnknown
*
)
dd1
);
ok
(
ref
==
2
,
"After AddRef the refcount is %u, expected 2
\n
"
,
ref
);
IDirectDraw_Release
(
dd1
);
ref
=
get_ref
((
IUnknown
*
)
dd1
);
ok
(
ref
==
1
,
"After Release the refcount is %u, expected 2
\n
"
,
ref
);
IDirectDraw_QueryInterface
(
dd1
,
&
IID_IDirectDraw2
,
(
void
**
)
&
dd2
);
ref
=
get_ref
((
IUnknown
*
)
dd2
);
ok
(
ref
==
2
,
"IDirectDraw2 refcount is %u, expected 2
\n
"
,
ref
);
IDirectDraw_QueryInterface
(
dd1
,
&
IID_IDirectDraw3
,
(
void
**
)
&
dd3
);
ref
=
get_ref
((
IUnknown
*
)
dd3
);
ok
(
ref
==
3
,
"IDirectDraw3 refcount is %u, expected 3
\n
"
,
ref
);
IDirectDraw_QueryInterface
(
dd1
,
&
IID_IDirectDraw4
,
(
void
**
)
&
dd4
);
ref
=
get_ref
((
IUnknown
*
)
dd4
);
ok
(
ref
==
4
,
"IDirectDraw4 refcount is %u, expected 4
\n
"
,
ref
);
IDirectDraw_Release
(
dd1
);
IDirectDraw2_Release
(
dd2
);
IDirectDraw3_Release
(
dd3
);
ref
=
get_ref
((
IUnknown
*
)
dd4
);
ok
(
ref
==
1
,
"IDirectDraw4 refcount is %u, expected 1
\n
"
,
ref
);
IDirectDraw4_Release
(
dd4
);
}
START_TEST
(
ddrawex
)
{
IClassFactory
*
classfactory
=
NULL
;
ULONG
ref
;
HRESULT
hr
;
HMODULE
hmod
=
LoadLibrary
(
"ddrawex.dll"
);
if
(
hmod
==
NULL
)
{
skip
(
"Failed to load ddrawex.dll
\n
"
);
return
;
}
pDllGetClassObject
=
(
void
*
)
GetProcAddress
(
hmod
,
"DllGetClassObject"
);
if
(
pDllGetClassObject
==
NULL
)
{
skip
(
"Failed to get DllGetClassObject
\n
"
);
return
;
}
hr
=
pDllGetClassObject
(
&
CLSID_DirectDrawFactory
,
&
IID_IClassFactory
,
(
void
**
)
&
classfactory
);
ok
(
hr
==
S_OK
,
"Failed to create a IClassFactory
\n
"
);
hr
=
IClassFactory_CreateInstance
(
classfactory
,
NULL
,
&
IID_IDirectDrawFactory
,
(
void
**
)
&
factory
);
ok
(
hr
==
S_OK
,
"Failed to create a IDirectDrawFactory
\n
"
);
RefCountTest
();
if
(
factory
)
{
ref
=
IDirectDrawFactory_Release
(
factory
);
ok
(
ref
==
0
,
"IDirectDrawFactory not cleanly released
\n
"
);
}
if
(
classfactory
)
{
ref
=
IClassFactory_Release
(
classfactory
);
todo_wine
ok
(
ref
==
1
,
"IClassFactory refcount wrong, ref = %u
\n
"
,
ref
);
}
}
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