Commit 9677805e authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw/tests: Properly create offscreen plain surfaces.

It's not entirely clear what kind of surface is actually created when just DDSCAPS_SYSTEMMEMORY is specified, but at the very least its format appears to be validated against the current display mode, which is not what we want.
parent 048f4d4c
......@@ -4753,7 +4753,7 @@ static void test_set_surface_desc(void)
U2(ddsd.ddpfPixelFormat).dwRBitMask = 0x00ff0000;
U3(ddsd.ddpfPixelFormat).dwGBitMask = 0x0000ff00;
U4(ddsd.ddpfPixelFormat).dwBBitMask = 0x000000ff;
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY;
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN;
hr = IDirectDraw2_CreateSurface(ddraw, &ddsd, &surface, NULL);
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
......@@ -4798,7 +4798,8 @@ static void test_set_surface_desc(void)
hr = IDirectDrawSurface3_GetSurfaceDesc(surface3, &ddsd);
ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr);
ok(ddsd.ddsCaps.dwCaps == DDSCAPS_SYSTEMMEMORY, "Got unexpected caps %#x.\n", ddsd.ddsCaps.dwCaps);
ok(ddsd.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN),
"Got unexpected caps %#x.\n", ddsd.ddsCaps.dwCaps);
/* Setting the caps is an error. This also means the original description cannot be reapplied. */
hr = IDirectDrawSurface3_SetSurfaceDesc(surface3, &ddsd, 0);
......@@ -4813,7 +4814,7 @@ static void test_set_surface_desc(void)
ddsd.lpSurface = data;
hr = IDirectDrawSurface3_SetSurfaceDesc(surface3, &ddsd, 0);
ok(hr == DDERR_INVALIDCAPS, "Setting DDSD_CAPS returned %#x.\n", hr);
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY;
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN;
hr = IDirectDrawSurface3_SetSurfaceDesc(surface3, &ddsd, 0);
ok(hr == DDERR_INVALIDCAPS, "Setting DDSD_CAPS returned %#x.\n", hr);
ddsd.ddsCaps.dwCaps = 0;
......@@ -4822,7 +4823,8 @@ static void test_set_surface_desc(void)
hr = IDirectDrawSurface3_GetSurfaceDesc(surface3, &ddsd);
ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr);
ok(ddsd.ddsCaps.dwCaps == DDSCAPS_SYSTEMMEMORY, "Got unexpected caps %#x.\n", ddsd.ddsCaps.dwCaps);
ok(ddsd.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN),
"Got unexpected caps %#x.\n", ddsd.ddsCaps.dwCaps);
/* Setting the height is allowed, but it cannot be set to 0, and only if LPSURFACE is set too. */
reset_ddsd(&ddsd);
......@@ -5050,7 +5052,7 @@ static void test_user_memory_getdc(void)
U2(ddsd.ddpfPixelFormat).dwRBitMask = 0x00ff0000;
U3(ddsd.ddpfPixelFormat).dwGBitMask = 0x0000ff00;
U4(ddsd.ddpfPixelFormat).dwBBitMask = 0x000000ff;
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY;
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN;
hr = IDirectDraw2_CreateSurface(ddraw, &ddsd, &surface, NULL);
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
......
......@@ -5359,7 +5359,7 @@ static void test_set_surface_desc(void)
U2(U4(ddsd).ddpfPixelFormat).dwRBitMask = 0x00ff0000;
U3(U4(ddsd).ddpfPixelFormat).dwGBitMask = 0x0000ff00;
U4(U4(ddsd).ddpfPixelFormat).dwBBitMask = 0x000000ff;
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY;
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN;
hr = IDirectDraw4_CreateSurface(ddraw, &ddsd, &surface, NULL);
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
......@@ -5400,7 +5400,8 @@ static void test_set_surface_desc(void)
hr = IDirectDrawSurface4_GetSurfaceDesc(surface, &ddsd);
ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr);
ok(ddsd.ddsCaps.dwCaps == DDSCAPS_SYSTEMMEMORY, "Got unexpected caps %#x.\n", ddsd.ddsCaps.dwCaps);
ok(ddsd.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN),
"Got unexpected caps %#x.\n", ddsd.ddsCaps.dwCaps);
ok(ddsd.ddsCaps.dwCaps2 == 0, "Got unexpected caps2 %#x.\n", 0);
/* Setting the caps is an error. This also means the original description cannot be reapplied. */
......@@ -5416,7 +5417,7 @@ static void test_set_surface_desc(void)
ddsd.lpSurface = data;
hr = IDirectDrawSurface4_SetSurfaceDesc(surface, &ddsd, 0);
ok(hr == DDERR_INVALIDCAPS, "Setting DDSD_CAPS returned %#x.\n", hr);
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY;
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN;
hr = IDirectDrawSurface4_SetSurfaceDesc(surface, &ddsd, 0);
ok(hr == DDERR_INVALIDCAPS, "Setting DDSD_CAPS returned %#x.\n", hr);
ddsd.ddsCaps.dwCaps = 0;
......@@ -5426,7 +5427,8 @@ static void test_set_surface_desc(void)
hr = IDirectDrawSurface4_GetSurfaceDesc(surface, &ddsd);
ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr);
ok(ddsd.ddsCaps.dwCaps == DDSCAPS_SYSTEMMEMORY, "Got unexpected caps %#x.\n", ddsd.ddsCaps.dwCaps);
ok(ddsd.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN),
"Got unexpected caps %#x.\n", ddsd.ddsCaps.dwCaps);
ok(ddsd.ddsCaps.dwCaps2 == 0, "Got unexpected caps2 %#x.\n", 0);
/* Setting the height is allowed, but it cannot be set to 0, and only if LPSURFACE is set too. */
......@@ -5652,7 +5654,7 @@ static void test_user_memory_getdc(void)
U2(U4(ddsd).ddpfPixelFormat).dwRBitMask = 0x00ff0000;
U3(U4(ddsd).ddpfPixelFormat).dwGBitMask = 0x0000ff00;
U4(U4(ddsd).ddpfPixelFormat).dwBBitMask = 0x000000ff;
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY;
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN;
hr = IDirectDraw4_CreateSurface(ddraw, &ddsd, &surface, NULL);
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
......
......@@ -5237,7 +5237,7 @@ static void test_set_surface_desc(void)
U2(U4(ddsd).ddpfPixelFormat).dwRBitMask = 0x00ff0000;
U3(U4(ddsd).ddpfPixelFormat).dwGBitMask = 0x0000ff00;
U4(U4(ddsd).ddpfPixelFormat).dwBBitMask = 0x000000ff;
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY;
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN;
hr = IDirectDraw7_CreateSurface(ddraw, &ddsd, &surface, NULL);
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
......@@ -5279,7 +5279,8 @@ static void test_set_surface_desc(void)
hr = IDirectDrawSurface7_GetSurfaceDesc(surface, &ddsd);
ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr);
ok(ddsd.ddsCaps.dwCaps == DDSCAPS_SYSTEMMEMORY, "Got unexpected caps %#x.\n", ddsd.ddsCaps.dwCaps);
ok(ddsd.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN),
"Got unexpected caps %#x.\n", ddsd.ddsCaps.dwCaps);
ok(ddsd.ddsCaps.dwCaps2 == 0, "Got unexpected caps2 %#x.\n", 0);
/* Setting the caps is an error. This also means the original description cannot be reapplied. */
......@@ -5295,7 +5296,7 @@ static void test_set_surface_desc(void)
ddsd.lpSurface = data;
hr = IDirectDrawSurface7_SetSurfaceDesc(surface, &ddsd, 0);
ok(hr == DDERR_INVALIDCAPS, "Setting DDSD_CAPS returned %#x.\n", hr);
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY;
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN;
hr = IDirectDrawSurface7_SetSurfaceDesc(surface, &ddsd, 0);
ok(hr == DDERR_INVALIDCAPS, "Setting DDSD_CAPS returned %#x.\n", hr);
ddsd.ddsCaps.dwCaps = 0;
......@@ -5305,7 +5306,8 @@ static void test_set_surface_desc(void)
hr = IDirectDrawSurface7_GetSurfaceDesc(surface, &ddsd);
ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr);
ok(ddsd.ddsCaps.dwCaps == DDSCAPS_SYSTEMMEMORY, "Got unexpected caps %#x.\n", ddsd.ddsCaps.dwCaps);
ok(ddsd.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN),
"Got unexpected caps %#x.\n", ddsd.ddsCaps.dwCaps);
ok(ddsd.ddsCaps.dwCaps2 == 0, "Got unexpected caps2 %#x.\n", 0);
/* Setting the height is allowed, but it cannot be set to 0, and only if LPSURFACE is set too. */
......@@ -5531,7 +5533,7 @@ static void test_user_memory_getdc(void)
U2(U4(ddsd).ddpfPixelFormat).dwRBitMask = 0x00ff0000;
U3(U4(ddsd).ddpfPixelFormat).dwGBitMask = 0x0000ff00;
U4(U4(ddsd).ddpfPixelFormat).dwBBitMask = 0x000000ff;
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY;
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN;
hr = IDirectDraw7_CreateSurface(ddraw, &ddsd, &surface, NULL);
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment