ReactOS 0.4.15-dev-7654-g6bc40d3
misc.cpp
Go to the documentation of this file.
2
3BOOL Test_Misc (INT* passed, INT* failed)
4{
6 if(!CreateSurface(&Surface))
7 return FALSE;
8
9 TEST (Surface->Initialize(NULL, NULL) == DDERR_ALREADYINITIALIZED);
10
11 // GetCaps
12 DDSCAPS2 Caps;
13 TEST (Surface->GetCaps((DDSCAPS2*)0xdeadbeef) == DDERR_INVALIDPARAMS);
14 TEST (Surface->GetCaps(&Caps) == DD_OK && Caps.dwCaps == 0x10004040
15 && Caps.dwCaps2 == 0 && Caps.dwCaps3 == 0 && Caps.dwCaps4 == 0); // FIXME: Replace 0x10004040
16
17 // GetDC / ReleaseDC
18 HDC hdc;
19 TEST (Surface->GetDC((HDC*)0xdeadbeef) == DDERR_INVALIDPARAMS);
20 TEST (Surface->ReleaseDC((HDC)0xdeadbeef) == DDERR_NODC);
21 TEST (Surface->ReleaseDC(GetDC(NULL)) == DDERR_NODC);
22
23 TEST (Surface->GetDC(&hdc) == DD_OK);
24 TEST (MoveToEx(hdc, 0, 0, NULL) == TRUE); // validate hdc
25 TEST (Surface->Blt(NULL, NULL, NULL, 0, NULL) == DDERR_SURFACEBUSY); // check lock
26 TEST (Surface->ReleaseDC(hdc) == DD_OK);
27
28 // ChangeUniquenessValue / GetUniquenessValue
30 // FIXME: find out other apis which increases the uniqueness value
31 TEST (Surface->GetUniquenessValue(&Value) == DD_OK && Value == 2);
32 TEST (Surface->Blt(NULL, NULL, NULL, 0, NULL) == DDERR_INVALIDPARAMS); // Even this increases the uniqueness value
33 TEST (Surface->GetUniquenessValue(&Value) == DD_OK && Value == 3);
34 TEST (Surface->ChangeUniquenessValue() == DD_OK);
35 TEST (Surface->GetUniquenessValue(&Value) == DD_OK && Value == 4);
36
37 // GetPixelFormat
39 // FIXME: Produce DDERR_INVALIDSURFACETYPE
40 TEST (Surface->GetPixelFormat((LPDDPIXELFORMAT)0xdeadbeef) == DDERR_INVALIDPARAMS);
41 TEST (Surface->GetPixelFormat(&PixelFormat));
42 PixelFormat.dwSize = sizeof(DDPIXELFORMAT);
43 TEST (Surface->GetPixelFormat(&PixelFormat) == DD_OK && PixelFormat.dwFlags == 0x40); // FIXME: Find out what 0x40 is
44
45 // GetSurfaceDesc / SetSurfaceDesc
46 DDSURFACEDESC2 Desc = {0};
47 // FIXME: Produce DDERR_INVALIDSURFACETYPE
48 TEST (Surface->GetSurfaceDesc((LPDDSURFACEDESC2)0xdeadbeef) == DDERR_INVALIDPARAMS);
49 TEST (Surface->GetSurfaceDesc(&Desc));
50 Desc.dwSize = sizeof(DDSURFACEDESC2);
51 TEST (Surface->GetSurfaceDesc(&Desc) == DD_OK && Desc.dwFlags == 0x100f); // FIXME: Find out what 0x100f is
53 // FIXME: Test SetSurfaceDesc
54
55 // GetDDInterface
56 IUnknown* iface;
57 TEST(Surface->GetDDInterface((LPVOID*)0xdeadbeef) == DDERR_INVALIDPARAMS);
58 TEST(Surface->GetDDInterface((LPVOID*)&iface) == DD_OK && iface);
59 TEST(iface->Release() == 1); // FIXME: Test the interface further
60
61 Surface->Release();
62
63 return TRUE;
64}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
DWORD * LPDIRECTDRAWSURFACE7
Definition: vmrender.idl:7
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
INT PixelFormat
ULONG Release()
#define TEST(x)
Definition: precomp.h:20
BOOL CreateSurface(LPDIRECTDRAWSURFACE7 *pSurface)
Definition: helper.cpp:28
BOOL Test_Misc(INT *passed, INT *failed)
Definition: misc.cpp:3
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
struct _DDSURFACEDESC2 DDSURFACEDESC2
#define DDERR_NODC
Definition: ddraw.h:160
struct _DDPIXELFORMAT DDPIXELFORMAT
#define DD_OK
Definition: ddraw.h:186
#define DDERR_INVALIDPARAMS
Definition: ddraw.h:79
#define DDERR_ALREADYINITIALIZED
Definition: ddraw.h:67
#define DDERR_SURFACEBUSY
Definition: ddraw.h:119
DWORD dwCaps4
Definition: ddraw.h:737
DWORD dwCaps3
Definition: ddraw.h:734
DWORD dwCaps2
Definition: ddraw.h:733
DWORD dwCaps
Definition: ddraw.h:732
DDPIXELFORMAT ddpfPixelFormat
Definition: ddraw.h:1185
DWORD dwFlags
Definition: ddraw.h:1153
DWORD dwSize
Definition: ddraw.h:1152
int32_t INT
Definition: typedefs.h:58
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
_In_ DD_SURFACE_LOCAL * pSurface
Definition: winddi.h:3481
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
HDC WINAPI GetDC(_In_opt_ HWND)