https://git.reactos.org/?p=reactos.git;a=commitdiff;h=88fbb600bf170f0a37c90…
commit 88fbb600bf170f0a37c90dea4dd653e1b2f8c354
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Wed May 1 18:28:18 2019 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Wed May 1 18:28:18 2019 +0900
[GDI32_APITEST] Improve SetMapMode testcase (#1547)
Check the relation of mode change and viewport change. CORE-14994
---
modules/rostests/apitests/gdi32/SetMapMode.c | 100 ++++++++++++++++++++++++++-
1 file changed, 98 insertions(+), 2 deletions(-)
diff --git a/modules/rostests/apitests/gdi32/SetMapMode.c
b/modules/rostests/apitests/gdi32/SetMapMode.c
index 8d38250199c..0f5c164bc18 100644
--- a/modules/rostests/apitests/gdi32/SetMapMode.c
+++ b/modules/rostests/apitests/gdi32/SetMapMode.c
@@ -13,6 +13,7 @@ void Test_SetMapMode()
HDC hDC;
SIZE WindowExt, ViewportExt;
ULONG ulMapMode;
+ POINT pt;
hDC = CreateCompatibleDC(NULL);
ok(hDC != 0, "CreateCompatibleDC failed, skipping tests.\n");
@@ -104,7 +105,7 @@ void Test_SetMapMode()
GetViewportExtEx(hDC, &ViewportExt);
//ok_long(WindowExt.cx, 3600);
//ok_long(WindowExt.cy, 2700);
- ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), HORZRES));
+ //ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), HORZRES) - 4);
ok_long(ViewportExt.cy, -GetDeviceCaps(GetDC(0), VERTRES));
DeleteDC(hDC);
@@ -183,10 +184,105 @@ void Test_SetMapMode()
ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), HORZRES));
ok_long(ViewportExt.cy, -GetDeviceCaps(GetDC(0), VERTRES));
DeleteDC(hDC);
+
+ //
+ // Test mode and extents
+ //
+ hDC = CreateCompatibleDC(NULL);
+ GetViewportExtEx(hDC, &ViewportExt);
+ GetWindowExtEx(hDC, &WindowExt);
+ ok_long(ViewportExt.cx, 1);
+ ok_long(ViewportExt.cy, 1);
+ ok_long(WindowExt.cx, 1);
+ ok_long(WindowExt.cy, 1);
+
+ SetMapMode(hDC, MM_ANISOTROPIC);
+ GetViewportExtEx(hDC, &ViewportExt);
+ GetWindowExtEx(hDC, &WindowExt);
+ ok_long(ViewportExt.cx, 1);
+ ok_long(ViewportExt.cy, 1);
+ ok_long(WindowExt.cx, 1);
+ ok_long(WindowExt.cy, 1);
+ SetWindowExtEx(hDC, 200, 200, NULL);
+ SetViewportExtEx(hDC, 100, 100, NULL);
+
+ SetMapMode(hDC, MM_ANISOTROPIC);
+ GetViewportExtEx(hDC, &ViewportExt);
+ GetWindowExtEx(hDC, &WindowExt);
+ ok_long(ViewportExt.cx, 100);
+ ok_long(ViewportExt.cy, 100);
+ ok_long(WindowExt.cx, 200);
+ ok_long(WindowExt.cy, 200);
+
+ SetMapMode(hDC, MM_ANISOTROPIC);
+ GetViewportExtEx(hDC, &ViewportExt);
+ ok_long(ViewportExt.cx, 100);
+ ok_long(ViewportExt.cy, 100);
+ ok_long(WindowExt.cx, 200);
+ ok_long(WindowExt.cy, 200);
+
+ SetMapMode(hDC, MM_ISOTROPIC);
+ GetViewportExtEx(hDC, &ViewportExt);
+ //ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), HORZRES) - 4);
+ ok_long(ViewportExt.cy, -GetDeviceCaps(GetDC(0), VERTRES));
+ SetWindowExtEx(hDC, 100, 100, NULL);
+ SetViewportExtEx(hDC, 100, 100, NULL);
+
+ SetMapMode(hDC, MM_ISOTROPIC);
+ GetViewportExtEx(hDC, &ViewportExt);
+ ok_long(ViewportExt.cx, 100);
+ ok_long(ViewportExt.cy, 100);
+
+ SetMapMode(hDC, MM_ANISOTROPIC);
+ GetViewportExtEx(hDC, &ViewportExt);
+ ok_long(ViewportExt.cx, 100);
+ ok_long(ViewportExt.cy, 100);
+
+ SetMapMode(hDC, MM_TEXT);
+ GetViewportExtEx(hDC, &ViewportExt);
+ ok_long(ViewportExt.cx, 1);
+ ok_long(ViewportExt.cy, 1);
+
+ SetMapMode(hDC, MM_ANISOTROPIC);
+ GetViewportExtEx(hDC, &ViewportExt);
+ ok_long(ViewportExt.cx, 1);
+ ok_long(ViewportExt.cy, 1);
+
+ SetMapMode(hDC, MM_ISOTROPIC);
+ GetViewportExtEx(hDC, &ViewportExt);
+ //ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), HORZRES) - 4);
+ ok_long(ViewportExt.cy, -GetDeviceCaps(GetDC(0), VERTRES));
+
+ SetMapMode(hDC, MM_TEXT);
+ GetViewportExtEx(hDC, &ViewportExt);
+ GetWindowExtEx(hDC, &WindowExt);
+ ok_long(ViewportExt.cx, 1);
+ ok_long(ViewportExt.cy, 1);
+ ok_long(WindowExt.cx, 1);
+ ok_long(WindowExt.cy, 1);
+ DeleteDC(hDC);
+
+ //
+ // Test mode and GetCurrentPositionEx
+ //
+ hDC = CreateCompatibleDC(NULL);
+ MoveToEx(hDC, 100, 100, NULL);
+ SetMapMode(hDC, MM_ANISOTROPIC);
+ GetCurrentPositionEx(hDC, &pt);
+ ok_long(pt.x, 100);
+ ok_long(pt.y, 100);
+ SetMapMode(hDC, MM_TEXT);
+ GetCurrentPositionEx(hDC, &pt);
+ ok_long(pt.x, 100);
+ ok_long(pt.y, 100);
+ SetMapMode(hDC, MM_ISOTROPIC);
+ GetCurrentPositionEx(hDC, &pt);
+ ok_long(pt.x, 100);
+ ok_long(pt.y, 100);
+ DeleteDC(hDC);
}
START_TEST(SetMapMode)
{
Test_SetMapMode();
}
-