Author: tkreuzer Date: Sat Apr 4 14:51:20 2015 New Revision: 67046
URL: http://svn.reactos.org/svn/reactos?rev=67046&view=rev Log: [GDI32_APITEST] Fix some broken tests or disable them.
Modified: trunk/rostests/apitests/gdi32/GetClipBox.c trunk/rostests/apitests/gdi32/GetRandomRgn.c trunk/rostests/apitests/gdi32/OffsetClipRgn.c
Modified: trunk/rostests/apitests/gdi32/GetClipBox.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/GetClipBox.... ============================================================================== --- trunk/rostests/apitests/gdi32/GetClipBox.c [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32/GetClipBox.c [iso-8859-1] Sat Apr 4 14:51:20 2015 @@ -40,7 +40,7 @@ SetLastError(ERROR_SUCCESS); ret = GetClipBox((HDC)0x12345, &rect); ok(ret == ERROR, "Expected ERROR, got %d\n", ret); - ok(GetLastError() == 0, "Expected 0, got %ld\n", GetLastError()); + ok((GetLastError() == 0) || (GetLastError() == ERROR_INVALID_HANDLE), "Expected 0, got %ld\n", GetLastError());
//ret = GetClipBox(hdc, &rect); //ok_int(ret, SIMPLEREGION);
Modified: trunk/rostests/apitests/gdi32/GetRandomRgn.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/GetRandomRg... ============================================================================== --- trunk/rostests/apitests/gdi32/GetRandomRgn.c [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32/GetRandomRgn.c [iso-8859-1] Sat Apr 4 14:51:20 2015 @@ -74,12 +74,12 @@ ret = GetRandomRgn(hdc, hrgn, 0); ok_int(ret, 0); ok_long(GetLastError(), 0xbadbad00); - +#if 0 // this is vista+ SetLastError(0xbadbad00); ret = GetRandomRgn(hdc, hrgn, 5); ok_int(ret, 1); ok_long(GetLastError(), 0xbadbad00); - +#endif SetLastError(0xbadbad00); ret = GetRandomRgn(hdc, hrgn, 6); ok_int(ret, 0); @@ -240,14 +240,100 @@ ok_int(ret, 1); GetRgnBox(hrgn1, &rect); DPtoLP(ghdcWindow, (LPPOINT)&rect, 2); +#if 0 // FIXME: this needs calculation ok_long(rect.left, 104); ok_long(rect.top, 124); ok_long(rect.right, 209); ok_long(rect.bottom, 196); +#endif
MoveWindow(ghwnd, 200, 400, 200, 200, 0);
ret = GetRandomRgn(ghdcWindow, hrgn1, SYSRGN); + ok_int(ret, 1); + GetRgnBox(hrgn1, &rect2); + DPtoLP(ghdcWindow, (LPPOINT)&rect2, 2); +#if 0 // FIXME: this needs calculation + ok_long(rect2.left, rect.left + 100); + ok_long(rect2.top, rect.top + 300); + ok_long(rect2.right, rect.right + 200 - 13); + ok_long(rect2.bottom, rect.bottom + 400); +#endif + + DeleteObject(hrgn1); + DeleteDC(hdc); + +} + +void Test_GetRandomRgn_RGN5() +{ + HDC hdc; + HRGN hrgn1, hrgn2; + INT ret; + RECT rect, rect2; + HBITMAP hbmp; + DBG_UNREFERENCED_LOCAL_VARIABLE(hrgn2); + DBG_UNREFERENCED_LOCAL_VARIABLE(rect2); + + hrgn1 = CreateRectRgn(11, 17, 23, 42); + if (!hrgn1) + { + printf("Coun't create a region\n"); + return; + } + + hdc = CreateCompatibleDC(0); + if (!hdc) + { + printf("Coun't create a dc\n"); + return; + } +#if 0 // this is vista+ + ret = GetRandomRgn(hdc, hrgn1, RGN5); + ok_int(ret, 1); + GetRgnBox(hrgn1, &rect); + ok_long(rect.left, 0); + ok_long(rect.top, 0); + ok_long(rect.right, 1); + ok_long(rect.bottom, 1); + + hrgn2 = CreateRectRgn(1, 2, 3, 4); + SelectClipRgn(hdc, hrgn2); + DeleteObject(hrgn2); + ret = GetRandomRgn(hdc, hrgn1, RGN5); + ok_int(ret, 1); + GetRgnBox(hrgn1, &rect); + ok_long(rect.left, 0); + ok_long(rect.top, 0); + ok_long(rect.right, 1); + ok_long(rect.bottom, 1); +#endif + + hbmp = CreateCompatibleBitmap(hdc, 4, 7); + SelectObject(hdc, hbmp); + ret = GetRandomRgn(hdc, hrgn1, SYSRGN); + ok_int(ret, 1); + GetRgnBox(hrgn1, &rect); + ok_long(rect.left, 0); + ok_long(rect.top, 0); + ok_long(rect.right, 4); + ok_long(rect.bottom, 7); + DeleteObject(hbmp); + +#if 0 // this is vista+ + MoveWindow(ghwnd, 100, 100, 100, 100, 0); + ret = GetRandomRgn(ghdcWindow, hrgn1, RGN5); + ok_int(ret, 1); + GetRgnBox(hrgn1, &rect); + DPtoLP(ghdcWindow, (LPPOINT)&rect, 2); + ok_long(rect.left, 104); + ok_long(rect.top, 124); + ok_long(rect.right, 209); + ok_long(rect.bottom, 196); + + MoveWindow(ghwnd, 200, 400, 200, 200, 0); + + ret = GetRandomRgn(ghdcWindow, hrgn1, RGN5); ok_int(ret, 1); GetRgnBox(hrgn1, &rect2); DPtoLP(ghdcWindow, (LPPOINT)&rect2, 2); @@ -255,86 +341,7 @@ ok_long(rect2.top, rect.top + 300); ok_long(rect2.right, rect.right + 200 - 13); ok_long(rect2.bottom, rect.bottom + 400); - - - DeleteObject(hrgn1); - DeleteDC(hdc); - -} - -void Test_GetRandomRgn_RGN5() -{ - HDC hdc; - HRGN hrgn1, hrgn2; - INT ret; - RECT rect, rect2; - HBITMAP hbmp; - - hrgn1 = CreateRectRgn(11, 17, 23, 42); - if (!hrgn1) - { - printf("Coun't create a region\n"); - return; - } - - hdc = CreateCompatibleDC(0); - if (!hdc) - { - printf("Coun't create a dc\n"); - return; - } - - ret = GetRandomRgn(hdc, hrgn1, RGN5); - ok_int(ret, 1); - GetRgnBox(hrgn1, &rect); - ok_long(rect.left, 0); - ok_long(rect.top, 0); - ok_long(rect.right, 1); - ok_long(rect.bottom, 1); - - hrgn2 = CreateRectRgn(1, 2, 3, 4); - SelectClipRgn(hdc, hrgn2); - DeleteObject(hrgn2); - ret = GetRandomRgn(hdc, hrgn1, RGN5); - ok_int(ret, 1); - GetRgnBox(hrgn1, &rect); - ok_long(rect.left, 0); - ok_long(rect.top, 0); - ok_long(rect.right, 1); - ok_long(rect.bottom, 1); - - hbmp = CreateCompatibleBitmap(hdc, 4, 7); - SelectObject(hdc, hbmp); - ret = GetRandomRgn(hdc, hrgn1, SYSRGN); - ok_int(ret, 1); - GetRgnBox(hrgn1, &rect); - ok_long(rect.left, 0); - ok_long(rect.top, 0); - ok_long(rect.right, 4); - ok_long(rect.bottom, 7); - DeleteObject(hbmp); - - MoveWindow(ghwnd, 100, 100, 100, 100, 0); - ret = GetRandomRgn(ghdcWindow, hrgn1, RGN5); - ok_int(ret, 1); - GetRgnBox(hrgn1, &rect); - DPtoLP(ghdcWindow, (LPPOINT)&rect, 2); - ok_long(rect.left, 104); - ok_long(rect.top, 124); - ok_long(rect.right, 209); - ok_long(rect.bottom, 196); - - MoveWindow(ghwnd, 200, 400, 200, 200, 0); - - ret = GetRandomRgn(ghdcWindow, hrgn1, RGN5); - ok_int(ret, 1); - GetRgnBox(hrgn1, &rect2); - DPtoLP(ghdcWindow, (LPPOINT)&rect2, 2); - ok_long(rect2.left, rect.left + 100); - ok_long(rect2.top, rect.top + 300); - ok_long(rect2.right, rect.right + 200 - 13); - ok_long(rect2.bottom, rect.bottom + 400); - +#endif
DeleteObject(hrgn1); DeleteDC(hdc);
Modified: trunk/rostests/apitests/gdi32/OffsetClipRgn.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/OffsetClipR... ============================================================================== --- trunk/rostests/apitests/gdi32/OffsetClipRgn.c [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32/OffsetClipRgn.c [iso-8859-1] Sat Apr 4 14:51:20 2015 @@ -30,7 +30,7 @@ /* Test invalid DC */ SetLastError(0x12345); ok_int(OffsetClipRgn((HDC)(ULONG_PTR)0x12345, 0, 0), ERROR); - ok_int(GetLastError(), 0x12345); + ok((GetLastError() == 0x12345) || (GetLastError() == ERROR_INVALID_HANDLE), "Expected 0x12345 or ERROR_INVALID_HANDLE, got %ld\n", GetLastError()); SetLastError(0x12345);
/* Test without a clip region set */