Author: tkreuzer
Date: Sun Dec 30 13:21:52 2012
New Revision: 58054
URL:
http://svn.reactos.org/svn/reactos?rev=58054&view=rev
Log:
[GDI32_APITEST]
Fix a warning and improve code.
Modified:
trunk/rostests/apitests/gdi32/CombineTransform.c
trunk/rostests/apitests/gdi32/SetDCPenColor.c
Modified: trunk/rostests/apitests/gdi32/CombineTransform.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/CombineTra…
==============================================================================
--- trunk/rostests/apitests/gdi32/CombineTransform.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/gdi32/CombineTransform.c [iso-8859-1] Sun Dec 30 13:21:52
2012
@@ -51,26 +51,21 @@
void Test_CombineTransform()
{
XFORM xform1, xform2, xform3;
- BOOL ret;
/* Test NULL paramters */
set_xform(&xform1, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
set_xform(&xform2, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
SetLastError(ERROR_SUCCESS);
- ret = CombineTransform(&xform3, &xform1, NULL);
- ok_int(ret, 0);
- ret = CombineTransform(&xform3, NULL, &xform2);
- ok_int(ret, 0);
- ret = CombineTransform(NULL, &xform1, &xform2);
- ok_int(ret, 0);
+ ok_int(CombineTransform(&xform3, &xform1, NULL), 0);
+ ok_int(CombineTransform(&xform3, NULL, &xform2), 0);
+ ok_int(CombineTransform(NULL, &xform1, &xform2), 0);
ok_int(GetLastError(), ERROR_SUCCESS);
/* 2 zero matrices */
set_xform(&xform1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
set_xform(&xform2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
SetLastError(ERROR_SUCCESS);
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 1);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_xform(xform3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
ok_int(GetLastError(), ERROR_SUCCESS);
@@ -78,49 +73,42 @@
set_xform(&xform1, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
set_xform(&xform2, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
SetLastError(ERROR_SUCCESS);
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 1);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_xform(xform3, 1.0, 0., 0., 1.0, 0., 0.);
ok_int(GetLastError(), ERROR_SUCCESS);
/* 2 Identity matrices with offsets */
set_xform(&xform1, 1.0, 0.0, 0.0, 1.0, 20.0, -100.0);
set_xform(&xform2, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 1);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_xform(xform3, 1.0, 0., 0., 1.0, 20.0, -100.0);
xform2.eDx = -60.0;
xform2.eDy = -20;
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 1);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_flt(xform3.eDx, -40.0);
ok_flt(xform3.eDy, -120.0);
/* add some stretching */
xform2.eM11 = 2;
xform2.eM22 = 4;
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 1);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_xform(xform3, 2.0, 0., 0., 4.0, -20.0, -420.0);
/* add some more stretching */
xform1.eM11 = -2.5;
xform1.eM22 = 0.5;
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 1);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_xform(xform3, -5.0, 0., 0., 2.0, -20.0, -420.0);
xform1.eM12 = 2.0;
xform1.eM21 = -0.5;
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 1);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_xform(xform3, -5.0, 8.0, -1.0, 2.0, -20.0, -420.0);
xform2.eM12 = 4.0;
xform2.eM21 = 6.5;
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 1);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_xform(xform3, 8.0, -2.0, 2.25, 0.0, -670.0, -340.0);
set_xform(&xform1, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
@@ -128,124 +116,105 @@
set_xform(&xform3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
xform1.eDx = (FLOAT)4294967167.999999761;
ok(xform1.eDx == 4294967040.0, "float rounding error.\n");
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok(ret == 1, "expected ret = 1, got %d\n", ret);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_xform(xform3, 1.0, 0.0, 0.0, 1.0, 4294967040.0, 0.0);
set_xform(&xform3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
xform1.eDx = (FLOAT)4294967167.999999762;
ok(xform1.eDx == 4294967296.0, "float rounding error.\n");
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 0);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 0);
ok_int(GetLastError(), ERROR_SUCCESS);
ok_xform(xform3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
xform1.eDx = (FLOAT)-4294967167.999999761;
ok(xform1.eDx == -4294967040.0, "float rounding error.\n");
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 1);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
xform1.eDx = (FLOAT)-4294967167.999999762;
ok(xform1.eDx == -4294967296.0, "float rounding error.\n");
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 0);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 0);
ok_int(GetLastError(), ERROR_SUCCESS);
xform1.eDx = 0;
xform1.eDy = (FLOAT)4294967167.999999761;
ok(xform1.eDy == 4294967040.0, "float rounding error.\n");
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 1);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
xform2.eDy = 1;
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 1);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_flt(xform3.eDy, 4294967040.0);
xform1.eDy = (FLOAT)4294967167.999999762;
ok(xform1.eDy == 4294967296.0, "float rounding error.\n");
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 0);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 0);
ok_int(GetLastError(), ERROR_SUCCESS);
xform1.eDy = (FLOAT)-4294967167.999999761;
ok(xform1.eDy == -4294967040.0, "float rounding error.\n");
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 1);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
xform1.eDy = (FLOAT)-4294967167.999999762;
ok(xform1.eDy == -4294967296.0, "float rounding error.\n");
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 0);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 0);
ok_int(GetLastError(), ERROR_SUCCESS);
xform2.eDy = 10000;
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 1);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
set_xform(&xform1, 1000.0, 0.0, 0.0, 0.0, 0.0, 0.0);
xform1.eDx = (FLOAT)-4294967167.999999762;
xform2.eM11 = 1000.0;
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 0);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 0);
ok_int(GetLastError(), ERROR_SUCCESS);
xform1.eDx = 100000.0;
xform2.eM11 = 100000.0;
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 0);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 0);
ok_int(GetLastError(), ERROR_SUCCESS);
/* Some undefined values */
set_xform(&xform1, geIND, 0.0, 0.0, geINF, 0.0, 0.0);
xform2 = xform1;
SetLastError(ERROR_SUCCESS);
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 1);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_xform(xform3, geIND, 0.0, 0.0, geINF, 0.0, 0.0);
ok_int(GetLastError(), ERROR_SUCCESS);
set_xform(&xform2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0);
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 1);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_xform(xform3, geIND, geIND, geINF, geINF, 0.0, 0.0);
ok_int(GetLastError(), ERROR_SUCCESS);
set_xform(&xform1, (FLOAT)18446743500000000000.0, 0.0, 1.0, 0.0, 0.0, 0.0);
xform2 = xform1;
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 1);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_flt(xform3.eM11, 340282326356119260000000000000000000000.0);
xform1.eM11 = (FLOAT)18446745000000000000.0;
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 1);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_flt(xform3.eM11, 340282346638528860000000000000000000000.0);
xform1.eM11 = (FLOAT)18446746000000000000.0;
- ret = CombineTransform(&xform3, &xform1, &xform2);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_long(*(DWORD*)&xform3.eM11, 0x7f800000);
/* zero matrix + 1 invalid */
set_xform(&xform1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
set_xform(&xform2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
*(DWORD*)&xform2.eM22 = 0x7f800000; // (0.0F/0.0F)
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 1);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_xform(xform3, 0.0, 0.0, 0.0, geIND, 0.0, 0.0);
/* zero matrix + 1 invalid */
xform2 = xform1;
*(DWORD*)&xform2.eM12 = 0x7f800000; // (0.0F/0.0F)
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 1);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_xform(xform3, 0.0, geIND, 0.0, geIND, 0.0, 0.0);
/* Some undefined values */
set_xform(&xform1, 0.0, geIND, 0.0, 0.0, 0.0, 0.0);
set_xform(&xform2, geIND, 0.0, 0.0, geINF, 0.0, 0.0);
- ret = CombineTransform(&xform3, &xform1, &xform2);
- ok_int(ret, 1);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_xform(xform3, geIND, geIND, geIND, geIND, 0.0, 0.0);
}
@@ -253,70 +222,69 @@
void Test_CombineTransform_Inval(float eInval, float eOut)
{
XFORM xform1, xform2, xform3;
- BOOL ret;
/* zero matrix / M11 invalid */
set_xform(&xform1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
set_xform(&xform2, eInval, 0.0, 0.0, 0.0, 0.0, 0.0);
- ret = CombineTransform(&xform3, &xform1, &xform2);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_xform(xform3, eOut, 0.0, 0.0, 0.0, 0.0, 0.0); // -> M21
- ret = CombineTransform(&xform3, &xform2, &xform1);
+ ok_int(CombineTransform(&xform3, &xform2, &xform1), 1);
ok_xform(xform3, eOut, 0.0, 0.0, 0.0, 0.0, 0.0); // -> M12
/* zero matrix / M12 invalid */
set_xform(&xform1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
set_xform(&xform2, 0.0, eInval, 0.0, 0.0, 0.0, 0.0);
- ret = CombineTransform(&xform3, &xform1, &xform2);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_xform(xform3, 0.0, eOut, 0.0, eOut, 0.0, 0.0);
- ret = CombineTransform(&xform3, &xform2, &xform1);
+ ok_int(CombineTransform(&xform3, &xform2, &xform1), 1);
ok_xform(xform3, eOut, eOut, 0.0, 0.0, 0.0, 0.0);
/* zero matrix / M21 invalid */
set_xform(&xform1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
set_xform(&xform2, 0.0, 0.0, eInval, 0.0, 0.0, 0.0);
- ret = CombineTransform(&xform3, &xform1, &xform2);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_xform(xform3, eOut, 0.0, eOut, 0.0, 0.0, 0.0);
- ret = CombineTransform(&xform3, &xform2, &xform1);
+ ok_int(CombineTransform(&xform3, &xform2, &xform1), 1);
ok_xform(xform3, 0.0, 0.0, eOut, eOut, 0.0, 0.0);
/* zero matrix / M22 invalid */
set_xform(&xform1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
set_xform(&xform2, 0.0, 0.0, 0.0, eInval, 0.0, 0.0);
- ret = CombineTransform(&xform3, &xform1, &xform2);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_xform(xform3, 0.0, 0.0, 0.0, eOut, 0.0, 0.0); // -> M12
- ret = CombineTransform(&xform3, &xform2, &xform1);
+ ok_int(CombineTransform(&xform3, &xform2, &xform1), 1);
ok_xform(xform3, 0.0, 0.0, 0.0, eOut, 0.0, 0.0); // -> M21
/* zero matrix / M11,M12 invalid */
set_xform(&xform1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
set_xform(&xform2, eInval, eInval, 0.0, 0.0, 0.0, 0.0);
- ret = CombineTransform(&xform3, &xform1, &xform2);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_xform(xform3, eOut, eOut, eOut, eOut, 0.0, 0.0);
- ret = CombineTransform(&xform3, &xform2, &xform1);
+ ok_int(CombineTransform(&xform3, &xform2, &xform1), 1);
ok_xform(xform3, eOut, eOut, 0.0, 0.0, 0.0, 0.0);
/* zero matrix / M11,M21 invalid */
set_xform(&xform1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
set_xform(&xform2, eInval, 0.0, eInval, 0.0, 0.0, 0.0);
- ret = CombineTransform(&xform3, &xform1, &xform2);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_xform(xform3, eOut, 0.0, eOut, 0.0, 0.0, 0.0);
- ret = CombineTransform(&xform3, &xform2, &xform1);
+ ok_int(CombineTransform(&xform3, &xform2, &xform1), 1);
ok_xform(xform3, eOut, eOut, eOut, eOut, 0.0, 0.0);
/* zero matrix / M11,M22 invalid */
set_xform(&xform1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
set_xform(&xform2, eInval, 0.0, 0.0, eInval, 0.0, 0.0);
- ret = CombineTransform(&xform3, &xform1, &xform2);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_xform(xform3, eOut, 0.0, 0.0, eOut, 0.0, 0.0); // -> M12, M21
- ret = CombineTransform(&xform3, &xform2, &xform1);
+ ok_int(CombineTransform(&xform3, &xform2, &xform1), 1);
ok_xform(xform3, eOut, 0.0, 0.0, eOut, 0.0, 0.0);
/* zero matrix / M12,M21 invalid */
set_xform(&xform1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
set_xform(&xform2, 0.0, eInval, eInval, 0.0, 0.0, 0.0);
- ret = CombineTransform(&xform3, &xform1, &xform2);
+ ok_int(CombineTransform(&xform3, &xform1, &xform2), 1);
ok_xform(xform3, eOut, eOut, eOut, eOut, 0.0, 0.0);
- ret = CombineTransform(&xform3, &xform2, &xform1);
+ ok_int(CombineTransform(&xform3, &xform2, &xform1), 1);
ok_xform(xform3, eOut, eOut, eOut, eOut, 0.0, 0.0);
}
Modified: trunk/rostests/apitests/gdi32/SetDCPenColor.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/SetDCPenCo…
==============================================================================
--- trunk/rostests/apitests/gdi32/SetDCPenColor.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/gdi32/SetDCPenColor.c [iso-8859-1] Sun Dec 30 13:21:52 2012
@@ -60,6 +60,7 @@
#endif
// Delete the DC
+ SelectObject(hDC, hbmpOld);
DeleteDC(hDC);
}