From 22a65466b3aa80bf9b543fb583df873db84e6f97 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Wed, 12 Aug 2015 21:11:35 +0300 Subject: [PATCH] dwrite/tests: Some tests for target hdc mode/transform. --- dlls/dwrite/tests/font.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c index 7ee5c8a7f15..b1327494100 100644 --- a/dlls/dwrite/tests/font.c +++ b/dlls/dwrite/tests/font.c @@ -757,6 +757,7 @@ static void test_CreateBitmapRenderTarget(void) HBITMAP hbm, hbm2; DWRITE_MATRIX m; DIBSECTION ds; + XFORM xform; COLORREF c; HRESULT hr; FLOAT pdip; @@ -791,6 +792,11 @@ if (0) /* crashes on native */ hdc = IDWriteBitmapRenderTarget_GetMemoryDC(target); ok(hdc != NULL, "got %p\n", hdc); + /* test mode */ + ret = GetGraphicsMode(hdc); +todo_wine + ok(ret == GM_ADVANCED, "got %d\n", ret); + hbm = GetCurrentObject(hdc, OBJ_BITMAP); ok(hbm != NULL, "got %p\n", hbm); @@ -914,7 +920,7 @@ if (0) /* crashes on native */ ok(ds.dsBm.bmBitsPixel == 1, "got %d\n", ds.dsBm.bmBitsPixel); ok(!ds.dsBm.bmBits, "got %p\n", ds.dsBm.bmBits); - /* transform tests */ + /* transform tests, current hdc transform is not immediately affected */ if (0) /* crashes on native */ hr = IDWriteBitmapRenderTarget_GetCurrentTransform(target, NULL); @@ -923,6 +929,10 @@ if (0) /* crashes on native */ ok(hr == S_OK, "got 0x%08x\n", hr); ok(m.m11 == 1.0 && m.m22 == 1.0 && m.m12 == 0.0 && m.m21 == 0.0, "got %.1f,%.1f,%.1f,%.1f\n", m.m11, m.m22, m.m12, m.m21); ok(m.dx == 0.0 && m.dy == 0.0, "got %.1f,%.1f\n", m.dx, m.dy); + ret = GetWorldTransform(hdc, &xform); + ok(ret, "got %d\n", ret); + ok(xform.eM11 == 1.0 && xform.eM22 == 1.0 && xform.eM12 == 0.0 && xform.eM21 == 0.0, "got wrong transform\n"); + ok(xform.eDx == 0.0 && xform.eDy == 0.0, "got %.1f,%.1f\n", xform.eDx, xform.eDy); memset(&m, 0, sizeof(m)); hr = IDWriteBitmapRenderTarget_SetCurrentTransform(target, &m); @@ -933,6 +943,19 @@ if (0) /* crashes on native */ ok(hr == S_OK, "got 0x%08x\n", hr); ok(m.m11 == 0.0 && m.m22 == 0.0 && m.m12 == 0.0 && m.m21 == 0.0, "got %.1f,%.1f,%.1f,%.1f\n", m.m11, m.m22, m.m12, m.m21); ok(m.dx == 0.0 && m.dy == 0.0, "got %.1f,%.1f\n", m.dx, m.dy); + ret = GetWorldTransform(hdc, &xform); + ok(ret, "got %d\n", ret); + ok(xform.eM11 == 1.0 && xform.eM22 == 1.0 && xform.eM12 == 0.0 && xform.eM21 == 0.0, "got wrong transform\n"); + ok(xform.eDx == 0.0 && xform.eDy == 0.0, "got %.1f,%.1f\n", xform.eDx, xform.eDy); + + memset(&m, 0, sizeof(m)); + m.m11 = 2.0; m.m22 = 1.0; + hr = IDWriteBitmapRenderTarget_SetCurrentTransform(target, &m); + ok(hr == S_OK, "got 0x%08x\n", hr); + ret = GetWorldTransform(hdc, &xform); + ok(ret, "got %d\n", ret); + ok(xform.eM11 == 1.0 && xform.eM22 == 1.0 && xform.eM12 == 0.0 && xform.eM21 == 0.0, "got wrong transform\n"); + ok(xform.eDx == 0.0 && xform.eDy == 0.0, "got %.1f,%.1f\n", xform.eDx, xform.eDy); hr = IDWriteBitmapRenderTarget_SetCurrentTransform(target, NULL); ok(hr == S_OK, "got 0x%08x\n", hr);