[PATCH 1/5] ddraw/tests: Add tests for clippers with a destroyed window.
Henri Verbeet
hverbeet at codeweavers.com
Mon Jan 9 15:16:48 CST 2012
---
dlls/ddraw/clipper.c | 5 +++--
dlls/ddraw/tests/ddraw1.c | 12 ++++++++++++
dlls/ddraw/tests/ddraw2.c | 12 ++++++++++++
dlls/ddraw/tests/ddraw4.c | 12 ++++++++++++
dlls/ddraw/tests/ddraw7.c | 12 ++++++++++++
5 files changed, 51 insertions(+), 2 deletions(-)
diff --git a/dlls/ddraw/clipper.c b/dlls/ddraw/clipper.c
index fb5c022..6e40bab 100644
--- a/dlls/ddraw/clipper.c
+++ b/dlls/ddraw/clipper.c
@@ -104,7 +104,8 @@ static HRGN get_window_region(HWND window)
if (!GetClientRect(window, &client_rect))
{
- ERR("Failed to get client rect.\n");
+ /* This can happen if the window is destroyed, for example. */
+ WARN("Failed to get client rect.\n");
return NULL;
}
@@ -157,7 +158,7 @@ static HRESULT WINAPI ddraw_clipper_GetClipList(IDirectDrawClipper *iface, RECT
if (!(region = get_window_region(clipper->window)))
{
wined3d_mutex_unlock();
- ERR("Failed to get window region.\n");
+ WARN("Failed to get window region.\n");
return E_FAIL;
}
}
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index 09d632a..6612c4d 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -328,6 +328,18 @@ static void test_clipper_blt(void)
hr = IDirectDrawSurface_BltFast(dst_surface, 0, 0, src_surface, NULL, DDBLTFAST_WAIT);
ok(hr == DDERR_BLTFASTCANTCLIP || broken(hr == E_NOTIMPL /* NT4 */), "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawClipper_SetHWnd(clipper, 0, window);
+ ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#x.\n", hr);
+ hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
+ ok(SUCCEEDED(hr), "Failed to get clip list size, hr %#x.\n", hr);
+ DestroyWindow(window);
+ hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
+ ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawClipper_SetHWnd(clipper, 0, NULL);
+ ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#x.\n", hr);
+ hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
+ ok(SUCCEEDED(hr), "Failed to get clip list size, hr %#x.\n", hr);
+
IDirectDrawSurface_Release(dst_surface);
IDirectDrawSurface_Release(src_surface);
IDirectDrawClipper_Release(clipper);
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index 7ffa977..4d9bf98 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -335,6 +335,18 @@ static void test_clipper_blt(void)
hr = IDirectDrawSurface_BltFast(dst_surface, 0, 0, src_surface, NULL, DDBLTFAST_WAIT);
ok(hr == DDERR_BLTFASTCANTCLIP || broken(hr == E_NOTIMPL /* NT4 */), "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawClipper_SetHWnd(clipper, 0, window);
+ ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#x.\n", hr);
+ hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
+ ok(SUCCEEDED(hr), "Failed to get clip list size, hr %#x.\n", hr);
+ DestroyWindow(window);
+ hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
+ ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawClipper_SetHWnd(clipper, 0, NULL);
+ ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#x.\n", hr);
+ hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
+ ok(SUCCEEDED(hr), "Failed to get clip list size, hr %#x.\n", hr);
+
IDirectDrawSurface_Release(dst_surface);
IDirectDrawSurface_Release(src_surface);
IDirectDrawClipper_Release(clipper);
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index 3f195b7..c3e550d 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -630,6 +630,18 @@ static void test_clipper_blt(void)
hr = IDirectDrawSurface4_BltFast(dst_surface, 0, 0, src_surface, NULL, DDBLTFAST_WAIT);
ok(hr == DDERR_BLTFASTCANTCLIP, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawClipper_SetHWnd(clipper, 0, window);
+ ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#x.\n", hr);
+ hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
+ ok(SUCCEEDED(hr), "Failed to get clip list size, hr %#x.\n", hr);
+ DestroyWindow(window);
+ hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
+ ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawClipper_SetHWnd(clipper, 0, NULL);
+ ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#x.\n", hr);
+ hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
+ ok(SUCCEEDED(hr), "Failed to get clip list size, hr %#x.\n", hr);
+
IDirectDrawSurface4_Release(dst_surface);
IDirectDrawSurface4_Release(src_surface);
IDirectDrawClipper_Release(clipper);
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 6075009..3cdfd2b 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -623,6 +623,18 @@ static void test_clipper_blt(void)
hr = IDirectDrawSurface7_BltFast(dst_surface, 0, 0, src_surface, NULL, DDBLTFAST_WAIT);
ok(hr == DDERR_BLTFASTCANTCLIP, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawClipper_SetHWnd(clipper, 0, window);
+ ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#x.\n", hr);
+ hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
+ ok(SUCCEEDED(hr), "Failed to get clip list size, hr %#x.\n", hr);
+ DestroyWindow(window);
+ hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
+ ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawClipper_SetHWnd(clipper, 0, NULL);
+ ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#x.\n", hr);
+ hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
+ ok(SUCCEEDED(hr), "Failed to get clip list size, hr %#x.\n", hr);
+
IDirectDrawSurface7_Release(dst_surface);
IDirectDrawSurface7_Release(src_surface);
IDirectDrawClipper_Release(clipper);
--
1.7.3.4
More information about the wine-patches
mailing list