From 0bdae1a0b8ba87cf46f72a82fa96be4807f555b4 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Fri, 11 Mar 2016 16:01:39 +0100 Subject: [PATCH] ddraw/tests: Skip initialising "quad" and "indices" in test_specular_lighting() if a 3D device can't be created. This also happens to avoid leaking them in that case. Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/ddraw/tests/ddraw2.c | 22 +++++++++++----------- dlls/ddraw/tests/ddraw4.c | 18 +++++++++--------- dlls/ddraw/tests/ddraw7.c | 18 +++++++++--------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 75bdc84951f..b26478df6c2 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -6959,6 +6959,17 @@ static void test_specular_lighting(void) D3DVERTEX *quad; WORD *indices; + window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, 0, 0, 0, 0); + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + { + skip("Failed to create a 3D device, skipping test.\n"); + DestroyWindow(window); + return; + } + quad = HeapAlloc(GetProcessHeap(), 0, vertices_side * vertices_side * sizeof(*quad)); indices = HeapAlloc(GetProcessHeap(), 0, indices_count * sizeof(*indices)); for (i = 0, y = 0; y < vertices_side; ++y) @@ -6988,17 +6999,6 @@ static void test_specular_lighting(void) } } - window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, - 0, 0, 640, 480, 0, 0, 0, 0); - ddraw = create_ddraw(); - ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) - { - skip("Failed to create a 3D device, skipping test.\n"); - DestroyWindow(window); - return; - } - hr = IDirect3DDevice2_GetDirect3D(device, &d3d); ok(SUCCEEDED(hr), "Failed to get D3D interface, hr %#x.\n", hr); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index a092787a968..8ff08cb2662 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -4230,6 +4230,15 @@ static void test_specular_lighting(void) } *quad; WORD *indices; + window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, 0, 0, 0, 0); + if (!(device = create_device(window, DDSCL_NORMAL))) + { + skip("Failed to create a 3D device, skipping test.\n"); + DestroyWindow(window); + return; + } + quad = HeapAlloc(GetProcessHeap(), 0, vertices_side * vertices_side * sizeof(*quad)); indices = HeapAlloc(GetProcessHeap(), 0, indices_count * sizeof(*indices)); for (i = 0, y = 0; y < vertices_side; ++y) @@ -4257,15 +4266,6 @@ static void test_specular_lighting(void) } } - window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, - 0, 0, 640, 480, 0, 0, 0, 0); - if (!(device = create_device(window, DDSCL_NORMAL))) - { - skip("Failed to create a 3D device, skipping test.\n"); - DestroyWindow(window); - return; - } - hr = IDirect3DDevice3_GetDirect3D(device, &d3d); ok(SUCCEEDED(hr), "Failed to get D3D interface, hr %#x.\n", hr); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index d7589a8f924..306e6d31880 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -3941,6 +3941,15 @@ static void test_specular_lighting(void) } *quad; WORD *indices; + window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, 0, 0, 0, 0); + if (!(device = create_device(window, DDSCL_NORMAL))) + { + skip("Failed to create a 3D device, skipping test.\n"); + DestroyWindow(window); + return; + } + quad = HeapAlloc(GetProcessHeap(), 0, vertices_side * vertices_side * sizeof(*quad)); indices = HeapAlloc(GetProcessHeap(), 0, indices_count * sizeof(*indices)); for (i = 0, y = 0; y < vertices_side; ++y) @@ -3968,15 +3977,6 @@ static void test_specular_lighting(void) } } - window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, - 0, 0, 640, 480, 0, 0, 0, 0); - if (!(device = create_device(window, DDSCL_NORMAL))) - { - skip("Failed to create a 3D device, skipping test.\n"); - DestroyWindow(window); - return; - } - hr = IDirect3DDevice7_GetRenderTarget(device, &rt); ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);