mirror of
https://github.com/reactos/reactos.git
synced 2026-07-07 10:40:20 +08:00
[GDI32_WINETEST]
sync gdi32_winetest to wine 1.1.40 svn path=/trunk/; revision=45975
This commit is contained in:
@@ -301,7 +301,7 @@ static void test_dib_info(HBITMAP hbm, const void *bits, const BITMAPINFOHEADER
|
||||
|
||||
ok(bm.bmType == 0, "wrong bm.bmType %d\n", bm.bmType);
|
||||
ok(bm.bmWidth == bmih->biWidth, "wrong bm.bmWidth %d\n", bm.bmWidth);
|
||||
ok(bm.bmHeight == bmih->biHeight, "wrong bm.bmHeight %d\n", bm.bmHeight);
|
||||
ok(bm.bmHeight == abs(bmih->biHeight), "wrong bm.bmHeight %d\n", bm.bmHeight);
|
||||
dib_width_bytes = DIB_GetWidthBytes(bm.bmWidth, bm.bmBitsPixel);
|
||||
bm_width_bytes = BITMAP_GetWidthBytes(bm.bmWidth, bm.bmBitsPixel);
|
||||
if (bm.bmWidthBytes != dib_width_bytes) /* Win2k bug */
|
||||
@@ -332,7 +332,7 @@ static void test_dib_info(HBITMAP hbm, const void *bits, const BITMAPINFOHEADER
|
||||
ret = GetObject(hbm, sizeof(*bma) * 2, bma);
|
||||
ok(ret == sizeof(*bma) || broken(ret == sizeof(*bma) * 2 /* Win9x */), "wrong size %d\n", ret);
|
||||
ok(bm.bmWidth == bmih->biWidth, "wrong bm.bmWidth %d\n", bm.bmWidth);
|
||||
ok(bm.bmHeight == bmih->biHeight, "wrong bm.bmHeight %d\n", bm.bmHeight);
|
||||
ok(bm.bmHeight == abs(bmih->biHeight), "wrong bm.bmHeight %d\n", bm.bmHeight);
|
||||
ok(bm.bmBits == bits, "wrong bm.bmBits %p != %p\n", bm.bmBits, bits);
|
||||
|
||||
ret = GetObject(hbm, sizeof(bm) / 2, &bm);
|
||||
@@ -363,20 +363,22 @@ static void test_dib_info(HBITMAP hbm, const void *bits, const BITMAPINFOHEADER
|
||||
ds.dsBmih.biSizeImage = 0;
|
||||
|
||||
ok(ds.dsBmih.biSize == bmih->biSize, "%u != %u\n", ds.dsBmih.biSize, bmih->biSize);
|
||||
ok(ds.dsBmih.biWidth == bmih->biWidth, "%u != %u\n", ds.dsBmih.biWidth, bmih->biWidth);
|
||||
ok(ds.dsBmih.biHeight == bmih->biHeight, "%u != %u\n", ds.dsBmih.biHeight, bmih->biHeight);
|
||||
ok(ds.dsBmih.biWidth == bmih->biWidth, "%d != %d\n", ds.dsBmih.biWidth, bmih->biWidth);
|
||||
ok(ds.dsBmih.biHeight == abs(bmih->biHeight) ||
|
||||
broken(ds.dsBmih.biHeight == bmih->biHeight), /* Win9x/WinMe */
|
||||
"%d != %d\n", ds.dsBmih.biHeight, abs(bmih->biHeight));
|
||||
ok(ds.dsBmih.biPlanes == bmih->biPlanes, "%u != %u\n", ds.dsBmih.biPlanes, bmih->biPlanes);
|
||||
ok(ds.dsBmih.biBitCount == bmih->biBitCount, "%u != %u\n", ds.dsBmih.biBitCount, bmih->biBitCount);
|
||||
ok(ds.dsBmih.biCompression == bmih->biCompression, "%u != %u\n", ds.dsBmih.biCompression, bmih->biCompression);
|
||||
ok(ds.dsBmih.biSizeImage == bmih->biSizeImage, "%u != %u\n", ds.dsBmih.biSizeImage, bmih->biSizeImage);
|
||||
ok(ds.dsBmih.biXPelsPerMeter == bmih->biXPelsPerMeter, "%u != %u\n", ds.dsBmih.biXPelsPerMeter, bmih->biXPelsPerMeter);
|
||||
ok(ds.dsBmih.biYPelsPerMeter == bmih->biYPelsPerMeter, "%u != %u\n", ds.dsBmih.biYPelsPerMeter, bmih->biYPelsPerMeter);
|
||||
ok(ds.dsBmih.biXPelsPerMeter == bmih->biXPelsPerMeter, "%d != %d\n", ds.dsBmih.biXPelsPerMeter, bmih->biXPelsPerMeter);
|
||||
ok(ds.dsBmih.biYPelsPerMeter == bmih->biYPelsPerMeter, "%d != %d\n", ds.dsBmih.biYPelsPerMeter, bmih->biYPelsPerMeter);
|
||||
|
||||
memset(&ds, 0xAA, sizeof(ds));
|
||||
ret = GetObject(hbm, sizeof(ds) - 4, &ds);
|
||||
ok(ret == sizeof(ds.dsBm) || broken(ret == (sizeof(ds) - 4) /* Win9x */), "wrong size %d\n", ret);
|
||||
ok(ds.dsBm.bmWidth == bmih->biWidth, "%u != %u\n", ds.dsBmih.biWidth, bmih->biWidth);
|
||||
ok(ds.dsBm.bmHeight == bmih->biHeight, "%u != %u\n", ds.dsBmih.biHeight, bmih->biHeight);
|
||||
ok(ds.dsBm.bmWidth == bmih->biWidth, "%d != %d\n", ds.dsBmih.biWidth, bmih->biWidth);
|
||||
ok(ds.dsBm.bmHeight == abs(bmih->biHeight), "%d != %d\n", ds.dsBmih.biHeight, abs(bmih->biHeight));
|
||||
ok(ds.dsBm.bmBits == bits, "%p != %p\n", ds.dsBm.bmBits, bits);
|
||||
|
||||
ret = GetObject(hbm, 0, &ds);
|
||||
@@ -525,6 +527,14 @@ static void test_dibsections(void)
|
||||
test_dib_info(hdib, bits, &pbmi->bmiHeader);
|
||||
DeleteObject(hdib);
|
||||
|
||||
/* Test a top-down DIB. */
|
||||
pbmi->bmiHeader.biHeight = -100;
|
||||
hdib = CreateDIBSection(hdc, pbmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
|
||||
ok(hdib != NULL, "CreateDIBSection error %d\n", GetLastError());
|
||||
test_dib_info(hdib, bits, &pbmi->bmiHeader);
|
||||
DeleteObject(hdib);
|
||||
|
||||
pbmi->bmiHeader.biHeight = 100;
|
||||
pbmi->bmiHeader.biBitCount = 8;
|
||||
pbmi->bmiHeader.biCompression = BI_RLE8;
|
||||
SetLastError(0xdeadbeef);
|
||||
|
||||
@@ -69,7 +69,7 @@ static void test_savedc_2(void)
|
||||
assert(hrgn != 0);
|
||||
|
||||
hdc = GetDC(hwnd);
|
||||
ok(hdc != NULL, "CreateDC rets %p\n", hdc);
|
||||
ok(hdc != NULL, "GetDC failed\n");
|
||||
|
||||
ret = GetClipBox(hdc, &rc_clip);
|
||||
ok(ret == SIMPLEREGION, "GetClipBox returned %d instead of SIMPLEREGION\n", ret);
|
||||
@@ -328,6 +328,152 @@ static void test_DC_bitmap(void)
|
||||
ReleaseDC( 0, hdc );
|
||||
}
|
||||
|
||||
static void test_DeleteDC(void)
|
||||
{
|
||||
HWND hwnd;
|
||||
HDC hdc, hdc_test;
|
||||
WNDCLASSEX cls;
|
||||
int ret;
|
||||
|
||||
/* window DC */
|
||||
hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP|WS_VISIBLE, 0,0,100,100,
|
||||
0, 0, 0, NULL);
|
||||
ok(hwnd != 0, "CreateWindowExA failed\n");
|
||||
|
||||
hdc = GetDC(hwnd);
|
||||
ok(hdc != 0, "GetDC failed\n");
|
||||
ret = GetObjectType(hdc);
|
||||
ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
|
||||
ret = DeleteDC(hdc);
|
||||
ok(ret, "DeleteDC failed\n");
|
||||
ret = GetObjectType(hdc);
|
||||
ok(!ret || broken(ret) /* win9x */, "GetObjectType should fail for a deleted DC\n");
|
||||
|
||||
hdc = GetWindowDC(hwnd);
|
||||
ok(hdc != 0, "GetDC failed\n");
|
||||
ret = GetObjectType(hdc);
|
||||
ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
|
||||
ret = DeleteDC(hdc);
|
||||
ok(ret, "DeleteDC failed\n");
|
||||
ret = GetObjectType(hdc);
|
||||
ok(!ret || broken(ret) /* win9x */, "GetObjectType should fail for a deleted DC\n");
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
/* desktop window DC */
|
||||
hwnd = GetDesktopWindow();
|
||||
ok(hwnd != 0, "GetDesktopWindow failed\n");
|
||||
|
||||
hdc = GetDC(hwnd);
|
||||
ok(hdc != 0, "GetDC failed\n");
|
||||
ret = GetObjectType(hdc);
|
||||
ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
|
||||
ret = DeleteDC(hdc);
|
||||
ok(ret, "DeleteDC failed\n");
|
||||
ret = GetObjectType(hdc);
|
||||
ok(!ret || broken(ret) /* win9x */, "GetObjectType should fail for a deleted DC\n");
|
||||
|
||||
hdc = GetWindowDC(hwnd);
|
||||
ok(hdc != 0, "GetDC failed\n");
|
||||
ret = GetObjectType(hdc);
|
||||
ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
|
||||
ret = DeleteDC(hdc);
|
||||
ok(ret, "DeleteDC failed\n");
|
||||
ret = GetObjectType(hdc);
|
||||
ok(!ret || broken(ret) /* win9x */, "GetObjectType should fail for a deleted DC\n");
|
||||
|
||||
/* CS_CLASSDC */
|
||||
memset(&cls, 0, sizeof(cls));
|
||||
cls.cbSize = sizeof(cls);
|
||||
cls.style = CS_CLASSDC;
|
||||
cls.hInstance = GetModuleHandle(0);
|
||||
cls.lpszClassName = "Wine class DC";
|
||||
cls.lpfnWndProc = DefWindowProcA;
|
||||
ret = RegisterClassExA(&cls);
|
||||
ok(ret, "RegisterClassExA failed\n");
|
||||
|
||||
hwnd = CreateWindowExA(0, "Wine class DC", NULL, WS_POPUP|WS_VISIBLE, 0,0,100,100,
|
||||
0, 0, 0, NULL);
|
||||
ok(hwnd != 0, "CreateWindowExA failed\n");
|
||||
|
||||
hdc = GetDC(hwnd);
|
||||
ok(hdc != 0, "GetDC failed\n");
|
||||
ret = GetObjectType(hdc);
|
||||
ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
|
||||
ret = DeleteDC(hdc);
|
||||
ok(ret, "DeleteDC failed\n");
|
||||
ret = GetObjectType(hdc);
|
||||
ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
|
||||
ret = ReleaseDC(hwnd, hdc);
|
||||
ok(ret, "ReleaseDC failed\n");
|
||||
ret = GetObjectType(hdc);
|
||||
ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
|
||||
|
||||
hdc_test = hdc;
|
||||
|
||||
hdc = GetWindowDC(hwnd);
|
||||
ok(hdc != 0, "GetDC failed\n");
|
||||
ret = GetObjectType(hdc);
|
||||
ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
|
||||
ret = DeleteDC(hdc);
|
||||
ok(ret, "DeleteDC failed\n");
|
||||
ret = GetObjectType(hdc);
|
||||
ok(!ret || broken(ret) /* win9x */, "GetObjectType should fail for a deleted DC\n");
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
ret = GetObjectType(hdc_test);
|
||||
ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
|
||||
|
||||
ret = UnregisterClassA("Wine class DC", GetModuleHandle(NULL));
|
||||
ok(ret, "UnregisterClassA failed\n");
|
||||
|
||||
ret = GetObjectType(hdc_test);
|
||||
todo_wine
|
||||
ok(!ret, "GetObjectType should fail for a deleted DC\n");
|
||||
|
||||
/* CS_OWNDC */
|
||||
memset(&cls, 0, sizeof(cls));
|
||||
cls.cbSize = sizeof(cls);
|
||||
cls.style = CS_OWNDC;
|
||||
cls.hInstance = GetModuleHandle(0);
|
||||
cls.lpszClassName = "Wine own DC";
|
||||
cls.lpfnWndProc = DefWindowProcA;
|
||||
ret = RegisterClassExA(&cls);
|
||||
ok(ret, "RegisterClassExA failed\n");
|
||||
|
||||
hwnd = CreateWindowExA(0, "Wine own DC", NULL, WS_POPUP|WS_VISIBLE, 0,0,100,100,
|
||||
0, 0, 0, NULL);
|
||||
ok(hwnd != 0, "CreateWindowExA failed\n");
|
||||
|
||||
hdc = GetDC(hwnd);
|
||||
ok(hdc != 0, "GetDC failed\n");
|
||||
ret = GetObjectType(hdc);
|
||||
ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
|
||||
ret = DeleteDC(hdc);
|
||||
ok(ret, "DeleteDC failed\n");
|
||||
ret = GetObjectType(hdc);
|
||||
ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
|
||||
ret = ReleaseDC(hwnd, hdc);
|
||||
ok(ret, "ReleaseDC failed\n");
|
||||
ret = GetObjectType(hdc);
|
||||
ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
|
||||
|
||||
hdc = GetWindowDC(hwnd);
|
||||
ok(hdc != 0, "GetDC failed\n");
|
||||
ret = GetObjectType(hdc);
|
||||
ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
|
||||
ret = DeleteDC(hdc);
|
||||
ok(ret, "DeleteDC failed\n");
|
||||
ret = GetObjectType(hdc);
|
||||
ok(!ret || broken(ret) /* win9x */, "GetObjectType should fail for a deleted DC\n");
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
ret = UnregisterClassA("Wine own DC", GetModuleHandle(NULL));
|
||||
ok(ret, "UnregisterClassA failed\n");
|
||||
}
|
||||
|
||||
START_TEST(dc)
|
||||
{
|
||||
test_savedc();
|
||||
@@ -335,4 +481,5 @@ START_TEST(dc)
|
||||
test_GdiConvertToDevmodeW();
|
||||
test_CreateCompatibleDC();
|
||||
test_DC_bitmap();
|
||||
test_DeleteDC();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user