[ROSTESTS][GDI32_APITEST] Refactor testcases (#1457)

[ROSTESTS][GDI32_APITEST] Refactor testcases
This commit is contained in:
Katayama Hirofumi MZ 2019-04-03 17:22:21 +09:00 committed by GitHub
parent 39c0fd5722
commit f65a62ea5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 213 additions and 209 deletions

View file

@ -3,6 +3,7 @@
* LICENSE: GPL - See COPYING in the top level directory
* PURPOSE: Test for GetRandomRgn
* PROGRAMMERS: Timo Kreuzer
* Katayama Hirofumi MZ
*/
#include "precomp.h"
@ -58,42 +59,42 @@ void Test_GetRandomRgn_Params()
SetLastError(0xbadbad00);
ret = GetRandomRgn(hdc, NULL, 0);
ok_int(ret, 0);
ok_long(GetLastError(), 0xbadbad00);
ok_err(0xbadbad00);
SetLastError(0xbadbad00);
ret = GetRandomRgn(hdc, NULL, CLIPRGN);
ok_int(ret, 0);
ok_long(GetLastError(), 0xbadbad00);
ok_err(0xbadbad00);
SetLastError(0xbadbad00);
ret = GetRandomRgn(hdc, hrgn, 0);
ok_int(ret, 0);
ok_long(GetLastError(), 0xbadbad00);
ok_err(0xbadbad00);
#if 0 // this is vista+
SetLastError(0xbadbad00);
ret = GetRandomRgn(hdc, hrgn, 5);
ok_int(ret, 1);
ok_long(GetLastError(), 0xbadbad00);
ok_err(0xbadbad00);
#endif
SetLastError(0xbadbad00);
ret = GetRandomRgn(hdc, hrgn, 6);
ok_int(ret, 0);
ok_long(GetLastError(), 0xbadbad00);
ok_err(0xbadbad00);
SetLastError(0xbadbad00);
ret = GetRandomRgn(hdc, hrgn, 27);
ok_int(ret, 0);
ok_long(GetLastError(), 0xbadbad00);
ok_err(0xbadbad00);
SetLastError(0xbadbad00);
ret = GetRandomRgn(hdc, hrgn, -1);
ok_int(ret, 0);
ok_long(GetLastError(), 0xbadbad00);
ok_err(0xbadbad00);
SetLastError(0xbadbad00);
ret = GetRandomRgn(hdc, hrgn, CLIPRGN);
ok_int(ret, 0);
ok_long(GetLastError(), 0xbadbad00);
ok_err(0xbadbad00);
SetLastError(0xbadbad00);
ret = GetRandomRgn((HDC)0x123, hrgn, CLIPRGN);

View file

@ -3,6 +3,7 @@
* LICENSE: GPL - See COPYING in the top level directory
* PURPOSE: Test for GetTextExtentExPoint
* PROGRAMMERS: Timo Kreuzer
* Katayama Hirofumi MZ
*/
#include "precomp.h"
@ -16,36 +17,36 @@ void Test_GetTextExtentExPoint()
SetLastError(0);
result = GetTextExtentExPointA(GetDC(0), "test", 4, 1000, &nFit, NULL, &size);
TEST(result == 1);
TEST(nFit == 4);
TEST(GetLastError() == 0);
ok_int(result, 1);
ok_int(nFit, 4);
ok_err(0);
printf("nFit = %d\n", nFit);
result = GetTextExtentExPointA(GetDC(0), "test", 4, 1, &nFit, NULL, &size);
TEST(result == 1);
TEST(nFit == 0);
TEST(GetLastError() == 0);
ok_int(result, 1);
ok_int(nFit, 0);
ok_err(0);
printf("nFit = %d\n", nFit);
result = GetTextExtentExPointA(GetDC(0), "test", 4, 0, &nFit, NULL, &size);
TEST(result == 1);
TEST(nFit == 0);
TEST(GetLastError() == 0);
ok_int(result, 1);
ok_int(nFit, 0);
ok_err(0);
result = GetTextExtentExPointA(GetDC(0), "test", 4, -1, &nFit, NULL, &size);
TEST(result == 1);
TEST(nFit == 4);
TEST(GetLastError() == 0);
ok_int(result, 1);
ok_int(nFit, 4);
ok_err(0);
result = GetTextExtentExPointA(GetDC(0), "test", 4, -2, &nFit, NULL, &size);
TEST(result == 0);
TEST(GetLastError() == 87);
ok_int(result, 0);
ok_err(87);
result = GetTextExtentExPointW(GetDC(0), L"test", 4, -10, &nFit, NULL, &size);
TEST(result == 1);
ok_int(result, 1);
result = GetTextExtentExPointA(GetDC(0), "test", 4, -10, &nFit, NULL, &size);
TEST(result == 0);
ok_int(result, 0);
}
START_TEST(GetTextExtentExPoint)

View file

@ -32,21 +32,21 @@ void Test_GetTextFace(void)
SetLastError(0xE000BEEF);
ret = GetTextFaceW(hDC, 0, NULL);
TEST(ret != 0);
ok(GetLastError() == 0xE000BEEF, "GetLastError() == %ld\n", GetLastError());
ok_err(0xE000BEEF);
ret2 = ret;
SetLastError(0xE000BEEF);
ret = GetTextFaceW(hDC, -1, NULL);
TEST(ret != 0);
TEST(ret == ret2);
ok(GetLastError() == 0xE000BEEF, "GetLastError() == %ld\n", GetLastError());
ok_int(ret, ret2);
ok_err(0xE000BEEF);
ret2 = ret;
SetLastError(0xE000BEEF);
ret = GetTextFaceW(hDC, 10000, NULL);
TEST(ret != 0);
TEST(ret == ret2);
ok(GetLastError() == 0xE000BEEF, "GetLastError() == %ld\n", GetLastError());
ok_int(ret, ret2);
ok_err(0xE000BEEF);
ret2 = ret;
/* Whether the buffer is correctly filled */
@ -54,31 +54,31 @@ void Test_GetTextFace(void)
ret = GetTextFaceW(hDC, 20, Buffer);
TEST(ret != 0);
TEST(ret <= 20);
TEST(Buffer[ret - 1] == 0);
ok(GetLastError() == 0xE000BEEF, "GetLastError() == %ld\n", GetLastError());
ok_int(Buffer[ret - 1], 0);
ok_err(0xE000BEEF);
SetLastError(0xE000BEEF);
ret = GetTextFaceW(hDC, 1, Buffer);
TEST(ret == 1);
TEST(Buffer[ret - 1] == 0);
ok(GetLastError() == 0xE000BEEF, "GetLastError() == %ld\n", GetLastError());
ok_int(ret, 1);
ok_int(Buffer[ret - 1], 0);
ok_err(0xE000BEEF);
SetLastError(0xE000BEEF);
ret = GetTextFaceW(hDC, 2, Buffer);
TEST(ret == 2);
TEST(Buffer[ret - 1] == 0);
ok(GetLastError() == 0xE000BEEF, "GetLastError() == %ld\n", GetLastError());
ok_int(ret, 2);
ok_int(Buffer[ret - 1], 0);
ok_err(0xE000BEEF);
/* Whether invalid buffer sizes are correctly ignored */
SetLastError(0xE000BEEF);
ret = GetTextFaceW(hDC, 0, Buffer);
TEST(ret == 0);
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError() == %ld\n", GetLastError());
ok_int(ret, 0);
ok_err(ERROR_INVALID_PARAMETER);
SetLastError(0xE000BEEF);
ret = GetTextFaceW(hDC, -1, Buffer);
TEST(ret == 0);
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError() == %ld\n", GetLastError());
ok_int(ret, 0);
ok_err(ERROR_INVALID_PARAMETER);
DeleteDC(hDC);
}

View file

@ -3,6 +3,7 @@
* LICENSE: GPL - See COPYING in the top level directory
* PURPOSE: Test for SetMapMode
* PROGRAMMERS: Timo Kreuzer
* Katayama Hirofumi MZ
*/
#include "precomp.h"
@ -21,79 +22,79 @@ void Test_SetMapMode()
GetViewportExtEx(hDC, &ViewportExt);
ulMapMode = SetMapMode(hDC, MM_ISOTROPIC);
TEST(ulMapMode == MM_TEXT);
TEST(WindowExt.cx == 1);
TEST(WindowExt.cy == 1);
TEST(ViewportExt.cx == 1);
TEST(ViewportExt.cy == 1);
ok_long(ulMapMode, MM_TEXT);
ok_long(WindowExt.cx, 1);
ok_long(WindowExt.cy, 1);
ok_long(ViewportExt.cx, 1);
ok_long(ViewportExt.cy, 1);
SetLastError(0);
ulMapMode = SetMapMode(hDC, 0);
TEST(GetLastError() == 0);
TEST(ulMapMode == 0);
ok_err(0);
ok_long(ulMapMode, 0);
/* Go through all valid values */
ulMapMode = SetMapMode(hDC, 1);
TEST(ulMapMode == MM_ISOTROPIC);
ok_long(ulMapMode, MM_ISOTROPIC);
ulMapMode = SetMapMode(hDC, 2);
TEST(ulMapMode == 1);
ok_long(ulMapMode, 1);
ulMapMode = SetMapMode(hDC, 3);
TEST(ulMapMode == 2);
ok_long(ulMapMode, 2);
ulMapMode = SetMapMode(hDC, 4);
TEST(ulMapMode == 3);
ok_long(ulMapMode, 3);
ulMapMode = SetMapMode(hDC, 5);
TEST(ulMapMode == 4);
ok_long(ulMapMode, 4);
ulMapMode = SetMapMode(hDC, 6);
TEST(ulMapMode == 5);
ok_long(ulMapMode, 5);
ulMapMode = SetMapMode(hDC, 7);
TEST(ulMapMode == 6);
ok_long(ulMapMode, 6);
ulMapMode = SetMapMode(hDC, 8);
TEST(ulMapMode == 7);
ok_long(ulMapMode, 7);
/* Test invalid value */
ulMapMode = SetMapMode(hDC, 9);
TEST(ulMapMode == 0);
ok_long(ulMapMode, 0);
ulMapMode = SetMapMode(hDC, 10);
TEST(ulMapMode == 0);
ok_long(ulMapMode, 0);
TEST(GetLastError() == 0);
ok_err(0);
/* Test NULL DC */
ulMapMode = SetMapMode((HDC)0, 2);
TEST(ulMapMode == 0);
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
ok_long(ulMapMode, 0);
ok_err(ERROR_INVALID_PARAMETER);
/* Test NULL DC and invalid mode */
ulMapMode = SetMapMode((HDC)0, 10);
TEST(ulMapMode == 0);
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
ok_long(ulMapMode, 0);
ok_err(ERROR_INVALID_PARAMETER);
/* Test invalid DC */
ulMapMode = SetMapMode((HDC)0x12345, 2);
TEST(ulMapMode == 0);
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
ok_long(ulMapMode, 0);
ok_err(ERROR_INVALID_PARAMETER);
/* Test invalid DC and invalid mode */
ulMapMode = SetMapMode((HDC)0x12345, 10);
TEST(ulMapMode == 0);
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
ok_long(ulMapMode, 0);
ok_err(ERROR_INVALID_PARAMETER);
DeleteDC(hDC);
/* Test a deleted DC */
ulMapMode = SetMapMode(hDC, 2);
TEST(ulMapMode == 0);
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
ok_long(ulMapMode, 0);
ok_err(ERROR_INVALID_PARAMETER);
/* Test MM_TEXT */
hDC = CreateCompatibleDC(NULL);
SetMapMode(hDC, MM_TEXT);
GetWindowExtEx(hDC, &WindowExt);
GetViewportExtEx(hDC, &ViewportExt);
TEST(WindowExt.cx == 1);
TEST(WindowExt.cy == 1);
TEST(ViewportExt.cx == 1);
TEST(ViewportExt.cy == 1);
ok_long(WindowExt.cx, 1);
ok_long(WindowExt.cy, 1);
ok_long(ViewportExt.cx, 1);
ok_long(ViewportExt.cy, 1);
DeleteDC(hDC);
/* Test MM_ISOTROPIC */
@ -101,10 +102,10 @@ void Test_SetMapMode()
SetMapMode(hDC, MM_ISOTROPIC);
GetWindowExtEx(hDC, &WindowExt);
GetViewportExtEx(hDC, &ViewportExt);
//TEST(WindowExt.cx == 3600);
//TEST(WindowExt.cy == 2700);
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
//ok_long(WindowExt.cx, 3600);
//ok_long(WindowExt.cy, 2700);
ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), HORZRES));
ok_long(ViewportExt.cy, -GetDeviceCaps(GetDC(0), VERTRES));
DeleteDC(hDC);
/* Test MM_ANISOTROPIC */
@ -112,20 +113,20 @@ void Test_SetMapMode()
SetMapMode(hDC, MM_ANISOTROPIC);
GetWindowExtEx(hDC, &WindowExt);
GetViewportExtEx(hDC, &ViewportExt);
TEST(WindowExt.cx == 1);
TEST(WindowExt.cy == 1);
TEST(ViewportExt.cx == 1);
TEST(ViewportExt.cy == 1);
ok_long(WindowExt.cx, 1);
ok_long(WindowExt.cy, 1);
ok_long(ViewportExt.cx, 1);
ok_long(ViewportExt.cy, 1);
/* set MM_ISOTROPIC first, the values will be kept */
SetMapMode(hDC, MM_ISOTROPIC);
SetMapMode(hDC, MM_ANISOTROPIC);
GetWindowExtEx(hDC, &WindowExt);
GetViewportExtEx(hDC, &ViewportExt);
//TEST(WindowExt.cx == 3600);
//TEST(WindowExt.cy == 2700);
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
//ok_long(WindowExt.cx, 3600);
//ok_long(WindowExt.cy, 2700);
ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), HORZRES));
ok_long(ViewportExt.cy, -GetDeviceCaps(GetDC(0), VERTRES));
DeleteDC(hDC);
/* Test MM_LOMETRIC */
@ -133,10 +134,10 @@ void Test_SetMapMode()
SetMapMode(hDC, MM_LOMETRIC);
GetWindowExtEx(hDC, &WindowExt);
GetViewportExtEx(hDC, &ViewportExt);
//TEST(WindowExt.cx == 3600);
//TEST(WindowExt.cy == 2700);
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
//ok_long(WindowExt.cx, 3600);
//ok_long(WindowExt.cy, 2700);
ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), HORZRES));
ok_long(ViewportExt.cy, -GetDeviceCaps(GetDC(0), VERTRES));
DeleteDC(hDC);
/* Test MM_HIMETRIC */
@ -144,10 +145,10 @@ void Test_SetMapMode()
SetMapMode(hDC, MM_HIMETRIC);
GetWindowExtEx(hDC, &WindowExt);
GetViewportExtEx(hDC, &ViewportExt);
//TEST(WindowExt.cx == 36000);
//TEST(WindowExt.cy == 27000);
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
//ok_long(WindowExt.cx, 36000);
//ok_long(WindowExt.cy, 27000);
ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), HORZRES));
ok_long(ViewportExt.cy, -GetDeviceCaps(GetDC(0), VERTRES));
DeleteDC(hDC);
/* Test MM_LOENGLISH */
@ -155,10 +156,10 @@ void Test_SetMapMode()
SetMapMode(hDC, MM_LOENGLISH);
GetWindowExtEx(hDC, &WindowExt);
GetViewportExtEx(hDC, &ViewportExt);
//TEST(WindowExt.cx == 1417);
//TEST(WindowExt.cy == 1063);
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
//ok_long(WindowExt.cx, 1417);
//ok_long(WindowExt.cy, 1063);
ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), HORZRES));
ok_long(ViewportExt.cy, -GetDeviceCaps(GetDC(0), VERTRES));
DeleteDC(hDC);
/* Test MM_HIENGLISH */
@ -166,10 +167,10 @@ void Test_SetMapMode()
SetMapMode(hDC, MM_HIENGLISH);
GetWindowExtEx(hDC, &WindowExt);
GetViewportExtEx(hDC, &ViewportExt);
//TEST(WindowExt.cx == 14173);
//TEST(WindowExt.cy == 10630);
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
//ok_long(WindowExt.cx, 14173);
//ok_long(WindowExt.cy, 10630);
ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), HORZRES));
ok_long(ViewportExt.cy, -GetDeviceCaps(GetDC(0), VERTRES));
DeleteDC(hDC);
/* Test MM_TWIPS */
@ -177,10 +178,10 @@ void Test_SetMapMode()
SetMapMode(hDC, MM_TWIPS);
GetWindowExtEx(hDC, &WindowExt);
GetViewportExtEx(hDC, &ViewportExt);
//TEST(WindowExt.cx == 20409);
//TEST(WindowExt.cy == 15307);
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
//ok_long(WindowExt.cx, 20409);
//ok_long(WindowExt.cy, 15307);
ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), HORZRES));
ok_long(ViewportExt.cy, -GetDeviceCaps(GetDC(0), VERTRES));
DeleteDC(hDC);
}

View file

@ -3,6 +3,7 @@
* LICENSE: GPL - See COPYING in the top level directory
* PURPOSE: Test for SetWindowExtEx
* PROGRAMMERS: Timo Kreuzer
* Katayama Hirofumi MZ
*/
#include "precomp.h"
@ -22,57 +23,57 @@ void Test_SetWindowExtEx()
SetLastError(0);
ret = SetWindowExtEx(0, 0, 0, NULL);
ok_err(ERROR_INVALID_HANDLE);
TEST(ret == 0);
ok_int(ret, 0);
SetLastError(0);
ret = SetWindowExtEx((HDC)0x1234, 0, 0, NULL);
ok_err(ERROR_INVALID_HANDLE);
TEST(ret == 0);
ok_int(ret, 0);
SetLastError(0);
ret = SetWindowExtEx((HDC)0x10000, 0, 0, NULL);
ok_err(ERROR_INVALID_PARAMETER);
TEST(ret == 0);
ok_int(ret, 0);
SetLastError(0);
ret = SetWindowExtEx((HDC)0x210000, 0, 0, NULL); // GDILoObjType_LO_ALTDC_TYPE
ok_err(ERROR_INVALID_HANDLE);
TEST(ret == 0);
ok_int(ret, 0);
SetLastError(0);
ret = SetWindowExtEx((HDC)0x260000, 0, 0, NULL); // GDILoObjType_LO_METAFILE16_TYPE
ok_err(ERROR_INVALID_HANDLE);
TEST(ret == 0);
ok_int(ret, 0);
SetLastError(0);
ret = SetWindowExtEx((HDC)0x460000, 0, 0, NULL); // GDILoObjType_LO_METAFILE_TYPE
ok_err(ERROR_INVALID_HANDLE);
TEST(ret == 0);
ok_int(ret, 0);
SetLastError(0);
ret = SetWindowExtEx((HDC)0x660000, 0, 0, NULL); // GDILoObjType_LO_METADC16_TYPE
ok_err(ERROR_INVALID_HANDLE);
TEST(ret == 0);
ok_int(ret, 0);
SetLastError(0);
ret = SetWindowExtEx(hDC, 0, 0, NULL);
ok_err(0);
TEST(ret == 1);
ok_int(ret, 1);
/* Test 16 bit handle */
SetLastError(0);
ret = SetWindowExtEx((HDC)((ULONG_PTR)hDC & 0xffff), 0, 0, NULL);
ok_err(ERROR_INVALID_HANDLE);
TEST(ret == 0);
ok_int(ret, 0);
WindowExt.cx = 1234;
WindowExt.cy = 6789;
SetLastError(0);
ret = SetWindowExtEx(0, 0, 0, &WindowExt);
ok_err(ERROR_INVALID_HANDLE);
TEST(ret == 0);
TEST(WindowExt.cx == 1234);
TEST(WindowExt.cy == 6789);
ok_int(ret, 0);
ok_long(WindowExt.cx, 1234);
ok_long(WindowExt.cy, 6789);
DeleteDC(hDC);
@ -80,7 +81,7 @@ void Test_SetWindowExtEx()
SetLastError(0);
ret = SetWindowExtEx(hDC, 0, 0, NULL);
ok_err(ERROR_INVALID_PARAMETER);
TEST(ret == 0);
ok_int(ret, 0);
hDC = CreateCompatibleDC(0);
ok(hDC != NULL, "CreateCompatibleDC failed. Skipping tests.\n");
@ -92,225 +93,225 @@ void Test_SetWindowExtEx()
/* Test setting 0 extents without changing the map mode (MM_TEXT) */
ret = SetWindowExtEx(hDC, 0, 0, &WindowExt);
TEST(ret == 1);
TEST(WindowExt.cx == 1);
TEST(WindowExt.cy == 1);
ok_int(ret, 1);
ok_long(WindowExt.cx, 1);
ok_long(WindowExt.cy, 1);
/* Test setting proper extents without changing the map mode (MM_TEXT) */
WindowExt.cx = WindowExt.cy = 0;
ret = SetWindowExtEx(hDC, 10, 20, &WindowExt);
TEST(ret == 1);
TEST(WindowExt.cx == 1);
TEST(WindowExt.cy == 1);
ok_int(ret, 1);
ok_long(WindowExt.cx, 1);
ok_long(WindowExt.cy, 1);
/* Values should not be changed */
WindowExt.cx = WindowExt.cy = 0;
ret = SetWindowExtEx(hDC, 40, 30, &WindowExt);
TEST(ret == 1);
TEST(WindowExt.cx == 1);
TEST(WindowExt.cy == 1);
ok_int(ret, 1);
ok_long(WindowExt.cx, 1);
ok_long(WindowExt.cy, 1);
/* Check the viewport */
GetViewportExtEx(hDC, &ViewportExt);
TEST(ViewportExt.cx == 1);
TEST(ViewportExt.cy == 1);
ok_long(ViewportExt.cx, 1);
ok_long(ViewportExt.cy, 1);
/* Test setting in isotropic mode with 0 extents */
SetMapMode(hDC, MM_ISOTROPIC);
WindowExt.cx = WindowExt.cy = 0;
ret = SetWindowExtEx(hDC, 0, 0, &WindowExt);
TEST(ret == 0);
//TEST(WindowExt.cx == 3600);
//TEST(WindowExt.cy == 2700);
ok_int(ret, 0);
//ok_long(WindowExt.cx, 3600);
//ok_long(WindowExt.cy, 2700);
ret = SetWindowExtEx(hDC, 100, 0, &WindowExt);
TEST(ret == 0);
ok_int(ret, 0);
ret = SetWindowExtEx(hDC, 0, 100, &WindowExt);
TEST(ret == 0);
ok_int(ret, 0);
/* Test setting in isotropic mode */
ret = SetWindowExtEx(hDC, 21224, 35114, &WindowExt);
TEST(ret == 1);
//TEST(WindowExt.cx == 3600);
//TEST(WindowExt.cy == 2700);
ok_int(ret, 1);
//ok_long(WindowExt.cx, 3600);
//ok_long(WindowExt.cy, 2700);
/* Values should be changed */
ret = SetWindowExtEx(hDC,
4 * GetDeviceCaps(GetDC(0), HORZRES),
-4 * GetDeviceCaps(GetDC(0), VERTRES),
&WindowExt);
TEST(ret == 1);
TEST(WindowExt.cx == 21224);
TEST(WindowExt.cy == 35114);
ok_int(ret, 1);
ok_long(WindowExt.cx, 21224);
ok_long(WindowExt.cy, 35114);
/* Check the viewport, should be the same */
GetViewportExtEx(hDC, &ViewportExt);
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), HORZRES));
ok_long(ViewportExt.cy, -GetDeviceCaps(GetDC(0), VERTRES));
/* again isotropic mode with 1:1 res */
ret = SetWindowExtEx(hDC, 123, 123, &WindowExt);
TEST(ret == 1);
TEST(WindowExt.cx == 4 * GetDeviceCaps(GetDC(0), HORZRES));
TEST(WindowExt.cy == -4 * GetDeviceCaps(GetDC(0), VERTRES));
ok_int(ret, 1);
ok_long(WindowExt.cx, 4 * GetDeviceCaps(GetDC(0), HORZRES));
ok_long(WindowExt.cy, -4 * GetDeviceCaps(GetDC(0), VERTRES));
/* Test flXform */
//TEST(pDC_Attr->flXform & PAGE_EXTENTS_CHANGED);
/* Check the viewport from the dcattr, without going through gdi */
//TEST(pDC_Attr->szlViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
//TEST(pDC_Attr->szlViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
//TEST(pDC_Attr->szlViewportExt.cx, GetDeviceCaps(GetDC(0), HORZRES));
//TEST(pDC_Attr->szlViewportExt.cy, -GetDeviceCaps(GetDC(0), VERTRES));
/* Check the viewport with gdi, should not be the same */
GetViewportExtEx(hDC, &ViewportExt);
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), VERTRES));
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), VERTRES));
ok_long(ViewportExt.cy, -GetDeviceCaps(GetDC(0), VERTRES));
/* Test flXform */
//TEST(pDC_Attr->flXform & PAGE_EXTENTS_CHANGED);
/* again isotropic mode with 3:1 res */
ret = SetWindowExtEx(hDC, 300, 100, &WindowExt);
TEST(ret == 1);
TEST(WindowExt.cx == 123);
TEST(WindowExt.cy == 123);
ok_int(ret, 1);
ok_long(WindowExt.cx, 123);
ok_long(WindowExt.cy, 123);
/* Check the viewport now, should not be the same */
GetViewportExtEx(hDC, &ViewportExt);
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), VERTRES));
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES) / 3);
ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), VERTRES));
ok_long(ViewportExt.cy, -GetDeviceCaps(GetDC(0), VERTRES) / 3);
/* again isotropic mode with 1:3 res */
SetViewportExtEx(hDC, 6000, 3000, 0);
ret = SetWindowExtEx(hDC, 200, 600, &WindowExt);
TEST(ret == 1);
TEST(WindowExt.cx == 300);
TEST(WindowExt.cy == 100);
ok_int(ret, 1);
ok_long(WindowExt.cx, 300);
ok_long(WindowExt.cy, 100);
/* Check the viewport now, should not be the same */
GetViewportExtEx(hDC, &ViewportExt);
TEST(ViewportExt.cx == 1000);
TEST(ViewportExt.cy == 3000);
ok_long(ViewportExt.cx, 1000);
ok_long(ViewportExt.cy, 3000);
/* Test setting in anisotropic mode */
SetMapMode(hDC, MM_ANISOTROPIC);
ret = SetWindowExtEx(hDC, 80, 60, &WindowExt);
TEST(ret == 1);
TEST(WindowExt.cx == 200);
TEST(WindowExt.cy == 600);
ok_int(ret, 1);
ok_long(WindowExt.cx, 200);
ok_long(WindowExt.cy, 600);
/* Values should be changed */
ret = SetWindowExtEx(hDC, 500, 500, &WindowExt);
TEST(ret == 1);
TEST(WindowExt.cx == 80);
TEST(WindowExt.cy == 60);
ok_int(ret, 1);
ok_long(WindowExt.cx, 80);
ok_long(WindowExt.cy, 60);
/* Check the viewport */
GetViewportExtEx(hDC, &ViewportExt);
TEST(ViewportExt.cx == 1000);
TEST(ViewportExt.cy == 3000);
ok_long(ViewportExt.cx, 1000);
ok_long(ViewportExt.cy, 3000);
/* Test setting in low metric mode */
SetMapMode(hDC, MM_LOMETRIC);
ret = SetWindowExtEx(hDC, 120, 90, &WindowExt);
TEST(ret == 1);
//TEST(WindowExt.cx == 3600);
//TEST(WindowExt.cy == 2700);
ok_int(ret, 1);
//ok_long(WindowExt.cx, 3600);
//ok_long(WindowExt.cy, 2700);
/* Values should not be changed */
WindowExt.cx = WindowExt.cy = 0;
ret = SetWindowExtEx(hDC, 900, 700, &WindowExt);
TEST(ret == 1);
//TEST(WindowExt.cx == 3600);
//TEST(WindowExt.cy == 2700);
ok_int(ret, 1);
//ok_long(WindowExt.cx, 3600);
//ok_long(WindowExt.cy, 2700);
/* Check the viewport */
GetViewportExtEx(hDC, &ViewportExt);
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), HORZRES));
ok_long(ViewportExt.cy, -GetDeviceCaps(GetDC(0), VERTRES));
/* Test setting in high metric mode */
SetMapMode(hDC, MM_HIMETRIC);
ret = SetWindowExtEx(hDC, 120, 90, &WindowExt);
TEST(ret == 1);
//TEST(WindowExt.cx == 36000);
//TEST(WindowExt.cy == 27000);
ok_int(ret, 1);
//ok_long(WindowExt.cx, 36000);
//ok_long(WindowExt.cy, 27000);
/* Values should not be changed */
WindowExt.cx = WindowExt.cy = 0;
ret = SetWindowExtEx(hDC, 500, 300, &WindowExt);
TEST(ret == 1);
//TEST(WindowExt.cx == 36000);
//TEST(WindowExt.cy == 27000);
ok_int(ret, 1);
//ok_long(WindowExt.cx, 36000);
//ok_long(WindowExt.cy, 27000);
/* Check the viewport */
GetViewportExtEx(hDC, &ViewportExt);
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), HORZRES));
ok_long(ViewportExt.cy, -GetDeviceCaps(GetDC(0), VERTRES));
/* Test setting in low english mode */
SetMapMode(hDC, MM_LOENGLISH);
ret = SetWindowExtEx(hDC, 320, 290, &WindowExt);
TEST(ret == 1);
//TEST(WindowExt.cx == 1417);
//TEST(WindowExt.cy == 1063);
ok_int(ret, 1);
//ok_long(WindowExt.cx, 1417);
//ok_long(WindowExt.cy, 1063);
/* Values should not be changed */
WindowExt.cx = WindowExt.cy = 0;
ret = SetWindowExtEx(hDC, 560, 140, &WindowExt);
TEST(ret == 1);
//TEST(WindowExt.cx == 1417);
//TEST(WindowExt.cy == 1063);
ok_int(ret, 1);
//ok_long(WindowExt.cx, 1417);
//ok_long(WindowExt.cy, 1063);
/* Check the viewport */
GetViewportExtEx(hDC, &ViewportExt);
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), HORZRES));
ok_long(ViewportExt.cy, -GetDeviceCaps(GetDC(0), VERTRES));
/* Test setting in high english mode */
SetMapMode(hDC, MM_HIENGLISH);
ret = SetWindowExtEx(hDC, 320, 290, &WindowExt);
TEST(ret == 1);
//TEST(WindowExt.cx == 14173);
//TEST(WindowExt.cy == 10630);
ok_int(ret, 1);
//ok_long(WindowExt.cx, 14173);
//ok_long(WindowExt.cy, 10630);
/* Values should not be changed */
WindowExt.cx = WindowExt.cy = 0;
ret = SetWindowExtEx(hDC, 1560, 1140, &WindowExt);
TEST(ret == 1);
//TEST(WindowExt.cx == 14173);
//TEST(WindowExt.cy == 10630);
ok_int(ret, 1);
//ok_long(WindowExt.cx, 14173);
//ok_long(WindowExt.cy, 10630);
/* Check the viewport */
GetViewportExtEx(hDC, &ViewportExt);
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), HORZRES));
ok_long(ViewportExt.cy, -GetDeviceCaps(GetDC(0), VERTRES));
/* Test setting in twips mode */
SetMapMode(hDC, MM_TWIPS);
ret = SetWindowExtEx(hDC, 3320, 3290, &WindowExt);
TEST(ret == 1);
//TEST(WindowExt.cx == 20409);
//TEST(WindowExt.cy == 15307);
ok_int(ret, 1);
//ok_long(WindowExt.cx, 20409);
//ok_long(WindowExt.cy, 15307);
/* Values should not be changed */
WindowExt.cx = WindowExt.cy = 0;
ret = SetWindowExtEx(hDC, 4560, 4140, &WindowExt);
TEST(ret == 1);
//TEST(WindowExt.cx == 20409);
//TEST(WindowExt.cy == 15307);
ok_int(ret, 1);
//ok_long(WindowExt.cx, 20409);
//ok_long(WindowExt.cy, 15307);
/* Check the viewport */
GetViewportExtEx(hDC, &ViewportExt);
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), HORZRES));
ok_long(ViewportExt.cy, -GetDeviceCaps(GetDC(0), VERTRES));
/* test manually modifying the dcattr, should go to tests for GetViewportExtEx */
SetMapMode(hDC, MM_ISOTROPIC);
ret = SetWindowExtEx(hDC, 420, 4140, &WindowExt);
//pDC_Attr->szlWindowExt.cx = 0;
GetViewportExtEx(hDC, &ViewportExt);
//TEST(pDC_Attr->szlWindowExt.cx == 0);
//TEST(ViewportExt.cx == 0);
//ok_long(pDC_Attr->szlWindowExt.cx, 0);
//ok_long(ViewportExt.cx, 0);
DeleteDC(hDC);
}