Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/ddraw/tests/ddraw1.c | 153 ++++++++++++++++++++++++++++++++++- dlls/ddraw/tests/ddraw2.c | 153 ++++++++++++++++++++++++++++++++++- dlls/ddraw/tests/ddraw4.c | 163 +++++++++++++++++++++++++++++++++++-- dlls/ddraw/tests/ddraw7.c | 164 ++++++++++++++++++++++++++++++++++++-- 4 files changed, 620 insertions(+), 13 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 4e27ecfb796..34ebfab1b7b 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -12091,9 +12091,27 @@ static void test_clear(void) DestroyWindow(window); }
+struct display_mode_list +{ + DDSURFACEDESC modes[20]; + unsigned int count; +}; + +static HRESULT CALLBACK build_mode_list_cb(DDSURFACEDESC *desc, void *context) +{ + struct display_mode_list *modes = context; + + if (modes->count < ARRAY_SIZE(modes->modes)) + modes->modes[modes->count] = *desc; + ++modes->count; + + return DDENUMRET_OK; +} + struct enum_surfaces_param { IDirectDrawSurface *surfaces[8]; + struct display_mode_list modes; unsigned int count; };
@@ -12119,9 +12137,31 @@ static HRESULT WINAPI enum_surfaces_cb(IDirectDrawSurface *surface, DDSURFACEDES return DDENUMRET_OK; }
+static HRESULT WINAPI enum_surfaces_create_cb(IDirectDrawSurface *surface, DDSURFACEDESC *desc, void *context) +{ + static const DWORD expect_flags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PITCH | DDSD_PIXELFORMAT; + struct enum_surfaces_param *param = context; + + ok(!surface, "Unexpected surface %p.\n", surface); + ok((desc->dwFlags & expect_flags) == expect_flags, "Got unexpected flags %#x.\n", desc->dwFlags); + if (param->count < ARRAY_SIZE(param->modes.modes)) + { + const DDSURFACEDESC *expect = ¶m->modes.modes[param->count]; + ok(desc->dwWidth == expect->dwWidth, "Expected width %u, got %u.\n", expect->dwWidth, desc->dwWidth); + ok(desc->dwHeight == expect->dwHeight, "Expected height %u, got %u.\n", expect->dwHeight, desc->dwHeight); + ok(!memcmp(&desc->ddpfPixelFormat, &expect->ddpfPixelFormat, sizeof(desc->ddpfPixelFormat)), + "Pixel formats didn't match.\n"); + } + + ++param->count; + + return DDENUMRET_OK; +} + static void test_enum_surfaces(void) { struct enum_surfaces_param param = {{0}}; + DDPIXELFORMAT current_format; IDirectDraw *ddraw; DDSURFACEDESC desc; HRESULT hr; @@ -12129,8 +12169,21 @@ static void test_enum_surfaces(void) ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n");
+ memset(&desc, 0, sizeof(desc)); + desc.dwSize = sizeof(desc); + hr = IDirectDraw_GetDisplayMode(ddraw, &desc); + ok(hr == DD_OK, "Failed to get display mode, hr %#x.\n", hr); + current_format = desc.ddpfPixelFormat; + hr = IDirectDraw_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); - ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); + ok(hr == DD_OK, "Failed to set cooperative level, hr %#x.\n", hr); + + hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_ALL, NULL, NULL, enum_surfaces_cb); + todo_wine ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + + hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_ALL, + NULL, NULL, enum_surfaces_cb); + todo_wine ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
memset(&desc, 0, sizeof(desc)); desc.dwSize = sizeof(desc); @@ -12150,6 +12203,7 @@ static void test_enum_surfaces(void) ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr); ok(!param.surfaces[3], "Got unexpected pointer %p.\n", param.surfaces[3]);
+ param.count = 0; hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_ALL, &desc, ¶m, enum_surfaces_cb); ok(SUCCEEDED(hr), "Failed to enumerate surfaces, hr %#x.\n", hr); @@ -12161,9 +12215,106 @@ static void test_enum_surfaces(void) ok(SUCCEEDED(hr), "Failed to enumerate surfaces, hr %#x.\n", hr); ok(param.count == 3, "Got unexpected number of enumerated surfaces %u.\n", param.count);
+ desc.dwFlags = DDSD_WIDTH | DDSD_HEIGHT; + param.count = 0; + hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_MATCH, + &desc, ¶m, enum_surfaces_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count); + + param.count = 0; + hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_NOMATCH, + &desc, ¶m, enum_surfaces_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + todo_wine ok(param.count == 2, "Got unexpected number of enumerated surfaces %u.\n", param.count); + + desc.dwFlags = 0; + param.count = 0; + hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_MATCH, + &desc, ¶m, enum_surfaces_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(param.count == 3, "Got unexpected number of enumerated surfaces %u.\n", param.count); + + desc.dwFlags = 0; + param.count = 0; + hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST, &desc, ¶m, enum_surfaces_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(param.count == 3, "Got unexpected number of enumerated surfaces %u.\n", param.count); + IDirectDrawSurface_Release(param.surfaces[2]); IDirectDrawSurface_Release(param.surfaces[1]); IDirectDrawSurface_Release(param.surfaces[0]); + + param.count = 0; + hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_ALL, + NULL, ¶m, enum_surfaces_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(!param.count, "Got unexpected number of enumerated surfaces %u.\n", param.count); + + memset(&desc, 0, sizeof(desc)); + desc.dwSize = sizeof(desc); + desc.dwFlags = DDSD_CAPS; + desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE; + + hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_ALL, + &desc, ¶m, enum_surfaces_create_cb); + todo_wine ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr); + + hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_NOMATCH, + &desc, ¶m, enum_surfaces_create_cb); + todo_wine ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr); + + hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED, + &desc, ¶m, enum_surfaces_create_cb); + todo_wine ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr); + + /* When not passed width and height, the callback is called with every + * available display resolution. */ + + param.modes.count = 0; + desc.dwFlags |= DDSD_PIXELFORMAT; + U4(desc).ddpfPixelFormat = current_format; + hr = IDirectDraw_EnumDisplayModes(ddraw, 0, &desc, ¶m.modes, build_mode_list_cb); + ok(hr == DD_OK, "Failed to build mode list, hr %#x.\n", hr); + + param.count = 0; + desc.dwFlags &= ~DDSD_PIXELFORMAT; + hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_MATCH, + &desc, ¶m, enum_surfaces_create_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + todo_wine ok(param.count == param.modes.count, "Expected %u surfaces, got %u.\n", param.modes.count, param.count); + + desc.dwFlags |= DDSD_WIDTH | DDSD_HEIGHT; + desc.dwWidth = desc.dwHeight = 32; + + param.modes.modes[0].dwWidth = param.modes.modes[0].dwHeight = 32; + + param.count = 0; + hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_MATCH, + &desc, ¶m, enum_surfaces_create_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + todo_wine ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count); + + hr = IDirectDraw_CreateSurface(ddraw, &desc, ¶m.surfaces[0], NULL); + ok(hr == DD_OK, "Failed to create surface, hr %#x.\n", hr); + param.count = 0; + hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_MATCH, + &desc, ¶m, enum_surfaces_create_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + todo_wine ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count); + IDirectDrawSurface_Release(param.surfaces[0]); + + desc.dwFlags |= DDSD_PIXELFORMAT; + desc.ddpfPixelFormat.dwSize = sizeof(desc.ddpfPixelFormat); + desc.ddpfPixelFormat.dwFlags = DDPF_FOURCC; + desc.ddpfPixelFormat.dwFourCC = 0xdeadbeef; + + param.count = 0; + hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_MATCH, + &desc, ¶m, enum_surfaces_create_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(!param.count, "Got unexpected number of enumerated surfaces %u.\n", param.count); + IDirectDraw_Release(ddraw); }
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 7c25b2be557..90f7b77c839 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -13067,9 +13067,27 @@ static void test_clear(void) DestroyWindow(window); }
+struct display_mode_list +{ + DDSURFACEDESC modes[20]; + unsigned int count; +}; + +static HRESULT CALLBACK build_mode_list_cb(DDSURFACEDESC *desc, void *context) +{ + struct display_mode_list *modes = context; + + if (modes->count < ARRAY_SIZE(modes->modes)) + modes->modes[modes->count] = *desc; + ++modes->count; + + return DDENUMRET_OK; +} + struct enum_surfaces_param { IDirectDrawSurface *surfaces[8]; + struct display_mode_list modes; unsigned int count; };
@@ -13095,9 +13113,31 @@ static HRESULT WINAPI enum_surfaces_cb(IDirectDrawSurface *surface, DDSURFACEDES return DDENUMRET_OK; }
+static HRESULT WINAPI enum_surfaces_create_cb(IDirectDrawSurface *surface, DDSURFACEDESC *desc, void *context) +{ + static const DWORD expect_flags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PITCH | DDSD_PIXELFORMAT; + struct enum_surfaces_param *param = context; + + ok(!surface, "Unexpected surface %p.\n", surface); + ok((desc->dwFlags & expect_flags) == expect_flags, "Got unexpected flags %#x.\n", desc->dwFlags); + if (param->count < ARRAY_SIZE(param->modes.modes)) + { + const DDSURFACEDESC *expect = ¶m->modes.modes[param->count]; + ok(desc->dwWidth == expect->dwWidth, "Expected width %u, got %u.\n", expect->dwWidth, desc->dwWidth); + ok(desc->dwHeight == expect->dwHeight, "Expected height %u, got %u.\n", expect->dwHeight, desc->dwHeight); + ok(!memcmp(&desc->ddpfPixelFormat, &expect->ddpfPixelFormat, sizeof(desc->ddpfPixelFormat)), + "Pixel formats didn't match.\n"); + } + + ++param->count; + + return DDENUMRET_OK; +} + static void test_enum_surfaces(void) { struct enum_surfaces_param param = {{0}}; + DDPIXELFORMAT current_format; IDirectDraw2 *ddraw; DDSURFACEDESC desc; HRESULT hr; @@ -13105,8 +13145,21 @@ static void test_enum_surfaces(void) ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n");
+ memset(&desc, 0, sizeof(desc)); + desc.dwSize = sizeof(desc); + hr = IDirectDraw2_GetDisplayMode(ddraw, &desc); + ok(hr == DD_OK, "Failed to get display mode, hr %#x.\n", hr); + current_format = desc.ddpfPixelFormat; + hr = IDirectDraw2_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); - ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); + ok(hr == DD_OK, "Failed to set cooperative level, hr %#x.\n", hr); + + hr = IDirectDraw2_EnumSurfaces(ddraw, DDENUMSURFACES_ALL, NULL, NULL, enum_surfaces_cb); + todo_wine ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + + hr = IDirectDraw2_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_ALL, + NULL, NULL, enum_surfaces_cb); + todo_wine ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
memset(&desc, 0, sizeof(desc)); desc.dwSize = sizeof(desc); @@ -13126,6 +13179,7 @@ static void test_enum_surfaces(void) ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr); ok(!param.surfaces[3], "Got unexpected pointer %p.\n", param.surfaces[3]);
+ param.count = 0; hr = IDirectDraw2_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_ALL, &desc, ¶m, enum_surfaces_cb); ok(SUCCEEDED(hr), "Failed to enumerate surfaces, hr %#x.\n", hr); @@ -13137,9 +13191,106 @@ static void test_enum_surfaces(void) ok(SUCCEEDED(hr), "Failed to enumerate surfaces, hr %#x.\n", hr); ok(param.count == 3, "Got unexpected number of enumerated surfaces %u.\n", param.count);
+ desc.dwFlags = DDSD_WIDTH | DDSD_HEIGHT; + param.count = 0; + hr = IDirectDraw2_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_MATCH, + &desc, ¶m, enum_surfaces_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count); + + param.count = 0; + hr = IDirectDraw2_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_NOMATCH, + &desc, ¶m, enum_surfaces_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + todo_wine ok(param.count == 2, "Got unexpected number of enumerated surfaces %u.\n", param.count); + + desc.dwFlags = 0; + param.count = 0; + hr = IDirectDraw2_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_MATCH, + &desc, ¶m, enum_surfaces_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(param.count == 3, "Got unexpected number of enumerated surfaces %u.\n", param.count); + + desc.dwFlags = 0; + param.count = 0; + hr = IDirectDraw2_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST, &desc, ¶m, enum_surfaces_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(param.count == 3, "Got unexpected number of enumerated surfaces %u.\n", param.count); + IDirectDrawSurface_Release(param.surfaces[2]); IDirectDrawSurface_Release(param.surfaces[1]); IDirectDrawSurface_Release(param.surfaces[0]); + + param.count = 0; + hr = IDirectDraw2_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_ALL, + NULL, ¶m, enum_surfaces_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(!param.count, "Got unexpected number of enumerated surfaces %u.\n", param.count); + + memset(&desc, 0, sizeof(desc)); + desc.dwSize = sizeof(desc); + desc.dwFlags = DDSD_CAPS; + desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE; + + hr = IDirectDraw2_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_ALL, + &desc, ¶m, enum_surfaces_create_cb); + todo_wine ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr); + + hr = IDirectDraw2_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_NOMATCH, + &desc, ¶m, enum_surfaces_create_cb); + todo_wine ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr); + + hr = IDirectDraw2_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED, + &desc, ¶m, enum_surfaces_create_cb); + todo_wine ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr); + + /* When not passed width and height, the callback is called with every + * available display resolution. */ + + param.modes.count = 0; + desc.dwFlags |= DDSD_PIXELFORMAT; + U4(desc).ddpfPixelFormat = current_format; + hr = IDirectDraw2_EnumDisplayModes(ddraw, 0, &desc, ¶m.modes, build_mode_list_cb); + ok(hr == DD_OK, "Failed to build mode list, hr %#x.\n", hr); + + param.count = 0; + desc.dwFlags &= ~DDSD_PIXELFORMAT; + hr = IDirectDraw2_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_MATCH, + &desc, ¶m, enum_surfaces_create_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + todo_wine ok(param.count == param.modes.count, "Expected %u surfaces, got %u.\n", param.modes.count, param.count); + + desc.dwFlags |= DDSD_WIDTH | DDSD_HEIGHT; + desc.dwWidth = desc.dwHeight = 32; + + param.modes.modes[0].dwWidth = param.modes.modes[0].dwHeight = 32; + + param.count = 0; + hr = IDirectDraw2_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_MATCH, + &desc, ¶m, enum_surfaces_create_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + todo_wine ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count); + + hr = IDirectDraw2_CreateSurface(ddraw, &desc, ¶m.surfaces[0], NULL); + ok(hr == DD_OK, "Failed to create surface, hr %#x.\n", hr); + param.count = 0; + hr = IDirectDraw2_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_MATCH, + &desc, ¶m, enum_surfaces_create_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + todo_wine ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count); + IDirectDrawSurface2_Release(param.surfaces[0]); + + desc.dwFlags |= DDSD_PIXELFORMAT; + desc.ddpfPixelFormat.dwSize = sizeof(desc.ddpfPixelFormat); + desc.ddpfPixelFormat.dwFlags = DDPF_FOURCC; + desc.ddpfPixelFormat.dwFourCC = 0xdeadbeef; + + param.count = 0; + hr = IDirectDraw2_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_MATCH, + &desc, ¶m, enum_surfaces_create_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(!param.count, "Got unexpected number of enumerated surfaces %u.\n", param.count); + IDirectDraw2_Release(ddraw); }
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index c38c0b3ce5a..8012e10a19c 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -15655,9 +15655,27 @@ static void test_clear(void) DestroyWindow(window); }
+struct display_mode_list +{ + DDSURFACEDESC2 modes[20]; + unsigned int count; +}; + +static HRESULT CALLBACK build_mode_list_cb(DDSURFACEDESC2 *desc, void *context) +{ + struct display_mode_list *modes = context; + + if (modes->count < ARRAY_SIZE(modes->modes)) + modes->modes[modes->count] = *desc; + ++modes->count; + + return DDENUMRET_OK; +} + struct enum_surfaces_param { IDirectDrawSurface4 *surfaces[8]; + struct display_mode_list modes; unsigned int count; };
@@ -15683,9 +15701,31 @@ static HRESULT WINAPI enum_surfaces_cb(IDirectDrawSurface4 *surface, DDSURFACEDE return DDENUMRET_OK; }
+static HRESULT WINAPI enum_surfaces_create_cb(IDirectDrawSurface4 *surface, DDSURFACEDESC2 *desc, void *context) +{ + static const DWORD expect_flags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PITCH | DDSD_PIXELFORMAT; + struct enum_surfaces_param *param = context; + + ok(!surface, "Unexpected surface %p.\n", surface); + ok((desc->dwFlags & expect_flags) == expect_flags, "Got unexpected flags %#x.\n", desc->dwFlags); + if (param->count < ARRAY_SIZE(param->modes.modes)) + { + const DDSURFACEDESC2 *expect = ¶m->modes.modes[param->count]; + ok(desc->dwWidth == expect->dwWidth, "Expected width %u, got %u.\n", expect->dwWidth, desc->dwWidth); + ok(desc->dwHeight == expect->dwHeight, "Expected height %u, got %u.\n", expect->dwHeight, desc->dwHeight); + ok(!memcmp(&U4(*desc).ddpfPixelFormat, &U4(*expect).ddpfPixelFormat, sizeof(U4(*desc).ddpfPixelFormat)), + "Pixel formats didn't match.\n"); + } + + ++param->count; + + return DDENUMRET_OK; +} + static void test_enum_surfaces(void) { struct enum_surfaces_param param = {{0}}; + DDPIXELFORMAT current_format; DDSURFACEDESC2 desc; IDirectDraw4 *ddraw; HRESULT hr; @@ -15693,8 +15733,21 @@ static void test_enum_surfaces(void) ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n");
+ memset(&desc, 0, sizeof(desc)); + desc.dwSize = sizeof(desc); + hr = IDirectDraw4_GetDisplayMode(ddraw, &desc); + ok(hr == DD_OK, "Failed to get display mode, hr %#x.\n", hr); + current_format = U4(desc).ddpfPixelFormat; + hr = IDirectDraw4_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); - ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); + ok(hr == DD_OK, "Failed to set cooperative level, hr %#x.\n", hr); + + hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_ALL, NULL, NULL, enum_surfaces_cb); + todo_wine ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + + hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_ALL, + NULL, NULL, enum_surfaces_cb); + todo_wine ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
memset(&desc, 0, sizeof(desc)); desc.dwSize = sizeof(desc); @@ -15704,30 +15757,128 @@ static void test_enum_surfaces(void) desc.dwWidth = 32; desc.dwHeight = 32; hr = IDirectDraw4_CreateSurface(ddraw, &desc, ¶m.surfaces[0], NULL); - ok(SUCCEEDED(hr), "Failed to create a surface, hr %#x.\n", hr); + ok(hr == DD_OK, "Failed to create a surface, hr %#x.\n", hr);
hr = IDirectDrawSurface4_GetAttachedSurface(param.surfaces[0], &desc.ddsCaps, ¶m.surfaces[1]); - ok(SUCCEEDED(hr), "Failed to get attached surface, hr %#x.\n", hr); + ok(hr == DD_OK, "Failed to get attached surface, hr %#x.\n", hr); hr = IDirectDrawSurface4_GetAttachedSurface(param.surfaces[1], &desc.ddsCaps, ¶m.surfaces[2]); - ok(SUCCEEDED(hr), "Failed to get attached surface, hr %#x.\n", hr); + ok(hr == DD_OK, "Failed to get attached surface, hr %#x.\n", hr); hr = IDirectDrawSurface4_GetAttachedSurface(param.surfaces[2], &desc.ddsCaps, ¶m.surfaces[3]); ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr); ok(!param.surfaces[3], "Got unexpected pointer %p.\n", param.surfaces[3]);
+ param.count = 0; hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_ALL, &desc, ¶m, enum_surfaces_cb); - ok(SUCCEEDED(hr), "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); ok(param.count == 3, "Got unexpected number of enumerated surfaces %u.\n", param.count);
param.count = 0; hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_ALL, NULL, ¶m, enum_surfaces_cb); - ok(SUCCEEDED(hr), "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(param.count == 3, "Got unexpected number of enumerated surfaces %u.\n", param.count); + + desc.dwFlags = DDSD_WIDTH | DDSD_HEIGHT; + param.count = 0; + hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_MATCH, + &desc, ¶m, enum_surfaces_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count); + + param.count = 0; + hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_NOMATCH, + &desc, ¶m, enum_surfaces_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + todo_wine ok(param.count == 2, "Got unexpected number of enumerated surfaces %u.\n", param.count); + + desc.dwFlags = 0; + param.count = 0; + hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_MATCH, + &desc, ¶m, enum_surfaces_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(param.count == 3, "Got unexpected number of enumerated surfaces %u.\n", param.count); + + desc.dwFlags = 0; + param.count = 0; + hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST, &desc, ¶m, enum_surfaces_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); ok(param.count == 3, "Got unexpected number of enumerated surfaces %u.\n", param.count);
IDirectDrawSurface4_Release(param.surfaces[2]); IDirectDrawSurface4_Release(param.surfaces[1]); IDirectDrawSurface4_Release(param.surfaces[0]); + + param.count = 0; + hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_ALL, + NULL, ¶m, enum_surfaces_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(!param.count, "Got unexpected number of enumerated surfaces %u.\n", param.count); + + memset(&desc, 0, sizeof(desc)); + desc.dwSize = sizeof(desc); + desc.dwFlags = DDSD_CAPS; + desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE; + + hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_ALL, + &desc, ¶m, enum_surfaces_create_cb); + todo_wine ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr); + + hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_NOMATCH, + &desc, ¶m, enum_surfaces_create_cb); + todo_wine ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr); + + hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED, + &desc, ¶m, enum_surfaces_create_cb); + todo_wine ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr); + + /* When not passed width and height, the callback is called with every + * available display resolution. */ + + param.modes.count = 0; + desc.dwFlags |= DDSD_PIXELFORMAT; + U4(desc).ddpfPixelFormat = current_format; + hr = IDirectDraw4_EnumDisplayModes(ddraw, 0, &desc, ¶m.modes, build_mode_list_cb); + ok(hr == DD_OK, "Failed to build mode list, hr %#x.\n", hr); + + param.count = 0; + desc.dwFlags &= ~DDSD_PIXELFORMAT; + hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_MATCH, + &desc, ¶m, enum_surfaces_create_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + todo_wine ok(param.count == param.modes.count, "Expected %u surfaces, got %u.\n", param.modes.count, param.count); + + desc.dwFlags |= DDSD_WIDTH | DDSD_HEIGHT; + desc.dwWidth = desc.dwHeight = 32; + + param.modes.modes[0].dwWidth = param.modes.modes[0].dwHeight = 32; + + param.count = 0; + hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_MATCH, + &desc, ¶m, enum_surfaces_create_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + todo_wine ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count); + + hr = IDirectDraw4_CreateSurface(ddraw, &desc, ¶m.surfaces[0], NULL); + ok(hr == DD_OK, "Failed to create surface, hr %#x.\n", hr); + param.count = 0; + hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_MATCH, + &desc, ¶m, enum_surfaces_create_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + todo_wine ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count); + IDirectDrawSurface4_Release(param.surfaces[0]); + + desc.dwFlags |= DDSD_PIXELFORMAT; + U4(desc).ddpfPixelFormat.dwSize = sizeof(U4(desc).ddpfPixelFormat); + U4(desc).ddpfPixelFormat.dwFlags = DDPF_FOURCC; + U4(desc).ddpfPixelFormat.dwFourCC = 0xdeadbeef; + + param.count = 0; + hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_MATCH, + &desc, ¶m, enum_surfaces_create_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(!param.count, "Got unexpected number of enumerated surfaces %u.\n", param.count); + IDirectDraw4_Release(ddraw); }
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index d3ea36e9808..d94676ba5e6 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -15058,9 +15058,27 @@ static void test_clear(void) DestroyWindow(window); }
+struct display_mode_list +{ + DDSURFACEDESC2 modes[20]; + unsigned int count; +}; + +static HRESULT CALLBACK build_mode_list_cb(DDSURFACEDESC2 *desc, void *context) +{ + struct display_mode_list *modes = context; + + if (modes->count < ARRAY_SIZE(modes->modes)) + modes->modes[modes->count] = *desc; + ++modes->count; + + return DDENUMRET_OK; +} + struct enum_surfaces_param { IDirectDrawSurface7 *surfaces[8]; + struct display_mode_list modes; unsigned int count; };
@@ -15086,9 +15104,31 @@ static HRESULT WINAPI enum_surfaces_cb(IDirectDrawSurface7 *surface, DDSURFACEDE return DDENUMRET_OK; }
+static HRESULT WINAPI enum_surfaces_create_cb(IDirectDrawSurface7 *surface, DDSURFACEDESC2 *desc, void *context) +{ + static const DWORD expect_flags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PITCH | DDSD_PIXELFORMAT; + struct enum_surfaces_param *param = context; + + ok(!surface, "Unexpected surface %p.\n", surface); + ok((desc->dwFlags & expect_flags) == expect_flags, "Got unexpected flags %#x.\n", desc->dwFlags); + if (param->count < ARRAY_SIZE(param->modes.modes)) + { + const DDSURFACEDESC2 *expect = ¶m->modes.modes[param->count]; + ok(desc->dwWidth == expect->dwWidth, "Expected width %u, got %u.\n", expect->dwWidth, desc->dwWidth); + ok(desc->dwHeight == expect->dwHeight, "Expected height %u, got %u.\n", expect->dwHeight, desc->dwHeight); + ok(!memcmp(&U4(*desc).ddpfPixelFormat, &U4(*expect).ddpfPixelFormat, sizeof(U4(*desc).ddpfPixelFormat)), + "Pixel formats didn't match.\n"); + } + + ++param->count; + + return DDENUMRET_OK; +} + static void test_enum_surfaces(void) { struct enum_surfaces_param param = {{0}}; + DDPIXELFORMAT current_format; DDSURFACEDESC2 desc; IDirectDraw7 *ddraw; HRESULT hr; @@ -15096,8 +15136,24 @@ static void test_enum_surfaces(void) ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n");
+ memset(&desc, 0, sizeof(desc)); + desc.dwSize = sizeof(desc); + hr = IDirectDraw7_GetDisplayMode(ddraw, &desc); + ok(hr == DD_OK, "Failed to get display mode, hr %#x.\n", hr); + current_format = U4(desc).ddpfPixelFormat; + hr = IDirectDraw7_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); - ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); + ok(hr == DD_OK, "Failed to set cooperative level, hr %#x.\n", hr); + + hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_ALL, NULL, NULL, NULL); + ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + + hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_ALL, NULL, NULL, enum_surfaces_cb); + todo_wine ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + + hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_ALL, + NULL, NULL, enum_surfaces_cb); + todo_wine ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
memset(&desc, 0, sizeof(desc)); desc.dwSize = sizeof(desc); @@ -15114,27 +15170,125 @@ static void test_enum_surfaces(void) }
hr = IDirectDrawSurface7_GetAttachedSurface(param.surfaces[0], &desc.ddsCaps, ¶m.surfaces[1]); - ok(SUCCEEDED(hr), "Failed to get attached surface, hr %#x.\n", hr); + ok(hr == DD_OK, "Failed to get attached surface, hr %#x.\n", hr); hr = IDirectDrawSurface7_GetAttachedSurface(param.surfaces[1], &desc.ddsCaps, ¶m.surfaces[2]); - ok(SUCCEEDED(hr), "Failed to get attached surface, hr %#x.\n", hr); + ok(hr == DD_OK, "Failed to get attached surface, hr %#x.\n", hr); hr = IDirectDrawSurface7_GetAttachedSurface(param.surfaces[2], &desc.ddsCaps, ¶m.surfaces[3]); ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr); ok(!param.surfaces[3], "Got unexpected pointer %p.\n", param.surfaces[3]);
+ param.count = 0; hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_ALL, &desc, ¶m, enum_surfaces_cb); - ok(SUCCEEDED(hr), "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); ok(param.count == 3, "Got unexpected number of enumerated surfaces %u.\n", param.count);
param.count = 0; hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_ALL, NULL, ¶m, enum_surfaces_cb); - ok(SUCCEEDED(hr), "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(param.count == 3, "Got unexpected number of enumerated surfaces %u.\n", param.count); + + desc.dwFlags = DDSD_WIDTH | DDSD_HEIGHT; + param.count = 0; + hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_MATCH, + &desc, ¶m, enum_surfaces_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count); + + param.count = 0; + hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_NOMATCH, + &desc, ¶m, enum_surfaces_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + todo_wine ok(param.count == 2, "Got unexpected number of enumerated surfaces %u.\n", param.count); + + desc.dwFlags = 0; + param.count = 0; + hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_MATCH, + &desc, ¶m, enum_surfaces_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(param.count == 3, "Got unexpected number of enumerated surfaces %u.\n", param.count); + + desc.dwFlags = 0; + param.count = 0; + hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST, &desc, ¶m, enum_surfaces_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); ok(param.count == 3, "Got unexpected number of enumerated surfaces %u.\n", param.count);
IDirectDrawSurface7_Release(param.surfaces[2]); IDirectDrawSurface7_Release(param.surfaces[1]); IDirectDrawSurface7_Release(param.surfaces[0]); + + param.count = 0; + hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_ALL, + NULL, ¶m, enum_surfaces_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(!param.count, "Got unexpected number of enumerated surfaces %u.\n", param.count); + + memset(&desc, 0, sizeof(desc)); + desc.dwSize = sizeof(desc); + desc.dwFlags = DDSD_CAPS; + desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE; + + hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_ALL, + &desc, ¶m, enum_surfaces_create_cb); + todo_wine ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr); + + hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_NOMATCH, + &desc, ¶m, enum_surfaces_create_cb); + todo_wine ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr); + + hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED, + &desc, ¶m, enum_surfaces_create_cb); + todo_wine ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr); + + /* When not passed width and height, the callback is called with every + * available display resolution. */ + + param.modes.count = 0; + desc.dwFlags |= DDSD_PIXELFORMAT; + U4(desc).ddpfPixelFormat = current_format; + hr = IDirectDraw7_EnumDisplayModes(ddraw, 0, &desc, ¶m.modes, build_mode_list_cb); + ok(hr == DD_OK, "Failed to build mode list, hr %#x.\n", hr); + + param.count = 0; + desc.dwFlags &= ~DDSD_PIXELFORMAT; + hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_MATCH, + &desc, ¶m, enum_surfaces_create_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + todo_wine ok(param.count == param.modes.count, "Expected %u surfaces, got %u.\n", param.modes.count, param.count); + + desc.dwFlags |= DDSD_WIDTH | DDSD_HEIGHT; + desc.dwWidth = desc.dwHeight = 32; + + param.modes.modes[0].dwWidth = param.modes.modes[0].dwHeight = 32; + + param.count = 0; + hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_MATCH, + &desc, ¶m, enum_surfaces_create_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + todo_wine ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count); + + hr = IDirectDraw7_CreateSurface(ddraw, &desc, ¶m.surfaces[0], NULL); + ok(hr == DD_OK, "Failed to create surface, hr %#x.\n", hr); + param.count = 0; + hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_MATCH, + &desc, ¶m, enum_surfaces_create_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + todo_wine ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count); + IDirectDrawSurface7_Release(param.surfaces[0]); + + desc.dwFlags |= DDSD_PIXELFORMAT; + U4(desc).ddpfPixelFormat.dwSize = sizeof(U4(desc).ddpfPixelFormat); + U4(desc).ddpfPixelFormat.dwFlags = DDPF_FOURCC; + U4(desc).ddpfPixelFormat.dwFourCC = 0xdeadbeef; + + param.count = 0; + hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_MATCH, + &desc, ¶m, enum_surfaces_create_cb); + ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(!param.count, "Got unexpected number of enumerated surfaces %u.\n", param.count); + IDirectDraw7_Release(ddraw); }
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/ddraw/ddraw.c | 8 ++++---- dlls/ddraw/tests/ddraw1.c | 2 +- dlls/ddraw/tests/ddraw2.c | 2 +- dlls/ddraw/tests/ddraw4.c | 2 +- dlls/ddraw/tests/ddraw7.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index b7e7e6514a8..afd2875ea21 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -3213,7 +3213,7 @@ static HRESULT CALLBACK EnumSurfacesCallbackThunk(IDirectDrawSurface7 *surface, * DD_OK on success * *****************************************************************************/ -static HRESULT WINAPI ddraw7_EnumSurfaces(IDirectDraw7 *iface, DWORD Flags, +static HRESULT WINAPI ddraw7_EnumSurfaces(IDirectDraw7 *iface, DWORD flags, DDSURFACEDESC2 *DDSD, void *Context, LPDDENUMSURFACESCALLBACK7 Callback) { struct ddraw *ddraw = impl_from_IDirectDraw7(iface); @@ -3223,10 +3223,10 @@ static HRESULT WINAPI ddraw7_EnumSurfaces(IDirectDraw7 *iface, DWORD Flags, struct list *entry, *entry2;
TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n", - iface, Flags, DDSD, Context, Callback); + iface, flags, DDSD, Context, Callback);
- all = Flags & DDENUMSURFACES_ALL; - nomatch = Flags & DDENUMSURFACES_NOMATCH; + all = flags & DDENUMSURFACES_ALL; + nomatch = !!(flags & DDENUMSURFACES_NOMATCH);
if (!Callback) return DDERR_INVALIDPARAMS; diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 34ebfab1b7b..4e620b4a905 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -12226,7 +12226,7 @@ static void test_enum_surfaces(void) hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_NOMATCH, &desc, ¶m, enum_surfaces_cb); ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); - todo_wine ok(param.count == 2, "Got unexpected number of enumerated surfaces %u.\n", param.count); + ok(param.count == 2, "Got unexpected number of enumerated surfaces %u.\n", param.count);
desc.dwFlags = 0; param.count = 0; diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 90f7b77c839..3172948d335 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -13202,7 +13202,7 @@ static void test_enum_surfaces(void) hr = IDirectDraw2_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_NOMATCH, &desc, ¶m, enum_surfaces_cb); ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); - todo_wine ok(param.count == 2, "Got unexpected number of enumerated surfaces %u.\n", param.count); + ok(param.count == 2, "Got unexpected number of enumerated surfaces %u.\n", param.count);
desc.dwFlags = 0; param.count = 0; diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 8012e10a19c..fb14f281e20 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -15790,7 +15790,7 @@ static void test_enum_surfaces(void) hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_NOMATCH, &desc, ¶m, enum_surfaces_cb); ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); - todo_wine ok(param.count == 2, "Got unexpected number of enumerated surfaces %u.\n", param.count); + ok(param.count == 2, "Got unexpected number of enumerated surfaces %u.\n", param.count);
desc.dwFlags = 0; param.count = 0; diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index d94676ba5e6..459869ad869 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -15200,7 +15200,7 @@ static void test_enum_surfaces(void) hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_NOMATCH, &desc, ¶m, enum_surfaces_cb); ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); - todo_wine ok(param.count == 2, "Got unexpected number of enumerated surfaces %u.\n", param.count); + ok(param.count == 2, "Got unexpected number of enumerated surfaces %u.\n", param.count);
desc.dwFlags = 0; param.count = 0;
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=71053
Your paranoid android.
=== wxppro (32 bit report) ===
ddraw: ddraw1.c:12285: Test failed: Expected 16 surfaces, got 3.
=== w2008s64 (32 bit report) ===
ddraw: ddraw1.c:12285: Test failed: Expected 16 surfaces, got 3.
=== w2008s64 (64 bit report) ===
ddraw: ddraw1.c:12285: Test failed: Expected 16 surfaces, got 3.
=== wxppro (32 bit report) ===
ddraw: ddraw2.c:13261: Test failed: Expected 16 surfaces, got 3.
=== w2008s64 (32 bit report) ===
ddraw: ddraw2.c:13261: Test failed: Expected 16 surfaces, got 3.
=== w2008s64 (64 bit report) ===
ddraw: ddraw2.c:13261: Test failed: Expected 16 surfaces, got 3.
=== wxppro (32 bit report) ===
ddraw: ddraw4.c:15849: Test failed: Expected 16 surfaces, got 3.
=== w2008s64 (32 bit report) ===
ddraw: ddraw4.c:15849: Test failed: Expected 16 surfaces, got 3.
=== w2008s64 (64 bit report) ===
ddraw: ddraw4.c:15849: Test failed: Expected 16 surfaces, got 3.
=== wxppro (32 bit report) ===
ddraw: ddraw7.c:15259: Test failed: Expected 16 surfaces, got 3.
=== w2008s64 (32 bit report) ===
ddraw: ddraw7.c:15259: Test failed: Expected 16 surfaces, got 3.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=17233 Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/ddraw/ddraw.c | 137 ++++++++++++++++++++++++++++++-------- dlls/ddraw/tests/ddraw1.c | 16 ++--- dlls/ddraw/tests/ddraw2.c | 16 ++--- dlls/ddraw/tests/ddraw4.c | 16 ++--- dlls/ddraw/tests/ddraw7.c | 16 ++--- 5 files changed, 142 insertions(+), 59 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index afd2875ea21..866b7089080 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -3174,6 +3174,9 @@ static HRESULT CALLBACK EnumSurfacesCallback2Thunk(IDirectDrawSurface7 *surface, struct ddraw_surface *surface_impl = impl_from_IDirectDrawSurface7(surface); struct surfacescallback2_context *cbcontext = context;
+ if (!surface) + return cbcontext->func(NULL, surface_desc, cbcontext->context); + IDirectDrawSurface4_AddRef(&surface_impl->IDirectDrawSurface4_iface); IDirectDrawSurface7_Release(surface);
@@ -3187,6 +3190,9 @@ static HRESULT CALLBACK EnumSurfacesCallbackThunk(IDirectDrawSurface7 *surface, struct ddraw_surface *surface_impl = impl_from_IDirectDrawSurface7(surface); struct surfacescallback_context *cbcontext = context;
+ if (!surface) + return cbcontext->func(NULL, (DDSURFACEDESC *)surface_desc, cbcontext->context); + IDirectDrawSurface_AddRef(&surface_impl->IDirectDrawSurface_iface); IDirectDrawSurface7_Release(surface);
@@ -3194,6 +3200,34 @@ static HRESULT CALLBACK EnumSurfacesCallbackThunk(IDirectDrawSurface7 *surface, (DDSURFACEDESC *)surface_desc, cbcontext->context); }
+struct enum_surface_mode_params +{ + IDirectDraw7 *ddraw; + const DDSURFACEDESC2 *desc; + LPDDENUMSURFACESCALLBACK7 callback; + void *context; +}; + +static HRESULT CALLBACK enum_surface_mode_callback(DDSURFACEDESC2 *surface_desc, void *context) +{ + const struct enum_surface_mode_params *params = context; + DDSURFACEDESC2 desc = *params->desc; + IDirectDrawSurface7 *surface; + + desc.dwFlags |= DDSD_WIDTH | DDSD_HEIGHT | DDSD_PITCH | DDSD_PIXELFORMAT; + desc.dwWidth = surface_desc->dwWidth; + desc.dwHeight = surface_desc->dwHeight; + desc.u1.lPitch = surface_desc->u1.lPitch; + desc.u4.ddpfPixelFormat = surface_desc->u4.ddpfPixelFormat; + + if (SUCCEEDED(ddraw7_CreateSurface(params->ddraw, &desc, &surface, NULL))) + { + IDirectDrawSurface7_Release(surface); + return params->callback(NULL, &desc, params->context); + } + return DDENUMRET_OK; +} + /***************************************************************************** * IDirectDraw7::EnumSurfaces * @@ -3214,52 +3248,101 @@ static HRESULT CALLBACK EnumSurfacesCallbackThunk(IDirectDrawSurface7 *surface, * *****************************************************************************/ static HRESULT WINAPI ddraw7_EnumSurfaces(IDirectDraw7 *iface, DWORD flags, - DDSURFACEDESC2 *DDSD, void *Context, LPDDENUMSURFACESCALLBACK7 Callback) + DDSURFACEDESC2 *surface_desc, void *context, LPDDENUMSURFACESCALLBACK7 callback) { struct ddraw *ddraw = impl_from_IDirectDraw7(iface); - struct ddraw_surface *surf; - BOOL all, nomatch; - DDSURFACEDESC2 desc; - struct list *entry, *entry2; + HRESULT hr = DD_OK;
TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n", - iface, flags, DDSD, Context, Callback); - - all = flags & DDENUMSURFACES_ALL; - nomatch = !!(flags & DDENUMSURFACES_NOMATCH); + iface, flags, surface_desc, context, callback);
- if (!Callback) + if (!callback) return DDERR_INVALIDPARAMS;
- wined3d_mutex_lock(); - - /* Use the _SAFE enumeration, the app may destroy enumerated surfaces */ - LIST_FOR_EACH_SAFE(entry, entry2, &ddraw->surface_list) + if (flags & DDENUMSURFACES_CANBECREATED) { - surf = LIST_ENTRY(entry, struct ddraw_surface, surface_list_entry); + IDirectDrawSurface7 *surface; + + if ((flags & (DDENUMSURFACES_ALL | DDENUMSURFACES_MATCH | DDENUMSURFACES_NOMATCH)) != DDENUMSURFACES_MATCH) + return DDERR_INVALIDPARAMS;
- if (!surf->iface_count) + wined3d_mutex_lock(); + + if (surface_desc->dwFlags & (DDSD_WIDTH | DDSD_HEIGHT)) { - WARN("Not enumerating surface %p because it doesn't have any references.\n", surf); - continue; + if (SUCCEEDED(ddraw7_CreateSurface(iface, surface_desc, &surface, NULL))) + { + struct ddraw_surface *surface_impl = impl_from_IDirectDrawSurface7(surface); + callback(NULL, &surface_impl->surface_desc, context); + IDirectDrawSurface7_Release(surface); + } } - - if (all || (nomatch != ddraw_match_surface_desc(DDSD, &surf->surface_desc))) + else { - TRACE("Enumerating surface %p.\n", surf); - desc = surf->surface_desc; - IDirectDrawSurface7_AddRef(&surf->IDirectDrawSurface7_iface); - if (Callback(&surf->IDirectDrawSurface7_iface, &desc, Context) != DDENUMRET_OK) + DDSURFACEDESC2 desc = { + .dwSize = sizeof(desc), + .dwFlags = DDSD_PIXELFORMAT, + .u4.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT), + }; + struct enum_surface_mode_params params = + { + .ddraw = iface, + .desc = surface_desc, + .callback = callback, + .context = context, + }; + struct wined3d_display_mode mode; + + if (FAILED(hr = wined3d_output_get_display_mode(ddraw->wined3d_output, &mode, NULL))) + { + ERR("Failed to get display mode, hr %#x.\n", hr); wined3d_mutex_unlock(); - return DD_OK; + return hr_ddraw_from_wined3d(hr); } + + ddrawformat_from_wined3dformat(&desc.u4.ddpfPixelFormat, mode.format_id); + hr = ddraw7_EnumDisplayModes(iface, 0, &desc, ¶ms, enum_surface_mode_callback); } + + wined3d_mutex_unlock(); } + else if (flags & DDENUMSURFACES_DOESEXIST) + { + struct ddraw_surface *surface, *cursor; + BOOL nomatch = !!(flags & DDENUMSURFACES_NOMATCH);
- wined3d_mutex_unlock(); + wined3d_mutex_lock();
- return DD_OK; + /* Use the safe enumeration, as the callback may destroy surfaces. */ + LIST_FOR_EACH_ENTRY_SAFE(surface, cursor, &ddraw->surface_list, struct ddraw_surface, surface_list_entry) + { + if (!surface->iface_count) + { + WARN("Not enumerating surface %p because it doesn't have any references.\n", surface); + continue; + } + + if ((flags & DDENUMSURFACES_ALL) + || nomatch != ddraw_match_surface_desc(surface_desc, &surface->surface_desc)) + { + DDSURFACEDESC2 desc = surface->surface_desc; + + TRACE("Enumerating surface %p.\n", surface); + IDirectDrawSurface7_AddRef(&surface->IDirectDrawSurface7_iface); + if (callback(&surface->IDirectDrawSurface7_iface, &desc, context) != DDENUMRET_OK) + break; + } + } + + wined3d_mutex_unlock(); + } + else + { + return DDERR_INVALIDPARAMS; + } + + return hr; }
static HRESULT WINAPI ddraw4_EnumSurfaces(IDirectDraw4 *iface, DWORD flags, diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 4e620b4a905..fe0042a5f0c 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -12179,11 +12179,11 @@ static void test_enum_surfaces(void) ok(hr == DD_OK, "Failed to set cooperative level, hr %#x.\n", hr);
hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_ALL, NULL, NULL, enum_surfaces_cb); - todo_wine ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_ALL, NULL, NULL, enum_surfaces_cb); - todo_wine ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
memset(&desc, 0, sizeof(desc)); desc.dwSize = sizeof(desc); @@ -12258,15 +12258,15 @@ static void test_enum_surfaces(void)
hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_ALL, &desc, ¶m, enum_surfaces_create_cb); - todo_wine ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr);
hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_NOMATCH, &desc, ¶m, enum_surfaces_create_cb); - todo_wine ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr);
hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED, &desc, ¶m, enum_surfaces_create_cb); - todo_wine ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr);
/* When not passed width and height, the callback is called with every * available display resolution. */ @@ -12282,7 +12282,7 @@ static void test_enum_surfaces(void) hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_MATCH, &desc, ¶m, enum_surfaces_create_cb); ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); - todo_wine ok(param.count == param.modes.count, "Expected %u surfaces, got %u.\n", param.modes.count, param.count); + ok(param.count == param.modes.count, "Expected %u surfaces, got %u.\n", param.modes.count, param.count);
desc.dwFlags |= DDSD_WIDTH | DDSD_HEIGHT; desc.dwWidth = desc.dwHeight = 32; @@ -12293,7 +12293,7 @@ static void test_enum_surfaces(void) hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_MATCH, &desc, ¶m, enum_surfaces_create_cb); ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); - todo_wine ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count); + ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count);
hr = IDirectDraw_CreateSurface(ddraw, &desc, ¶m.surfaces[0], NULL); ok(hr == DD_OK, "Failed to create surface, hr %#x.\n", hr); @@ -12301,7 +12301,7 @@ static void test_enum_surfaces(void) hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_MATCH, &desc, ¶m, enum_surfaces_create_cb); ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); - todo_wine ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count); + ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count); IDirectDrawSurface_Release(param.surfaces[0]);
desc.dwFlags |= DDSD_PIXELFORMAT; diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 3172948d335..87ce9203cca 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -13155,11 +13155,11 @@ static void test_enum_surfaces(void) ok(hr == DD_OK, "Failed to set cooperative level, hr %#x.\n", hr);
hr = IDirectDraw2_EnumSurfaces(ddraw, DDENUMSURFACES_ALL, NULL, NULL, enum_surfaces_cb); - todo_wine ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
hr = IDirectDraw2_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_ALL, NULL, NULL, enum_surfaces_cb); - todo_wine ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
memset(&desc, 0, sizeof(desc)); desc.dwSize = sizeof(desc); @@ -13234,15 +13234,15 @@ static void test_enum_surfaces(void)
hr = IDirectDraw2_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_ALL, &desc, ¶m, enum_surfaces_create_cb); - todo_wine ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr);
hr = IDirectDraw2_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_NOMATCH, &desc, ¶m, enum_surfaces_create_cb); - todo_wine ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr);
hr = IDirectDraw2_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED, &desc, ¶m, enum_surfaces_create_cb); - todo_wine ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr);
/* When not passed width and height, the callback is called with every * available display resolution. */ @@ -13258,7 +13258,7 @@ static void test_enum_surfaces(void) hr = IDirectDraw2_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_MATCH, &desc, ¶m, enum_surfaces_create_cb); ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); - todo_wine ok(param.count == param.modes.count, "Expected %u surfaces, got %u.\n", param.modes.count, param.count); + ok(param.count == param.modes.count, "Expected %u surfaces, got %u.\n", param.modes.count, param.count);
desc.dwFlags |= DDSD_WIDTH | DDSD_HEIGHT; desc.dwWidth = desc.dwHeight = 32; @@ -13269,7 +13269,7 @@ static void test_enum_surfaces(void) hr = IDirectDraw2_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_MATCH, &desc, ¶m, enum_surfaces_create_cb); ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); - todo_wine ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count); + ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count);
hr = IDirectDraw2_CreateSurface(ddraw, &desc, ¶m.surfaces[0], NULL); ok(hr == DD_OK, "Failed to create surface, hr %#x.\n", hr); @@ -13277,7 +13277,7 @@ static void test_enum_surfaces(void) hr = IDirectDraw2_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_MATCH, &desc, ¶m, enum_surfaces_create_cb); ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); - todo_wine ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count); + ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count); IDirectDrawSurface2_Release(param.surfaces[0]);
desc.dwFlags |= DDSD_PIXELFORMAT; diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index fb14f281e20..2a58bf098c8 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -15743,11 +15743,11 @@ static void test_enum_surfaces(void) ok(hr == DD_OK, "Failed to set cooperative level, hr %#x.\n", hr);
hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_ALL, NULL, NULL, enum_surfaces_cb); - todo_wine ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_ALL, NULL, NULL, enum_surfaces_cb); - todo_wine ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
memset(&desc, 0, sizeof(desc)); desc.dwSize = sizeof(desc); @@ -15822,15 +15822,15 @@ static void test_enum_surfaces(void)
hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_ALL, &desc, ¶m, enum_surfaces_create_cb); - todo_wine ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr);
hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_NOMATCH, &desc, ¶m, enum_surfaces_create_cb); - todo_wine ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr);
hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED, &desc, ¶m, enum_surfaces_create_cb); - todo_wine ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr);
/* When not passed width and height, the callback is called with every * available display resolution. */ @@ -15846,7 +15846,7 @@ static void test_enum_surfaces(void) hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_MATCH, &desc, ¶m, enum_surfaces_create_cb); ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); - todo_wine ok(param.count == param.modes.count, "Expected %u surfaces, got %u.\n", param.modes.count, param.count); + ok(param.count == param.modes.count, "Expected %u surfaces, got %u.\n", param.modes.count, param.count);
desc.dwFlags |= DDSD_WIDTH | DDSD_HEIGHT; desc.dwWidth = desc.dwHeight = 32; @@ -15857,7 +15857,7 @@ static void test_enum_surfaces(void) hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_MATCH, &desc, ¶m, enum_surfaces_create_cb); ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); - todo_wine ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count); + ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count);
hr = IDirectDraw4_CreateSurface(ddraw, &desc, ¶m.surfaces[0], NULL); ok(hr == DD_OK, "Failed to create surface, hr %#x.\n", hr); @@ -15865,7 +15865,7 @@ static void test_enum_surfaces(void) hr = IDirectDraw4_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_MATCH, &desc, ¶m, enum_surfaces_create_cb); ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); - todo_wine ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count); + ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count); IDirectDrawSurface4_Release(param.surfaces[0]);
desc.dwFlags |= DDSD_PIXELFORMAT; diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 459869ad869..511af4c6abd 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -15149,11 +15149,11 @@ static void test_enum_surfaces(void) ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_ALL, NULL, NULL, enum_surfaces_cb); - todo_wine ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_ALL, NULL, NULL, enum_surfaces_cb); - todo_wine ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
memset(&desc, 0, sizeof(desc)); desc.dwSize = sizeof(desc); @@ -15232,15 +15232,15 @@ static void test_enum_surfaces(void)
hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_ALL, &desc, ¶m, enum_surfaces_create_cb); - todo_wine ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr);
hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_NOMATCH, &desc, ¶m, enum_surfaces_create_cb); - todo_wine ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr);
hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED, &desc, ¶m, enum_surfaces_create_cb); - todo_wine ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr); + ok(hr == DDERR_INVALIDPARAMS, "Failed to enumerate surfaces, hr %#x.\n", hr);
/* When not passed width and height, the callback is called with every * available display resolution. */ @@ -15256,7 +15256,7 @@ static void test_enum_surfaces(void) hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_MATCH, &desc, ¶m, enum_surfaces_create_cb); ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); - todo_wine ok(param.count == param.modes.count, "Expected %u surfaces, got %u.\n", param.modes.count, param.count); + ok(param.count == param.modes.count, "Expected %u surfaces, got %u.\n", param.modes.count, param.count);
desc.dwFlags |= DDSD_WIDTH | DDSD_HEIGHT; desc.dwWidth = desc.dwHeight = 32; @@ -15267,7 +15267,7 @@ static void test_enum_surfaces(void) hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_MATCH, &desc, ¶m, enum_surfaces_create_cb); ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); - todo_wine ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count); + ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count);
hr = IDirectDraw7_CreateSurface(ddraw, &desc, ¶m.surfaces[0], NULL); ok(hr == DD_OK, "Failed to create surface, hr %#x.\n", hr); @@ -15275,7 +15275,7 @@ static void test_enum_surfaces(void) hr = IDirectDraw7_EnumSurfaces(ddraw, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_MATCH, &desc, ¶m, enum_surfaces_create_cb); ok(hr == DD_OK, "Failed to enumerate surfaces, hr %#x.\n", hr); - todo_wine ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count); + ok(param.count == 1, "Got unexpected number of enumerated surfaces %u.\n", param.count); IDirectDrawSurface7_Release(param.surfaces[0]);
desc.dwFlags |= DDSD_PIXELFORMAT;
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=71054
Your paranoid android.
=== wxppro (32 bit report) ===
ddraw: ddraw1.c:12285: Test failed: Expected 16 surfaces, got 3.
=== w2008s64 (32 bit report) ===
ddraw: ddraw1.c:12285: Test failed: Expected 16 surfaces, got 3.
=== w2008s64 (64 bit report) ===
ddraw: ddraw1.c:12285: Test failed: Expected 16 surfaces, got 3.
=== wxppro (32 bit report) ===
ddraw: ddraw2.c:13261: Test failed: Expected 16 surfaces, got 3.
=== w2008s64 (32 bit report) ===
ddraw: ddraw2.c:13261: Test failed: Expected 16 surfaces, got 3.
=== w2008s64 (64 bit report) ===
ddraw: ddraw2.c:13261: Test failed: Expected 16 surfaces, got 3.
=== wxppro (32 bit report) ===
ddraw: ddraw4.c:15849: Test failed: Expected 16 surfaces, got 3.
=== w2008s64 (32 bit report) ===
ddraw: ddraw4.c:15849: Test failed: Expected 16 surfaces, got 3.
=== w1064v1809_2scr (32 bit report) ===
ddraw: ddraw4.c:2668: Test failed: Expected message 0x46, but didn't receive it. ddraw4.c:2789: Test failed: Failed to set foreground window. ddraw4.c:2797: Test failed: Failed to set foreground window. ddraw4.c:2819: Test failed: Expected window extended style 0x108, got 0x100. ddraw4.c:2822: Test failed: Failed to set foreground window. ddraw4.c:2825: Test failed: Expected window style 0x34cf0000, got 0x14cf0000. ddraw4.c:2828: Test failed: Expected window extended style 0x108, got 0x100. ddraw4.c:3164: Test failed: Failed to set foreground window. ddraw4.c:3165: Test failed: Expected message 0x6, but didn't receive it. ddraw4.c:3172: Test failed: Got unexpected screen size 2560x1600. ddraw4.c:598: Test failed: Got unexpected wparam 0 for message 1c, expected 1. ddraw4.c:3178: Test failed: Expected message 0x5, but didn't receive it. ddraw4.c:3181: Test failed: Expected (0,0)-(1152,864), got (-32000,-32000)-(-31840,-31972). ddraw4.c:3185: Test failed: Got unexpected screen size 1024x768. ddraw4.c:3198: Test failed: Expected message 0x46, but didn't receive it. ddraw4.c:3226: Test failed: Expected message 0x46, but didn't receive it. ddraw4.c:3228: Test failed: Expected screen size 1024x768, got 0x0. ddraw4.c:3234: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,736). ddraw4.c:3264: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,736). ddraw4.c:3271: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,736). ddraw4.c:3297: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,736). ddraw4.c:3320: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,736). ddraw4.c:3342: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,736). ddraw4.c:3368: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,736). ddraw4.c:3388: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,736). ddraw4.c:3424: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,736). ddraw4.c:3434: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,736). ddraw4.c:3460: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,736). ddraw4.c:3483: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,736). ddraw4.c:3505: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,736). ddraw4.c:3531: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,736). ddraw4.c:3551: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,736). ddraw4.c:3588: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,736). ddraw4.c:3614: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,736). ddraw4.c:3684: Test failed: Expected (0,0)-(1152,864), got (-8,-8)-(1160,832). ddraw4.c:3709: Test failed: Expected (0,0)-(1152,864), got (-8,-8)-(1160,832).
=== w2008s64 (64 bit report) ===
ddraw: ddraw4.c:15849: Test failed: Expected 16 surfaces, got 3.
=== wxppro (32 bit report) ===
ddraw: ddraw7.c:15259: Test failed: Expected 16 surfaces, got 3.
=== w2008s64 (32 bit report) ===
ddraw: ddraw7.c:15259: Test failed: Expected 16 surfaces, got 3.
=== w8 (32 bit report) ===
ddraw: ddraw7.c:3169: Test failed: Failed to create surface, hr 0x887601c2. 0e18:ddraw7: unhandled exception c0000005 at 0051FD6C
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=71052
Your paranoid android.
=== wxppro (32 bit report) ===
ddraw: ddraw1.c:12285: Test failed: Expected 16 surfaces, got 3.
=== w2008s64 (32 bit report) ===
ddraw: ddraw1.c:12285: Test failed: Expected 16 surfaces, got 3.
=== w8 (32 bit report) ===
ddraw: ddraw1.c:3234: Test failed: Got unexpected hr 0x887601c2.
=== w2008s64 (64 bit report) ===
ddraw: ddraw1.c:12285: Test failed: Expected 16 surfaces, got 3.
=== wxppro (32 bit report) ===
ddraw: ddraw2.c:13261: Test failed: Expected 16 surfaces, got 3.
=== w2008s64 (32 bit report) ===
ddraw: ddraw2.c:13261: Test failed: Expected 16 surfaces, got 3.
=== w2008s64 (64 bit report) ===
ddraw: ddraw2.c:13261: Test failed: Expected 16 surfaces, got 3.
=== wxppro (32 bit report) ===
ddraw: ddraw4.c:15849: Test failed: Expected 16 surfaces, got 3.
=== w2008s64 (32 bit report) ===
ddraw: ddraw4.c:15849: Test failed: Expected 16 surfaces, got 3.
=== w2008s64 (64 bit report) ===
ddraw: ddraw4.c:15849: Test failed: Expected 16 surfaces, got 3.
=== wxppro (32 bit report) ===
ddraw: ddraw7.c:15259: Test failed: Expected 16 surfaces, got 3.
=== w2008s64 (32 bit report) ===
ddraw: ddraw7.c:15259: Test failed: Expected 16 surfaces, got 3.