[ros-diffs] [tkreuzer] 32746: - add tests for SetWorldTransform - more tests for CreateCompatibleDC, GetClipRgn, SelectObject and SetDCPenColor

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Sat Mar 22 04:21:53 CET 2008


Author: tkreuzer
Date: Fri Mar 21 22:21:52 2008
New Revision: 32746

URL: http://svn.reactos.org/svn/reactos?rev=3D32746&view=3Drev
Log:
- add tests for SetWorldTransform =

- more tests for CreateCompatibleDC, GetClipRgn, SelectObject and SetDCPenC=
olor

Added:
    trunk/rostests/apitests/gdi32api/tests/SetWorldTransform.c   (with prop=
s)
Modified:
    trunk/rostests/apitests/gdi32api/testlist.c
    trunk/rostests/apitests/gdi32api/tests/CreateCompatibleDC.c
    trunk/rostests/apitests/gdi32api/tests/GetClipRgn.c
    trunk/rostests/apitests/gdi32api/tests/SelectObject.c
    trunk/rostests/apitests/gdi32api/tests/SetDCPenColor.c

Modified: trunk/rostests/apitests/gdi32api/testlist.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/te=
stlist.c?rev=3D32746&r1=3D32745&r2=3D32746&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/rostests/apitests/gdi32api/testlist.c (original)
+++ trunk/rostests/apitests/gdi32api/testlist.c Fri Mar 21 22:21:52 2008
@@ -18,7 +18,7 @@
 #include "tests/SelectObject.c"
 #include "tests/SetDCPenColor.c"
 #include "tests/SetSysColors.c"
-//#include "tests/SetWorldTransform.c"
+#include "tests/SetWorldTransform.c"
 =

 /* The List of tests */
 TESTENTRY TestList[] =3D
@@ -37,7 +37,7 @@
 	{ L"SetSysColors", Test_SetSysColors },
 	{ L"SelectObject", Test_SelectObject },
 	{ L"SetDCPenColor", Test_SetDCPenColor },
-//	{ L"SetWorldTransform", Test_SetWorldTransform },
+	{ L"SetWorldTransform", Test_SetWorldTransform },
 };
 =

 /* The function that gives us the number of tests */

Modified: trunk/rostests/apitests/gdi32api/tests/CreateCompatibleDC.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/te=
sts/CreateCompatibleDC.c?rev=3D32746&r1=3D32745&r2=3D32746&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/rostests/apitests/gdi32api/tests/CreateCompatibleDC.c (original)
+++ trunk/rostests/apitests/gdi32api/tests/CreateCompatibleDC.c Fri Mar 21 =
22:21:52 2008
@@ -3,12 +3,23 @@
 {
 	HDC hDCScreen, hOldDC, hDC, hDC2;
 =

-	// Create a DC
+	/* Get screen DC */
 	hDCScreen =3D GetDC(NULL);
-	if (hDCScreen =3D=3D NULL)
-	{
-		return FALSE;
-	}
+	ASSERT(hDCScreen !=3D NULL);
+
+	/* Test NULL DC handle */
+	SetLastError(ERROR_SUCCESS);
+	hDC =3D CreateCompatibleDC(NULL);
+	TEST(hDC !=3D NULL);
+	TEST(GetLastError() =3D=3D ERROR_SUCCESS);
+	if(hDC) DeleteDC(hDC);
+
+	/* Test invalid DC handle */
+	SetLastError(ERROR_SUCCESS);
+	hDC =3D CreateCompatibleDC((HDC)0x123456);
+	TEST(hDC =3D=3D NULL);
+	TEST(GetLastError() =3D=3D ERROR_SUCCESS);
+	if(hDC) DeleteDC(hDC);
 =

 	hDC =3D CreateCompatibleDC(hDCScreen);
 	RTEST(hDC !=3D NULL);

Modified: trunk/rostests/apitests/gdi32api/tests/GetClipRgn.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/te=
sts/GetClipRgn.c?rev=3D32746&r1=3D32745&r2=3D32746&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/rostests/apitests/gdi32api/tests/GetClipRgn.c (original)
+++ trunk/rostests/apitests/gdi32api/tests/GetClipRgn.c Fri Mar 21 22:21:52=
 2008
@@ -13,8 +13,15 @@
 	hDC =3D GetDC(hWnd);
 	hrgn =3D CreateRectRgn(0,0,0,0);
 =

+	/* Test invalid DC */
 	SetLastError(ERROR_SUCCESS);
-//	TEST(GetClipRgn(hDC)
+	TEST(GetClipRgn((HDC)0x12345, hrgn) =3D=3D -1);
+	TEST(GetLastError() =3D=3D ERROR_INVALID_PARAMETER);
+
+	/* Test invalid hrgn */
+	SetLastError(ERROR_SUCCESS);
+	TEST(GetClipRgn(hDC, (HRGN)0x12345) =3D=3D 0);
+	TEST(GetLastError() =3D=3D ERROR_SUCCESS);
 =

 	ReleaseDC(hWnd, hDC);
 	DestroyWindow(hWnd);

Modified: trunk/rostests/apitests/gdi32api/tests/SelectObject.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/te=
sts/SelectObject.c?rev=3D32746&r1=3D32745&r2=3D32746&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/rostests/apitests/gdi32api/tests/SelectObject.c (original)
+++ trunk/rostests/apitests/gdi32api/tests/SelectObject.c Fri Mar 21 22:21:=
52 2008
@@ -2,7 +2,7 @@
 Test_SelectObject(PTESTINFO pti)
 {
 	HGDIOBJ hOldObj, hNewObj;
-	HDC hScreenDC, hDC;
+	HDC hScreenDC, hDC, hDC2;
 	PGDI_TABLE_ENTRY pEntry;
 	PDC_ATTR pDc_Attr;
 	HANDLE hcmXform;
@@ -34,6 +34,16 @@
 	TEST(hOldObj =3D=3D GetStockObject(WHITE_BRUSH));
 	TEST(pDc_Attr->hbrush =3D=3D hNewObj);
 	SelectObject(hDC, hOldObj);
+
+	/* Test wrong hDC handle type */
+	SetLastError(ERROR_SUCCESS);
+	hNewObj =3D GetStockObject(GRAY_BRUSH);
+	hDC2 =3D (HDC)((UINT_PTR)hDC & ~GDI_HANDLE_TYPE_MASK);
+	hDC2 =3D (HDC)((UINT_PTR)hDC2 | GDI_OBJECT_TYPE_PEN);
+	hOldObj =3D SelectObject(hDC2, hNewObj);
+	TEST(GetLastError() =3D=3D ERROR_INVALID_HANDLE);
+	TEST(hOldObj =3D=3D NULL);
+	TEST(pDc_Attr->hbrush =3D=3D GetStockObject(WHITE_BRUSH));
 =

 	/* Test wrong hobj handle type */
 	SetLastError(ERROR_SUCCESS);

Modified: trunk/rostests/apitests/gdi32api/tests/SetDCPenColor.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/te=
sts/SetDCPenColor.c?rev=3D32746&r1=3D32745&r2=3D32746&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/rostests/apitests/gdi32api/tests/SetDCPenColor.c (original)
+++ trunk/rostests/apitests/gdi32api/tests/SetDCPenColor.c Fri Mar 21 22:21=
:52 2008
@@ -4,7 +4,9 @@
 	HDC hScreenDC, hDC;
 =

 	// Test an incorrect DC
+	SetLastError(ERROR_SUCCESS);
 	RTEST(SetDCPenColor(0, RGB(0,0,0)) =3D=3D CLR_INVALID);
+	TEST(GetLastError() =3D=3D ERROR_INVALID_PARAMETER);
 =

 	// Get the Screen DC
 	hScreenDC =3D GetDC(NULL);

Added: trunk/rostests/apitests/gdi32api/tests/SetWorldTransform.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/te=
sts/SetWorldTransform.c?rev=3D32746&view=3Dauto
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/rostests/apitests/gdi32api/tests/SetWorldTransform.c (added)
+++ trunk/rostests/apitests/gdi32api/tests/SetWorldTransform.c Fri Mar 21 2=
2:21:52 2008
@@ -1,0 +1,20 @@
+INT
+Test_SetWorldTransform(PTESTINFO pti)
+{
+	PGDI_TABLE_ENTRY pEntry;
+	HDC hScreenDC, hDC;
+	DC_ATTR* pDC_Attr;
+
+	/* Create a DC */
+	hScreenDC =3D GetDC(NULL);
+	hDC =3D CreateCompatibleDC(hScreenDC);
+	ReleaseDC(NULL, hScreenDC);
+	SetGraphicsMode(hDC, GM_ADVANCED);
+
+	pEntry =3D GdiHandleTable + GDI_HANDLE_GET_INDEX(hDC);
+	pDC_Attr =3D pEntry->UserData;
+
+	DeleteDC(hDC);
+
+	return APISTATUS_NORMAL;
+}

Propchange: trunk/rostests/apitests/gdi32api/tests/SetWorldTransform.c
---------------------------------------------------------------------------=
---
    svn:eol-style =3D native




More information about the Ros-diffs mailing list