Author: cwittich
Date: Sun Mar 7 08:29:40 2010
New Revision: 45975
URL:
http://svn.reactos.org/svn/reactos?rev=45975&view=rev
Log:
[GDI32_WINETEST]
sync gdi32_winetest to wine 1.1.40
Modified:
trunk/rostests/winetests/gdi32/bitmap.c
trunk/rostests/winetests/gdi32/dc.c
Modified: trunk/rostests/winetests/gdi32/bitmap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdi32/bitmap.c?…
==============================================================================
--- trunk/rostests/winetests/gdi32/bitmap.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/gdi32/bitmap.c [iso-8859-1] Sun Mar 7 08:29:40 2010
@@ -301,7 +301,7 @@
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 @@
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 @@
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 @@
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);
Modified: trunk/rostests/winetests/gdi32/dc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdi32/dc.c?rev=…
==============================================================================
--- trunk/rostests/winetests/gdi32/dc.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/gdi32/dc.c [iso-8859-1] Sun Mar 7 08:29:40 2010
@@ -69,7 +69,7 @@
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 @@
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 @@
test_GdiConvertToDevmodeW();
test_CreateCompatibleDC();
test_DC_bitmap();
-}
+ test_DeleteDC();
+}