=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: ddraw/tests: Add a getdc test with a custom pitch.
Alexandre Julliard
julliard at winehq.org
Wed Jan 8 13:41:34 CST 2014
Module: wine
Branch: master
Commit: 03b2e737d2dcf1b1c668084c4d24fa7fdccf819c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=03b2e737d2dcf1b1c668084c4d24fa7fdccf819c
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Tue Jan 7 22:12:16 2014 +0100
ddraw/tests: Add a getdc test with a custom pitch.
---
dlls/ddraw/tests/ddraw2.c | 40 +++++++++++++++++++++++++++++++++++++++-
dlls/ddraw/tests/ddraw4.c | 40 +++++++++++++++++++++++++++++++++++++++-
dlls/ddraw/tests/ddraw7.c | 40 +++++++++++++++++++++++++++++++++++++++-
3 files changed, 117 insertions(+), 3 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index 46882be..30c5b81 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -1,6 +1,6 @@
/*
* Copyright 2011-2012 Henri Verbeet for CodeWeavers
- * Copyright 2012-2013 Stefan Dösinger for CodeWeavers
+ * Copyright 2012-2014 Stefan Dösinger for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -4878,6 +4878,7 @@ static void test_user_memory_getdc(void)
DWORD data[16][16];
ULONG ref;
HDC dc;
+ unsigned int x, y;
if (!(ddraw = create_ddraw()))
{
@@ -4926,6 +4927,43 @@ static void test_user_memory_getdc(void)
ok(data[0][0] == 0xffffffff, "Expected color 0xffffffff, got %#x.\n", data[0][0]);
ok(data[15][15] == 0x00000000, "Expected color 0x00000000, got %#x.\n", data[15][15]);
+ ddsd.dwFlags = DDSD_LPSURFACE | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PITCH;
+ ddsd.lpSurface = data;
+ ddsd.dwWidth = 4;
+ ddsd.dwHeight = 8;
+ U1(ddsd).lPitch = sizeof(*data);
+ hr = IDirectDrawSurface3_SetSurfaceDesc(surface3, &ddsd, 0);
+ ok(SUCCEEDED(hr), "Failed to set surface desc, hr %#x.\n", hr);
+
+ memset(data, 0xaa, sizeof(data));
+ hr = IDirectDrawSurface3_GetDC(surface3, &dc);
+ ok(SUCCEEDED(hr), "Failed to get DC, hr %#x.\n", hr);
+ BitBlt(dc, 0, 0, 4, 8, NULL, 0, 0, BLACKNESS);
+ BitBlt(dc, 1, 1, 2, 2, NULL, 0, 0, WHITENESS);
+ hr = IDirectDrawSurface3_ReleaseDC(surface3, dc);
+ ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr);
+
+ for (y = 0; y < 4; y++)
+ {
+ for (x = 0; x < 4; x++)
+ {
+ if ((x == 1 || x == 2) && (y == 1 || y == 2))
+ ok(data[y][x] == 0xffffffff, "Expected color 0xffffffff on position %ux%u, got %#x.\n",
+ x, y, data[y][x]);
+ else
+ ok(data[y][x] == 0x00000000, "Expected color 0xaaaaaaaa on position %ux%u, got %#x.\n",
+ x, y, data[y][x]);
+ }
+ }
+ ok(data[0][5] == 0xaaaaaaaa, "Expected color 0xaaaaaaaa on position 5x0, got %#x.\n",
+ data[0][5]);
+ ok(data[7][3] == 0x00000000, "Expected color 0x00000000 on position 3x7, got %#x.\n",
+ data[7][3]);
+ ok(data[7][4] == 0xaaaaaaaa, "Expected color 0xaaaaaaaa on position 4x7, got %#x.\n",
+ data[7][4]);
+ ok(data[8][0] == 0xaaaaaaaa, "Expected color 0xaaaaaaaa on position 0x8, got %#x.\n",
+ data[8][0]);
+
IDirectDrawSurface3_Release(surface3);
ref = IDirectDraw2_Release(ddraw);
ok(ref == 0, "Ddraw object not properly released, refcount %u.\n", ref);
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index df1a23c..e737b42 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -1,6 +1,6 @@
/*
* Copyright 2011-2012 Henri Verbeet for CodeWeavers
- * Copyright 2012-2013 Stefan Dösinger for CodeWeavers
+ * Copyright 2012-2014 Stefan Dösinger for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -5479,6 +5479,7 @@ static void test_user_memory_getdc(void)
DWORD data[16][16];
ULONG ref;
HDC dc;
+ unsigned int x, y;
if (!(ddraw = create_ddraw()))
{
@@ -5523,6 +5524,43 @@ static void test_user_memory_getdc(void)
ok(data[0][0] == 0xffffffff, "Expected color 0xffffffff, got %#x.\n", data[0][0]);
ok(data[15][15] == 0x00000000, "Expected color 0x00000000, got %#x.\n", data[15][15]);
+ ddsd.dwFlags = DDSD_LPSURFACE | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PITCH;
+ ddsd.lpSurface = data;
+ ddsd.dwWidth = 4;
+ ddsd.dwHeight = 8;
+ U1(ddsd).lPitch = sizeof(*data);
+ hr = IDirectDrawSurface4_SetSurfaceDesc(surface, &ddsd, 0);
+ ok(SUCCEEDED(hr), "Failed to set surface desc, hr %#x.\n", hr);
+
+ memset(data, 0xaa, sizeof(data));
+ hr = IDirectDrawSurface4_GetDC(surface, &dc);
+ ok(SUCCEEDED(hr), "Failed to get DC, hr %#x.\n", hr);
+ BitBlt(dc, 0, 0, 4, 8, NULL, 0, 0, BLACKNESS);
+ BitBlt(dc, 1, 1, 2, 2, NULL, 0, 0, WHITENESS);
+ hr = IDirectDrawSurface4_ReleaseDC(surface, dc);
+ ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr);
+
+ for (y = 0; y < 4; y++)
+ {
+ for (x = 0; x < 4; x++)
+ {
+ if ((x == 1 || x == 2) && (y == 1 || y == 2))
+ ok(data[y][x] == 0xffffffff, "Expected color 0xffffffff on position %ux%u, got %#x.\n",
+ x, y, data[y][x]);
+ else
+ ok(data[y][x] == 0x00000000, "Expected color 0x00000000 on position %ux%u, got %#x.\n",
+ x, y, data[y][x]);
+ }
+ }
+ ok(data[0][5] == 0xaaaaaaaa, "Expected color 0xaaaaaaaa on position 5x0, got %#x.\n",
+ data[0][5]);
+ ok(data[7][3] == 0x00000000, "Expected color 0x00000000 on position 3x7, got %#x.\n",
+ data[7][3]);
+ ok(data[7][4] == 0xaaaaaaaa, "Expected color 0xaaaaaaaa on position 4x7, got %#x.\n",
+ data[7][4]);
+ ok(data[8][0] == 0xaaaaaaaa, "Expected color 0xaaaaaaaa on position 0x8, got %#x.\n",
+ data[8][0]);
+
IDirectDrawSurface4_Release(surface);
ref = IDirectDraw4_Release(ddraw);
ok(ref == 0, "Ddraw object not properly released, refcount %u.\n", ref);
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index e36927e..f8fa70f 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2006, 2012-2013 Stefan Dösinger for CodeWeavers
+ * Copyright 2006, 2012-2014 Stefan Dösinger for CodeWeavers
* Copyright 2011 Henri Verbeet for CodeWeavers
*
* This library is free software; you can redistribute it and/or
@@ -5373,6 +5373,7 @@ static void test_user_memory_getdc(void)
DWORD data[16][16];
ULONG ref;
HDC dc;
+ unsigned int x, y;
if (!(ddraw = create_ddraw()))
{
@@ -5417,6 +5418,43 @@ static void test_user_memory_getdc(void)
ok(data[0][0] == 0xffffffff, "Expected color 0xffffffff, got %#x.\n", data[0][0]);
ok(data[15][15] == 0x00000000, "Expected color 0x00000000, got %#x.\n", data[15][15]);
+ ddsd.dwFlags = DDSD_LPSURFACE | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PITCH;
+ ddsd.lpSurface = data;
+ ddsd.dwWidth = 4;
+ ddsd.dwHeight = 8;
+ U1(ddsd).lPitch = sizeof(*data);
+ hr = IDirectDrawSurface7_SetSurfaceDesc(surface, &ddsd, 0);
+ ok(SUCCEEDED(hr), "Failed to set surface desc, hr %#x.\n", hr);
+
+ memset(data, 0xaa, sizeof(data));
+ hr = IDirectDrawSurface7_GetDC(surface, &dc);
+ ok(SUCCEEDED(hr), "Failed to get DC, hr %#x.\n", hr);
+ BitBlt(dc, 0, 0, 4, 8, NULL, 0, 0, BLACKNESS);
+ BitBlt(dc, 1, 1, 2, 2, NULL, 0, 0, WHITENESS);
+ hr = IDirectDrawSurface7_ReleaseDC(surface, dc);
+ ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr);
+
+ for (y = 0; y < 4; y++)
+ {
+ for (x = 0; x < 4; x++)
+ {
+ if ((x == 1 || x == 2) && (y == 1 || y == 2))
+ ok(data[y][x] == 0xffffffff, "Expected color 0xffffffff on position %ux%u, got %#x.\n",
+ x, y, data[y][x]);
+ else
+ ok(data[y][x] == 0x00000000, "Expected color 0x00000000 on position %ux%u, got %#x.\n",
+ x, y, data[y][x]);
+ }
+ }
+ ok(data[0][5] == 0xaaaaaaaa, "Expected color 0xaaaaaaaa on position 5x0, got %#x.\n",
+ data[0][5]);
+ ok(data[7][3] == 0x00000000, "Expected color 0x00000000 on position 3x7, got %#x.\n",
+ data[7][3]);
+ ok(data[7][4] == 0xaaaaaaaa, "Expected color 0xaaaaaaaa on position 4x7, got %#x.\n",
+ data[7][4]);
+ ok(data[8][0] == 0xaaaaaaaa, "Expected color 0xaaaaaaaa on position 0x8, got %#x.\n",
+ data[8][0]);
+
IDirectDrawSurface7_Release(surface);
ref = IDirectDraw7_Release(ddraw);
ok(ref == 0, "Ddraw object not properly released, refcount %u.\n", ref);
More information about the wine-cvs
mailing list