mirror of
https://github.com/reactos/reactos.git
synced 2024-07-01 02:10:07 +00:00
Tests BltBatch and GetBltStatus
svn path=/trunk/; revision=27124
This commit is contained in:
parent
db153659fe
commit
d1d6598616
72
rostests/dxtest/ddraw/Surface/blt.cpp
Normal file
72
rostests/dxtest/ddraw/Surface/blt.cpp
Normal file
|
@ -0,0 +1,72 @@
|
|||
|
||||
DWORD GetPixel (LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
|
||||
{
|
||||
DWORD ret;
|
||||
RECT rect = {x, y, x+1, y+1};
|
||||
DDSURFACEDESC2 desc = {0};
|
||||
desc.dwSize = sizeof(DDSURFACEDESC2);
|
||||
|
||||
if(Surface->Lock(&rect, &desc, DDLOCK_READONLY | DDLOCK_WAIT, NULL))
|
||||
{
|
||||
printf("ERROR: Unable to lock surface\n");
|
||||
return 0xdeadbeef;
|
||||
}
|
||||
|
||||
ret = *((DWORD *)desc.lpSurface);
|
||||
|
||||
if(Surface->Unlock (&rect) != DD_OK)
|
||||
{
|
||||
printf("ERROR: Unable to unlock surface ?!\n");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
VOID GetBltStatus_Test (LPDIRECTDRAWSURFACE7 Surface, INT* passed, INT* failed)
|
||||
{
|
||||
TEST (Surface->GetBltStatus(0) == DDERR_INVALIDPARAMS);
|
||||
TEST (Surface->GetBltStatus(DDGBS_CANBLT) == DD_OK);
|
||||
TEST (Surface->GetBltStatus(DDGBS_ISBLTDONE) == DD_OK);
|
||||
|
||||
// Lock Surface
|
||||
DDSURFACEDESC2 desc = {0};
|
||||
desc.dwSize = sizeof(DDSURFACEDESC2);
|
||||
Surface->Lock(NULL, &desc, DDLOCK_WAIT, NULL);
|
||||
TEST (Surface->GetBltStatus(DDGBS_ISBLTDONE) == DD_OK);
|
||||
TEST (Surface->GetBltStatus(DDGBS_CANBLT) == DD_OK); // does not return DDERR_SURFACEBUSY for me as msdn says (xp,nvidea) - mbosma
|
||||
Surface->Unlock (NULL);
|
||||
|
||||
// Try to produce busy surface by filling it 500 times
|
||||
DDBLTFX bltfx;
|
||||
bltfx.dwSize = sizeof(DDBLTFX);
|
||||
bltfx.dwFillColor = RGB(0, 0, 0);
|
||||
|
||||
int i;
|
||||
for(i=0; i<500; i++)
|
||||
Surface->Blt(NULL, NULL, NULL, DDBLT_COLORFILL, &bltfx);
|
||||
|
||||
TEST (Surface->GetBltStatus(DDGBS_ISBLTDONE) == DDERR_WASSTILLDRAWING);
|
||||
TEST (Surface->GetBltStatus(DDGBS_CANBLT) == DD_OK);
|
||||
}
|
||||
|
||||
BOOL Test_Blt (INT* passed, INT* failed)
|
||||
{
|
||||
LPDIRECTDRAWSURFACE7 Surface;
|
||||
if(!CreateSurface(&Surface))
|
||||
return FALSE;
|
||||
|
||||
// Test GetPixel (needs Lock API)
|
||||
DDBLTFX bltfx;
|
||||
bltfx.dwSize = sizeof(DDBLTFX);
|
||||
bltfx.dwFillColor = RGB(0, 0, 0);
|
||||
Surface->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &bltfx);
|
||||
if(GetPixel(Surface, 0, 0) != RGB(0, 0, 0))
|
||||
return FALSE;
|
||||
|
||||
// The tests
|
||||
TEST(Surface->BltBatch(NULL, 0, 0) == DDERR_UNSUPPORTED);
|
||||
GetBltStatus_Test (Surface, passed, failed);
|
||||
|
||||
Surface->Release();
|
||||
return TRUE;
|
||||
}
|
|
@ -10,6 +10,7 @@
|
|||
#include "DDraw/available_mem.cpp"
|
||||
#include "Surface/create.cpp"
|
||||
#include "Surface/private_data.cpp"
|
||||
#include "Surface/blt.cpp"
|
||||
#include "Surface/misc.cpp"
|
||||
|
||||
/* The List of tests */
|
||||
|
@ -22,6 +23,7 @@ TEST TestList[] =
|
|||
{ "IDirectDraw: GetFourCC", Test_GetFourCCCodes },
|
||||
{ "IDirectDraw: Cooperative Levels", Test_SetCooperativeLevel },
|
||||
{ "IDirectDrawSurface: Creation", Test_CreateSurface },
|
||||
{ "IDirectDrawSurface: Blting", Test_Blt },
|
||||
{ "IDirectDrawSurface: Private Data", Test_PrivateData },
|
||||
{ "IDirectDrawSurface: Miscellaneous Tests", Test_Misc },
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue