Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/ddraw/tests/ddraw1.c | 14 +++++++++----- dlls/ddraw/tests/ddraw2.c | 16 ++++++++++------ dlls/ddraw/tests/ddraw4.c | 16 ++++++++++------ dlls/ddraw/tests/ddraw7.c | 28 ++++++++++++++++++---------- 4 files changed, 47 insertions(+), 27 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 86aa68d218..1b38c4a05f 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -3884,9 +3884,8 @@ static void test_unsupported_formats(void) DestroyWindow(window); }
-static void test_rt_caps(void) +static void test_rt_caps_riid(REFCLSID riid, const char *device_name) { - const char *device_name = "HAL"; PALETTEENTRY palette_entries[256]; IDirectDrawPalette *palette; IDirect3DDevice *device; @@ -4058,7 +4057,7 @@ static void test_rt_caps(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_riid(ddraw, window, DDSCL_NORMAL, riid))) { skip("Failed to create a (%s) 3D device, skipping test.\n", device_name); IDirectDraw_Release(ddraw); @@ -4110,14 +4109,14 @@ static void test_rt_caps(void) "Test %s %u: Got unexpected caps %#x, expected %#x.\n", device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
- hr = IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DHALDevice, (void **)&device); + hr = IDirectDrawSurface_QueryInterface(surface, riid, (void **)&device); ok(hr == test_data[i].create_device_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n", device_name, i, hr, test_data[i].create_device_hr); if (hr == DDERR_NOPALETTEATTACHED) { hr = IDirectDrawSurface_SetPalette(surface, palette); ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr); - hr = IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DHALDevice, (void **)&device); + hr = IDirectDrawSurface_QueryInterface(surface, riid, (void **)&device); if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr); else @@ -4140,6 +4139,11 @@ static void test_rt_caps(void) DestroyWindow(window); }
+static void test_rt_caps(void) +{ + test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL"); +} + static void test_primary_caps(void) { const DWORD placement = DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY; diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 71f1413b14..a8c14fbcad 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -4306,9 +4306,8 @@ static void test_unsupported_formats(void) DestroyWindow(window); }
-static void test_rt_caps(void) +static void test_rt_caps_riid(REFCLSID riid, const char *device_name) { - const char *device_name = "HAL"; PALETTEENTRY palette_entries[256]; IDirectDrawPalette *palette; IDirect3DDevice2 *device; @@ -4523,7 +4522,7 @@ static void test_rt_caps(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_riid(ddraw, window, DDSCL_NORMAL, riid))) { skip("Failed to create a (%s) 3D device, skipping test.\n", device_name); IDirectDraw2_Release(ddraw); @@ -4581,7 +4580,7 @@ static void test_rt_caps(void) "Test %s %u: Got unexpected caps %#x, expected %#x.\n", device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
- hr = IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device); + hr = IDirect3D2_CreateDevice(d3d, riid, surface, &device); ok(hr == test_data[i].create_device_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n", device_name, i, hr, test_data[i].create_device_hr); if (FAILED(hr)) @@ -4590,7 +4589,7 @@ static void test_rt_caps(void) { hr = IDirectDrawSurface_SetPalette(surface, palette); ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr); - hr = IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device); + hr = IDirect3D2_CreateDevice(d3d, riid, surface, &device); if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr); else @@ -4607,7 +4606,7 @@ static void test_rt_caps(void) hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface, NULL); ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface, hr %#x.\n", device_name, i, hr);
- hr = IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device); + hr = IDirect3D2_CreateDevice(d3d, riid, surface, &device); ok(SUCCEEDED(hr), "Test %s %u: Failed to create device, hr %#x.\n", device_name, i, hr); }
@@ -4671,6 +4670,11 @@ done: DestroyWindow(window); }
+static void test_rt_caps(void) +{ + test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL"); +} + static void test_primary_caps(void) { const DWORD placement = DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY; diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index e3299ee643..392ce1093c 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -5923,9 +5923,8 @@ static void test_unsupported_formats(void) DestroyWindow(window); }
-static void test_rt_caps(void) +static void test_rt_caps_riid(REFCLSID riid, const char *device_name) { - const char *device_name = "HAL"; PALETTEENTRY palette_entries[256]; IDirectDrawPalette *palette; IDirectDraw4 *ddraw; @@ -6127,7 +6126,7 @@ static void test_rt_caps(void) }
memset(&z_fmt, 0, sizeof(z_fmt)); - hr = IDirect3D3_EnumZBufferFormats(d3d, &IID_IDirect3DHALDevice, enum_z_fmt, &z_fmt); + hr = IDirect3D3_EnumZBufferFormats(d3d, riid, enum_z_fmt, &z_fmt); if (FAILED(hr) || !z_fmt.dwSize) { skip("No depth buffer formats available, skipping test.\n"); @@ -6168,7 +6167,7 @@ static void test_rt_caps(void) "Test %s %u: Got unexpected caps %#x, expected %#x.\n", device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
- hr = IDirect3D3_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device, NULL); + hr = IDirect3D3_CreateDevice(d3d, riid, surface, &device, NULL); ok(hr == test_data[i].create_device_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n", device_name, i, hr, test_data[i].create_device_hr); if (FAILED(hr)) @@ -6177,7 +6176,7 @@ static void test_rt_caps(void) { hr = IDirectDrawSurface4_SetPalette(surface, palette); ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr); - hr = IDirect3D3_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device, NULL); + hr = IDirect3D3_CreateDevice(d3d, riid, surface, &device, NULL); if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr); else @@ -6194,7 +6193,7 @@ static void test_rt_caps(void) hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL); ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface, hr %#x.\n", device_name, i, hr);
- hr = IDirect3D3_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device, NULL); + hr = IDirect3D3_CreateDevice(d3d, riid, surface, &device, NULL); ok(SUCCEEDED(hr), "Test %s %u: Failed to create device, hr %#x.\n", device_name, i, hr); }
@@ -6245,6 +6244,11 @@ done: DestroyWindow(window); }
+static void test_rt_caps(void) +{ + test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL"); +} + static void test_primary_caps(void) { const DWORD placement = DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY; diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 2fcc54283f..ca14be85cb 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -5662,14 +5662,12 @@ static void test_unsupported_formats(void) DestroyWindow(window); }
-static void test_rt_caps(void) +static void test_rt_caps_riid(REFCLSID riid, const char *device_name) { - const char *device_name = "HAL"; - const GUID *devtype = &IID_IDirect3DHALDevice; PALETTEENTRY palette_entries[256]; IDirectDrawPalette *palette; IDirectDraw7 *ddraw; - struct { REFCLSID riid; BOOL present; } device_data = { &IID_IDirect3DTnLHalDevice }; + struct { REFCLSID riid; BOOL present; } device_data = { riid }; DDPIXELFORMAT z_fmt; IDirect3D7 *d3d; unsigned int i; @@ -5869,11 +5867,15 @@ static void test_rt_caps(void)
hr = IDirect3D7_EnumDevices(d3d, enum_devtype_cb, &device_data); ok(SUCCEEDED(hr), "Failed to enumerate devices, hr %#x.\n", hr); - if (device_data.present) - devtype = device_data.riid; + if (!device_data.present) + { + skip("Failed to enumerate %s device, skipping test.\n", device_name); + IDirect3D7_Release(d3d); + goto done; + }
memset(&z_fmt, 0, sizeof(z_fmt)); - hr = IDirect3D7_EnumZBufferFormats(d3d, devtype, enum_z_fmt, &z_fmt); + hr = IDirect3D7_EnumZBufferFormats(d3d, riid, enum_z_fmt, &z_fmt); if (FAILED(hr) || !z_fmt.dwSize) { skip("No depth buffer formats available, skipping test.\n"); @@ -5914,7 +5916,7 @@ static void test_rt_caps(void) "Test %s %u: Got unexpected caps %#x, expected %#x.\n", device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
- hr = IDirect3D7_CreateDevice(d3d, devtype, surface, &device); + hr = IDirect3D7_CreateDevice(d3d, riid, surface, &device); ok(hr == test_data[i].create_device_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n", device_name, i, hr, test_data[i].create_device_hr); if (FAILED(hr)) @@ -5923,7 +5925,7 @@ static void test_rt_caps(void) { hr = IDirectDrawSurface7_SetPalette(surface, palette); ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr); - hr = IDirect3D7_CreateDevice(d3d, devtype, surface, &device); + hr = IDirect3D7_CreateDevice(d3d, riid, surface, &device); if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr); else @@ -5940,7 +5942,7 @@ static void test_rt_caps(void) hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL); ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface, hr %#x.\n", device_name, i, hr);
- hr = IDirect3D7_CreateDevice(d3d, devtype, surface, &device); + hr = IDirect3D7_CreateDevice(d3d, riid, surface, &device); ok(SUCCEEDED(hr), "Test %s %u: Failed to create device, hr %#x.\n", device_name, i, hr); }
@@ -5991,6 +5993,12 @@ done: DestroyWindow(window); }
+static void test_rt_caps(void) +{ + test_rt_caps_riid(&IID_IDirect3DTnLHalDevice, "TnLHal"); + test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL"); +} + static void test_primary_caps(void) { const DWORD placement = DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY;