Alexander Dorofeyev : ddraw/tests: Add colorkeyed blit to p8_primary_test.

Alexandre Julliard julliard at winehq.org
Fri Apr 11 06:28:45 CDT 2008


Module: wine
Branch: master
Commit: df422cf0fb6a77ef7500532f0e5dd117b45d9e19
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=df422cf0fb6a77ef7500532f0e5dd117b45d9e19

Author: Alexander Dorofeyev <alexd4 at inbox.lv>
Date:   Thu Apr 10 23:12:58 2008 +0300

ddraw/tests: Add colorkeyed blit to p8_primary_test.

---

 dlls/ddraw/tests/visual.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/dlls/ddraw/tests/visual.c b/dlls/ddraw/tests/visual.c
index 11c4ad3..02d9c59 100644
--- a/dlls/ddraw/tests/visual.c
+++ b/dlls/ddraw/tests/visual.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2007 Stefan Dösinger(for CodeWeavers)
+ * Copyright (C) 2008 Alexander Dorofeyev
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -2165,6 +2166,7 @@ static void p8_primary_test()
     DDBLTFX ddbltfx;
     COLORREF color;
     RECT rect;
+    DDCOLORKEY clrKey;
     unsigned differences;
 
     /* An IDirect3DDevice cannot be queryInterfaced from an IDirect3DDevice7 on windows */
@@ -2275,12 +2277,13 @@ static void p8_primary_test()
 
     ok(colortables_check_equality(entries, coltable), "unexpected colortable on offscreen surface\n");
 
-    p8_surface_fill_rect(offscreen, 0, 0, 16, 16, 1);
+    p8_surface_fill_rect(offscreen, 0, 0, 16, 16, 2);
 
     memset(entries, 0, sizeof(entries));
     entries[0].peRed = 0xff;
     entries[1].peGreen = 0xff;
     entries[2].peBlue = 0xff;
+    entries[3].peRed = 0x80;
     hr = IDirectDrawPalette_SetEntries(ddprimpal, 0, 0, 256, entries);
     ok(hr == DD_OK, "IDirectDrawPalette_SetEntries failed with %08x\n", hr);
 
@@ -2288,10 +2291,30 @@ static void p8_primary_test()
     ok(hr==DD_OK, "IDirectDrawSurface_BltFast returned: %x\n", hr);
 
     color = getPixelColor_GDI(Surface1, 1, 1);
+    ok(GetRValue(color) == 0 && GetGValue(color) == 0x00 && GetBValue(color) == 0xFF,
+            "got R %02X G %02X B %02X, expected R 00 G 00 B FF\n",
+            GetRValue(color), GetGValue(color), GetBValue(color));
+
+    /* Color keyed blit. */
+    p8_surface_fill_rect(offscreen, 0, 0, 8, 8, 3);
+    clrKey.dwColorSpaceLowValue = 3;
+    clrKey.dwColorSpaceHighValue = 3;
+    hr = IDirectDrawSurface_SetColorKey(offscreen, DDCKEY_SRCBLT, &clrKey);
+    ok(hr==D3D_OK, "IDirectDrawSurfac_SetColorKey returned: %x\n", hr);
+
+    hr = IDirectDrawSurface_BltFast(Surface1, 100, 100, offscreen, NULL, DDBLTFAST_SRCCOLORKEY);
+    ok(hr==DD_OK, "IDirectDrawSurface_BltFast returned: %x\n", hr);
+
+    color = getPixelColor_GDI(Surface1, 105, 105);
     ok(GetRValue(color) == 0 && GetGValue(color) == 0xFF && GetBValue(color) == 0,
             "got R %02X G %02X B %02X, expected R 00 G FF B 00\n",
             GetRValue(color), GetGValue(color), GetBValue(color));
 
+    color = getPixelColor_GDI(Surface1, 112, 112);
+    ok(GetRValue(color) == 0 && GetGValue(color) == 0x00 && GetBValue(color) == 0xFF,
+            "got R %02X G %02X B %02X, expected R 00 G 00 B FF\n",
+            GetRValue(color), GetGValue(color), GetBValue(color));
+
     /* Test blitting and locking patterns that are likely to trigger bugs in opengl renderer (p8
        surface conversion and uploading/downloading to/from opengl texture). Similar patterns (
        blitting front buffer areas to/from an offscreen surface mixed with locking) are used by C&C




More information about the wine-cvs mailing list