1 /* Unit test suite for user interface functions
3 * Copyright 2009 Nikolay Sivov
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "wine/test.h"
25 static void test_FillRect(void)
29 HBITMAP hbmp, oldhbmp;
34 /* fill bitmap data with white */
35 memset(bits, 0xff, sizeof(bits));
38 ok( hdc != NULL, "CreateDC rets %p\n", hdc);
39 /* create a memory dc */
40 hdcmem = CreateCompatibleDC(hdc);
41 ok(hdcmem != NULL, "CreateCompatibleDC rets %p\n", hdcmem);
42 /* test monochrome bitmap: should always work */
43 hbmp = CreateBitmap(32, 32, 1, 1, bits);
44 ok(hbmp != NULL, "CreateBitmap returns %p\n", hbmp);
45 oldhbmp = SelectObject(hdcmem, hbmp);
46 ok(oldhbmp != NULL, "SelectObject returned NULL\n"); /* a memdc always has a bitmap selected */
47 col = GetPixel(hdcmem, 0, 0);
48 ok( col == 0xffffff, "GetPixel returned %08x, expected 0xffffff\n", col);
50 /* select black brush */
51 old_brush = SelectObject(hdcmem, GetStockObject(BLACK_BRUSH));
53 r.right = r.bottom = 5;
54 FillRect(hdcmem, &r, 0);
55 SelectObject(hdcmem, old_brush);
56 /* bitmap filled with last selected brush */
57 col = GetPixel(hdcmem, 0, 0);
58 ok(col == 0, "GetPixel returned %08x, expected 0\n", col);
60 SelectObject(hdcmem, oldhbmp);