Author: jgardou
Date: Thu Jun 10 00:17:06 2010
New Revision: 47730
URL:
http://svn.reactos.org/svn/reactos?rev=47730&view=rev
Log:
[ROSTESTS]
test what happens when a DC is saved and a bitmap is selected into it.
Modified:
trunk/rostests/apitests/w32knapi/ntgdi/NtGdiSaveDC.c
Modified: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiSaveDC.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/ntgdi/N…
==============================================================================
--- trunk/rostests/apitests/w32knapi/ntgdi/NtGdiSaveDC.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/w32knapi/ntgdi/NtGdiSaveDC.c [iso-8859-1] Thu Jun 10 00:17:06
2010
@@ -2,8 +2,9 @@
INT
Test_NtGdiSaveDC(PTESTINFO pti)
{
- HDC hdc;
+ HDC hdc, hdc2;
HWND hwnd;
+ HBITMAP hbmp1, hbmp2, hOldBmp;
/* Test 0 hdc */
TEST(NtGdiSaveDC(0) == 0);
@@ -39,6 +40,38 @@
NtGdiRestoreDC(hdc, 1);
ReleaseDC(hwnd, hdc);
DestroyWindow(hwnd);
+
+ /* test behaviour when a bitmap is selected */
+ hbmp1 = CreateBitmap(2, 2, 1, 1, NULL);
+ TEST(hbmp1);
+ hbmp2 = CreateBitmap(2, 2, 1, 1, NULL);
+ TEST(hbmp2);
+ hdc = CreateCompatibleDC(0);
+ TEST(hdc);
+ hdc2 = CreateCompatibleDC(0);
+ TEST(hdc2);
+ hOldBmp = SelectObject(hdc, hbmp1);
+ TEST(hOldBmp);
+ TEST(NtGdiSaveDC(hdc) == 1);
+ TEST(SelectObject(hdc, hbmp2) == hbmp1);
+ TEST(SelectObject(hdc2, hbmp1) == NULL);
+ SelectObject(hdc, hOldBmp);
+ NtGdiRestoreDC(hdc, 1);
+ TEST(GetCurrentObject(hdc, OBJ_BITMAP) == hbmp1);
+ /* Again, just to be sure */
+ TEST(NtGdiSaveDC(hdc) == 1);
+ TEST(NtGdiSaveDC(hdc) == 2);
+ TEST(SelectObject(hdc, hbmp2) == hbmp1);
+ TEST(SelectObject(hdc2, hbmp1) == NULL);
+ SelectObject(hdc, hOldBmp);
+ NtGdiRestoreDC(hdc, 2);
+ TEST(GetCurrentObject(hdc, OBJ_BITMAP) == hbmp1);
+ /*Cleanup */
+ SelectObject(hdc, hOldBmp);
+ DeleteDC(hdc);
+ DeleteDC(hdc2);
+ DeleteObject(hbmp1);
+ DeleteObject(hbmp2);
return APISTATUS_NORMAL;
}