[UXTHEME_WINETEST] Sync with Wine Staging 2.9. CORE-13362
authorAmine Khaldi <amine.khaldi@reactos.org>
Sun, 4 Jun 2017 01:52:19 +0000 (01:52 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sun, 4 Jun 2017 01:52:19 +0000 (01:52 +0000)
svn path=/trunk/; revision=74890

rostests/winetests/uxtheme/system.c

index 6844b3b..44730a3 100644 (file)
@@ -527,14 +527,42 @@ static void test_CloseThemeData(void)
     ok( hRes == E_HANDLE, "Expected E_HANDLE, got 0x%08x\n", hRes);
 }
 
+static void test_buffer_dc_props(HDC hdc, const RECT *rect)
+{
+    static const XFORM ident = { 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f };
+    XFORM xform;
+    POINT org;
+    RECT box;
+    BOOL ret;
+
+    ret = GetWorldTransform(hdc, &xform);
+    ok(ret, "Failed to get world transform\n");
+    ok(!memcmp(&xform, &ident, sizeof(xform)), "Unexpected world transform\n");
+
+    ret = GetViewportOrgEx(hdc, &org);
+    ok(ret, "Failed to get vport origin\n");
+    ok(org.x == 0 && org.y == 0, "Unexpected vport origin\n");
+
+    ret = GetWindowOrgEx(hdc, &org);
+    ok(ret, "Failed to get vport origin\n");
+    ok(org.x == rect->left && org.y == rect->top, "Unexpected window origin\n");
+
+    ret = GetClipBox(hdc, &box);
+    ok(ret, "Failed to get clip box\n");
+    ok(box.left == rect->left && box.top == rect->top, "Unexpected clip box\n");
+
+    ok(GetGraphicsMode(hdc) == GM_COMPATIBLE, "wrong graphics mode\n");
+}
+
 static void test_buffered_paint(void)
 {
+    HDC target, src, hdc, screen_dc;
     BP_PAINTPARAMS params = { 0 };
     BP_BUFFERFORMAT format;
-    HDC target, src, hdc;
     HPAINTBUFFER buffer;
     RECT rect, rect2;
     RGBQUAD *bits;
+    HBITMAP hbm;
     HRESULT hr;
     int row;
 
@@ -674,6 +702,31 @@ todo_wine
     hr = pGetBufferedPaintBits(NULL, NULL, &row);
     ok(hr == E_POINTER, "Unexpected return code %#x\n", hr);
 
+    screen_dc = GetDC(0);
+
+    hdc = CreateCompatibleDC(screen_dc);
+    ok(hdc != NULL, "Failed to create a DC\n");
+    hbm = CreateCompatibleBitmap(screen_dc, 64, 64);
+    ok(hbm != NULL, "Failed to create a bitmap\n");
+    SelectObject(hdc, hbm);
+
+    ReleaseDC(0, screen_dc);
+
+    SetRect(&rect, 1, 2, 34, 56);
+
+    buffer = pBeginBufferedPaint(hdc, &rect, BPBF_COMPATIBLEBITMAP, NULL, &src);
+    test_buffer_dc_props(src, &rect);
+    hr = pEndBufferedPaint(buffer, FALSE);
+    ok(hr == S_OK, "Unexpected return code %#x\n", hr);
+
+    DeleteObject(hbm);
+    DeleteDC(hdc);
+
+    buffer = pBeginBufferedPaint(target, &rect, BPBF_COMPATIBLEBITMAP, NULL, &src);
+    test_buffer_dc_props(src, &rect);
+    hr = pEndBufferedPaint(buffer, FALSE);
+    ok(hr == S_OK, "Unexpected return code %#x\n", hr);
+
     /* access buffer bits */
     for (format = BPBF_COMPATIBLEBITMAP; format <= BPBF_TOPDOWNMONODIB; format++)
     {
@@ -703,37 +756,16 @@ START_TEST(system)
 {
     init_funcs();
 
-    /* No real functional tests will be done (yet). The current tests
+    /* No real functional theme API tests will be done (yet). The current tests
      * only show input/return behaviour
      */
 
-    /* IsThemeActive, IsAppThemed and IsThemePartDefined*/
-    trace("Starting test_IsThemed()\n");
     test_IsThemed();
-
-    /* GetWindowTheme */
-    trace("Starting test_GetWindowTheme()\n");
     test_GetWindowTheme();
-
-    /* SetWindowTheme */
-    trace("Starting test_SetWindowTheme()\n");
     test_SetWindowTheme();
-
-    /* OpenThemeData, a bit more functional now */
-    trace("Starting test_OpenThemeData()\n");
     test_OpenThemeData();
-
-    /* OpenThemeDataEx */
-    trace("Starting test_OpenThemeDataEx()\n");
     test_OpenThemeDataEx();
-
-    /* GetCurrentThemeName */
-    trace("Starting test_GetCurrentThemeName()\n");
     test_GetCurrentThemeName();
-
-    /* CloseThemeData */
-    trace("Starting test_CloseThemeData()\n");
     test_CloseThemeData();
-
     test_buffered_paint();
 }