36#define rough_match(got, expected) (abs( MulDiv( (got) - (expected), 1000, (expected) )) <= 5)
38#define expect_LPtoDP(_hdc, _x, _y) \
40 POINT _pt = { 1000, 1000 }; \
41 LPtoDP(_hdc, &_pt, 1); \
42 ok(rough_match(_pt.x, _x), "expected x %d, got %ld\n", (_x), _pt.x); \
43 ok(rough_match(_pt.y, _y), "expected y %d, got %ld\n", (_y), _pt.y); \
46#define expect_world_transform(_hdc, _em11, _em22) \
50 SetLastError(0xdeadbeef); \
51 _ret = GetWorldTransform(_hdc, &_xform); \
52 if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) \
54 ok(_ret, "GetWorldTransform error %lu\n", GetLastError()); \
55 ok(_xform.eM11 == (_em11), "expected %f, got %f\n", (_em11), _xform.eM11); \
56 ok(_xform.eM12 == 0.0, "expected 0.0, got %f\n", _xform.eM12); \
57 ok(_xform.eM21 == 0.0, "expected 0.0, got %f\n", _xform.eM21); \
58 ok(_xform.eM22 == (_em22), "expected %f, got %f\n", (_em22), _xform.eM22); \
59 ok(_xform.eDx == 0.0, "expected 0.0, got %f\n", _xform.eDx); \
60 ok(_xform.eDy == 0.0, "expected 0.0, got %f\n", _xform.eDy); \
64#define expect_dc_ext(_func, _hdc, _cx, _cy) \
68 SetLastError(0xdeadbeef); \
69 _ret = _func(_hdc, &_size); \
70 ok(_ret, #_func " error %lu\n", GetLastError()); \
71 ok(_size.cx == (_cx), "expected cx %ld, got %ld\n", (_cx), _size.cx); \
72 ok(_size.cy == (_cy), "expected cy %ld, got %ld\n", (_cy), _size.cy); \
75#define expect_viewport_ext(_hdc, _cx, _cy) expect_dc_ext(GetViewportExtEx, _hdc, _cx, _cy)
76#define expect_window_ext(_hdc, _cx, _cy) expect_dc_ext(GetWindowExtEx, _hdc, _cx, _cy)
82 LONG size_cx, size_cy, res_x, res_y, dpi_x, dpi_y;
95 ok(!
ret,
"SetWorldTransform should fail in GM_COMPATIBLE mode\n");
103 trace(
"dc size %ld x %ld, resolution %ld x %ld dpi %ld x %ld\n",
104 size_cx, size_cy, res_x, res_y, dpi_x, dpi_y );
119 "expected cx %ld or %d, got %ld\n", size_cx * 10,
MulDiv( res_x, 254, dpi_x ),
size.cx );
122 "expected cy %ld or %d, got %ld\n", size_cy * 10,
MulDiv( res_y, 254, dpi_y ),
size.cy );
139 skip(
"GM_ADVANCED is not supported on this platform\n");
158 "SetWorldTransform should fail with an invalid xform\n");
183 "expected cx %ld or %d, got %ld\n", size_cx * 10,
MulDiv( res_x, 254, dpi_x ),
size.cx );
186 "expected cy %ld or %d, got %ld\n", size_cy * 10,
MulDiv( res_y, 254, dpi_y ),
size.cy );
199 size.cx = 0xdeadbeef;
200 size.cy = 0xdeadbeef;
202 ok(
ret,
"SetViewportExtEx(-1, -1) failed\n");
217 size.cx = 0xdeadbeef;
218 size.cy = 0xdeadbeef;
220 ok(
ret,
"SetViewportExtEx(-1, -1) failed\n");
228 ok(
ret,
"SetGraphicsMode(GM_COMPATIBLE) should not fail if DC has't an identity transform\n");
243 LONG size_cx, size_cy, res_x, res_y, dpi_x, dpi_y;
253 win_skip(
"Don't have GetLayout\n" );
276 if (!pGetLayout(
hdc ))
278 win_skip(
"SetLayout not supported\n" );
292 ok(
pt.x == 0 &&
pt.y == 0,
"wrong origin %ld,%ld\n",
pt.x,
pt.y );
294 ok(
pt.x == 0 &&
pt.y == 0,
"wrong origin %ld,%ld\n",
pt.x,
pt.y );
296 ok(
pt.x == 0 &&
pt.y == 0,
"wrong origin %ld,%ld\n",
pt.x,
pt.y );
300 BOOL ret = pGetTransform(
hdc, 0x204, &xform );
302 ok( xform.
eM11 == -1.0,
"got %f\n", xform.
eM11 );
303 ok( xform.
eM12 == 0.0,
"got %f\n", xform.
eM12 );
304 ok( xform.
eM21 == 0.0,
"got %f\n", xform.
eM21 );
305 ok( xform.
eM22 == 1.0,
"got %f\n", xform.
eM22 );
306 ok( xform.
eDx == 99.0,
"got %f\n", xform.
eDx );
307 ok( xform.
eDy == 0.0,
"got %f\n", xform.
eDy );
310 SetRect( &rc, 10, 10, 20, 20 );
317 SetRect( &rc, 80, 10, 90, 20 );
325 SetRect( &rc, 15, 10, 20, 20 );
335 SetRect( &rc, 15, 10, 40, 20 );
352 SetRect( &rc, 55, 15, 80, 25 );
366 "expected cx %ld or %d, got %ld\n", size_cx * 10,
MulDiv( res_x, 254, dpi_x ),
size.cx );
369 "expected cy %lxd or %d, got %ld\n", size_cy * 10,
MulDiv( res_y, 254, dpi_y ),
size.cy );
409 xform.
eDx = xform.
eDy = 0;
411 ok(
ret,
"ModifyWorldTransform failed\n");
413 memset(&xform2, 0xcc,
sizeof(xform2));
415 ok(
ret,
"GetWorldTransform failed\n");
416 ok(!
memcmp(&xform, &xform2,
sizeof(xform)),
"unexpected xform\n");
422 xform.
eDx = xform.
eDy = 0;
424 ok(!
ret,
"ModifyWorldTransform succeeded\n");
431 SIZE windowExt, viewportExt;
432 POINT windowOrg, windowOrgAfter, viewportOrg, viewportOrgAfter;
440 "Window extension: Expected %ldx%ld, got %ldx%ld\n",
441 cx,
cy, windowExt.
cx, windowExt.
cy);
445 "Viewport extents have not been properly adjusted: Expected %ldx%ld, got %ldx%ld\n",
446 expected_vp_cx, expected_vp_cy, viewportExt.
cx, viewportExt.
cy);
449 ok(windowOrg.
x == windowOrgAfter.
x && windowOrg.
y == windowOrgAfter.
y,
450 "Window origin changed from (%ld,%ld) to (%ld,%ld)\n",
451 windowOrg.
x, windowOrg.
y, windowOrgAfter.
x, windowOrgAfter.
y);
454 ok(viewportOrg.
x == viewportOrgAfter.
x && viewportOrg.
y == viewportOrgAfter.
y,
455 "Viewport origin changed from (%ld,%ld) to (%ld,%ld)\n",
456 viewportOrg.
x, viewportOrg.
y, viewportOrgAfter.
x, viewportOrgAfter.
y);
461 SIZE windowExt, windowExtAfter, viewportExt;
462 POINT windowOrg, windowOrgAfter, viewportOrg, viewportOrgAfter;
471 "Viewport extents have not been properly adjusted: Expected %ldx%ld, got %ldx%ld\n",
472 expected_vp_cx, expected_vp_cy, viewportExt.
cx, viewportExt.
cy);
475 ok(windowExt.
cx == windowExtAfter.
cx && windowExt.
cy == windowExtAfter.
cy,
476 "Window extension changed from %ldx%ld to %ldx%ld\n",
477 windowExt.
cx, windowExt.
cy, windowExtAfter.
cx, windowExtAfter.
cy);
480 ok(windowOrg.
x == windowOrgAfter.
x && windowOrg.
y == windowOrgAfter.
y,
481 "Window origin changed from (%ld,%ld) to (%ld,%ld)\n",
482 windowOrg.
x, windowOrg.
y, windowOrgAfter.
x, windowOrgAfter.
y);
485 ok(viewportOrg.
x == viewportOrgAfter.
x && viewportOrg.
y == viewportOrgAfter.
y,
486 "Viewport origin changed from (%ld,%ld) to (%ld,%ld)\n",
487 viewportOrg.
x, viewportOrg.
y, viewportOrgAfter.
x, viewportOrgAfter.
y);
536 SIZE orig_lometric_vp, orig_lometric_wnd;
538 if(!pSetVirtualResolution)
540 win_skip(
"Don't have SetVirtualResolution\n");
550 r = pSetVirtualResolution(
hdc, 4000, 1000, 400, 200);
566 r = pSetVirtualResolution(
hdc, 8000, 1000, 400, 200);
575 r = pSetVirtualResolution(
hdc, 8000, 1000, 200, 200);
583 r = pSetVirtualResolution(
hdc, 8000, 1000, 200, 200);
591 r = pSetVirtualResolution(
hdc, 8000, 2000, 200, 200);
599 r = pSetVirtualResolution(
hdc, 0, 0, 10, 0);
607 r = pSetVirtualResolution(
hdc, 0, 0, 0, 0);
644 SIZE lometric_vp, lometric_wnd;
648 win_skip(
"Don't have GetTransform\n");
652 r = pGetTransform(
hdc, 0x203, &xform);
655 r = pGetTransform(
hdc, 0x304, &xform);
658 r = pGetTransform(
hdc, 0x204, &xform);
661 r = pGetTransform(
hdc, 0x402, &xform);
669 r = pGetTransform(
hdc, 0x203, &xform);
673 r = pGetTransform(
hdc, 0x304, &xform);
681 r = pGetTransform(
hdc, 0x204, &xform);
685 r = pGetTransform(
hdc, 0x402, &xform);
697 r = pGetTransform(
hdc, 0x203, &xform);
701 r = pGetTransform(
hdc, 0x304, &xform);
707 r = pGetTransform(
hdc, 0x204, &xform);
713 r = pGetTransform(
hdc, 0x402, &xform);
719 r = pGetTransform(
hdc, 0x102, &xform);
721 r = pGetTransform(
hdc, 0x103, &xform);
723 r = pGetTransform(
hdc, 0x104, &xform);
725 r = pGetTransform(
hdc, 0x202, &xform);
727 r = pGetTransform(
hdc, 0x302, &xform);
729 r = pGetTransform(
hdc, 0x303, &xform);
731 r = pGetTransform(
hdc, 0x403, &xform);
733 r = pGetTransform(
hdc, 0x404, &xform);
735 r = pGetTransform(
hdc, 0xffff, &xform);
std::map< E_MODULE, HMODULE > mod
static const char * wine_dbgstr_rect(const RECT *prc)
#define GetProcAddress(x, y)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
_ACRTIMP double __cdecl fabs(double)
DWORD WINAPI SetLayout(_In_ HDC hdc, _In_ DWORD dwLayout)
GLdouble GLdouble GLdouble r
GLenum GLenum GLenum GLenum mapping
static void test_world_transform(void)
static void test_SetViewportExt(HDC hdc, LONG cx, LONG cy, LONG expected_vp_cx, LONG expected_vp_cy)
#define expect_world_transform(_hdc, _em11, _em22)
static void xform_near_match(int line, XFORM *got, XFORM *expect)
#define rough_match(got, expected)
static void test_isotropic_mapping(void)
#define expect_LPtoDP(_hdc, _x, _y)
static void test_modify_world_transform(void)
static void expect_identity(int line, XFORM *xf)
static void test_SetWindowExt(HDC hdc, LONG cx, LONG cy, LONG expected_vp_cx, LONG expected_vp_cy)
static void test_setvirtualresolution(void)
#define expect_window_ext(_hdc, _cx, _cy)
static void test_dc_layout(void)
static void test_gettransform(void)
#define expect_viewport_ext(_hdc, _cx, _cy)
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
_Out_opt_ int _Out_opt_ int * cy
DWORD WINAPI GetLastError(void)
int WINAPI SetMapMode(_In_ HDC, _In_ int)
int WINAPI GetClipBox(_In_ HDC, _Out_ LPRECT)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
int WINAPI SetGraphicsMode(_In_ HDC, _In_ int)
HDC WINAPI CreateICA(_In_opt_ LPCSTR, _In_opt_ LPCSTR, _In_opt_ LPCSTR, _In_opt_ const DEVMODEA *)
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
int WINAPI GetGraphicsMode(_In_ HDC)
BOOL WINAPI SetViewportExtEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPSIZE)
BOOL WINAPI GetWindowOrgEx(_In_ HDC, _Out_ LPPOINT)
int WINAPI IntersectClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
int WINAPI GetClipRgn(_In_ HDC, _In_ HRGN)
BOOL WINAPI SetWindowExtEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPSIZE)
BOOL WINAPI GetWorldTransform(_In_ HDC, _Out_ LPXFORM)
int WINAPI GetMapMode(_In_ HDC)
#define MWT_RIGHTMULTIPLY
BOOL WINAPI GetWindowExtEx(_In_ HDC, _Out_ LPSIZE)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
int WINAPI OffsetClipRgn(_In_ HDC, _In_ int, _In_ int)
BOOL WINAPI SetWorldTransform(_In_ HDC, _In_ const XFORM *)
BOOL WINAPI DeleteDC(_In_ HDC)
BOOL WINAPI GetViewportExtEx(_In_ HDC, _Out_ LPSIZE)
BOOL WINAPI SetRectRgn(_In_ HRGN, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI GetViewportOrgEx(_In_ HDC, _Out_ LPPOINT)
int WINAPI ExtSelectClipRgn(_In_ HDC, _In_opt_ HRGN, _In_ int)
int WINAPI GetRgnBox(_In_ HRGN, _Out_ LPRECT)
BOOL WINAPI ModifyWorldTransform(_In_ HDC, _In_opt_ const XFORM *, _In_ DWORD)
BOOL WINAPI GetDCOrgEx(_In_ HDC, _Out_ LPPOINT)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)