Dmitry Timoshkov : gdi32: Add a simple SelectObject test for bitmaps.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jan 22 07:05:36 CST 2007
Module: wine
Branch: master
Commit: 295f8101ec882bd62042ff4526f0cb3f6c2cf5bf
URL: http://source.winehq.org/git/wine.git/?a=commit;h=295f8101ec882bd62042ff4526f0cb3f6c2cf5bf
Author: Dmitry Timoshkov <dmitry at codeweavers.com>
Date: Mon Jan 22 18:31:34 2007 +0800
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 cd5a829..f0da8df 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();
}
More information about the wine-cvs
mailing list