Author: greatlrd
Date: Sat May 10 10:21:49 2008
New Revision: 33409
URL:
http://svn.reactos.org/svn/reactos?rev=33409&view=rev
Log:
adding more testcase for NtGdiGetStockObject it testing what type for gdi object the
handle return now and we manger figout what type of handle the value 20 and value 21
NtGdiGetStockObject(20) == GDI_OBJECT_TYPE_COLORSPACE
NtGdiGetStockObject(21) == GDI_OBJECT_TYPE_BITMAP
Modified:
trunk/rostests/apitests/w32knapi/ntgdi/NtGdiGetStockObject.c
Modified: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiGetStockObject.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/ntgdi/N…
==============================================================================
--- trunk/rostests/apitests/w32knapi/ntgdi/NtGdiGetStockObject.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/w32knapi/ntgdi/NtGdiGetStockObject.c [iso-8859-1] Sat May 10
10:21:49 2008
@@ -2,28 +2,123 @@
INT
Test_NtGdiGetStockObject(PTESTINFO pti)
{
- RTEST(NtGdiGetStockObject(WHITE_BRUSH) != 0);
- RTEST(NtGdiGetStockObject(LTGRAY_BRUSH) != 0);
- RTEST(NtGdiGetStockObject(GRAY_BRUSH) != 0);
- RTEST(NtGdiGetStockObject(DKGRAY_BRUSH) != 0);
- RTEST(NtGdiGetStockObject(BLACK_BRUSH) != 0);
- RTEST(NtGdiGetStockObject(NULL_BRUSH) != 0);
- RTEST(NtGdiGetStockObject(WHITE_PEN) != 0);
- RTEST(NtGdiGetStockObject(BLACK_PEN) != 0);
- RTEST(NtGdiGetStockObject(NULL_PEN) != 0);
+ HANDLE handle = NULL;
+
+ /* BRUSH testing */
+ handle = (HANDLE) NtGdiGetStockObject(WHITE_BRUSH);
+ RTEST(handle != 0);
+ RTEST(GDI_HANDLE_GET_TYPE(handle) == GDI_OBJECT_TYPE_BRUSH);
+ RTEST(GDI_HANDLE_IS_STOCKOBJ(handle) == TRUE);
+
+ handle = (HANDLE) NtGdiGetStockObject(LTGRAY_BRUSH);
+ RTEST(handle != 0);
+ RTEST(GDI_HANDLE_GET_TYPE(handle) == GDI_OBJECT_TYPE_BRUSH);
+ RTEST(GDI_HANDLE_IS_STOCKOBJ(handle) == TRUE);
+
+ handle = (HANDLE) NtGdiGetStockObject(GRAY_BRUSH);
+ RTEST(handle != 0);
+ RTEST(GDI_HANDLE_GET_TYPE(handle) == GDI_OBJECT_TYPE_BRUSH);
+ RTEST(GDI_HANDLE_IS_STOCKOBJ(handle) == TRUE);
+
+ handle = (HANDLE) NtGdiGetStockObject(DKGRAY_BRUSH);
+ RTEST(handle != 0);
+ RTEST(GDI_HANDLE_GET_TYPE(handle) == GDI_OBJECT_TYPE_BRUSH);
+ RTEST(GDI_HANDLE_IS_STOCKOBJ(handle) == TRUE);
+
+ handle = (HANDLE) NtGdiGetStockObject(BLACK_BRUSH);
+ RTEST(handle != 0);
+ RTEST(GDI_HANDLE_GET_TYPE(handle) == GDI_OBJECT_TYPE_BRUSH);
+ RTEST(GDI_HANDLE_IS_STOCKOBJ(handle) == TRUE);
+
+ handle = (HANDLE) NtGdiGetStockObject(NULL_BRUSH);
+ RTEST(handle != 0);
+ RTEST(GDI_HANDLE_GET_TYPE(handle) == GDI_OBJECT_TYPE_BRUSH);
+ RTEST(GDI_HANDLE_IS_STOCKOBJ(handle) == TRUE);
+
+ /* PEN testing */
+ handle = (HANDLE) NtGdiGetStockObject(WHITE_PEN);
+ RTEST(handle != 0);
+ RTEST(GDI_HANDLE_GET_TYPE(handle) == GDI_OBJECT_TYPE_PEN);
+ RTEST(GDI_HANDLE_IS_STOCKOBJ(handle) != 0);
+
+ handle = (HANDLE) NtGdiGetStockObject(BLACK_PEN);
+ RTEST(handle != 0);
+ RTEST(GDI_HANDLE_GET_TYPE(handle) == GDI_OBJECT_TYPE_PEN);
+ RTEST(GDI_HANDLE_IS_STOCKOBJ(handle) != 0);
+
+ handle = (HANDLE) NtGdiGetStockObject(NULL_PEN);
+ RTEST(handle != 0);
+ RTEST(GDI_HANDLE_GET_TYPE(handle) == GDI_OBJECT_TYPE_PEN);
+ RTEST(GDI_HANDLE_IS_STOCKOBJ(handle) == TRUE);
+
+ /* Not inuse ? */
RTEST(NtGdiGetStockObject(9) == 0);
- RTEST(NtGdiGetStockObject(OEM_FIXED_FONT) != 0);
- RTEST(NtGdiGetStockObject(ANSI_FIXED_FONT) != 0);
- RTEST(NtGdiGetStockObject(ANSI_VAR_FONT) != 0);
- RTEST(NtGdiGetStockObject(SYSTEM_FONT) != 0);
- RTEST(NtGdiGetStockObject(DEVICE_DEFAULT_FONT) != 0);
- RTEST(NtGdiGetStockObject(DEFAULT_PALETTE) != 0);
- RTEST(NtGdiGetStockObject(SYSTEM_FIXED_FONT) != 0);
- RTEST(NtGdiGetStockObject(DEFAULT_GUI_FONT) != 0);
- RTEST(NtGdiGetStockObject(DC_BRUSH) != 0);
- RTEST(NtGdiGetStockObject(DC_PEN) != 0);
- RTEST(NtGdiGetStockObject(20) != 0);
- RTEST(NtGdiGetStockObject(21) != 0);
+
+ /* FONT testing */
+ handle = (HANDLE) NtGdiGetStockObject(OEM_FIXED_FONT);
+ RTEST(handle != 0);
+ RTEST(GDI_HANDLE_GET_TYPE(handle) == GDI_OBJECT_TYPE_FONT);
+ RTEST(GDI_HANDLE_IS_STOCKOBJ(handle) != 0);
+
+ handle = (HANDLE) NtGdiGetStockObject(ANSI_FIXED_FONT);
+ RTEST(handle != 0);
+ RTEST(GDI_HANDLE_GET_TYPE(handle) == GDI_OBJECT_TYPE_FONT);
+ RTEST(GDI_HANDLE_IS_STOCKOBJ(handle) == TRUE);
+
+ handle = (HANDLE) NtGdiGetStockObject(ANSI_VAR_FONT);
+ RTEST(handle != 0);
+ RTEST(GDI_HANDLE_GET_TYPE(handle) == GDI_OBJECT_TYPE_FONT);
+ RTEST(GDI_HANDLE_IS_STOCKOBJ(handle) == TRUE);
+
+ handle = (HANDLE) NtGdiGetStockObject(SYSTEM_FONT);
+ RTEST(handle != 0);
+ RTEST(GDI_HANDLE_GET_TYPE(handle) == GDI_OBJECT_TYPE_FONT);
+ RTEST(GDI_HANDLE_IS_STOCKOBJ(handle) == TRUE);
+
+ handle = (HANDLE) NtGdiGetStockObject(DEVICE_DEFAULT_FONT);
+ RTEST(handle != 0);
+ RTEST(GDI_HANDLE_GET_TYPE(handle) == GDI_OBJECT_TYPE_FONT);
+ RTEST(GDI_HANDLE_IS_STOCKOBJ(handle) == TRUE);
+
+ handle = (HANDLE) NtGdiGetStockObject(SYSTEM_FIXED_FONT);
+ RTEST(handle != 0);
+ RTEST(GDI_HANDLE_GET_TYPE(handle) == GDI_OBJECT_TYPE_FONT);
+ RTEST(GDI_HANDLE_IS_STOCKOBJ(handle) == TRUE);
+
+ handle = (HANDLE) NtGdiGetStockObject(DEFAULT_GUI_FONT);
+ RTEST(handle != 0);
+ RTEST(GDI_HANDLE_GET_TYPE(handle) == GDI_OBJECT_TYPE_FONT);
+ RTEST(GDI_HANDLE_IS_STOCKOBJ(handle) == TRUE);
+
+ /* PALETTE testing */
+ handle = (HANDLE) NtGdiGetStockObject(DEFAULT_PALETTE);
+ RTEST(handle != 0);
+ RTEST(GDI_HANDLE_GET_TYPE(handle) == GDI_OBJECT_TYPE_PALETTE);
+ RTEST(GDI_HANDLE_IS_STOCKOBJ(handle) == TRUE);
+
+ /* DC testing */
+ handle = (HANDLE) NtGdiGetStockObject(DC_BRUSH);
+ RTEST(handle != 0);
+ RTEST(GDI_HANDLE_GET_TYPE(handle) == GDI_OBJECT_TYPE_BRUSH);
+ RTEST(GDI_HANDLE_IS_STOCKOBJ(handle) == TRUE);
+
+ handle = (HANDLE) NtGdiGetStockObject(DC_PEN);
+ RTEST(handle != 0);
+ RTEST(GDI_HANDLE_GET_TYPE(handle) == GDI_OBJECT_TYPE_PEN);
+ RTEST(GDI_HANDLE_IS_STOCKOBJ(handle) == TRUE);
+
+
+ /* ? testing */
+ handle = (HANDLE) NtGdiGetStockObject(20);
+ RTEST(handle != 0);
+ RTEST(GDI_HANDLE_GET_TYPE(handle) == GDI_OBJECT_TYPE_COLORSPACE);
+ RTEST(GDI_HANDLE_IS_STOCKOBJ(handle) == TRUE);
+
+ handle = (HANDLE) NtGdiGetStockObject(21);
+ RTEST(handle != 0);
+ RTEST(GDI_HANDLE_GET_TYPE(handle) == GDI_OBJECT_TYPE_BITMAP);
+ RTEST(GDI_HANDLE_IS_STOCKOBJ(handle) == TRUE);
+
RTEST(NtGdiGetStockObject(22) == 0);
RTEST(NtGdiGetStockObject(23) == 0);
return APISTATUS_NORMAL;