mirror of
https://github.com/reactos/reactos.git
synced 2025-05-30 06:28:34 +00:00
[GDI32_APITEST]
- Try to fix some more test fails on win 2003 svn path=/trunk/; revision=56512
This commit is contained in:
parent
da7a389957
commit
2d7b85a68d
2 changed files with 86 additions and 110 deletions
|
@ -11,7 +11,6 @@
|
|||
|
||||
void Test_DPtoLP_Params()
|
||||
{
|
||||
BOOL ret;
|
||||
HDC hdc;
|
||||
POINT apt[2];
|
||||
|
||||
|
@ -21,53 +20,43 @@ void Test_DPtoLP_Params()
|
|||
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_Params()
|
|||
|
||||
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 @@ void Test_DPtoLP()
|
|||
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 @@ void Test_DPtoLP()
|
|||
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);
|
||||
|
||||
apt[0].x = 1;
|
||||
apt[0].y = 1;
|
||||
apt[1].x = -1000;
|
||||
apt[1].y = 1000;
|
||||
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 = 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);
|
||||
}
|
||||
|
|
|
@ -127,15 +127,15 @@ Test_General(void)
|
|||
//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_General(void)
|
|||
|
||||
/* 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 @@ Test_ExtPen(void)
|
|||
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 @@ Test_Colorspace(void)
|
|||
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_err(ERROR_INVALID_PARAMETER);
|
||||
|
||||
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_long(GetObjectA((HANDLE)GDI_OBJECT_TYPE_COLORSPACE, 328, NULL), 0);
|
||||
ok_err(ERROR_INSUFFICIENT_BUFFER);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue