[ROSTESTS]

test what happens when a DC is saved and a bitmap is selected into it.

svn path=/trunk/; revision=47730
This commit is contained in:
Jérôme Gardou 2010-06-10 00:17:06 +00:00
parent 8be9465a83
commit 937d830410

View file

@ -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 @@ Test_NtGdiSaveDC(PTESTINFO pti)
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;
}