[2/2] gdi32: Add a simple SelectObject test for bitmaps
Dmitry Timoshkov
dmitry at codeweavers.com
Mon Jan 22 04:31:34 CST 2007
Hello,
this test passes under Wine.
Changelog:
gdi32: Add a simple SelectObject test for bitmaps.
---
dlls/gdi32/tests/bitmap.c | 59 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 59 insertions(+), 0 deletions(-)
diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c
index 1ff94f2..9442f07 100644
--- a/dlls/gdi32/tests/bitmap.c
+++ b/dlls/gdi32/tests/bitmap.c
@@ -1547,6 +1547,64 @@ todo_wine
ReleaseDC(0, hdc);
}
+static void test_select_object(void)
+{
+ HDC hdc;
+ HBITMAP hbm, hbm_old;
+ INT planes, bpp;
+
+ hdc = GetDC(0);
+ ok(hdc != 0, "GetDC(0) failed\n");
+ hbm = CreateCompatibleBitmap(hdc, 10, 10);
+ ok(hbm != 0, "CreateCompatibleBitmap failed\n");
+
+ hbm_old = SelectObject(hdc, hbm);
+ ok(hbm_old == 0, "SelectObject should fail\n");
+
+ DeleteObject(hbm);
+ ReleaseDC(0, hdc);
+
+ hdc = CreateCompatibleDC(0);
+ ok(hdc != 0, "GetDC(0) failed\n");
+ hbm = CreateCompatibleBitmap(hdc, 10, 10);
+ ok(hbm != 0, "CreateCompatibleBitmap failed\n");
+
+ hbm_old = SelectObject(hdc, hbm);
+ ok(hbm_old != 0, "SelectObject failed\n");
+ hbm_old = SelectObject(hdc, hbm_old);
+ ok(hbm_old == hbm, "SelectObject failed\n");
+
+ DeleteObject(hbm);
+
+ /* test an 1-bpp bitmap */
+ planes = GetDeviceCaps(hdc, PLANES);
+ bpp = 1;
+
+ hbm = CreateBitmap(10, 10, planes, bpp, NULL);
+ ok(hbm != 0, "CreateBitmap failed\n");
+
+ hbm_old = SelectObject(hdc, hbm);
+ ok(hbm_old != 0, "SelectObject failed\n");
+ hbm_old = SelectObject(hdc, hbm_old);
+ ok(hbm_old == hbm, "SelectObject failed\n");
+
+ DeleteObject(hbm);
+
+ /* test a color bitmap that doesn't match the dc's bpp */
+ planes = GetDeviceCaps(hdc, PLANES);
+ bpp = GetDeviceCaps(hdc, BITSPIXEL) == 24 ? 8 : 24;
+
+ hbm = CreateBitmap(10, 10, planes, bpp, NULL);
+ ok(hbm != 0, "CreateBitmap failed\n");
+
+ hbm_old = SelectObject(hdc, hbm);
+ ok(hbm_old == 0, "SelectObject should fail\n");
+
+ DeleteObject(hbm);
+
+ DeleteDC(hdc);
+}
+
START_TEST(bitmap)
{
is_win9x = GetWindowLongPtrW(GetDesktopWindow(), GWLP_WNDPROC) == 0;
@@ -1562,4 +1620,5 @@ START_TEST(bitmap)
test_GetDIBits_selected_DDB(TRUE);
test_GetDIBits_selected_DDB(FALSE);
test_GetDIBits();
+ test_select_object();
}
--
1.4.4.4
More information about the wine-patches
mailing list