Analogous to the d3d8 and d3d9 tests.
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- dlls/ddraw/tests/ddraw1.c | 59 ++++++++++++++++++++++------------------------- dlls/ddraw/tests/ddraw2.c | 59 ++++++++++++++++++++++------------------------- dlls/ddraw/tests/ddraw4.c | 51 ++++++++++++++++++++++------------------ dlls/ddraw/tests/ddraw7.c | 55 +++++++++++++++++++++++-------------------- 4 files changed, 114 insertions(+), 110 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 109910b8205..db54abd4165 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -82,58 +82,45 @@ static BOOL compare_vec4(const struct vec4 *vec, float x, float y, float z, floa && compare_float(vec->w, w, ulps); }
-static BOOL ddraw_is_warp(IDirectDraw *ddraw) +static BOOL ddraw_get_identifier(IDirectDraw *ddraw, DDDEVICEIDENTIFIER *identifier) { IDirectDraw4 *ddraw4; - DDDEVICEIDENTIFIER identifier; HRESULT hr;
- if (!strcmp(winetest_platform, "wine")) - return FALSE; - hr = IDirectDraw_QueryInterface(ddraw, &IID_IDirectDraw4, (void **)&ddraw4); ok(SUCCEEDED(hr), "Failed to get IDirectDraw4 interface, hr %#x.\n", hr); - hr = IDirectDraw4_GetDeviceIdentifier(ddraw4, &identifier, 0); + hr = IDirectDraw4_GetDeviceIdentifier(ddraw4, identifier, 0); ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); IDirectDraw4_Release(ddraw4);
- return !!strstr(identifier.szDriver, "warp"); + return SUCCEEDED(hr); }
-static BOOL ddraw_is_nvidia(IDirectDraw *ddraw) +static BOOL ddraw_is_warp(IDirectDraw *ddraw) { - IDirectDraw4 *ddraw4; DDDEVICEIDENTIFIER identifier; - HRESULT hr;
- if (!strcmp(winetest_platform, "wine")) - return FALSE; + return strcmp(winetest_platform, "wine") + && ddraw_get_identifier(ddraw, &identifier) + && strstr(identifier.szDriver, "warp"); +}
- hr = IDirectDraw_QueryInterface(ddraw, &IID_IDirectDraw4, (void **)&ddraw4); - ok(SUCCEEDED(hr), "Failed to get IDirectDraw4 interface, hr %#x.\n", hr); - hr = IDirectDraw4_GetDeviceIdentifier(ddraw4, &identifier, 0); - ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); - IDirectDraw4_Release(ddraw4); +static BOOL ddraw_is_nvidia(IDirectDraw *ddraw) +{ + DDDEVICEIDENTIFIER identifier;
- return identifier.dwVendorId == 0x10de; + return strcmp(winetest_platform, "wine") + && ddraw_get_identifier(ddraw, &identifier) + && identifier.dwVendorId == 0x10de; }
static BOOL ddraw_is_intel(IDirectDraw *ddraw) { - IDirectDraw4 *ddraw4; DDDEVICEIDENTIFIER identifier; - HRESULT hr;
- if (!strcmp(winetest_platform, "wine")) - return FALSE; - - hr = IDirectDraw_QueryInterface(ddraw, &IID_IDirectDraw4, (void **)&ddraw4); - ok(SUCCEEDED(hr), "Failed to get IDirectDraw4 interface, hr %#x.\n", hr); - hr = IDirectDraw4_GetDeviceIdentifier(ddraw4, &identifier, 0); - ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); - IDirectDraw4_Release(ddraw4); - - return identifier.dwVendorId == 0x8086; + return strcmp(winetest_platform, "wine") + && ddraw_get_identifier(ddraw, &identifier) + && identifier.dwVendorId == 0x8086; }
static IDirectDrawSurface *create_overlay(IDirectDraw *ddraw, @@ -10784,8 +10771,9 @@ done:
START_TEST(ddraw1) { - IDirectDraw *ddraw; + DDDEVICEIDENTIFIER identifier; DEVMODEW current_mode; + IDirectDraw *ddraw; HMODULE dwmapi;
if (!(ddraw = create_ddraw())) @@ -10793,6 +10781,15 @@ START_TEST(ddraw1) skip("Failed to create a ddraw object, skipping tests.\n"); return; } + + if (ddraw_get_identifier(ddraw, &identifier)) + { + trace("Driver string: "%s"\n", identifier.szDriver); + trace("Description string: "%s"\n", identifier.szDescription); + trace("Driver version %d.%d.%d.%d\n", + HIWORD(U(identifier.liDriverVersion).HighPart), LOWORD(U(identifier.liDriverVersion).HighPart), + HIWORD(U(identifier.liDriverVersion).LowPart), LOWORD(U(identifier.liDriverVersion).LowPart)); + } IDirectDraw_Release(ddraw);
memset(¤t_mode, 0, sizeof(current_mode)); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 1db7ad9329f..d2382d153be 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -84,58 +84,45 @@ static BOOL compare_vec4(const struct vec4 *vec, float x, float y, float z, floa && compare_float(vec->w, w, ulps); }
-static BOOL ddraw_is_warp(IDirectDraw2 *ddraw) +static BOOL ddraw_get_identifier(IDirectDraw2 *ddraw, DDDEVICEIDENTIFIER *identifier) { IDirectDraw4 *ddraw4; - DDDEVICEIDENTIFIER identifier; HRESULT hr;
- if (!strcmp(winetest_platform, "wine")) - return FALSE; - hr = IDirectDraw2_QueryInterface(ddraw, &IID_IDirectDraw4, (void **)&ddraw4); ok(SUCCEEDED(hr), "Failed to get IDirectDraw4 interface, hr %#x.\n", hr); - hr = IDirectDraw4_GetDeviceIdentifier(ddraw4, &identifier, 0); + hr = IDirectDraw4_GetDeviceIdentifier(ddraw4, identifier, 0); ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); IDirectDraw4_Release(ddraw4);
- return !!strstr(identifier.szDriver, "warp"); + return SUCCEEDED(hr); }
-static BOOL ddraw_is_nvidia(IDirectDraw2 *ddraw) +static BOOL ddraw_is_warp(IDirectDraw2 *ddraw) { - IDirectDraw4 *ddraw4; DDDEVICEIDENTIFIER identifier; - HRESULT hr;
- if (!strcmp(winetest_platform, "wine")) - return FALSE; + return strcmp(winetest_platform, "wine") + && ddraw_get_identifier(ddraw, &identifier) + && strstr(identifier.szDriver, "warp"); +}
- hr = IDirectDraw2_QueryInterface(ddraw, &IID_IDirectDraw4, (void **)&ddraw4); - ok(SUCCEEDED(hr), "Failed to get IDirectDraw4 interface, hr %#x.\n", hr); - hr = IDirectDraw4_GetDeviceIdentifier(ddraw4, &identifier, 0); - ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); - IDirectDraw4_Release(ddraw4); +static BOOL ddraw_is_nvidia(IDirectDraw2 *ddraw) +{ + DDDEVICEIDENTIFIER identifier;
- return identifier.dwVendorId == 0x10de; + return strcmp(winetest_platform, "wine") + && ddraw_get_identifier(ddraw, &identifier) + && identifier.dwVendorId == 0x10de; }
static BOOL ddraw_is_intel(IDirectDraw2 *ddraw) { - IDirectDraw4 *ddraw4; DDDEVICEIDENTIFIER identifier; - HRESULT hr;
- if (!strcmp(winetest_platform, "wine")) - return FALSE; - - hr = IDirectDraw2_QueryInterface(ddraw, &IID_IDirectDraw4, (void **)&ddraw4); - ok(SUCCEEDED(hr), "Failed to get IDirectDraw4 interface, hr %#x.\n", hr); - hr = IDirectDraw4_GetDeviceIdentifier(ddraw4, &identifier, 0); - ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); - IDirectDraw4_Release(ddraw4); - - return identifier.dwVendorId == 0x8086; + return strcmp(winetest_platform, "wine") + && ddraw_get_identifier(ddraw, &identifier) + && identifier.dwVendorId == 0x8086; }
static IDirectDrawSurface *create_overlay(IDirectDraw2 *ddraw, @@ -12160,8 +12147,9 @@ done:
START_TEST(ddraw2) { - IDirectDraw2 *ddraw; + DDDEVICEIDENTIFIER identifier; DEVMODEW current_mode; + IDirectDraw2 *ddraw; HMODULE dwmapi;
if (!(ddraw = create_ddraw())) @@ -12169,6 +12157,15 @@ START_TEST(ddraw2) skip("Failed to create a ddraw object, skipping tests.\n"); return; } + + if (ddraw_get_identifier(ddraw, &identifier)) + { + trace("Driver string: "%s"\n", identifier.szDriver); + trace("Description string: "%s"\n", identifier.szDescription); + trace("Driver version %d.%d.%d.%d\n", + HIWORD(U(identifier.liDriverVersion).HighPart), LOWORD(U(identifier.liDriverVersion).HighPart), + HIWORD(U(identifier.liDriverVersion).LowPart), LOWORD(U(identifier.liDriverVersion).LowPart)); + } IDirectDraw2_Release(ddraw);
memset(¤t_mode, 0, sizeof(current_mode)); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 98c86d0bf01..caa3ced1728 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -94,46 +94,41 @@ static BOOL compare_color(D3DCOLOR c1, D3DCOLOR c2, BYTE max_diff) return TRUE; }
-static BOOL ddraw_is_warp(IDirectDraw4 *ddraw) +static BOOL ddraw_get_identifier(IDirectDraw4 *ddraw, DDDEVICEIDENTIFIER *identifier) { - DDDEVICEIDENTIFIER identifier; HRESULT hr;
- if (!strcmp(winetest_platform, "wine")) - return FALSE; - - hr = IDirectDraw4_GetDeviceIdentifier(ddraw, &identifier, 0); + hr = IDirectDraw4_GetDeviceIdentifier(ddraw, identifier, 0); ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr);
- return !!strstr(identifier.szDriver, "warp"); + return SUCCEEDED(hr); }
-static BOOL ddraw_is_nvidia(IDirectDraw4 *ddraw) +static BOOL ddraw_is_warp(IDirectDraw4 *ddraw) { DDDEVICEIDENTIFIER identifier; - HRESULT hr;
- if (!strcmp(winetest_platform, "wine")) - return FALSE; + return strcmp(winetest_platform, "wine") + && ddraw_get_identifier(ddraw, &identifier) + && strstr(identifier.szDriver, "warp"); +}
- hr = IDirectDraw4_GetDeviceIdentifier(ddraw, &identifier, 0); - ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); +static BOOL ddraw_is_nvidia(IDirectDraw4 *ddraw) +{ + DDDEVICEIDENTIFIER identifier;
- return identifier.dwVendorId == 0x10de; + return strcmp(winetest_platform, "wine") + && ddraw_get_identifier(ddraw, &identifier) + && identifier.dwVendorId == 0x10de; }
static BOOL ddraw_is_intel(IDirectDraw4 *ddraw) { DDDEVICEIDENTIFIER identifier; - HRESULT hr; - - if (!strcmp(winetest_platform, "wine")) - return FALSE; - - hr = IDirectDraw4_GetDeviceIdentifier(ddraw, &identifier, 0); - ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr);
- return identifier.dwVendorId == 0x8086; + return strcmp(winetest_platform, "wine") + && ddraw_get_identifier(ddraw, &identifier) + && identifier.dwVendorId == 0x8086; }
static IDirectDrawSurface4 *create_overlay(IDirectDraw4 *ddraw, @@ -14008,8 +14003,9 @@ static void test_compute_sphere_visibility(void)
START_TEST(ddraw4) { - IDirectDraw4 *ddraw; + DDDEVICEIDENTIFIER identifier; DEVMODEW current_mode; + IDirectDraw4 *ddraw; HMODULE dwmapi;
if (!(ddraw = create_ddraw())) @@ -14017,6 +14013,15 @@ START_TEST(ddraw4) skip("Failed to create a ddraw object, skipping tests.\n"); return; } + + if (ddraw_get_identifier(ddraw, &identifier)) + { + trace("Driver string: "%s"\n", identifier.szDriver); + trace("Description string: "%s"\n", identifier.szDescription); + trace("Driver version %d.%d.%d.%d\n", + HIWORD(U(identifier.liDriverVersion).HighPart), LOWORD(U(identifier.liDriverVersion).HighPart), + HIWORD(U(identifier.liDriverVersion).LowPart), LOWORD(U(identifier.liDriverVersion).LowPart)); + } IDirectDraw4_Release(ddraw);
memset(¤t_mode, 0, sizeof(current_mode)); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 7c6264bd557..f1568bb9d07 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -108,46 +108,41 @@ static ULONG get_refcount(IUnknown *iface) return IUnknown_Release(iface); }
-static BOOL ddraw_is_warp(IDirectDraw7 *ddraw) +static BOOL ddraw_get_identifier(IDirectDraw7 *ddraw, DDDEVICEIDENTIFIER2 *identifier) { - DDDEVICEIDENTIFIER2 identifier; HRESULT hr;
- if (!strcmp(winetest_platform, "wine")) - return FALSE; - - hr = IDirectDraw7_GetDeviceIdentifier(ddraw, &identifier, 0); + hr = IDirectDraw7_GetDeviceIdentifier(ddraw, identifier, 0); ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr);
- return !!strstr(identifier.szDriver, "warp"); + return SUCCEEDED(hr); }
-static BOOL ddraw_is_nvidia(IDirectDraw7 *ddraw) +static BOOL ddraw_is_warp(IDirectDraw7 *ddraw) { DDDEVICEIDENTIFIER2 identifier; - HRESULT hr;
- if (!strcmp(winetest_platform, "wine")) - return FALSE; + return strcmp(winetest_platform, "wine") + && ddraw_get_identifier(ddraw, &identifier) + && strstr(identifier.szDriver, "warp"); +}
- hr = IDirectDraw7_GetDeviceIdentifier(ddraw, &identifier, 0); - ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); +static BOOL ddraw_is_nvidia(IDirectDraw7 *ddraw) +{ + DDDEVICEIDENTIFIER2 identifier;
- return identifier.dwVendorId == 0x10de; + return strcmp(winetest_platform, "wine") + && ddraw_get_identifier(ddraw, &identifier) + && identifier.dwVendorId == 0x10de; }
static BOOL ddraw_is_intel(IDirectDraw7 *ddraw) { DDDEVICEIDENTIFIER2 identifier; - HRESULT hr; - - if (!strcmp(winetest_platform, "wine")) - return FALSE; - - hr = IDirectDraw7_GetDeviceIdentifier(ddraw, &identifier, 0); - ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr);
- return identifier.dwVendorId == 0x8086; + return strcmp(winetest_platform, "wine") + && ddraw_get_identifier(ddraw, &identifier) + && identifier.dwVendorId == 0x8086; }
static IDirectDrawSurface7 *create_overlay(IDirectDraw7 *ddraw, @@ -13384,11 +13379,12 @@ static void test_clip_planes_limits(void)
START_TEST(ddraw7) { - HMODULE module = GetModuleHandleA("ddraw.dll"); - HMODULE dwmapi; - IDirectDraw7 *ddraw; + DDDEVICEIDENTIFIER2 identifier; + HMODULE module, dwmapi; DEVMODEW current_mode; + IDirectDraw7 *ddraw;
+ module = GetModuleHandleA("ddraw.dll"); if (!(pDirectDrawCreateEx = (void *)GetProcAddress(module, "DirectDrawCreateEx"))) { win_skip("DirectDrawCreateEx not available, skipping tests.\n"); @@ -13400,6 +13396,15 @@ START_TEST(ddraw7) skip("Failed to create a ddraw object, skipping tests.\n"); return; } + + if (ddraw_get_identifier(ddraw, &identifier)) + { + trace("Driver string: "%s"\n", identifier.szDriver); + trace("Description string: "%s"\n", identifier.szDescription); + trace("Driver version %d.%d.%d.%d\n", + HIWORD(U(identifier.liDriverVersion).HighPart), LOWORD(U(identifier.liDriverVersion).HighPart), + HIWORD(U(identifier.liDriverVersion).LowPart), LOWORD(U(identifier.liDriverVersion).LowPart)); + } IDirectDraw7_Release(ddraw);
memset(¤t_mode, 0, sizeof(current_mode));