mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
Blt-API Tests
svn path=/trunk/; revision=27129
This commit is contained in:
parent
d1d6598616
commit
1bc331c11f
1 changed files with 87 additions and 2 deletions
|
@ -22,18 +22,102 @@ DWORD GetPixel (LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
|
|||
return ret;
|
||||
}
|
||||
|
||||
VOID Blt_Test (LPDIRECTDRAWSURFACE7 Surface, INT* passed, INT* failed)
|
||||
{
|
||||
LPDIRECTDRAWSURFACE7 Source;
|
||||
if(!CreateSurface(&Source))
|
||||
return;
|
||||
|
||||
// The following has been tested with Nvidea hardware
|
||||
// the results might differently with other graphic
|
||||
// card drivers. - mbosma
|
||||
|
||||
// FIXME: Test Color Key (DDBLT_KEYDEST / DDBLT_KEYSRC / DDBLT_KEYDESTOVERRIDE / DDBLT_KEYSRCOVERRIDE)
|
||||
|
||||
// General Tests
|
||||
DDBLTFX bltfx;
|
||||
TEST (Surface->Blt(NULL, NULL, NULL, 0, NULL) == DDERR_INVALIDPARAMS);
|
||||
TEST (Surface->Blt(NULL, Surface, NULL, 0, NULL) == DD_OK ); // blting to itself
|
||||
|
||||
TEST (Surface->Blt(NULL, NULL, NULL, DDBLT_WAIT|DDBLT_DDFX, &bltfx) == DDERR_INVALIDPARAMS);
|
||||
bltfx.dwDDFX = DDBLTFX_NOTEARING;
|
||||
TEST (Surface->Blt(NULL, NULL, NULL, DDBLT_WAIT|DDBLT_DDFX, &bltfx) == DDERR_INVALIDPARAMS);
|
||||
bltfx.dwSize = sizeof(DDBLTFX);
|
||||
TEST (Surface->Blt(NULL, NULL, NULL, DDBLT_WAIT, &bltfx) == DDERR_INVALIDPARAMS);
|
||||
TEST (Surface->Blt(NULL, Source, NULL, DDBLT_WAIT|DDBLT_DDFX, &bltfx) == DD_OK); // don't know why this works on a offscreen surfaces
|
||||
|
||||
// Test color filling
|
||||
bltfx.dwFillColor = RGB(0, 255, 0);
|
||||
TEST (Source->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &bltfx) == DD_OK);
|
||||
RECT rect = {100, 100, 200, 200};
|
||||
bltfx.dwFillColor = RGB(255, 255, 0);
|
||||
TEST (Source->Blt(&rect, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &bltfx) == DD_OK);
|
||||
TEST (GetPixel(Source, 0, 0) == RGB(0, 255, 0));
|
||||
TEST (GetPixel(Source, 100, 100) == RGB(255, 255, 0));
|
||||
|
||||
// Test DestRect and SrcRect
|
||||
RECT SourceRect = {100, 100, 200, 200};
|
||||
RECT DestRect = {0, 0, 200, 100};
|
||||
|
||||
TEST (Surface->Blt(&SourceRect, Source, &DestRect, 0, NULL) == DD_OK);
|
||||
TEST (GetPixel(Surface, 100, 100) == RGB(0, 255, 0)); // Src bigger: normal blt
|
||||
|
||||
TEST (Surface->Blt(&DestRect, Source, &SourceRect, 0, NULL) == DD_OK);
|
||||
TEST (GetPixel(Surface, 0, 0) == 0x00ffbf); // Dest bigger: wtf ??
|
||||
|
||||
DestRect.right = 100; // both are same size now
|
||||
TEST (Surface->Blt(&DestRect, Source, &SourceRect, 0, NULL) == DD_OK);
|
||||
TEST (GetPixel(Surface, 0, 0) == RGB(255, 255, 0));
|
||||
|
||||
RECT TooBig = {100, 100, 200, 250};
|
||||
TEST (Surface->Blt(&TooBig, Source, &SourceRect, 0, NULL) == DDERR_INVALIDRECT);
|
||||
TEST (Surface->Blt(&DestRect, Source, &TooBig, 0, NULL) == DDERR_INVALIDRECT);
|
||||
|
||||
// Test Rotation
|
||||
bltfx.dwDDFX = DDBLTFX_MIRRORLEFTRIGHT|DDBLTFX_MIRRORUPDOWN;
|
||||
TEST (Surface->Blt(NULL, Source, NULL, DDBLT_WAIT|DDBLT_DDFX, &bltfx) == DD_OK);
|
||||
TEST (GetPixel(Surface, 0, 0) == RGB(255, 255, 0));
|
||||
|
||||
bltfx.dwDDFX = DDBLTFX_ROTATE180;
|
||||
TEST (Surface->Blt(NULL, Source, NULL, DDBLT_DDFX, &bltfx) == DDERR_NOROTATIONHW);
|
||||
|
||||
//bltfx.dwRotationAngle =
|
||||
TEST (Surface->Blt(NULL, Source, NULL, DDBLT_ROTATIONANGLE, &bltfx) == DDERR_NOROTATIONHW);
|
||||
|
||||
// Test Raster Operations
|
||||
bltfx.dwROP = BLACKNESS;
|
||||
TEST (Surface->Blt(NULL, Source, NULL, DDBLT_WAIT|DDBLT_ROP, &bltfx) == DD_OK);
|
||||
TEST(GetPixel(Surface, 0, 0) == RGB(0, 0, 0));
|
||||
bltfx.dwROP = WHITENESS;
|
||||
TEST (Surface->Blt(NULL, Source, NULL, DDBLT_WAIT|DDBLT_ROP, &bltfx) == DD_OK);
|
||||
TEST(GetPixel(Surface, 0, 0) == RGB(255, 255, 255));
|
||||
bltfx.dwROP = SRCCOPY; // this flag actually does nothing
|
||||
TEST (Surface->Blt(NULL, Source, NULL, DDBLT_WAIT|DDBLT_ROP, &bltfx) == DD_OK);
|
||||
TEST(GetPixel(Surface, 0, 0) == RGB(0, 255, 0));
|
||||
bltfx.dwROP = SRCAND;
|
||||
TEST (Surface->Blt(NULL, Source, NULL, DDBLT_WAIT|DDBLT_ROP, &bltfx) == DDERR_NORASTEROPHW);
|
||||
|
||||
// Test Direct Draw Raster Operations
|
||||
bltfx.dwDDROP = 0x123;
|
||||
TEST (Surface->Blt(NULL, Source, NULL, DDBLT_WAIT|DDBLT_DDROPS, &bltfx) == DDERR_NODDROPSHW);
|
||||
|
||||
// Streching
|
||||
bltfx.dwDDFX = DDBLTFX_ARITHSTRETCHY;
|
||||
TEST (Surface->Blt(NULL, Source, NULL, DDBLT_WAIT|DDBLT_DDFX, &bltfx) == DDERR_NOSTRETCHHW);
|
||||
}
|
||||
|
||||
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);
|
||||
//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
|
||||
TEST (Surface->GetBltStatus(DDGBS_CANBLT) == DD_OK); // does not return DDERR_SURFACEBUSY for me as msdn says (xp,nvidea)
|
||||
Surface->Unlock (NULL);
|
||||
|
||||
// Try to produce busy surface by filling it 500 times
|
||||
|
@ -65,6 +149,7 @@ BOOL Test_Blt (INT* passed, INT* failed)
|
|||
|
||||
// The tests
|
||||
TEST(Surface->BltBatch(NULL, 0, 0) == DDERR_UNSUPPORTED);
|
||||
Blt_Test (Surface, passed, failed);
|
||||
GetBltStatus_Test (Surface, passed, failed);
|
||||
|
||||
Surface->Release();
|
||||
|
|
Loading…
Reference in a new issue