Author: tkreuzer
Date: Sat May 5 14:19:22 2012
New Revision: 56512
URL:
http://svn.reactos.org/svn/reactos?rev=56512&view=rev
Log:
[GDI32_APITEST]
- Try to fix some more test fails on win 2003
Modified:
trunk/rostests/apitests/gdi32/DPtoLP.c
trunk/rostests/apitests/gdi32/GetObject.c
Modified: trunk/rostests/apitests/gdi32/DPtoLP.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/DPtoLP.c?r…
==============================================================================
--- trunk/rostests/apitests/gdi32/DPtoLP.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/gdi32/DPtoLP.c [iso-8859-1] Sat May 5 14:19:22 2012
@@ -11,7 +11,6 @@
void Test_DPtoLP_Params()
{
- BOOL ret;
HDC hdc;
POINT apt[2];
@@ -21,53 +20,43 @@
apt[1].y = 1000;
SetLastError(ERROR_SUCCESS);
- ret = DPtoLP(NULL, NULL, 0);
- ok(ret == 1, "Expected ret == 1, got %d\n", ret);
- ok(GetLastError() == ERROR_SUCCESS, "Exected ERROR_SUCCESS, got %ld\n",
GetLastError());
+ ok_int(DPtoLP(NULL, NULL, 0), 1);
+ ok_err(ERROR_SUCCESS);
- ret = DPtoLP(NULL, NULL, -1);
- ok(ret == 1, "Expected ret == 1, got %d\n", ret);
- ok(GetLastError() == ERROR_SUCCESS, "Exected ERROR_SUCCESS, got %ld\n",
GetLastError());
+ ok_int(DPtoLP(NULL, NULL, -1), 1);
+ ok_err(ERROR_SUCCESS);
- ret = DPtoLP(NULL, (PVOID)0x80000000, -1);
- ok(ret == 1, "Expected ret == 1, got %d\n", ret);
- ok(GetLastError() == ERROR_SUCCESS, "Exected ERROR_SUCCESS, got %ld\n",
GetLastError());
+ ok_int(DPtoLP(NULL, (PVOID)0x80000000, -1), 1);
+ ok_err(ERROR_SUCCESS);
- ret = DPtoLP(NULL, NULL, 2);
- ok(ret == 0, "Expected ret == 0, got %d\n", ret);
- ok(GetLastError() == ERROR_INVALID_PARAMETER, "Exected ERROR_INVALID_PARAMETER, got
%ld\n", GetLastError());
+ ok_int(DPtoLP(NULL, NULL, 2), 0);
+ ok_err(ERROR_INVALID_PARAMETER);
SetLastError(ERROR_SUCCESS);
- ret = DPtoLP(NULL, apt, 2);
- ok(ret == 0, "Expected ret == 0, got %d\n", ret);
- ok(GetLastError() == ERROR_INVALID_PARAMETER, "Exected ERROR_INVALID_PARAMETER, got
%ld\n", GetLastError());
+ ok_int(DPtoLP(NULL, apt, 2), 0);
+ ok_err(ERROR_INVALID_PARAMETER);
SetLastError(ERROR_SUCCESS);
- ret = DPtoLP(NULL, apt, 0);
- ok(ret == 1, "Expected ret == 1, got %d\n", ret);
- ok(GetLastError() == ERROR_SUCCESS, "Exected ERROR_SUCCESS, got %ld\n",
GetLastError());
+ ok_int(DPtoLP(NULL, apt, 0), 1);
+ ok(GetLastError() == ERROR_SUCCESS, "Exected ERROR_SUCCESS, got %ld\n",
GetLastError());
SetLastError(ERROR_SUCCESS);
- ret = DPtoLP(NULL, apt, -2);
- ok(ret == 1, "Expected ret == 1, got %d\n", ret);
- ok(GetLastError() == ERROR_SUCCESS, "Exected ERROR_SUCCESS, got %ld\n",
GetLastError());
+ ok_int(DPtoLP(NULL, apt, -2), 1);
+ ok_err(ERROR_SUCCESS);
SetLastError(ERROR_SUCCESS);
- ret = DPtoLP((HDC)-4, apt, -2);
- ok(ret == 1, "Expected ret == 1, got %d\n", ret);
- ok(GetLastError() == ERROR_SUCCESS, "Exected ERROR_SUCCESS, got %ld\n",
GetLastError());
+ ok_int(DPtoLP((HDC)-4, apt, -2), 1);
+ ok_err(ERROR_SUCCESS);
hdc = GetDC(0);
SetLastError(ERROR_SUCCESS);
- ret = DPtoLP(hdc, NULL, 2);
- ok(ret == 1, "Expected ret == 1, got %d\n", ret);
- ok(GetLastError() == ERROR_SUCCESS, "Exected ERROR_SUCCESS, got %ld\n",
GetLastError());
+ ok_int(DPtoLP(hdc, NULL, 2), 1);
+ ok_err(ERROR_SUCCESS);
hdc = GetDC(0);
SetLastError(ERROR_SUCCESS);
- ret = DPtoLP(hdc, (PVOID)0x80000000, 2);
- ok(ret == 1, "Expected ret == 1, got %d\n", ret);
- ok(GetLastError() == ERROR_SUCCESS, "Exected ERROR_SUCCESS, got %ld\n",
GetLastError());
+ ok_int(DPtoLP(hdc, (PVOID)0x80000000, 2), 1);
+ ok_err(ERROR_SUCCESS);
ReleaseDC(0, hdc);
@@ -75,10 +64,10 @@
void Test_DPtoLP()
{
- BOOL ret;
HDC hdc;
POINT apt[2];
XFORM xform;
+ LONG lLogPixelsX, lLogPixelsY;
apt[0].x = 1;
apt[0].y = 1;
@@ -86,23 +75,23 @@
apt[1].y = 1000;
hdc = GetDC(0);
+ lLogPixelsX = GetDeviceCaps(hdc, LOGPIXELSX);
+ lLogPixelsY = GetDeviceCaps(hdc, LOGPIXELSY);
SetMapMode(hdc, MM_TEXT);
- ret = DPtoLP(hdc, apt, 2);
- ok(ret == 1, "Expected ret == 1, got %d\n", ret);
+ ok_int(DPtoLP(hdc, apt, 2), 1);
ok_int(apt[0].x, 1);
ok_int(apt[0].y, 1);
ok_int(apt[1].x, -1000);
ok_int(apt[1].y, 1000);
+ apt[0].x = 100; apt[0].y = 256; apt[1].x = -1000; apt[1].y = 1000;
SetMapMode(hdc, MM_LOMETRIC);
- ret = DPtoLP(hdc, apt, 2);
- ok(ret == 1, "Expected ret == 1, got %d\n", ret);
- ok_int(apt[0].x, 4);
- ok_int(apt[0].y, -4);
- ok_int(apt[1].x, -3527);
- ok_int(apt[1].y, -3527);
-
+ ok_int(DPtoLP(hdc, apt, 2), 1);
+ ok_int(apt[0].x * lLogPixelsX, 33888 );
+ ok_int(apt[0].y * lLogPixelsY, -86688 );
+ ok_int(apt[1].x * lLogPixelsX, -338688 );
+ ok_int(apt[1].y * lLogPixelsY, -338688 );
SetGraphicsMode(hdc, GM_ADVANCED);
SetMapMode(hdc, MM_ANISOTROPIC);
@@ -110,73 +99,61 @@
xform.eM12 = 0.;
xform.eM21 = 0.;
xform.eM22 = 1.;
- xform.eDx = 4294967167.999999761;
+ xform.eDx = (FLOAT)4294967167.999999761;
xform.eDy = 1.;
- ret = SetWorldTransform(hdc, &xform);
- ok(ret == 1, "ret\n");
+ ok_int(SetWorldTransform(hdc, &xform), 1);
- ret = DPtoLP(hdc, apt, 2);
- ok(ret == 1, "Expected ret == 0, got %d\n", ret);
- ok_int(apt[0].x, 526);
- ok_int(apt[0].y, 13);
- ok_int(apt[1].x, -11929);
- ok_int(apt[1].y, 12440);
+ apt[0].x = 100; apt[0].y = 256; apt[1].x = -1000; apt[1].y = 1000;
+ ok_int(DPtoLP(hdc, apt, 2), 1);
+ ok_int(apt[0].x * lLogPixelsX, 58464 );
+ ok_int(apt[0].y * lLogPixelsY, -86784 );
+ ok_int(apt[1].x * lLogPixelsX, -314112 );
+ ok_int(apt[1].y * lLogPixelsY, -338784 );
+ apt[0].x = 100; apt[0].y = 256; apt[1].x = -1000; apt[1].y = 1000;
xform.eM11 = 10000000.;
- ret = SetWorldTransform(hdc, &xform);
- ret = DPtoLP(hdc, apt, 2);
- ok(ret == 1, "Expected ret == 0, got %d\n", ret);
- ok_int(apt[0].x, -429);
- ok_int(apt[0].y, -47);
- ok_int(apt[1].x, -429);
- ok_int(apt[1].y, -43881);
+ ok_int(SetWorldTransform(hdc, &xform), 1);
+ ok_int(DPtoLP(hdc, apt, 2), 1);
+ ok_int(apt[0].x * lLogPixelsX, -41184 );
+ ok_int(apt[0].y * lLogPixelsY, -86784 );
+ ok_int(apt[1].x * lLogPixelsX, -41184 );
+ ok_int(apt[1].y * lLogPixelsY, -338784 );
+ apt[0].x = 100; apt[0].y = 256; apt[1].x = -1000; apt[1].y = 1000;
xform.eM11 = 1.;
- xform.eDx = 4294967167.999999762; // this is too big
- ret = SetWorldTransform(hdc, &xform);
- ok(ret == 1, "ret\n");
- ret = DPtoLP(hdc, apt, 2);
- ok(ret == 0, "Expected ret == 0, got %d\n", ret);
- ok_int(apt[0].x, -429);
- ok_int(apt[0].y, -47);
- ok_int(apt[1].x, -429);
- ok_int(apt[1].y, -43881);
+ xform.eDx = (FLOAT)4294967167.999999762; // this is too big
+ ok_int(SetWorldTransform(hdc, &xform), 1);
+ ok_int(DPtoLP(hdc, apt, 2), 0);
+ ok_int(apt[0].x, 100 );
+ ok_int(apt[0].y, 256 );
+ ok_int(apt[1].x, -1000 );
+ ok_int(apt[1].y, 1000 );
xform.eM11 = 2.;
- xform.eDx = 4294967167.999999762;
- ret = SetWorldTransform(hdc, &xform);
- ok(ret == 1, "ret\n");
- ret = DPtoLP(hdc, apt, 2);
- ok(ret == 1, "Expected ret == 1, got %d\n", ret);
- ok_int(apt[0].x, 2147482891);
- ok_int(apt[0].y, 165);
- ok_int(apt[1].x, 2147482891);
- ok_int(apt[1].y, 154782);
+ xform.eDx = (FLOAT)4294967167.999999762;
+ ok_int(SetWorldTransform(hdc, &xform), 1);
+ ok_int(DPtoLP(hdc, apt, 2), 1);
+ ok_int(apt[0].x * lLogPixelsX, 16896 );
+ ok_int(apt[0].y * lLogPixelsY, -86784 );
+ ok_int(apt[1].x * lLogPixelsX, -169344 );
+ ok_int(apt[1].y * lLogPixelsY, -338784 );
- apt[0].x = 1;
- apt[0].y = 1;
- apt[1].x = -1000;
- apt[1].y = 1000;
-
+ apt[0].x = 100; apt[0].y = 256; apt[1].x = -1000; apt[1].y = 1000;
xform.eM11 = 10000000.;
- ret = SetWorldTransform(hdc, &xform);
- ok(ret == 1, "ret\n");
- ret = DPtoLP(hdc, apt, 2);
- ok(ret == 1, "Expected ret == 1, got %d\n", ret);
- ok_int(apt[0].x, -429);
- ok_int(apt[0].y, -5);
- ok_int(apt[1].x, -429);
- ok_int(apt[1].y, -3528);
+ ok_int(SetWorldTransform(hdc, &xform), 1);
+ ok_int(DPtoLP(hdc, apt, 2), 1);
+ ok_int(apt[0].x * lLogPixelsX, -41184 );
+ ok_int(apt[0].y * lLogPixelsY, -86784 );
+ ok_int(apt[1].x * lLogPixelsX, -41184 );
+ ok_int(apt[1].y * lLogPixelsY, -338784 );
xform.eM11 = 1000000.;
- ret = SetWorldTransform(hdc, &xform);
- ok(ret == 1, "ret\n");
- ret = DPtoLP(hdc, apt, 2);
- ok(ret == 1, "Expected ret == 1, got %d\n", ret);
- ok_int(apt[0].x, -4295);
- ok_int(apt[0].y, 17);
- ok_int(apt[1].x, -4295);
- ok_int(apt[1].y, 12443);
+ ok_int(SetWorldTransform(hdc, &xform), 1);
+ ok_int(DPtoLP(hdc, apt, 2), 1);
+ ok_int(apt[0].x * lLogPixelsX, -412320 );
+ ok_int(apt[0].y * lLogPixelsY, 306048 );
+ ok_int(apt[1].x * lLogPixelsX, -412320 );
+ ok_int(apt[1].y * lLogPixelsY, 1195104 );
ReleaseDC(0, hdc);
}
Modified: trunk/rostests/apitests/gdi32/GetObject.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/GetObject.…
==============================================================================
--- trunk/rostests/apitests/gdi32/GetObject.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/gdi32/GetObject.c [iso-8859-1] Sat May 5 14:19:22 2012
@@ -127,15 +127,15 @@
//ok(GetObject(hBrush, sizeof(LOGBRUSH), plogbrush) == 0, "\n"); // fails on
win7
/* Test invalid buffer */
- SetLastError(ERROR_SUCCESS);
+ SetLastError(0xbadbad00);
ok(GetObjectA(GetStockObject(WHITE_BRUSH), sizeof(LOGBRUSH), (PVOID)0xc0000000) == 0,
"\n");
- ok(GetLastError() == ERROR_NOACCESS, "expected ERROR_NOACCESS, got %ld\n",
GetLastError());
+ ok((GetLastError() == 0xbadbad00) || (GetLastError() == ERROR_NOACCESS), "wrong
error: %ld\n", GetLastError());
SetLastError(ERROR_SUCCESS);
ok(GetObjectW(GetStockObject(BLACK_PEN), sizeof(LOGPEN), (PVOID)0xc0000000) == 0,
"\n");
- ok(GetLastError() == ERROR_NOACCESS, "expected ERROR_NOACCESS, got %ld\n",
GetLastError());
+ ok((GetLastError() == 0xbadbad00) || (GetLastError() == ERROR_NOACCESS), "wrong
error: %ld\n", GetLastError());
SetLastError(ERROR_SUCCESS);
ok(GetObjectW(GetStockObject(21), sizeof(BITMAP), (PVOID)0xc0000000) == 0,
"\n");
- ok(GetLastError() == ERROR_NOACCESS, "expected ERROR_NOACCESS, got %ld\n",
GetLastError());
+ ok((GetLastError() == 0xbadbad00) || (GetLastError() == ERROR_NOACCESS), "wrong
error: %ld\n", GetLastError());
SetLastError(ERROR_SUCCESS);
ok(GetObjectW(GetStockObject(SYSTEM_FONT), sizeof(LOGFONT), (PVOID)0xc0000000) == 0,
"\n");
ok(GetLastError() == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n",
GetLastError());
@@ -157,11 +157,11 @@
/* Test buffer size of 0 */
SetLastError(ERROR_SUCCESS);
- ok(GetObjectA(GetStockObject(WHITE_BRUSH), 0, &TestStruct) == sizeof(LOGBRUSH),
"\n");
+ ok_long(GetObjectA(GetStockObject(WHITE_BRUSH), 0, &TestStruct), sizeof(LOGBRUSH));
ok(GetLastError() == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n",
GetLastError());
SetLastError(ERROR_SUCCESS);
ok(GetObjectA(GetStockObject(BLACK_PEN), 0, &TestStruct) == 0, "\n");
- ok(GetLastError() == ERROR_NOACCESS, "expected ERROR_NOACCESS, got %ld\n",
GetLastError());
+ ok((GetLastError() == 0xbadbad00) || (GetLastError() == ERROR_NOACCESS), "wrong
error: %ld\n", GetLastError());
SetLastError(ERROR_SUCCESS);
ok(GetObjectW(GetStockObject(SYSTEM_FONT), 0, &TestStruct) == 0, "\n");
ok(GetLastError() == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n",
GetLastError());
@@ -458,7 +458,7 @@
ok(GetLastError() == ERROR_INVALID_PARAMETER, "got %ld\n", GetLastError());
SetLastError(ERROR_SUCCESS);
ok(GetObject(hPen, 0, &extlogpen) == 0, "\n");
- ok(GetLastError() == ERROR_NOACCESS, "got %ld\n", GetLastError());
+ ok((GetLastError() == 0xbadbad00) || (GetLastError() == ERROR_NOACCESS), "wrong
error: %ld\n", GetLastError());
SetLastError(ERROR_SUCCESS);
ok(GetObject(hPen, 4, &extlogpen) == 0, "\n");
ok(GetLastError() == ERROR_SUCCESS, "got %ld\n", GetLastError());
@@ -627,19 +627,18 @@
SetLastError(ERROR_SUCCESS);
GetObjectA((HANDLE)GDI_OBJECT_TYPE_COLORSPACE, 0, NULL);
//ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_COLORSPACE, 0, NULL) == 60, "\n");//
FIXME: what structure? fails on win7
- ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "\n");
+ ok_err(ERROR_INSUFFICIENT_BUFFER);
SetLastError(ERROR_SUCCESS);
ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_COLORSPACE, 0, NULL) == 0, "\n");
- ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "\n");
+ ok_err(ERROR_INSUFFICIENT_BUFFER);
SetLastError(ERROR_SUCCESS);
ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_COLORSPACE, 327, buffer) == 0, "\n");
- ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "expected
ERROR_INSUFFICIENT_BUFFER, got %ld\n", GetLastError());
+ ok_err(ERROR_INSUFFICIENT_BUFFER);
ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_COLORSPACE, 328, buffer) == 0, "\n");
- ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER,
got %ld\n", GetLastError());
-
- ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_COLORSPACE, 328, NULL) == 0, "\n");
- //ok(ret == 0, "Expected ... got %d\n", ret);
- ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "expected
ERROR_INSUFFICIENT_BUFFER, got %ld\n", GetLastError());
+ ok_err(ERROR_INVALID_PARAMETER);
+
+ ok_long(GetObjectA((HANDLE)GDI_OBJECT_TYPE_COLORSPACE, 328, NULL), 0);
+ ok_err(ERROR_INSUFFICIENT_BUFFER);
}
void