Commit 48bb687d authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

gdi: Separate GDI tests by moving them into appropriate files.

Separate GDI tests by moving them into appropriate files: bitmap tests to bitmap.c, font test to font.c, pen tests to pen.c.
parent fd2ed6ff
...@@ -3,9 +3,11 @@ bitmap.ok ...@@ -3,9 +3,11 @@ bitmap.ok
brush.ok brush.ok
clipping.ok clipping.ok
dc.ok dc.ok
font.ok
gdiobj.ok gdiobj.ok
generated.ok generated.ok
mapping.ok mapping.ok
metafile.ok metafile.ok
palette.ok palette.ok
pen.ok
testlist.c testlist.c
...@@ -10,11 +10,13 @@ CTESTS = \ ...@@ -10,11 +10,13 @@ CTESTS = \
brush.c \ brush.c \
clipping.c \ clipping.c \
dc.c \ dc.c \
font.c \
gdiobj.c \ gdiobj.c \
generated.c \ generated.c \
mapping.c \ mapping.c \
metafile.c \ metafile.c \
palette.c palette.c \
pen.c
@MAKE_TEST_RULES@ @MAKE_TEST_RULES@
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* Unit test suite for bitmaps * Unit test suite for bitmaps
* *
* Copyright 2004 Huw Davies * Copyright 2004 Huw Davies
* Copyright 2006 Dmitry Timoshkov
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -743,18 +744,86 @@ todo_wine { ...@@ -743,18 +744,86 @@ todo_wine {
ReleaseDC(0, hdc); ReleaseDC(0, hdc);
} }
START_TEST(bitmap) static void test_bitmap(void)
{ {
HWND hWnd; char buf[256], buf_cmp[256];
HBITMAP hbmp, hbmp_old;
HDC hdc;
BITMAP bm;
INT ret;
hdc = CreateCompatibleDC(0);
assert(hdc != 0);
hbmp = CreateBitmap(15, 15, 1, 1, NULL);
assert(hbmp != NULL);
ret = GetObject(hbmp, sizeof(bm), &bm);
ok(ret == sizeof(bm), "%d != %d\n", ret, sizeof(bm));
ok(bm.bmType == 0, "wrong bm.bmType %d\n", bm.bmType);
ok(bm.bmWidth == 15, "wrong bm.bmWidth %d\n", bm.bmWidth);
ok(bm.bmHeight == 15, "wrong bm.bmHeight %d\n", bm.bmHeight);
ok(bm.bmWidthBytes == 2, "wrong bm.bmWidthBytes %d\n", bm.bmWidthBytes);
ok(bm.bmPlanes == 1, "wrong bm.bmPlanes %d\n", bm.bmPlanes);
ok(bm.bmBitsPixel == 1, "wrong bm.bmBitsPixel %d\n", bm.bmBitsPixel);
ok(bm.bmBits == NULL, "wrong bm.bmBits %p\n", bm.bmBits);
assert(sizeof(buf) >= bm.bmWidthBytes * bm.bmHeight);
assert(sizeof(buf) == sizeof(buf_cmp));
memset(buf_cmp, 0xAA, sizeof(buf_cmp));
memset(buf_cmp, 0, bm.bmWidthBytes * bm.bmHeight);
memset(buf, 0xAA, sizeof(buf));
ret = GetBitmapBits(hbmp, sizeof(buf), buf);
ok(ret == bm.bmWidthBytes * bm.bmHeight, "%d != %d\n", ret, bm.bmWidthBytes * bm.bmHeight);
ok(!memcmp(buf, buf_cmp, sizeof(buf)), "buffers do not match\n");
hbmp_old = SelectObject(hdc, hbmp);
ret = GetObject(hbmp, sizeof(bm), &bm);
ok(ret == sizeof(bm), "%d != %d\n", ret, sizeof(bm));
hWnd = CreateWindowExA(0, "EDIT", NULL, 0, ok(bm.bmType == 0, "wrong bm.bmType %d\n", bm.bmType);
10, 10, 300, 300, ok(bm.bmWidth == 15, "wrong bm.bmWidth %d\n", bm.bmWidth);
NULL, NULL, NULL, NULL); ok(bm.bmHeight == 15, "wrong bm.bmHeight %d\n", bm.bmHeight);
assert(hWnd); ok(bm.bmWidthBytes == 2, "wrong bm.bmWidthBytes %d\n", bm.bmWidthBytes);
is_win9x = GetWindowLongPtrW(hWnd, GWLP_WNDPROC) == 0; ok(bm.bmPlanes == 1, "wrong bm.bmPlanes %d\n", bm.bmPlanes);
DestroyWindow(hWnd); ok(bm.bmBitsPixel == 1, "wrong bm.bmBitsPixel %d\n", bm.bmBitsPixel);
ok(bm.bmBits == NULL, "wrong bm.bmBits %p\n", bm.bmBits);
memset(buf, 0xAA, sizeof(buf));
ret = GetBitmapBits(hbmp, sizeof(buf), buf);
ok(ret == bm.bmWidthBytes * bm.bmHeight, "%d != %d\n", ret, bm.bmWidthBytes * bm.bmHeight);
ok(!memcmp(buf, buf_cmp, sizeof(buf)), "buffers do not match\n");
hbmp_old = SelectObject(hdc, hbmp_old);
ok(hbmp_old == hbmp, "wrong old bitmap %p\n", hbmp_old);
/* test various buffer sizes for GetObject */
ret = GetObject(hbmp, sizeof(bm) * 2, &bm);
ok(ret == sizeof(bm), "%d != %d\n", ret, sizeof(bm));
ret = GetObject(hbmp, sizeof(bm) / 2, &bm);
ok(ret == 0, "%d != 0\n", ret);
ret = GetObject(hbmp, 0, &bm);
ok(ret == 0, "%d != 0\n", ret);
ret = GetObject(hbmp, 1, &bm);
ok(ret == 0, "%d != 0\n", ret);
DeleteObject(hbmp);
DeleteDC(hdc);
}
START_TEST(bitmap)
{
is_win9x = GetWindowLongPtrW(GetDesktopWindow(), GWLP_WNDPROC) == 0;
test_createdibitmap(); test_createdibitmap();
test_dibsections(); test_dibsections();
test_mono_dibsection(); test_mono_dibsection();
test_bitmap();
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment