Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/evr/tests/evr.c | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-)
diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c index fb4a2130f37..3cf14143f8e 100644 --- a/dlls/evr/tests/evr.c +++ b/dlls/evr/tests/evr.c @@ -49,10 +49,14 @@ static HWND create_window(void) 0, 0, r.right - r.left, r.bottom - r.top, NULL, NULL, NULL, NULL); }
-static IDirect3DDevice9 *create_device(IDirect3D9 *d3d9, HWND focus_window) +static IDirect3DDevice9 *create_device(HWND focus_window) { D3DPRESENT_PARAMETERS present_parameters = {0}; IDirect3DDevice9 *device = NULL; + IDirect3D9 *d3d9; + + d3d9 = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d9, "Failed to create a D3D object.\n");
present_parameters.BackBufferWidth = 640; present_parameters.BackBufferHeight = 480; @@ -66,6 +70,8 @@ static IDirect3DDevice9 *create_device(IDirect3D9 *d3d9, HWND focus_window) IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, focus_window, D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device);
+ IDirect3D9_Release(d3d9); + return device; }
@@ -718,16 +724,13 @@ static void test_surface_sample(void) DWORD flags, count, length; IDirect3DDevice9 *device; IMFSample *sample; - IDirect3D9 *d3d; IUnknown *unk; HWND window; HRESULT hr; BYTE *data;
window = create_window(); - d3d = Direct3DCreate9(D3D_SDK_VERSION); - ok(!!d3d, "Failed to create a D3D object.\n"); - if (!(device = create_device(d3d, window))) + if (!(device = create_device(window))) { skip("Failed to create a D3D device, skipping tests.\n"); goto done; @@ -929,7 +932,6 @@ static void test_surface_sample(void) done: if (backbuffer) IDirect3DSurface9_Release(backbuffer); - IDirect3D9_Release(d3d); DestroyWindow(window); }
@@ -944,7 +946,6 @@ static void test_default_mixer_type_negotiation(void) IMFTransform *transform; DWORD index, count; GUID guid, *guids; - IDirect3D9 *d3d; IUnknown *unk; HWND window; HRESULT hr; @@ -980,9 +981,7 @@ static void test_default_mixer_type_negotiation(void) /* Now try with device manager. */
window = create_window(); - d3d = Direct3DCreate9(D3D_SDK_VERSION); - ok(!!d3d, "Failed to create a D3D object.\n"); - if (!(device = create_device(d3d, window))) + if (!(device = create_device(window))) { skip("Failed to create a D3D device, skipping tests.\n"); goto done; @@ -1117,7 +1116,6 @@ todo_wine
done: IMFTransform_Release(transform); - IDirect3D9_Release(d3d); DestroyWindow(window); }
@@ -1340,7 +1338,6 @@ static void test_MFCreateVideoSampleAllocator(void) LONG refcount, count; unsigned int token; IMFGetService *gs; - IDirect3D9 *d3d; IUnknown *unk; HWND window; HRESULT hr; @@ -1455,9 +1452,7 @@ static void test_MFCreateVideoSampleAllocator(void)
/* Using device manager */ window = create_window(); - d3d = Direct3DCreate9(D3D_SDK_VERSION); - ok(!!d3d, "Failed to create a D3D object.\n"); - if (!(device = create_device(d3d, window))) + if (!(device = create_device(window))) { skip("Failed to create a D3D device, skipping tests.\n"); goto done; @@ -1506,7 +1501,6 @@ static void test_MFCreateVideoSampleAllocator(void) IDirect3DDeviceManager9_Release(manager); IDirect3DDevice9_Release(device); done: - IDirect3D9_Release(d3d); DestroyWindow(window); }
@@ -2101,7 +2095,6 @@ static void test_presenter_media_type(void) IDirect3DDeviceManager9 *manager; HRESULT hr; IMFTransform *mixer; - IDirect3D9 *d3d; IDirect3DDevice9 *device; unsigned int token; SIZE frame_size; @@ -2111,9 +2104,7 @@ static void test_presenter_media_type(void) RECT dst;
window = create_window(); - d3d = Direct3DCreate9(D3D_SDK_VERSION); - ok(!!d3d, "Failed to create a D3D object.\n"); - if (!(device = create_device(d3d, window))) + if (!(device = create_device(window))) { skip("Failed to create a D3D device, skipping tests.\n"); goto done; @@ -2195,7 +2186,6 @@ todo_wine { IMFTransform_Release(mixer);
done: - IDirect3D9_Release(d3d); DestroyWindow(window); }
@@ -2438,16 +2428,13 @@ static void test_mixer_samples(void) DWORD count, flags, color, status; IMFTransform *mixer; IMFSample *sample, *sample2; - IDirect3D9 *d3d; HWND window; UINT token; HRESULT hr; LONGLONG pts, duration;
window = create_window(); - d3d = Direct3DCreate9(D3D_SDK_VERSION); - ok(!!d3d, "Failed to create a D3D object.\n"); - if (!(device = create_device(d3d, window))) + if (!(device = create_device(window))) { skip("Failed to create a D3D device, skipping tests.\n"); goto done; @@ -2677,7 +2664,6 @@ static void test_mixer_samples(void) IDirect3DDeviceManager9_Release(manager);
done: - IDirect3D9_Release(d3d); DestroyWindow(window); }