ReactOS
0.4.16-dev-197-g92996da
private_data.cpp
Go to the documentation of this file.
1
BOOL
CreateSurface
(
LPDIRECTDRAWSURFACE7
*
pSurface
);
2
3
BOOL
Test_PrivateData
(
INT
* passed,
INT
* failed)
4
{
5
LPDIRECTDRAWSURFACE7
Surface;
6
DWORD
size
,
dummy
= 0xBAADF00D;
7
GUID
guid
= { 0 };
8
GUID
guid2
= { 0x1 };
9
10
if
(!
CreateSurface
(&Surface))
11
return
FALSE
;
12
13
// General test
14
TEST
(Surface->SetPrivateData(
guid
,
NULL
, 0, 0) ==
DDERR_INVALIDPARAMS
);
15
TEST
(Surface->SetPrivateData(
guid
, (
LPVOID
)&
dummy
, 0, 0) ==
DDERR_INVALIDPARAMS
);
16
TEST
(Surface->SetPrivateData(
guid
, (
LPVOID
)0xdeadbeef,
sizeof
(
DWORD
), 0) ==
DDERR_INVALIDPARAMS
);
17
TEST
(Surface->SetPrivateData(
guid
, (
LPVOID
)&
dummy
,
sizeof
(
DWORD
), 0) ==
DD_OK
);
18
19
TEST
(Surface->GetPrivateData(
guid
,
NULL
, 0) ==
DDERR_INVALIDPARAMS
);
20
TEST
(Surface->GetPrivateData(
guid
, &
dummy
, 0) ==
DDERR_INVALIDPARAMS
);
21
size
= 0;
22
TEST
(Surface->GetPrivateData(
guid
, &
dummy
, &
size
) ==
DDERR_MOREDATA
&&
size
==
sizeof
(
DWORD
));
23
size
= 2;
24
TEST
(Surface->GetPrivateData(
guid
,
NULL
, &
size
) ==
DDERR_MOREDATA
&&
size
==
sizeof
(
DWORD
));
25
TEST
(Surface->GetPrivateData(
guid
,
NULL
, &
size
) ==
DDERR_INVALIDPARAMS
);
26
TEST
(Surface->GetPrivateData(
guid
, &
dummy
, &
size
) ==
DD_OK
&&
dummy
== 0xBAADF00D);
27
TEST
(Surface->GetPrivateData(
guid2
,
NULL
, 0) ==
DDERR_NOTFOUND
);
28
29
TEST
(Surface->FreePrivateData(
guid
) ==
DD_OK
);
30
TEST
(Surface->FreePrivateData(
guid
) ==
DDERR_NOTFOUND
);
31
32
// Test for DDSPD_VOLATILE flag
33
TEST
(Surface->SetPrivateData(
guid
, (
LPVOID
)&
dummy
,
sizeof
(
DWORD
),
DDSPD_VOLATILE
) ==
DD_OK
);
34
size
= 0;
35
TEST
(Surface->GetPrivateData(
guid
,
NULL
, &
size
) ==
DDERR_MOREDATA
&&
size
==
sizeof
(
DWORD
));
36
TEST
(Surface->GetPrivateData(
guid
, &
dummy
, &
size
) ==
DD_OK
&&
dummy
== 0xBAADF00D);
37
38
DDBLTFX
bltfx;
39
bltfx.
dwSize
=
sizeof
(
DDBLTFX
);
40
bltfx.
dwFillColor
=
RGB
(0, 0, 0);
41
if
(Surface->Blt(
NULL
,
NULL
,
NULL
,
DDBLT_COLORFILL
|
DDBLT_WAIT
, &bltfx) !=
DD_OK
)
42
printf
(
"ERROR: Failed to draw to surface !"
);
43
TEST
(Surface->GetPrivateData(
guid
, &
dummy
, &
size
) ==
DDERR_EXPIRED
);
44
45
// TODO: Test for DDSPD_IUNKNOWNPOINTER (see http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/ddraw7/directdraw7/ddref_5qyf.asp)
46
47
Surface->Release();
48
return
TRUE
;
49
}
NULL
#define NULL
Definition:
types.h:112
TRUE
#define TRUE
Definition:
types.h:120
FALSE
#define FALSE
Definition:
types.h:117
RGB
#define RGB(r, g, b)
Definition:
precomp.h:71
LPDIRECTDRAWSURFACE7
DWORD * LPDIRECTDRAWSURFACE7
Definition:
vmrender.idl:7
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
size
GLsizeiptr size
Definition:
glext.h:5919
GUID
Definition:
shobjidl.idl:2988
dummy
Definition:
ndr_types.idl:28
void
Definition:
nsiface.idl:2307
guid
const GUID * guid
Definition:
metadataquery.c:687
TEST
#define TEST(x)
Definition:
precomp.h:20
guid2
static GUID guid2
Definition:
devinst.c:42
CreateSurface
BOOL CreateSurface(LPDIRECTDRAWSURFACE7 *pSurface)
Definition:
helper.cpp:28
Test_PrivateData
BOOL Test_PrivateData(INT *passed, INT *failed)
Definition:
private_data.cpp:3
DDBLT_COLORFILL
#define DDBLT_COLORFILL
Definition:
ddraw.h:555
DDSPD_VOLATILE
#define DDSPD_VOLATILE
Definition:
ddraw.h:465
DDBLTFX
struct _DDBLTFX DDBLTFX
DDERR_NOTFOUND
#define DDERR_NOTFOUND
Definition:
ddraw.h:97
DDERR_MOREDATA
#define DDERR_MOREDATA
Definition:
ddraw.h:176
DD_OK
#define DD_OK
Definition:
ddraw.h:186
DDBLT_WAIT
#define DDBLT_WAIT
Definition:
ddraw.h:569
DDERR_EXPIRED
#define DDERR_EXPIRED
Definition:
ddraw.h:177
DDERR_INVALIDPARAMS
#define DDERR_INVALIDPARAMS
Definition:
ddraw.h:79
_DDBLTFX
Definition:
ddraw.h:1271
_DDBLTFX::dwSize
DWORD dwSize
Definition:
ddraw.h:1272
_DDBLTFX::dwFillColor
DWORD dwFillColor
Definition:
ddraw.h:1310
INT
int32_t INT
Definition:
typedefs.h:58
pSurface
_In_ DD_SURFACE_LOCAL * pSurface
Definition:
winddi.h:3481
modules
rostests
dxtest
ddraw
Surface
private_data.cpp
Generated on Wed Oct 30 2024 06:08:00 for ReactOS by
1.9.6