mirror of
https://github.com/reactos/reactos.git
synced 2025-01-03 21:09:19 +00:00
[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:
parent
8be9465a83
commit
937d830410
1 changed files with 34 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue