From 937d830410de2f096db7b124ce523ae83f78665d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Thu, 10 Jun 2010 00:17:06 +0000 Subject: [PATCH] [ROSTESTS] test what happens when a DC is saved and a bitmap is selected into it. svn path=/trunk/; revision=47730 --- .../apitests/w32knapi/ntgdi/NtGdiSaveDC.c | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/rostests/apitests/w32knapi/ntgdi/NtGdiSaveDC.c b/rostests/apitests/w32knapi/ntgdi/NtGdiSaveDC.c index 2c27851f52c..2163776f387 100644 --- a/rostests/apitests/w32knapi/ntgdi/NtGdiSaveDC.c +++ b/rostests/apitests/w32knapi/ntgdi/NtGdiSaveDC.c @@ -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; }