37#define rough_match(got, expected) (abs( MulDiv( (got) - (expected), 1000, (expected) )) <= 5)
39#define expect_LPtoDP(_hdc, _x, _y) \
41 POINT _pt = { 1000, 1000 }; \
42 LPtoDP(_hdc, &_pt, 1); \
43 ok(rough_match(_pt.x, _x), "expected x %d, got %d\n", (_x), _pt.x); \
44 ok(rough_match(_pt.y, _y), "expected y %d, got %d\n", (_y), _pt.y); \
47#define expect_world_transform(_hdc, _em11, _em22) \
51 SetLastError(0xdeadbeef); \
52 _ret = GetWorldTransform(_hdc, &_xform); \
53 if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) \
55 ok(_ret, "GetWorldTransform error %u\n", GetLastError()); \
56 ok(_xform.eM11 == (_em11), "expected %f, got %f\n", (_em11), _xform.eM11); \
57 ok(_xform.eM12 == 0.0, "expected 0.0, got %f\n", _xform.eM12); \
58 ok(_xform.eM21 == 0.0, "expected 0.0, got %f\n", _xform.eM21); \
59 ok(_xform.eM22 == (_em22), "expected %f, got %f\n", (_em22), _xform.eM22); \
60 ok(_xform.eDx == 0.0, "expected 0.0, got %f\n", _xform.eDx); \
61 ok(_xform.eDy == 0.0, "expected 0.0, got %f\n", _xform.eDy); \
65#define expect_dc_ext(_func, _hdc, _cx, _cy) \
69 SetLastError(0xdeadbeef); \
70 _ret = _func(_hdc, &_size); \
71 ok(_ret, #_func " error %u\n", GetLastError()); \
72 ok(_size.cx == (_cx), "expected cx %d, got %d\n", (_cx), _size.cx); \
73 ok(_size.cy == (_cy), "expected cy %d, got %d\n", (_cy), _size.cy); \
76#define expect_viewport_ext(_hdc, _cx, _cy) expect_dc_ext(GetViewportExtEx, _hdc, _cx, _cy)
77#define expect_window_ext(_hdc, _cx, _cy) expect_dc_ext(GetWindowExtEx, _hdc, _cx, _cy)
82 INT ret, 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 %d x %d, resolution %d x %d dpi %d x %d\n",
104 size_cx, size_cy, res_x, res_y, dpi_x, dpi_y );
119 "expected cx %d or %d, got %d\n", size_cx * 10,
MulDiv( res_x, 254, dpi_x ),
size.cx );
122 "expected cy %d or %d, got %d\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 %d or %d, got %d\n", size_cx * 10,
MulDiv( res_x, 254, dpi_x ),
size.cx );
186 "expected cy %d or %d, got %d\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");
242 INT ret, size_cx, size_cy, res_x, res_y, dpi_x, dpi_y;
250 if (!pGetLayout || !pSetLayout)
252 win_skip(
"Don't have SetLayout\n" );
275 if (!pGetLayout(
hdc ))
277 win_skip(
"SetLayout not supported\n" );
289 ok(
pt.x == 0 &&
pt.y == 0,
"wrong origin %d,%d\n",
pt.x,
pt.y );
291 ok(
pt.x == 0 &&
pt.y == 0,
"wrong origin %d,%d\n",
pt.x,
pt.y );
293 ok(
pt.x == 0 &&
pt.y == 0,
"wrong origin %d,%d\n",
pt.x,
pt.y );
297 BOOL ret = pGetTransform(
hdc, 0x204, &xform );
299 ok( xform.
eM11 == -1.0,
"got %f\n", xform.
eM11 );
300 ok( xform.
eM12 == 0.0,
"got %f\n", xform.
eM12 );
301 ok( xform.
eM21 == 0.0,
"got %f\n", xform.
eM21 );
302 ok( xform.
eM22 == 1.0,
"got %f\n", xform.
eM22 );
303 ok( xform.
eDx == 99.0,
"got %f\n", xform.
eDx );
304 ok( xform.
eDy == 0.0,
"got %f\n", xform.
eDy );
307 SetRect( &rc, 10, 10, 20, 20 );
314 SetRect( &rc, 80, 10, 90, 20 );
322 SetRect( &rc, 15, 10, 20, 20 );
332 SetRect( &rc, 15, 10, 40, 20 );
349 SetRect( &rc, 55, 15, 80, 25 );
363 "expected cx %d or %d, got %d\n", size_cx * 10,
MulDiv( res_x, 254, dpi_x ),
size.cx );
366 "expected cy %d or %d, got %d\n", size_cy * 10,
MulDiv( res_y, 254, dpi_y ),
size.cy );
406 SIZE windowExt, viewportExt;
407 POINT windowOrg, windowOrgAfter, viewportOrg, viewportOrgAfter;
415 "Window extension: Expected %dx%d, got %dx%d\n",
416 cx,
cy, windowExt.
cx, windowExt.
cy);
420 "Viewport extents have not been properly adjusted: Expected %dx%d, got %dx%d\n",
421 expected_vp_cx, expected_vp_cy, viewportExt.
cx, viewportExt.
cy);
424 ok(windowOrg.
x == windowOrgAfter.
x && windowOrg.
y == windowOrgAfter.
y,
425 "Window origin changed from (%d,%d) to (%d,%d)\n",
426 windowOrg.
x, windowOrg.
y, windowOrgAfter.
x, windowOrgAfter.
y);
429 ok(viewportOrg.
x == viewportOrgAfter.
x && viewportOrg.
y == viewportOrgAfter.
y,
430 "Viewport origin changed from (%d,%d) to (%d,%d)\n",
431 viewportOrg.
x, viewportOrg.
y, viewportOrgAfter.
x, viewportOrgAfter.
y);
436 SIZE windowExt, windowExtAfter, viewportExt;
437 POINT windowOrg, windowOrgAfter, viewportOrg, viewportOrgAfter;
446 "Viewport extents have not been properly adjusted: Expected %dx%d, got %dx%d\n",
447 expected_vp_cx, expected_vp_cy, viewportExt.
cx, viewportExt.
cy);
450 ok(windowExt.
cx == windowExtAfter.
cx && windowExt.
cy == windowExtAfter.
cy,
451 "Window extension changed from %dx%d to %dx%d\n",
452 windowExt.
cx, windowExt.
cy, windowExtAfter.
cx, windowExtAfter.
cy);
455 ok(windowOrg.
x == windowOrgAfter.
x && windowOrg.
y == windowOrgAfter.
y,
456 "Window origin changed from (%d,%d) to (%d,%d)\n",
457 windowOrg.
x, windowOrg.
y, windowOrgAfter.
x, windowOrgAfter.
y);
460 ok(viewportOrg.
x == viewportOrgAfter.
x && viewportOrg.
y == viewportOrgAfter.
y,
461 "Viewport origin changed from (%d,%d) to (%d,%d)\n",
462 viewportOrg.
x, viewportOrg.
y, viewportOrgAfter.
x, viewportOrgAfter.
y);
511 SIZE orig_lometric_vp, orig_lometric_wnd;
513 if(!pSetVirtualResolution)
515 win_skip(
"Don't have SetVirtualResolution\n");
525 r = pSetVirtualResolution(
hdc, 4000, 1000, 400, 200);
541 r = pSetVirtualResolution(
hdc, 8000, 1000, 400, 200);
550 r = pSetVirtualResolution(
hdc, 8000, 1000, 200, 200);
558 r = pSetVirtualResolution(
hdc, 8000, 1000, 200, 200);
566 r = pSetVirtualResolution(
hdc, 8000, 2000, 200, 200);
574 r = pSetVirtualResolution(
hdc, 0, 0, 10, 0);
582 r = pSetVirtualResolution(
hdc, 0, 0, 0, 0);
619 SIZE lometric_vp, lometric_wnd;
623 win_skip(
"Don't have GetTransform\n");
627 r = pGetTransform(
hdc, 0x203, &xform);
630 r = pGetTransform(
hdc, 0x304, &xform);
633 r = pGetTransform(
hdc, 0x204, &xform);
636 r = pGetTransform(
hdc, 0x402, &xform);
644 r = pGetTransform(
hdc, 0x203, &xform);
648 r = pGetTransform(
hdc, 0x304, &xform);
656 r = pGetTransform(
hdc, 0x204, &xform);
660 r = pGetTransform(
hdc, 0x402, &xform);
672 r = pGetTransform(
hdc, 0x203, &xform);
676 r = pGetTransform(
hdc, 0x304, &xform);
682 r = pGetTransform(
hdc, 0x204, &xform);
688 r = pGetTransform(
hdc, 0x402, &xform);
694 r = pGetTransform(
hdc, 0x102, &xform);
696 r = pGetTransform(
hdc, 0x103, &xform);
698 r = pGetTransform(
hdc, 0x104, &xform);
700 r = pGetTransform(
hdc, 0x202, &xform);
702 r = pGetTransform(
hdc, 0x302, &xform);
704 r = pGetTransform(
hdc, 0x303, &xform);
706 r = pGetTransform(
hdc, 0x403, &xform);
708 r = pGetTransform(
hdc, 0x404, &xform);
710 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)
GLdouble GLdouble GLdouble r
GLenum GLenum GLenum GLenum mapping
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
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)
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)