Author: tkreuzer
Date: Wed May 2 02:08:34 2007
New Revision: 26620
URL:
http://svn.reactos.org/svn/reactos?rev=26620&view=rev
Log:
update gdi32_test
- fix #line ...
- add more tests
Modified:
trunk/rostests/win32/gdi32/tests/CreateCompatibleDC.c
trunk/rostests/win32/gdi32/tests/CreatePen.c
trunk/rostests/win32/gdi32/tests/ExtCreatePen.c
trunk/rostests/win32/gdi32/tests/GetObject.c
trunk/rostests/win32/gdi32/tests/GetStockObject.c
trunk/rostests/win32/gdi32/tests/SelectObject.c
trunk/rostests/win32/gdi32/tests/SetDCPenColor.c
trunk/rostests/win32/gdi32/tests/SetSysColors.c
Modified: trunk/rostests/win32/gdi32/tests/CreateCompatibleDC.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/win32/gdi32/tests/CreateC…
==============================================================================
--- trunk/rostests/win32/gdi32/tests/CreateCompatibleDC.c (original)
+++ trunk/rostests/win32/gdi32/tests/CreateCompatibleDC.c Wed May 2 02:08:34 2007
@@ -1,4 +1,4 @@
-#line 1 "CreateCompatibleDC.c"
+#line 2 "CreateCompatibleDC.c"
#include "..\gditest.h"
Modified: trunk/rostests/win32/gdi32/tests/CreatePen.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/win32/gdi32/tests/CreateP…
==============================================================================
--- trunk/rostests/win32/gdi32/tests/CreatePen.c (original)
+++ trunk/rostests/win32/gdi32/tests/CreatePen.c Wed May 2 02:08:34 2007
@@ -1,4 +1,4 @@
-#line 1 "CreatePen.c"
+#line 2 "CreatePen.c"
#include "..\gditest.h"
@@ -6,14 +6,56 @@
Test_CreatePen(INT* passed, INT* failed)
{
HPEN hPen;
+ LOGPEN logpen;
- hPen = CreatePen(PS_COSMETIC, 1, RGB(1,2,3));
- if (!hPen) return FALSE;
+ SetLastError(ERROR_SUCCESS);
+
+ hPen = CreatePen(PS_DASHDOT, 5, RGB(1,2,3));
+ TEST(hPen);
/* Test if we have a PEN */
TEST(GDI_HANDLE_GET_TYPE(hPen) == GDI_OBJECT_TYPE_PEN);
-
+
+ GetObject(hPen, sizeof(logpen), &logpen);
+ TEST(logpen.lopnStyle == PS_DASHDOT);
+ TEST(logpen.lopnWidth.x == 5);
+ TEST(logpen.lopnColor == RGB(1,2,3));
DeleteObject(hPen);
+
+ /* PS_GEOMETRIC | PS_DASHDOT = 0x00001011 will become PS_SOLID */
+ logpen.lopnStyle = 22;
+ hPen = CreatePen(PS_GEOMETRIC | PS_DASHDOT, 5, RGB(1,2,3));
+ TEST(hPen);
+ GetObject(hPen, sizeof(logpen), &logpen);
+ TEST(logpen.lopnStyle == PS_SOLID);
+ DeleteObject(hPen);
+
+ /* PS_USERSTYLE will become PS_SOLID */
+ logpen.lopnStyle = 22;
+ hPen = CreatePen(PS_USERSTYLE, 5, RGB(1,2,3));
+ TEST(hPen);
+ GetObject(hPen, sizeof(logpen), &logpen);
+ TEST(logpen.lopnStyle == PS_SOLID);
+ DeleteObject(hPen);
+
+ /* PS_ALTERNATE will become PS_SOLID */
+ logpen.lopnStyle = 22;
+ hPen = CreatePen(PS_ALTERNATE, 5, RGB(1,2,3));
+ TEST(hPen);
+ GetObject(hPen, sizeof(logpen), &logpen);
+ TEST(logpen.lopnStyle == PS_SOLID);
+ DeleteObject(hPen);
+
+ /* PS_INSIDEFRAME is ok */
+ logpen.lopnStyle = 22;
+ hPen = CreatePen(PS_INSIDEFRAME, 5, RGB(1,2,3));
+ TEST(hPen);
+ GetObject(hPen, sizeof(logpen), &logpen);
+ TEST(logpen.lopnStyle == PS_INSIDEFRAME);
+ DeleteObject(hPen);
+
+ TEST(GetLastError() == ERROR_SUCCESS);
+
return TRUE;
}
Modified: trunk/rostests/win32/gdi32/tests/ExtCreatePen.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/win32/gdi32/tests/ExtCrea…
==============================================================================
--- trunk/rostests/win32/gdi32/tests/ExtCreatePen.c (original)
+++ trunk/rostests/win32/gdi32/tests/ExtCreatePen.c Wed May 2 02:08:34 2007
@@ -1,3 +1,5 @@
+#line 2 "ExtCreatePen.c"
+
#include "..\gditest.h"
BOOL
@@ -5,6 +7,7 @@
{
HPEN hPen;
LOGBRUSH logbrush;
+ DWORD dwStyles[17] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17};
logbrush.lbStyle = BS_SOLID;
logbrush.lbColor = RGB(1,2,3);
@@ -14,9 +17,16 @@
/* Test if we have an EXTPEN */
TEST(GDI_HANDLE_GET_TYPE(hPen) == GDI_OBJECT_TYPE_EXTPEN);
+ DeleteObject(hPen);
-
+ /* test userstyles */
+ hPen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 5, &logbrush, 17, (CONST
DWORD*)&dwStyles);
+ TEST(hPen == 0);
+ hPen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 5, &logbrush, 16, (CONST
DWORD*)&dwStyles);
+ TEST(hPen != 0);
+
DeleteObject(hPen);
+
return TRUE;
}
Modified: trunk/rostests/win32/gdi32/tests/GetObject.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/win32/gdi32/tests/GetObje…
==============================================================================
--- trunk/rostests/win32/gdi32/tests/GetObject.c (original)
+++ trunk/rostests/win32/gdi32/tests/GetObject.c Wed May 2 02:08:34 2007
@@ -1,4 +1,4 @@
-#line 1 "GetObject.c"
+#line 2 "GetObject.c"
#include "..\gditest.h"
@@ -213,11 +213,16 @@
TEST(GetObject(hPen, 5, NULL) == sizeof(LOGPEN));
TEST(GetObject(hPen, -5, NULL) == sizeof(LOGPEN));
TEST(GetObject(hPen, sizeof(LOGPEN), &logpen) == sizeof(LOGPEN));
+ TEST(GetObject(hPen, sizeof(LOGPEN)-1, &logpen) == 0);
TEST(GetObject(hPen, sizeof(LOGPEN)+2, &logpen) == sizeof(LOGPEN));
TEST(GetObject(hPen, 0, &logpen) == 0);
- TEST(GetObject(hPen, 5, &logpen) == 0);
TEST(GetObject(hPen, -5, &logpen) == sizeof(LOGPEN));
TEST(GetLastError() == ERROR_SUCCESS);
+
+ /* test if the fields are filled correctly */
+ TEST(logpen.lopnStyle == PS_SOLID);
+
+
DeleteObject(hPen);
return TRUE;
}
@@ -227,6 +232,12 @@
HPEN hPen;
EXTLOGPEN extlogpen;
LOGBRUSH logbrush;
+ DWORD dwStyles[17] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
+ struct
+ {
+ EXTLOGPEN extlogpen;
+ DWORD dwStyles[50];
+ } elpUserStyle;
SetLastError(ERROR_SUCCESS);
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_EXTPEN, 0, NULL) == 0);
@@ -236,8 +247,8 @@
FillMemory(&extlogpen, sizeof(EXTLOGPEN), 0x77);
logbrush.lbStyle = BS_SOLID;
logbrush.lbColor = RGB(1,2,3);
- logbrush.lbHatch = 0;
- hPen = ExtCreatePen(PS_GEOMETRIC | PS_SOLID, 5, &logbrush, 0, NULL);
+ logbrush.lbHatch = 22;
+ hPen = ExtCreatePen(PS_GEOMETRIC | PS_DASH, 5, &logbrush, 0, NULL);
TEST(GDI_HANDLE_GET_TYPE(hPen) == GDI_OBJECT_TYPE_EXTPEN);
TEST(GetObject((HANDLE)GDI_OBJECT_TYPE_EXTPEN, 0, NULL) == 0);
@@ -254,17 +265,29 @@
TEST(extlogpen.elpWidth == 0x77777777);
TEST(GetObject(hPen, sizeof(EXTLOGPEN), &extlogpen) ==
sizeof(EXTLOGPEN)-sizeof(DWORD));
+ TEST(GetObject(hPen, sizeof(EXTLOGPEN)-sizeof(DWORD), &extlogpen) ==
sizeof(EXTLOGPEN)-sizeof(DWORD));
+ TEST(GetObject(hPen, sizeof(EXTLOGPEN)-sizeof(DWORD)-1, &extlogpen) == 0);
TEST(GetObject(hPen, sizeof(EXTLOGPEN)+2, &extlogpen) ==
sizeof(EXTLOGPEN)-sizeof(DWORD));
TEST(GetObject(hPen, -5, &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD));
/* test if the fields are filled correctly */
- TEST(extlogpen.elpPenStyle == PS_GEOMETRIC);
+ TEST(extlogpen.elpPenStyle == (PS_GEOMETRIC | PS_DASH));
TEST(extlogpen.elpWidth == 5);
TEST(extlogpen.elpBrushStyle == 0);
TEST(extlogpen.elpColor == RGB(1,2,3));
- TEST(extlogpen.elpHatch == 0);
+ TEST(extlogpen.elpHatch == 22);
TEST(extlogpen.elpNumEntries == 0);
DeleteObject(hPen);
+
+ /* A maximum of 16 Styles is allowed */
+ hPen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 5, &logbrush, 16, (CONST
DWORD*)&dwStyles);
+ TEST(GetObject(hPen, 0, NULL) == sizeof(EXTLOGPEN) + 15*sizeof(DWORD));
+ TEST(GetObject(hPen, sizeof(EXTLOGPEN) + 15*sizeof(DWORD), &elpUserStyle) ==
sizeof(EXTLOGPEN) + 15*sizeof(DWORD));
+ TEST(((EXTLOGPEN*)&elpUserStyle)->elpStyleEntry[0] == 0);
+ TEST(((EXTLOGPEN*)&elpUserStyle)->elpStyleEntry[1] == 1);
+ TEST(((EXTLOGPEN*)&elpUserStyle)->elpStyleEntry[15] == 15);
+ DeleteObject(hPen);
+
return TRUE;
}
@@ -402,7 +425,7 @@
TEST(GetLastError() == ERROR_INVALID_HANDLE);
DeleteObject(hRgn);
-// Test_Font(passed, failed);
+ Test_Font(passed, failed);
Test_Colorspace(passed, failed);
Test_General(passed, failed);
Test_Bitmap(passed, failed);
@@ -410,7 +433,7 @@
Test_Palette(passed, failed);
Test_Brush(passed, failed);
Test_Pen(passed, failed);
-// Test_ExtPen(passed, failed); // not implemented yet in ROS
+ Test_ExtPen(passed, failed); // not implemented yet in ROS
Test_MetaDC(passed, failed);
return TRUE;
Modified: trunk/rostests/win32/gdi32/tests/GetStockObject.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/win32/gdi32/tests/GetStoc…
==============================================================================
--- trunk/rostests/win32/gdi32/tests/GetStockObject.c (original)
+++ trunk/rostests/win32/gdi32/tests/GetStockObject.c Wed May 2 02:08:34 2007
@@ -1,4 +1,4 @@
-#line 1 "GetStockObject.c"
+#line 2 "GetStockObject.c"
#include "..\gditest.h"
Modified: trunk/rostests/win32/gdi32/tests/SelectObject.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/win32/gdi32/tests/SelectO…
==============================================================================
--- trunk/rostests/win32/gdi32/tests/SelectObject.c (original)
+++ trunk/rostests/win32/gdi32/tests/SelectObject.c Wed May 2 02:08:34 2007
@@ -1,4 +1,4 @@
-#line 1 "SelectObject.c"
+#line 2 "SelectObject.c"
#include "..\gditest.h"
Modified: trunk/rostests/win32/gdi32/tests/SetDCPenColor.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/win32/gdi32/tests/SetDCPe…
==============================================================================
--- trunk/rostests/win32/gdi32/tests/SetDCPenColor.c (original)
+++ trunk/rostests/win32/gdi32/tests/SetDCPenColor.c Wed May 2 02:08:34 2007
@@ -1,4 +1,4 @@
-#line 1 "SetDCPenColor.c"
+#line 2 "SetDCPenColor.c"
#include "..\gditest.h"
Modified: trunk/rostests/win32/gdi32/tests/SetSysColors.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/win32/gdi32/tests/SetSysC…
==============================================================================
--- trunk/rostests/win32/gdi32/tests/SetSysColors.c (original)
+++ trunk/rostests/win32/gdi32/tests/SetSysColors.c Wed May 2 02:08:34 2007
@@ -1,4 +1,4 @@
-#line 1 "SetSysColors.c"
+#line 2 "SetSysColors.c"
#include "..\gditest.h"