ReactOS
0.4.16-dev-125-g798ea90
create.cpp
Go to the documentation of this file.
1
HWND
CreateBasicWindow
(
VOID
);
2
3
LPDIRECTDRAW7
DirectDraw
;
4
5
BOOL
TestCaps
(
const
char
*
dummy
,
DWORD
Caps,
HRESULT
test1
,
HRESULT
test2
)
6
{
7
LPDIRECTDRAWSURFACE7
Surface =
NULL
;
8
DDSURFACEDESC2
Desc = { 0 };
9
Desc.
dwHeight
= 200;
10
Desc.
dwWidth
= 200;
11
Desc.
dwSize
=
sizeof
(
DDSURFACEDESC2
);
12
Desc.
ddsCaps
.
dwCaps
= Caps;
13
14
Desc.
dwFlags
=
DDSD_CAPS
;
15
BOOL
ret
=
DirectDraw
->CreateSurface(&Desc, &Surface,
NULL
) ==
test1
;
16
17
Desc.
dwFlags
=
DDSD_CAPS
|
DDSD_HEIGHT
|
DDSD_WIDTH
;
18
ret
=
ret
&&
DirectDraw
->CreateSurface(&Desc, &Surface,
NULL
) ==
test2
;
19
20
if
( Surface )
21
Surface->
Release
();
22
23
return
ret
;
24
}
25
26
BOOL
Test_CreateSurface
(
INT
* passed,
INT
* failed)
27
{
28
LPDIRECTDRAWSURFACE7
Surface =
NULL
;
29
HWND
hwnd
;
30
31
/* Preparations */
32
if
(
DirectDrawCreateEx
(
NULL
, (
VOID
**)&
DirectDraw
, IID_IDirectDraw7,
NULL
) !=
DD_OK
)
33
{
34
printf
(
"ERROR: Failed to set up ddraw\n"
);
35
return
FALSE
;
36
}
37
38
TEST
(
DirectDraw
->CreateSurface(
NULL
,
NULL
,
NULL
) ==
DDERR_NOCOOPERATIVELEVELSET
);
39
40
if
(!(
hwnd
=
CreateBasicWindow
() ))
41
{
42
printf
(
"ERROR: Failed to create window\n"
);
43
DirectDraw
->Release();
44
return
FALSE
;
45
}
46
47
if
(
DirectDraw
->SetCooperativeLevel (
hwnd
,
DDSCL_NORMAL
) !=
DD_OK
)
48
{
49
printf
(
"ERROR: Could not set cooperative level\n"
);
50
DirectDraw
->Release();
51
return
0;
52
}
53
54
/* The Test */
55
DDSURFACEDESC2
Desc = { 0 };
56
Desc.
dwSize
=
sizeof
(
DDSURFACEDESC2
);
57
Desc.
dwHeight
= 200;
58
Desc.
dwWidth
= 200;
59
60
TEST
(
DirectDraw
->CreateSurface(&Desc, &Surface, (
IUnknown
*)0xdeadbeef) ==
CLASS_E_NOAGGREGATION
);
61
TEST
(
DirectDraw
->CreateSurface(
NULL
, &Surface,
NULL
) ==
DDERR_INVALIDPARAMS
);
62
TEST
(
DirectDraw
->CreateSurface(&Desc,
NULL
,
NULL
) ==
DDERR_INVALIDPARAMS
);
63
TEST
(
DirectDraw
->CreateSurface(&Desc, &Surface,
NULL
) ==
DDERR_INVALIDPARAMS
);
64
65
// Test (nearly) all possible cap combinations
66
#include "
caps_tests.h
"
67
68
DirectDraw
->Release();
69
70
return
TRUE
;
71
}
caps_tests.h
DirectDraw
Definition:
ddraw_classes.idl:28
NULL
#define NULL
Definition:
types.h:112
TRUE
#define TRUE
Definition:
types.h:120
FALSE
#define FALSE
Definition:
types.h:117
DirectDrawCreateEx
HRESULT WINAPI DirectDrawCreateEx(LPGUID lpGUID, LPVOID *lplpDD, REFIID id, LPUNKNOWN pUnkOuter)
Definition:
main.c:139
LPDIRECTDRAW7
DWORD * LPDIRECTDRAW7
Definition:
vmrender.idl:6
LPDIRECTDRAWSURFACE7
DWORD * LPDIRECTDRAWSURFACE7
Definition:
vmrender.idl:7
test2
void test2()
Definition:
ehthrow.cxx:284
test1
void test1()
Definition:
ehthrow.cxx:277
BOOL
unsigned int BOOL
Definition:
ntddk_ex.h:94
DWORD
unsigned long DWORD
Definition:
ntddk_ex.h:95
printf
#define printf
Definition:
freeldr.h:97
HRESULT
Definition:
mshtmhst.idl:286
IUnknown
Definition:
unknwn.idl:39
dummy
Definition:
ndr_types.idl:28
nsISupports::Release
nsrefcnt Release()
void
Definition:
nsiface.idl:2307
TEST
#define TEST(x)
Definition:
precomp.h:20
CreateBasicWindow
HWND CreateBasicWindow(VOID)
Test_CreateSurface
BOOL Test_CreateSurface(INT *passed, INT *failed)
Definition:
create.cpp:26
TestCaps
BOOL TestCaps(const char *dummy, DWORD Caps, HRESULT test1, HRESULT test2)
Definition:
create.cpp:5
DDSD_WIDTH
#define DDSD_WIDTH
Definition:
ddraw.h:210
DDSCL_NORMAL
#define DDSCL_NORMAL
Definition:
ddraw.h:535
DDSURFACEDESC2
struct _DDSURFACEDESC2 DDSURFACEDESC2
DDSD_HEIGHT
#define DDSD_HEIGHT
Definition:
ddraw.h:209
DDERR_NOCOOPERATIVELEVELSET
#define DDERR_NOCOOPERATIVELEVELSET
Definition:
ddraw.h:89
DD_OK
#define DD_OK
Definition:
ddraw.h:186
DDERR_INVALIDPARAMS
#define DDERR_INVALIDPARAMS
Definition:
ddraw.h:79
DDSD_CAPS
#define DDSD_CAPS
Definition:
ddraw.h:208
_DDSCAPS2::dwCaps
DWORD dwCaps
Definition:
ddraw.h:732
_DDSURFACEDESC2
Definition:
ddraw.h:1151
_DDSURFACEDESC2::dwWidth
DWORD dwWidth
Definition:
ddraw.h:1155
_DDSURFACEDESC2::dwHeight
DWORD dwHeight
Definition:
ddraw.h:1154
_DDSURFACEDESC2::ddsCaps
DDSCAPS2 ddsCaps
Definition:
ddraw.h:1188
_DDSURFACEDESC2::dwFlags
DWORD dwFlags
Definition:
ddraw.h:1153
_DDSURFACEDESC2::dwSize
DWORD dwSize
Definition:
ddraw.h:1152
INT
int32_t INT
Definition:
typedefs.h:58
ret
int ret
Definition:
wcstombs-tests.c:31
hwnd
_In_ LONG _In_ HWND hwnd
Definition:
winddi.h:4023
CLASS_E_NOAGGREGATION
#define CLASS_E_NOAGGREGATION
Definition:
winerror.h:2662
modules
rostests
dxtest
ddraw
Surface
create.cpp
Generated on Mon Oct 14 2024 06:08:10 for ReactOS by
1.9.6