Author: tkreuzer Date: Mon Apr 6 06:49:47 2009 New Revision: 40389
URL: http://svn.reactos.org/svn/reactos?rev=40389&view=rev Log: Improve tests for NtGdiDeleteObjectApp
Modified: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c
Modified: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/ntgdi/Nt... ============================================================================== --- trunk/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c [iso-8859-1] (original) +++ trunk/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c [iso-8859-1] Mon Apr 6 06:49:47 2009 @@ -5,12 +5,10 @@ HDC hdc; HBITMAP hbmp; HBRUSH hbrush; - BOOL ret;
/* Try to delete 0 */ SetLastError(0); - ret = NtGdiDeleteObjectApp(0); - TEST(ret == 0); + TEST(NtGdiDeleteObjectApp(0) == 0); TEST(GetLastError() == 0);
/* Try to delete something with a stockbit */ @@ -21,40 +19,32 @@ /* Delete a DC */ SetLastError(0); hdc = CreateCompatibleDC(NULL); - ASSERT(hdc); - TEST(IsHandleValid(hdc) == 1); - ret = NtGdiDeleteObjectApp(hdc); - TEST(ret == 1); + ASSERT(IsHandleValid(hdc) == 1); + TEST(NtGdiDeleteObjectApp(hdc) == 1); TEST(GetLastError() == 0); TEST(IsHandleValid(hdc) == 0);
/* Delete a brush */ SetLastError(0); hbrush = CreateSolidBrush(0x123456); - ASSERT(hbrush); - TEST(IsHandleValid(hbrush) == 1); - ret = NtGdiDeleteObjectApp(hbrush); - TEST(ret == 1); + ASSERT(IsHandleValid(hbrush) == 1); + TEST(NtGdiDeleteObjectApp(hbrush) == 1); TEST(GetLastError() == 0); TEST(IsHandleValid(hbrush) == 0);
/* Try to delete a stock brush */ SetLastError(0); hbrush = GetStockObject(BLACK_BRUSH); - ASSERT(hbrush); - TEST(IsHandleValid(hbrush) == 1); - ret = NtGdiDeleteObjectApp(hbrush); - TEST(ret == 1); + ASSERT(IsHandleValid(hbrush) == 1); + TEST(NtGdiDeleteObjectApp(hbrush) == 1); TEST(GetLastError() == 0); TEST(IsHandleValid(hbrush) == 1);
/* Delete a bitmap */ SetLastError(0); hbmp = CreateBitmap(10, 10, 1, 1, NULL); - ASSERT(hbmp); - TEST(IsHandleValid(hbmp) == 1); - ret = NtGdiDeleteObjectApp(hbmp); - TEST(ret == 1); + ASSERT(IsHandleValid(hbmp) == 1); + TEST(NtGdiDeleteObjectApp(hbmp) == 1); TEST(GetLastError() == 0); TEST(IsHandleValid(hbmp) == 0);
@@ -65,23 +55,19 @@ /* Try to delete a brush that is selected into a DC */ SetLastError(0); hbrush = CreateSolidBrush(0x123456); - ASSERT(hbrush); - TEST(IsHandleValid(hbrush) == 1); + ASSERT(IsHandleValid(hbrush) == 1); TEST(NtGdiSelectBrush(hdc, hbrush)); - ret = NtGdiDeleteObjectApp(hbrush); - TEST(ret == 1); + TEST(NtGdiDeleteObjectApp(hbrush) == 1); TEST(GetLastError() == 0); TEST(IsHandleValid(hbrush) == 1);
/* Try to delete a bitmap that is selected into a DC */ SetLastError(0); hbmp = CreateBitmap(10, 10, 1, 1, NULL); - ASSERT(hbmp); - TEST(IsHandleValid(hbmp) == 1); + ASSERT(IsHandleValid(hbmp) == 1); TEST(NtGdiSelectBitmap(hdc, hbmp));
- ret = NtGdiDeleteObjectApp(hbmp); - TEST(ret == 1); + TEST(NtGdiDeleteObjectApp(hbmp) == 1); TEST(GetLastError() == 0); TEST(IsHandleValid(hbmp) == 1);
@@ -89,11 +75,19 @@ NtGdiSelectBitmap(hdc, GetStockObject(DEFAULT_BITMAP)); TEST(IsHandleValid(hbmp) == 0);
- ret = NtGdiDeleteObjectApp(hbmp); - TEST(ret == 1); + TEST(NtGdiDeleteObjectApp(hbmp) == 1); TEST(GetLastError() == 0); TEST(IsHandleValid(hbmp) == 0);
+ /* Try to delete a brush that is selected into a DC */ + SetLastError(0); + hbrush = CreateSolidBrush(123); + ASSERT(IsHandleValid(hbrush) == 1); + TEST(NtGdiSelectBrush(hdc, hbrush)); + + TEST(NtGdiDeleteObjectApp(hbrush) == 1); + TEST(GetLastError() == 0); + TEST(IsHandleValid(hbrush) == 1);
return APISTATUS_NORMAL; }