mirror of
https://github.com/reactos/reactos.git
synced 2025-06-04 17:00:31 +00:00
Start of ddraw test case.
svn path=/trunk/; revision=26739
This commit is contained in:
parent
053c08fc8e
commit
1c0a28e0fa
5 changed files with 139 additions and 0 deletions
12
rostests/dxtest/ddraw/ddraw.rbuild
Normal file
12
rostests/dxtest/ddraw/ddraw.rbuild
Normal file
|
@ -0,0 +1,12 @@
|
|||
<module name="ddraw_test" type="win32cui" allowwarnings="true">
|
||||
<include base="ddraw_test">.</include>
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_WIN32_WINNT">0x0501</define>
|
||||
<library>kernel32</library>
|
||||
<library>user32</library>
|
||||
<library>gdi32</library>
|
||||
<library>ddraw</library>
|
||||
<library>dxguid</library>
|
||||
<file>ddraw_test.c</file>
|
||||
<file>testlist.cpp</file>
|
||||
</module>
|
51
rostests/dxtest/ddraw/ddraw_test.c
Normal file
51
rostests/dxtest/ddraw/ddraw_test.c
Normal file
|
@ -0,0 +1,51 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ddrawtest.h"
|
||||
|
||||
INT NumTests(void);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
INT Num = NumTests();
|
||||
INT i, j;
|
||||
INT passed, failed, opassed, ofailed;
|
||||
|
||||
opassed = 0;
|
||||
ofailed = 0;
|
||||
printf("DirectDraw tests\n");
|
||||
if (argc > 1)
|
||||
{
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
for (j = 0; j < NumTests(); j++)
|
||||
{
|
||||
if (stricmp(argv[i], TestList[j].Test) == 0)
|
||||
{
|
||||
passed = 0;
|
||||
failed = 0;
|
||||
TestList[j].Proc(&passed, &failed);
|
||||
opassed += passed;
|
||||
ofailed += failed;
|
||||
printf(" tests: %d, passed: %d, failed: %d\n\n", passed+failed, passed, failed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < Num; i++)
|
||||
{
|
||||
passed = 0;
|
||||
failed = 0;
|
||||
printf("Test: %s\n", TestList[i].Test);
|
||||
TestList[i].Proc(&passed, &failed);
|
||||
opassed += passed;
|
||||
ofailed += failed;
|
||||
printf(" tests: %d, passed: %d, failed: %d\n\n", passed+failed, passed, failed);
|
||||
}
|
||||
}
|
||||
printf("\nOverall tests: %d, passed: %d, failed: %d\n", opassed+ofailed, opassed, ofailed);
|
||||
|
||||
return ofailed;
|
||||
}
|
34
rostests/dxtest/ddraw/ddrawtest.h
Normal file
34
rostests/dxtest/ddraw/ddrawtest.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
#ifndef _DDRAWTEST_H
|
||||
#define _DDRAWTEST_H
|
||||
|
||||
#define WINVER 0x501
|
||||
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <ddraw.h>
|
||||
|
||||
#define TEST(x) \
|
||||
if (x)\
|
||||
{\
|
||||
(*passed)++;\
|
||||
} else {\
|
||||
(*failed)++;\
|
||||
printf("Test failed in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
|
||||
};
|
||||
|
||||
|
||||
/* The type definitions */
|
||||
typedef BOOL (*TESTPROC)(INT*, INT*);
|
||||
|
||||
typedef struct tagTEST
|
||||
{
|
||||
CHAR* Test;
|
||||
TESTPROC Proc;
|
||||
} TEST, *PTEST;
|
||||
|
||||
|
||||
extern TEST TestList[];
|
||||
|
||||
#endif /* _DDRAWTEST_H */
|
||||
|
||||
/* EOF */
|
23
rostests/dxtest/ddraw/testlist.cpp
Normal file
23
rostests/dxtest/ddraw/testlist.cpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
#ifndef _DDRAWTESTLIST_H
|
||||
#define _DDRAWTESTLIST_H
|
||||
|
||||
#include "ddrawtest.h"
|
||||
|
||||
/* include the tests */
|
||||
#include "tests/CreateDDraw.cpp"
|
||||
|
||||
/* The List of tests */
|
||||
TEST TestList[] =
|
||||
{
|
||||
{ "CreateDDraw", Test_CreateDDraw }
|
||||
};
|
||||
|
||||
/* The function that gives us the number of tests */
|
||||
extern "C" INT NumTests(void)
|
||||
{
|
||||
return sizeof(TestList) / sizeof(TEST);
|
||||
}
|
||||
|
||||
#endif /* _DDRAWTESTLIST_H */
|
||||
|
||||
/* EOF */
|
19
rostests/dxtest/ddraw/tests/CreateDDraw.cpp
Normal file
19
rostests/dxtest/ddraw/tests/CreateDDraw.cpp
Normal file
|
@ -0,0 +1,19 @@
|
|||
#include "ddrawtest.h"
|
||||
|
||||
PCHAR DDErrorString (HRESULT hResult);
|
||||
|
||||
BOOL Test_CreateDDraw (INT* passed, INT* failed)
|
||||
{
|
||||
LPDIRECTDRAW7 DirectDraw;
|
||||
IDirectDraw* DirectDraw2;
|
||||
|
||||
// FIXME: Test first parameter
|
||||
|
||||
TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, (IUnknown*)0xdeadbeef) == CLASS_E_NOAGGREGATION);
|
||||
TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw4, NULL) == DDERR_INVALIDPARAMS);
|
||||
TEST (DirectDrawCreateEx(NULL, NULL, IID_IDirectDraw7, NULL) == DDERR_INVALIDPARAMS);
|
||||
TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL) == DD_OK);
|
||||
TEST (DirectDrawCreate(NULL ,&DirectDraw2, NULL) == DD_OK);
|
||||
|
||||
return TRUE;
|
||||
}
|
Loading…
Reference in a new issue