Commit 301b5d27 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

gdi32: Add a couple of SetGraphicsMode/SetWorldTransform tests, make them pass under Wine.

parent 5fdf50f7
......@@ -1200,10 +1200,12 @@ BOOL WINAPI GetTransform( HDC hdc, DWORD unknown, LPXFORM xform )
BOOL WINAPI SetWorldTransform( HDC hdc, const XFORM *xform )
{
BOOL ret = FALSE;
DC *dc = get_dc_ptr( hdc );
DC *dc;
if (!xform) return FALSE;
dc = get_dc_ptr( hdc );
if (!dc) return FALSE;
if (!xform) goto done;
/* Check that graphics mode is GM_ADVANCED */
if (dc->GraphicsMode!=GM_ADVANCED) goto done;
......@@ -1211,6 +1213,9 @@ BOOL WINAPI SetWorldTransform( HDC hdc, const XFORM *xform )
TRACE("eM11 %f eM12 %f eM21 %f eM22 %f eDx %f eDy %f\n",
xform->eM11, xform->eM12, xform->eM21, xform->eM22, xform->eDx, xform->eDy);
/* The transform must conform to (eM11 * eM22 != eM12 * eM21) requirement */
if (xform->eM11 * xform->eM22 == xform->eM12 * xform->eM21) goto done;
if (dc->funcs->pSetWorldTransform)
{
ret = dc->funcs->pSetWorldTransform(dc->physDev, xform);
......
......@@ -85,6 +85,15 @@ static void test_world_transform(void)
hdc = CreateCompatibleDC(0);
xform.eM11 = 1.0f;
xform.eM12 = 0.0f;
xform.eM21 = 0.0f;
xform.eM22 = 1.0f;
xform.eDx = 0.0f;
xform.eDy = 0.0f;
ret = SetWorldTransform(hdc, &xform);
ok(!ret, "SetWorldTransform should fail in GM_COMPATIBLE mode\n");
size_cx = GetDeviceCaps(hdc, HORZSIZE);
size_cy = GetDeviceCaps(hdc, VERTSIZE);
res_x = GetDeviceCaps(hdc, HORZRES);
......@@ -144,6 +153,16 @@ static void test_world_transform(void)
expect_world_trasform(hdc, 1.0, 1.0);
expect_LPtoDP(hdc, 1000, 1000);
/* The transform must conform to (eM11 * eM22 != eM12 * eM21) requirement */
xform.eM11 = 1.0f;
xform.eM12 = 2.0f;
xform.eM21 = 1.0f;
xform.eM22 = 2.0f;
xform.eDx = 0.0f;
xform.eDy = 0.0f;
ret = SetWorldTransform(hdc, &xform);
ok(!ret, "SetWorldTransform should fail with an invalid xform\n");
xform.eM11 = 20.0f;
xform.eM12 = 0.0f;
xform.eM21 = 0.0f;
......@@ -183,6 +202,16 @@ static void test_world_transform(void)
expect_world_trasform(hdc, 20.0, 20.0);
expect_LPtoDP(hdc, 20000, 20000);
ret = SetGraphicsMode(hdc, GM_COMPATIBLE);
ok(ret, "SetGraphicsMode(GM_COMPATIBLE) should not fail if DC has't an identity transform\n");
ret = GetGraphicsMode(hdc);
ok(ret == GM_COMPATIBLE, "expected GM_COMPATIBLE, got %d\n", ret);
expect_viewport_ext(hdc, 1, 1);
expect_window_ext(hdc, 1, 1);
expect_world_trasform(hdc, 20.0, 20.0);
expect_LPtoDP(hdc, 20000, 20000);
DeleteDC(hdc);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment