[ros-diffs] [mbosma] 27129: Blt-API Tests

mbosma at svn.reactos.org mbosma at svn.reactos.org
Sun Jun 10 22:47:18 CEST 2007


Author: mbosma
Date: Mon Jun 11 00:47:17 2007
New Revision: 27129

URL: http://svn.reactos.org/svn/reactos?rev=27129&view=rev
Log:
Blt-API Tests

Modified:
    trunk/rostests/dxtest/ddraw/Surface/blt.cpp

Modified: trunk/rostests/dxtest/ddraw/Surface/blt.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/Surface/blt.cpp?rev=27129&r1=27128&r2=27129&view=diff
==============================================================================
--- trunk/rostests/dxtest/ddraw/Surface/blt.cpp (original)
+++ trunk/rostests/dxtest/ddraw/Surface/blt.cpp Mon Jun 11 00:47:17 2007
@@ -22,18 +22,102 @@
     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 @@
 
     // The tests
     TEST(Surface->BltBatch(NULL, 0, 0) == DDERR_UNSUPPORTED);
+    Blt_Test (Surface, passed, failed);
     GetBltStatus_Test (Surface, passed, failed);
 
     Surface->Release();




More information about the Ros-diffs mailing list