[GDIPLUS_WINETEST] Sync with Wine Staging 1.9.16. CORE-11866
authorAmine Khaldi <amine.khaldi@reactos.org>
Fri, 19 Aug 2016 09:29:03 +0000 (09:29 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Fri, 19 Aug 2016 09:29:03 +0000 (09:29 +0000)
svn path=/trunk/; revision=72342

rostests/winetests/gdiplus/font.c
rostests/winetests/gdiplus/graphics.c
rostests/winetests/gdiplus/image.c
rostests/winetests/gdiplus/metafile.c
rostests/winetests/gdiplus/region.c

index 0b6fbcb..c49878c 100644 (file)
@@ -81,7 +81,7 @@ static void test_createfont(void)
     stat = GdipDeleteFontFamily(fontfamily2);
     expect(Ok, stat);
 
     stat = GdipDeleteFontFamily(fontfamily2);
     expect(Ok, stat);
 
-    /* Test to see if returned size is based on unit (its not) */
+    /* Test to see if returned size is based on unit (it's not) */
     GdipGetFontSize(font, &size);
     ok (size == 12, "Expected 12, got %f\n", size);
     GdipDeleteFont(font);
     GdipGetFontSize(font, &size);
     ok (size == 12, "Expected 12, got %f\n", size);
     GdipDeleteFont(font);
@@ -788,6 +788,7 @@ static void test_font_substitution(void)
     expect(Ok, status);
     strcpy(fallback_font,lf.lfFaceName);
     trace("fallback font %s\n", fallback_font);
     expect(Ok, status);
     strcpy(fallback_font,lf.lfFaceName);
     trace("fallback font %s\n", fallback_font);
+    GdipDeleteFont(font);
 
     lstrcpyA(lf.lfFaceName, "ThisFontShouldNotExist");
     status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
 
     lstrcpyA(lf.lfFaceName, "ThisFontShouldNotExist");
     status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
index 99ade24..7d308d7 100644 (file)
@@ -2319,6 +2319,29 @@ static void test_GdipGetVisibleClipBounds_window(void)
         recti.X, recti.Y, recti.Width, recti.Height,
         exp.X, exp.Y, exp.Width, exp.Height);
 
         recti.X, recti.Y, recti.Width, recti.Height,
         exp.X, exp.Y, exp.Width, exp.Height);
 
+    /* window bounds with transform applied */
+    status = GdipResetClip(graphics);
+    expect(Ok, status);
+
+    status = GdipScaleWorldTransform(graphics, 0.5, 0.5, MatrixOrderPrepend);
+    expect(Ok, status);
+
+    exp.X = window.X * 2.0;
+    exp.Y = window.Y * 2.0;
+    exp.Width = window.Width * 2.0;
+    exp.Height = window.Height * 2.0;
+
+    status = GdipGetVisibleClipBounds(graphics, &rectf);
+    expect(Ok, status);
+    ok(rectf.X == exp.X &&
+        rectf.Y == exp.Y &&
+        rectf.Width == exp.Width &&
+        rectf.Height == exp.Height,
+        "Expected clip bounds (%0.f, %0.f, %0.f, %0.f) to be "
+        "twice the window size (%0.f, %0.f, %0.f, %0.f)\n",
+        rectf.X, rectf.Y, rectf.Width, rectf.Height,
+        exp.X, exp.Y, exp.Width, exp.Height);
+
     GdipDeleteGraphics(graphics);
     EndPaint(hwnd, &ps);
 }
     GdipDeleteGraphics(graphics);
     EndPaint(hwnd, &ps);
 }
@@ -3746,10 +3769,8 @@ todo_wine
         expected_width = base_cx * pt.Y;
         expected_height = base_cy * pt.Y;
 
         expected_width = base_cx * pt.Y;
         expected_height = base_cy * pt.Y;
 
-        if (td[i].unit == UnitDisplay || td[i].unit == UnitPixel)
+        todo_wine_if(td[i].unit != UnitDisplay && td[i].unit != UnitPixel)
             ok(fabs(expected_width - bounds.Width) <= 0.001, "%u: expected %f, got %f\n", i, expected_width, bounds.Width);
             ok(fabs(expected_width - bounds.Width) <= 0.001, "%u: expected %f, got %f\n", i, expected_width, bounds.Width);
-        else
-            todo_wine ok(fabs(expected_width - bounds.Width) <= 0.001, "%u: expected %f, got %f\n", i, expected_width, bounds.Width);
         ok(fabs(expected_height - bounds.Height) <= 0.001, "%u: expected %f, got %f\n", i, expected_height, bounds.Height);
 
         GdipDeleteGraphics(graphics);
         ok(fabs(expected_height - bounds.Height) <= 0.001, "%u: expected %f, got %f\n", i, expected_height, bounds.Height);
 
         GdipDeleteGraphics(graphics);
@@ -4846,7 +4867,7 @@ static void test_clipping(void)
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 45 && rc.top == 20 && rc.right == 95 && rc.bottom == 45,
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 45 && rc.top == 20 && rc.right == 95 && rc.bottom == 45,
-       "expected 45,20-95,45, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 45,20-95,45, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
     DeleteObject(hrgn);
 
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
@@ -4854,7 +4875,7 @@ static void test_clipping(void)
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
-       "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     ptf[0].X = 100.0;
     DeleteObject(hrgn);
 
     ptf[0].X = 100.0;
@@ -4871,7 +4892,7 @@ static void test_clipping(void)
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
-       "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     status = GdipGetRegionHRgn(region100x100, graphics, &hrgn);
     DeleteObject(hrgn);
 
     status = GdipGetRegionHRgn(region100x100, graphics, &hrgn);
@@ -4879,7 +4900,7 @@ static void test_clipping(void)
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820,
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820,
-       "expected 210,420-410,820, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 210,420-410,820, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     ptf[0].X = 210.0;
     DeleteObject(hrgn);
 
     ptf[0].X = 210.0;
@@ -4918,7 +4939,7 @@ static void test_clipping(void)
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 45 && rc.top == 20 && rc.right == 95 && rc.bottom == 45,
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 45 && rc.top == 20 && rc.right == 95 && rc.bottom == 45,
-       "expected 45,20-95,45, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 45,20-95,45, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
     DeleteObject(hrgn);
 
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
@@ -4926,7 +4947,7 @@ static void test_clipping(void)
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
-       "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     ptf[0].X = 100.0;
     DeleteObject(hrgn);
 
     ptf[0].X = 100.0;
@@ -4943,7 +4964,7 @@ static void test_clipping(void)
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
-       "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     status = GdipGetRegionHRgn(region100x100, graphics, &hrgn);
     DeleteObject(hrgn);
 
     status = GdipGetRegionHRgn(region100x100, graphics, &hrgn);
@@ -4951,7 +4972,7 @@ static void test_clipping(void)
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820,
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820,
-       "expected 210,420-410,820, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 210,420-410,820, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     ptf[0].X = 210.0;
     DeleteObject(hrgn);
 
     ptf[0].X = 210.0;
@@ -4999,7 +5020,7 @@ static void test_clipping(void)
        /* rounding under Wine is slightly different */
        (rc.left == 14 && rc.top == 4 && rc.right == 33 && rc.bottom == 14) /* Wine */ ||
        broken(rc.left == 45 && rc.top == 20 && rc.right == 95 && rc.bottom == 45) /* before Win7 */,
        /* rounding under Wine is slightly different */
        (rc.left == 14 && rc.top == 4 && rc.right == 33 && rc.bottom == 14) /* Wine */ ||
        broken(rc.left == 45 && rc.top == 20 && rc.right == 95 && rc.bottom == 45) /* before Win7 */,
-       "expected 14,5-33,14, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 14,5-33,14, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
     DeleteObject(hrgn);
 
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
@@ -5008,7 +5029,7 @@ static void test_clipping(void)
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) ||
       broken(rc.left == 267 && rc.top == 267 && rc.right == 534 && rc.bottom == 534) /* before Win7 */,
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) ||
       broken(rc.left == 267 && rc.top == 267 && rc.right == 534 && rc.bottom == 534) /* before Win7 */,
-       "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     ptf[0].X = 100.0;
     DeleteObject(hrgn);
 
     ptf[0].X = 100.0;
@@ -5026,7 +5047,7 @@ static void test_clipping(void)
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
-       "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     status = GdipGetRegionHRgn(region100x100, graphics, &hrgn);
     DeleteObject(hrgn);
 
     status = GdipGetRegionHRgn(region100x100, graphics, &hrgn);
@@ -5036,7 +5057,7 @@ static void test_clipping(void)
     ok((rc.left == 560 && rc.top == 1120 && rc.right == 1094 && rc.bottom == 2187) ||
        /* rounding under Wine is slightly different */
        (rc.left == 560 && rc.top == 1120 && rc.right == 1093 && rc.bottom == 2187) /* Wine */,
     ok((rc.left == 560 && rc.top == 1120 && rc.right == 1094 && rc.bottom == 2187) ||
        /* rounding under Wine is slightly different */
        (rc.left == 560 && rc.top == 1120 && rc.right == 1093 && rc.bottom == 2187) /* Wine */,
-       "expected 560,1120-1094,2187, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 560,1120-1094,2187, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     ptf[0].X = 560.0;
     DeleteObject(hrgn);
 
     ptf[0].X = 560.0;
@@ -5073,7 +5094,7 @@ static void test_clipping(void)
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820,
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820,
-       "expected 210,420-410,820, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 210,420-410,820, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     status = GdipGetRegionHRgn(region100x100, graphics, &hrgn);
     DeleteObject(hrgn);
 
     status = GdipGetRegionHRgn(region100x100, graphics, &hrgn);
@@ -5083,7 +5104,7 @@ static void test_clipping(void)
     ok((rc.left == 1147 && rc.top == 4534 && rc.right == 2214 && rc.bottom == 8800) ||
        /* rounding under Wine is slightly different */
        (rc.left == 1147 && rc.top == 4533 && rc.right == 2213 && rc.bottom == 8800) /* Wine */,
     ok((rc.left == 1147 && rc.top == 4534 && rc.right == 2214 && rc.bottom == 8800) ||
        /* rounding under Wine is slightly different */
        (rc.left == 1147 && rc.top == 4533 && rc.right == 2213 && rc.bottom == 8800) /* Wine */,
-       "expected 1147,4534-2214,8800, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 1147,4534-2214,8800, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     ptf[0].X = 1147.0;
     DeleteObject(hrgn);
 
     ptf[0].X = 1147.0;
@@ -5143,7 +5164,7 @@ static void test_clipping(void)
     ok((rc.left == 22 && rc.top == -6 && rc.right == 46 && rc.bottom == 7) ||
        /* rounding under Wine is slightly different */
        (rc.left == 21 && rc.top == -5 && rc.right == 46 && rc.bottom == 7) /* Wine */,
     ok((rc.left == 22 && rc.top == -6 && rc.right == 46 && rc.bottom == 7) ||
        /* rounding under Wine is slightly different */
        (rc.left == 21 && rc.top == -5 && rc.right == 46 && rc.bottom == 7) /* Wine */,
-       "expected (22,-6)-(46,7), got (%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected (22,-6)-(46,7), got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
     DeleteObject(hrgn);
 
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
@@ -5151,7 +5172,7 @@ static void test_clipping(void)
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
-       "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     ptf[0].X = 100.0;
     DeleteObject(hrgn);
 
     ptf[0].X = 100.0;
@@ -5178,7 +5199,7 @@ static void test_clipping(void)
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820,
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820,
-       "expected 210,420-410,820, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 210,420-410,820, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     status = GdipGetRegionHRgn(region100x100, graphics, &hrgn);
     DeleteObject(hrgn);
 
     status = GdipGetRegionHRgn(region100x100, graphics, &hrgn);
@@ -5188,7 +5209,7 @@ static void test_clipping(void)
     ok((rc.left == -3406 && rc.top == 4500 && rc.right == -350 && rc.bottom == 8728) ||
        /* rounding under Wine is slightly different */
        (rc.left == -3407 && rc.top == 4500 && rc.right == -350 && rc.bottom == 8728) /* Wine */,
     ok((rc.left == -3406 && rc.top == 4500 && rc.right == -350 && rc.bottom == 8728) ||
        /* rounding under Wine is slightly different */
        (rc.left == -3407 && rc.top == 4500 && rc.right == -350 && rc.bottom == 8728) /* Wine */,
-       "expected (-3406,4500)-(-350,8728), got (%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected (-3406,4500)-(-350,8728), got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     ptf[0].X = -3406.0;
     DeleteObject(hrgn);
 
     ptf[0].X = -3406.0;
@@ -5246,7 +5267,7 @@ static void test_clipping(void)
     ok((rc.left == -27 && rc.top == 8 && rc.right == -2 && rc.bottom == 21) ||
        /* rounding under Wine is slightly different */
        (rc.left == -28 && rc.top == 9 && rc.right == -2 && rc.bottom == 21) /* Wine */,
     ok((rc.left == -27 && rc.top == 8 && rc.right == -2 && rc.bottom == 21) ||
        /* rounding under Wine is slightly different */
        (rc.left == -28 && rc.top == 9 && rc.right == -2 && rc.bottom == 21) /* Wine */,
-       "expected (-27,8)-(-2,21), got (%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected (-27,8)-(-2,21), got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
     DeleteObject(hrgn);
 
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
@@ -5254,7 +5275,7 @@ static void test_clipping(void)
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
-       "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     ptf[0].X = 100.0;
     DeleteObject(hrgn);
 
     ptf[0].X = 100.0;
@@ -5281,7 +5302,7 @@ static void test_clipping(void)
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820,
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820,
-       "expected 210,420-410,820, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 210,420-410,820, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     status = GdipGetRegionHRgn(region100x100, graphics, &hrgn);
     DeleteObject(hrgn);
 
     status = GdipGetRegionHRgn(region100x100, graphics, &hrgn);
@@ -5291,7 +5312,7 @@ static void test_clipping(void)
     ok((rc.left == 4500 && rc.top == 351 && rc.right == 8728 && rc.bottom == 3407) ||
        /* rounding under Wine is slightly different */
        (rc.left == 4499 && rc.top == 351 && rc.right == 8728 && rc.bottom == 3407) /* Wine */,
     ok((rc.left == 4500 && rc.top == 351 && rc.right == 8728 && rc.bottom == 3407) ||
        /* rounding under Wine is slightly different */
        (rc.left == 4499 && rc.top == 351 && rc.right == 8728 && rc.bottom == 3407) /* Wine */,
-       "expected (4500,351)-(8728,3407), got (%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected (4500,351)-(8728,3407), got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     ptf[0].X = -3406.0;
     DeleteObject(hrgn);
 
     ptf[0].X = -3406.0;
@@ -5363,14 +5384,14 @@ static void test_clipping_2(void)
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
-       "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
     expect(Ok, status);
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 9600 && rc.top == 9600 && rc.right == 19200 && rc.bottom == 19200,
     DeleteObject(hrgn);
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
     expect(Ok, status);
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 9600 && rc.top == 9600 && rc.right == 19200 && rc.bottom == 19200,
-       "expected 9600,9600-19200,19200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 9600,9600-19200,19200, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     ptf[0].X = 9600.0;
     DeleteObject(hrgn);
 
     ptf[0].X = 9600.0;
@@ -5394,7 +5415,7 @@ static void test_clipping_2(void)
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok((rc.left == 7200 && rc.top == 7200 && rc.right == 14400 && rc.bottom == 14400) ||
        broken(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) /* before Win7 */,
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok((rc.left == 7200 && rc.top == 7200 && rc.right == 14400 && rc.bottom == 14400) ||
        broken(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) /* before Win7 */,
-       "expected 7200,7200-14400,14400, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 7200,7200-14400,14400, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
     expect(Ok, status);
     DeleteObject(hrgn);
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
     expect(Ok, status);
@@ -5402,7 +5423,7 @@ static void test_clipping_2(void)
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok((rc.left == 9600 && rc.top == 9600 && rc.right == 19200 && rc.bottom == 19200) ||
        broken(rc.left == 134 && rc.top == 134 && rc.right == 267 && rc.bottom == 267) /* before Win7 */,
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok((rc.left == 9600 && rc.top == 9600 && rc.right == 19200 && rc.bottom == 19200) ||
        broken(rc.left == 134 && rc.top == 134 && rc.right == 267 && rc.bottom == 267) /* before Win7 */,
-       "expected 9600,9600-19200,19200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 9600,9600-19200,19200, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     ptf[0].X = 9600.0;
     DeleteObject(hrgn);
 
     ptf[0].X = 9600.0;
@@ -5445,7 +5466,7 @@ static void test_clipping_2(void)
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) ||
        broken(rc.left == 2 && rc.top == 2 && rc.right == 3 && rc.bottom == 3) /* before Win7 */,
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) ||
        broken(rc.left == 2 && rc.top == 2 && rc.right == 3 && rc.bottom == 3) /* before Win7 */,
-       "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
     expect(Ok, status);
     DeleteObject(hrgn);
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
     expect(Ok, status);
@@ -5453,7 +5474,7 @@ static void test_clipping_2(void)
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) ||
        broken(rc.left == 2 && rc.top == 2 && rc.right == 3 && rc.bottom == 3) /* before Win7 */,
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) ||
        broken(rc.left == 2 && rc.top == 2 && rc.right == 3 && rc.bottom == 3) /* before Win7 */,
-       "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     ptf[0].X = 100.0;
     DeleteObject(hrgn);
 
     ptf[0].X = 100.0;
@@ -5483,7 +5504,7 @@ static void test_clipping_2(void)
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok((rc.left == 75 && rc.top == 75 && rc.right == 150 && rc.bottom == 150) ||
        broken(rc.left == 2 && rc.top == 2 && rc.right == 3 && rc.bottom == 3) /* before Win7 */,
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok((rc.left == 75 && rc.top == 75 && rc.right == 150 && rc.bottom == 150) ||
        broken(rc.left == 2 && rc.top == 2 && rc.right == 3 && rc.bottom == 3) /* before Win7 */,
-       "expected 75,75-150,150, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 75,75-150,150, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
     expect(Ok, status);
     DeleteObject(hrgn);
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
     expect(Ok, status);
@@ -5491,7 +5512,7 @@ static void test_clipping_2(void)
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) ||
        broken(rc.left == 2 && rc.top == 2 && rc.right == 3 && rc.bottom == 3) /* before Win7 */,
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) ||
        broken(rc.left == 2 && rc.top == 2 && rc.right == 3 && rc.bottom == 3) /* before Win7 */,
-       "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     ptf[0].X = 100.0;
     DeleteObject(hrgn);
 
     ptf[0].X = 100.0;
@@ -5526,14 +5547,14 @@ static void test_clipping_2(void)
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 65 && rc.top == 65 && rc.right == 140 && rc.bottom == 140,
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 65 && rc.top == 65 && rc.right == 140 && rc.bottom == 140,
-       "expected 65,65-140,140, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 65,65-140,140, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
     expect(Ok, status);
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
     DeleteObject(hrgn);
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
     expect(Ok, status);
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
-       "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     ptf[0].X = 100.0;
     DeleteObject(hrgn);
 
     ptf[0].X = 100.0;
@@ -5562,14 +5583,14 @@ static void test_clipping_2(void)
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 300 && rc.top == 150 && rc.right == 600 && rc.bottom == 300,
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 300 && rc.top == 150 && rc.right == 600 && rc.bottom == 300,
-       "expected 300,150-600,300, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 300,150-600,300, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
     expect(Ok, status);
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
     DeleteObject(hrgn);
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
     expect(Ok, status);
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
-       "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     ptf[0].X = 100.0;
     DeleteObject(hrgn);
 
     ptf[0].X = 100.0;
@@ -5594,7 +5615,7 @@ static void test_clipping_2(void)
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok((rc.left == 150 && rc.top == 75 && rc.right == 300 && rc.bottom == 150) ||
        broken(rc.left == 300 && rc.top == 150 && rc.right == 600 && rc.bottom == 300) /* before Win7 */,
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok((rc.left == 150 && rc.top == 75 && rc.right == 300 && rc.bottom == 150) ||
        broken(rc.left == 300 && rc.top == 150 && rc.right == 600 && rc.bottom == 300) /* before Win7 */,
-       "expected 150,75-300,150, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 150,75-300,150, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
     expect(Ok, status);
     DeleteObject(hrgn);
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
     expect(Ok, status);
@@ -5602,7 +5623,7 @@ static void test_clipping_2(void)
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) ||
        broken(rc.left == 200 && rc.top == 200 && rc.right == 400 && rc.bottom == 400) /* before Win7 */,
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) ||
        broken(rc.left == 200 && rc.top == 200 && rc.right == 400 && rc.bottom == 400) /* before Win7 */,
-       "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     ptf[0].X = 100.0;
     DeleteObject(hrgn);
 
     ptf[0].X = 100.0;
@@ -5643,14 +5664,14 @@ static void test_clipping_2(void)
     ok((rc.left == 54 && rc.top == -26 && rc.right == 107 && rc.bottom == 27) ||
        /* rounding under Wine is slightly different */
        (rc.left == 53 && rc.top == -26 && rc.right == 106 && rc.bottom == 27) /* Wine */,
     ok((rc.left == 54 && rc.top == -26 && rc.right == 107 && rc.bottom == 27) ||
        /* rounding under Wine is slightly different */
        (rc.left == 53 && rc.top == -26 && rc.right == 106 && rc.bottom == 27) /* Wine */,
-       "expected 54,-26-107,27, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 54,-26-107,27, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
     expect(Ok, status);
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
     DeleteObject(hrgn);
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
     expect(Ok, status);
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
-       "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     ptf[0].X = 100.0;
     DeleteObject(hrgn);
 
     ptf[0].X = 100.0;
@@ -5689,14 +5710,14 @@ static void test_clipping_2(void)
     ok((rc.left == -26 && rc.top == 54 && rc.right == 27 && rc.bottom == 107) ||
        /* rounding under Wine is slightly different */
        (rc.left == -27 && rc.top == 54 && rc.right == 27 && rc.bottom == 106) /* Wine */,
     ok((rc.left == -26 && rc.top == 54 && rc.right == 27 && rc.bottom == 107) ||
        /* rounding under Wine is slightly different */
        (rc.left == -27 && rc.top == 54 && rc.right == 27 && rc.bottom == 106) /* Wine */,
-       "expected -26,54-27,107, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected -26,54-27,107, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
     expect(Ok, status);
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
     DeleteObject(hrgn);
     status = GdipGetRegionHRgn(region, graphics, &hrgn);
     expect(Ok, status);
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
     ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
-       "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+       "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
     DeleteObject(hrgn);
 
     ptf[0].X = 100.0;
     DeleteObject(hrgn);
 
     ptf[0].X = 100.0;
index 0d1d6a6..d0ebea8 100644 (file)
@@ -2,7 +2,7 @@
  * Unit test suite for images
  *
  * Copyright (C) 2007 Google (Evan Stade)
  * Unit test suite for images
  *
  * Copyright (C) 2007 Google (Evan Stade)
- * Copyright (C) 2012 Dmitry Timoshkov
+ * Copyright (C) 2012,2016 Dmitry Timoshkov
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -3187,12 +3187,7 @@ static void test_image_properties(void)
 
         status = GdipGetPropertyCount(image, &prop_count);
         ok(status == Ok, "%u: GdipGetPropertyCount error %d\n", i, status);
 
         status = GdipGetPropertyCount(image, &prop_count);
         ok(status == Ok, "%u: GdipGetPropertyCount error %d\n", i, status);
-        if (td[i].image_data == pngimage || td[i].image_data == jpgimage)
-        todo_wine
-        ok(td[i].prop_count == prop_count || td[i].prop_count2 == prop_count,
-           " %u: expected property count %u or %u, got %u\n",
-           i, td[i].prop_count, td[i].prop_count2, prop_count);
-        else
+        todo_wine_if(td[i].image_data == pngimage || td[i].image_data == jpgimage)
         ok(td[i].prop_count == prop_count || td[i].prop_count2 == prop_count,
            " %u: expected property count %u or %u, got %u\n",
            i, td[i].prop_count, td[i].prop_count2, prop_count);
         ok(td[i].prop_count == prop_count || td[i].prop_count2 == prop_count,
            " %u: expected property count %u or %u, got %u\n",
            i, td[i].prop_count, td[i].prop_count2, prop_count);
@@ -4745,6 +4740,135 @@ static void test_createeffect(void)
     }
 }
 
     }
 }
 
+static void test_getadjustedpalette(void)
+{
+    ColorMap colormap;
+    GpImageAttributes *imageattributes;
+    ColorPalette *palette;
+    GpStatus stat;
+
+    stat = GdipCreateImageAttributes(&imageattributes);
+    expect(Ok, stat);
+
+    colormap.oldColor.Argb = 0xffffff00;
+    colormap.newColor.Argb = 0xffff00ff;
+    stat = GdipSetImageAttributesRemapTable(imageattributes, ColorAdjustTypeBitmap,
+        TRUE, 1, &colormap);
+    expect(Ok, stat);
+
+    colormap.oldColor.Argb = 0xffffff80;
+    colormap.newColor.Argb = 0xffff80ff;
+    stat = GdipSetImageAttributesRemapTable(imageattributes, ColorAdjustTypeDefault,
+        TRUE, 1, &colormap);
+    expect(Ok, stat);
+
+    palette = GdipAlloc(sizeof(*palette) + sizeof(ARGB) * 2);
+    palette->Count = 0;
+
+    stat = GdipGetImageAttributesAdjustedPalette(imageattributes, palette, ColorAdjustTypeBitmap);
+    expect(InvalidParameter, stat);
+
+    palette->Count = 3;
+    palette->Entries[0] = 0xffffff00;
+    palette->Entries[1] = 0xffffff80;
+    palette->Entries[2] = 0xffffffff;
+
+    stat = GdipGetImageAttributesAdjustedPalette(imageattributes, palette, ColorAdjustTypeBitmap);
+    expect(Ok, stat);
+    expect(0xffff00ff, palette->Entries[0]);
+    expect(0xffffff80, palette->Entries[1]);
+    expect(0xffffffff, palette->Entries[2]);
+
+    palette->Entries[0] = 0xffffff00;
+    palette->Entries[1] = 0xffffff80;
+    palette->Entries[2] = 0xffffffff;
+
+    stat = GdipGetImageAttributesAdjustedPalette(imageattributes, palette, ColorAdjustTypeBrush);
+    expect(Ok, stat);
+    expect(0xffffff00, palette->Entries[0]);
+    expect(0xffff80ff, palette->Entries[1]);
+    expect(0xffffffff, palette->Entries[2]);
+
+    stat = GdipGetImageAttributesAdjustedPalette(NULL, palette, ColorAdjustTypeBitmap);
+    expect(InvalidParameter, stat);
+
+    stat = GdipGetImageAttributesAdjustedPalette(imageattributes, NULL, ColorAdjustTypeBitmap);
+    expect(InvalidParameter, stat);
+
+    stat = GdipGetImageAttributesAdjustedPalette(imageattributes, palette, -1);
+    expect(InvalidParameter, stat);
+
+    stat = GdipGetImageAttributesAdjustedPalette(imageattributes, palette, ColorAdjustTypeDefault);
+    expect(InvalidParameter, stat);
+
+    GdipFree(palette);
+    GdipDisposeImageAttributes(imageattributes);
+}
+
+/* RGB 24 bpp 1x1 pixel PNG image */
+static const char png_1x1_data[] = {
+  0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a,
+  0x00,0x00,0x00,0x0d,'I','H','D','R',0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x08,0x02,0x00,0x00,0x00,0x90,0x77,0x53,0xde,
+  0x00,0x00,0x00,0x0c,'I','D','A','T',0x08,0xd7,0x63,0xf8,0xff,0xff,0x3f,0x00,0x05,0xfe,0x02,0xfe,0xdc,0xcc,0x59,0xe7,
+  0x00,0x00,0x00,0x00,'I','E','N','D',0xae,0x42,0x60,0x82
+};
+
+static void test_png_color_formats(void)
+{
+    static const struct
+    {
+        char bit_depth, color_type;
+        PixelFormat format;
+        UINT flags;
+    } td[] =
+    {
+        /* 2 - PNG_COLOR_TYPE_RGB */
+        { 8, 2, PixelFormat24bppRGB, ImageFlagsColorSpaceRGB },
+        /* 0 - PNG_COLOR_TYPE_GRAY */
+        { 1, 0, PixelFormat1bppIndexed, ImageFlagsColorSpaceRGB },
+        { 2, 0, PixelFormat32bppARGB, ImageFlagsColorSpaceGRAY },
+        { 4, 0, PixelFormat32bppARGB, ImageFlagsColorSpaceGRAY },
+        { 8, 0, PixelFormat32bppARGB, ImageFlagsColorSpaceGRAY },
+        { 16, 0, PixelFormat32bppARGB, ImageFlagsColorSpaceGRAY },
+    };
+    BYTE buf[sizeof(png_1x1_data)];
+    GpStatus status;
+    GpImage *image;
+    ImageType type;
+    PixelFormat format;
+    UINT flags;
+    int i;
+
+    for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+    {
+        memcpy(buf, png_1x1_data, sizeof(png_1x1_data));
+        buf[24] = td[i].bit_depth;
+        buf[25] = td[i].color_type;
+
+        image = load_image(buf, sizeof(buf));
+        ok(image != NULL, "%d: failed to load image data\n", i);
+        if (!image) continue;
+
+        status = GdipGetImageType(image, &type);
+        ok(status == Ok, "%u: GdipGetImageType error %d\n", i, status);
+        ok(type == ImageTypeBitmap, "%d: wrong image type %d\n", i, type);
+
+        status = GdipGetImagePixelFormat(image, &format);
+        expect(Ok, status);
+        ok(format == td[i].format ||
+           broken(td[i].bit_depth == 1 && td[i].color_type == 0 && format == PixelFormat32bppARGB), /* XP */
+           "%d: expected %#x, got %#x\n", i, td[i].format, format);
+
+        status = GdipGetImageFlags(image, &flags);
+        expect(Ok, status);
+        ok((flags & td[i].flags) == td[i].flags ||
+           broken(td[i].bit_depth == 1 && td[i].color_type == 0 && (flags & ImageFlagsColorSpaceGRAY)), /* XP */
+           "%d: expected %#x, got %#x\n", i, td[i].flags, flags);
+
+        GdipDisposeImage(image);
+    }
+}
+
 START_TEST(image)
 {
     struct GdiplusStartupInput gdiplusStartupInput;
 START_TEST(image)
 {
     struct GdiplusStartupInput gdiplusStartupInput;
@@ -4757,6 +4881,7 @@ START_TEST(image)
 
     GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
 
 
     GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
 
+    test_png_color_formats();
     test_supported_encoders();
     test_CloneBitmapArea();
     test_ARGB_conversion();
     test_supported_encoders();
     test_CloneBitmapArea();
     test_ARGB_conversion();
@@ -4802,6 +4927,7 @@ START_TEST(image)
     test_colorkey();
     test_dispose();
     test_createeffect();
     test_colorkey();
     test_dispose();
     test_createeffect();
+    test_getadjustedpalette();
 
     GdiplusShutdown(gdiplusToken);
 }
 
     GdiplusShutdown(gdiplusToken);
 }
index 13b9db8..c268d9e 100644 (file)
@@ -867,6 +867,95 @@ static void test_fillrect(void)
     expect(Ok, stat);
 }
 
     expect(Ok, stat);
 }
 
+static const emfplus_record clear_emf_records[] = {
+    {0, EMR_HEADER},
+    {0, EmfPlusRecordTypeHeader},
+    {0, EmfPlusRecordTypeClear},
+    {1, EMR_SAVEDC},
+    {1, EMR_SETICMMODE},
+    {1, EMR_BITBLT},
+    {1, EMR_RESTOREDC},
+    {0, EmfPlusRecordTypeEndOfFile},
+    {0, EMR_EOF},
+    {0}
+};
+
+static void test_clear(void)
+{
+    GpStatus stat;
+    GpMetafile *metafile;
+    GpGraphics *graphics;
+    HDC hdc;
+    HENHMETAFILE hemf;
+    static const GpRectF frame = {0.0, 0.0, 100.0, 100.0};
+    static const GpPointF dst_points[3] = {{10.0,10.0},{20.0,10.0},{10.0,20.0}};
+    static const WCHAR description[] = {'w','i','n','e','t','e','s','t',0};
+    GpBitmap *bitmap;
+    ARGB color;
+
+    hdc = CreateCompatibleDC(0);
+
+    stat = GdipRecordMetafile(hdc, EmfTypeEmfPlusOnly, &frame, MetafileFrameUnitPixel, description, &metafile);
+    expect(Ok, stat);
+
+    DeleteDC(hdc);
+
+    if (stat != Ok)
+        return;
+
+    stat = GdipGetHemfFromMetafile(metafile, &hemf);
+    expect(InvalidParameter, stat);
+
+    stat = GdipGetImageGraphicsContext((GpImage*)metafile, &graphics);
+    expect(Ok, stat);
+
+    stat = GdipGraphicsClear(graphics, 0xffffff00);
+    expect(Ok, stat);
+
+    stat = GdipDeleteGraphics(graphics);
+    expect(Ok, stat);
+
+    save_metafile(metafile, "clear.emf");
+
+    stat = GdipCreateBitmapFromScan0(30, 30, 0, PixelFormat32bppRGB, NULL, &bitmap);
+    expect(Ok, stat);
+
+    stat = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
+    expect(Ok, stat);
+
+    stat = GdipDrawImagePointsRect(graphics, (GpImage*)metafile, dst_points, 3,
+        0.0, 0.0, 100.0, 100.0, UnitPixel, NULL, NULL, NULL);
+    expect(Ok, stat);
+
+    stat = GdipBitmapGetPixel(bitmap, 5, 5, &color);
+    expect(Ok, stat);
+    expect(0xff000000, color);
+
+    stat = GdipBitmapGetPixel(bitmap, 15, 15, &color);
+    expect(Ok, stat);
+    expect(0xffffff00, color);
+
+    stat = GdipBitmapGetPixel(bitmap, 25, 25, &color);
+    expect(Ok, stat);
+    expect(0xff000000, color);
+
+    stat = GdipDeleteGraphics(graphics);
+    expect(Ok, stat);
+
+    stat = GdipDisposeImage((GpImage*)bitmap);
+    expect(Ok, stat);
+
+    stat = GdipGetHemfFromMetafile(metafile, &hemf);
+    expect(Ok, stat);
+
+    stat = GdipDisposeImage((GpImage*)metafile);
+    expect(Ok, stat);
+
+    check_emfplus(hemf, clear_emf_records, "clear emf");
+
+    DeleteEnhMetaFile(hemf);
+}
+
 static void test_nullframerect(void) {
     GpStatus stat;
     GpMetafile *metafile;
 static void test_nullframerect(void) {
     GpStatus stat;
     GpMetafile *metafile;
@@ -893,8 +982,10 @@ static void test_nullframerect(void) {
     expect(UnitPixel, unit);
     expectf(0.0, bounds.X);
     expectf(0.0, bounds.Y);
     expect(UnitPixel, unit);
     expectf(0.0, bounds.X);
     expectf(0.0, bounds.Y);
-    expectf(1.0, bounds.Width);
-    expectf(1.0, bounds.Height);
+    ok(bounds.Width == 1.0 || broken(bounds.Width == 0.0) /* xp sp1 */,
+        "expected 1.0, got %f\n", bounds.Width);
+    ok(bounds.Height == 1.0 || broken(bounds.Height == 0.0) /* xp sp1 */,
+        "expected 1.0, got %f\n", bounds.Height);
 
     stat = GdipGetImageGraphicsContext((GpImage*)metafile, &graphics);
     expect(Ok, stat);
 
     stat = GdipGetImageGraphicsContext((GpImage*)metafile, &graphics);
     expect(Ok, stat);
@@ -913,8 +1004,10 @@ static void test_nullframerect(void) {
     expect(UnitPixel, unit);
     expectf(0.0, bounds.X);
     expectf(0.0, bounds.Y);
     expect(UnitPixel, unit);
     expectf(0.0, bounds.X);
     expectf(0.0, bounds.Y);
-    expectf(1.0, bounds.Width);
-    expectf(1.0, bounds.Height);
+    ok(bounds.Width == 1.0 || broken(bounds.Width == 0.0) /* xp sp1 */,
+        "expected 1.0, got %f\n", bounds.Width);
+    ok(bounds.Height == 1.0 || broken(bounds.Height == 0.0) /* xp sp1 */,
+        "expected 1.0, got %f\n", bounds.Height);
 
     stat = GdipDeleteGraphics(graphics);
     expect(Ok, stat);
 
     stat = GdipDeleteGraphics(graphics);
     expect(Ok, stat);
@@ -922,10 +1015,10 @@ static void test_nullframerect(void) {
     stat = GdipGetImageBounds((GpImage*)metafile, &bounds, &unit);
     expect(Ok, stat);
     expect(UnitPixel, unit);
     stat = GdipGetImageBounds((GpImage*)metafile, &bounds, &unit);
     expect(Ok, stat);
     expect(UnitPixel, unit);
-    todo_wine expectf_(25.0, bounds.X, 0.05);
-    todo_wine expectf_(25.0, bounds.Y, 0.05);
-    todo_wine expectf_(75.0, bounds.Width, 0.05);
-    todo_wine expectf_(75.0, bounds.Height, 0.05);
+    expectf_(25.0, bounds.X, 0.05);
+    expectf_(25.0, bounds.Y, 0.05);
+    expectf_(75.0, bounds.Width, 0.05);
+    expectf_(75.0, bounds.Height, 0.05);
 
     stat = GdipDisposeImage((GpImage*)metafile);
     expect(Ok, stat);
 
     stat = GdipDisposeImage((GpImage*)metafile);
     expect(Ok, stat);
@@ -1179,6 +1272,157 @@ static void test_pagetransform(void)
     expect(Ok, stat);
 }
 
     expect(Ok, stat);
 }
 
+static const emfplus_record worldtransform_records[] = {
+    {0, EMR_HEADER},
+    {0, EmfPlusRecordTypeHeader},
+    {0, EmfPlusRecordTypeFillRects},
+    {0, EmfPlusRecordTypeScaleWorldTransform},
+    {0, EmfPlusRecordTypeFillRects},
+    {0, EmfPlusRecordTypeResetWorldTransform},
+    {0, EmfPlusRecordTypeFillRects},
+    {0, EmfPlusRecordTypeEndOfFile},
+    {0, EMR_EOF},
+    {0}
+};
+
+static void test_worldtransform(void)
+{
+    GpStatus stat;
+    GpMetafile *metafile;
+    GpGraphics *graphics;
+    HDC hdc;
+    static const GpRectF frame = {0.0, 0.0, 5.0, 5.0};
+    static const GpPointF dst_points[3] = {{0.0,0.0},{100.0,0.0},{0.0,100.0}};
+    static const WCHAR description[] = {'w','i','n','e','t','e','s','t',0};
+    GpBitmap *bitmap;
+    ARGB color;
+    GpBrush *brush;
+    GpMatrix *transform;
+    BOOL identity;
+    REAL elements[6];
+
+    hdc = CreateCompatibleDC(0);
+
+    stat = GdipRecordMetafile(hdc, EmfTypeEmfPlusOnly, &frame, MetafileFrameUnitPixel, description, &metafile);
+    expect(Ok, stat);
+
+    DeleteDC(hdc);
+
+    if (stat != Ok)
+        return;
+
+    stat = GdipCreateMatrix(&transform);
+    expect(Ok, stat);
+
+    stat = GdipGetImageGraphicsContext((GpImage*)metafile, &graphics);
+    expect(Ok, stat);
+
+    /* initial transform */
+    stat = GdipGetWorldTransform(graphics, transform);
+    expect(Ok, stat);
+
+    stat = GdipIsMatrixIdentity(transform, &identity);
+    expect(Ok, stat);
+    expect(TRUE, identity);
+
+    stat = GdipCreateSolidFill((ARGB)0xff0000ff, (GpSolidFill**)&brush);
+    expect(Ok, stat);
+
+    stat = GdipFillRectangleI(graphics, brush, 0, 0, 1, 1);
+    expect(Ok, stat);
+
+    stat = GdipDeleteBrush(brush);
+    expect(Ok, stat);
+
+    /* scale transform */
+    stat = GdipScaleWorldTransform(graphics, 2.0, 4.0, MatrixOrderPrepend);
+    expect(Ok, stat);
+
+    stat = GdipGetWorldTransform(graphics, transform);
+    expect(Ok, stat);
+
+    stat = GdipGetMatrixElements(transform, elements);
+    expect(Ok, stat);
+    expectf(2.0, elements[0]);
+    expectf(0.0, elements[1]);
+    expectf(0.0, elements[2]);
+    expectf(4.0, elements[3]);
+    expectf(0.0, elements[4]);
+    expectf(0.0, elements[5]);
+
+    stat = GdipCreateSolidFill((ARGB)0xff00ff00, (GpSolidFill**)&brush);
+    expect(Ok, stat);
+
+    stat = GdipFillRectangle(graphics, brush, 0.5, 0.5, 0.5, 0.25);
+    expect(Ok, stat);
+
+    stat = GdipDeleteBrush(brush);
+    expect(Ok, stat);
+
+    /* reset transform */
+    stat = GdipResetWorldTransform(graphics);
+    expect(Ok, stat);
+
+    stat = GdipGetWorldTransform(graphics, transform);
+    expect(Ok, stat);
+
+    stat = GdipIsMatrixIdentity(transform, &identity);
+    expect(Ok, stat);
+    expect(TRUE, identity);
+
+    stat = GdipCreateSolidFill((ARGB)0xff00ffff, (GpSolidFill**)&brush);
+    expect(Ok, stat);
+
+    stat = GdipFillRectangle(graphics, brush, 1.0, 0.0, 1.0, 1.0);
+    expect(Ok, stat);
+
+    stat = GdipDeleteBrush(brush);
+    expect(Ok, stat);
+
+    stat = GdipDeleteMatrix(transform);
+    expect(Ok, stat);
+
+    stat = GdipDeleteGraphics(graphics);
+    expect(Ok, stat);
+
+    check_metafile(metafile, worldtransform_records, "worldtransform metafile", dst_points, &frame, UnitPixel);
+
+    save_metafile(metafile, "worldtransform.emf");
+
+    stat = GdipCreateBitmapFromScan0(100, 100, 0, PixelFormat32bppARGB, NULL, &bitmap);
+    expect(Ok, stat);
+
+    stat = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
+    expect(Ok, stat);
+
+    play_metafile(metafile, graphics, worldtransform_records, "worldtransform playback", dst_points, &frame, UnitPixel);
+
+    stat = GdipBitmapGetPixel(bitmap, 80, 80, &color);
+    expect(Ok, stat);
+    expect(0, color);
+
+    stat = GdipBitmapGetPixel(bitmap, 10, 10, &color);
+    expect(Ok, stat);
+    expect(0xff0000ff, color);
+
+    stat = GdipBitmapGetPixel(bitmap, 30, 50, &color);
+    expect(Ok, stat);
+    expect(0xff00ff00, color);
+
+    stat = GdipBitmapGetPixel(bitmap, 30, 10, &color);
+    expect(Ok, stat);
+    expect(0xff00ffff, color);
+
+    stat = GdipDeleteGraphics(graphics);
+    expect(Ok, stat);
+
+    stat = GdipDisposeImage((GpImage*)bitmap);
+    expect(Ok, stat);
+
+    stat = GdipDisposeImage((GpImage*)metafile);
+    expect(Ok, stat);
+}
+
 static void test_converttoemfplus(void)
 {
     GpStatus (WINAPI *pGdipConvertToEmfPlus)( const GpGraphics *graphics, GpMetafile *metafile, BOOL *succ,
 static void test_converttoemfplus(void)
 {
     GpStatus (WINAPI *pGdipConvertToEmfPlus)( const GpGraphics *graphics, GpMetafile *metafile, BOOL *succ,
@@ -1284,8 +1528,10 @@ static void test_frameunit(void)
     expect(UnitPixel, unit);
     expectf(0.0, bounds.X);
     expectf(0.0, bounds.Y);
     expect(UnitPixel, unit);
     expectf(0.0, bounds.X);
     expectf(0.0, bounds.Y);
-    expectf(1.0, bounds.Width);
-    expectf(1.0, bounds.Height);
+    ok(bounds.Width == 1.0 || broken(bounds.Width == 0.0) /* xp sp1 */,
+        "expected 1.0, got %f\n", bounds.Width);
+    ok(bounds.Height == 1.0 || broken(bounds.Height == 0.0) /* xp sp1 */,
+        "expected 1.0, got %f\n", bounds.Height);
 
     stat = GdipGetImageGraphicsContext((GpImage*)metafile, &graphics);
     expect(Ok, stat);
 
     stat = GdipGetImageGraphicsContext((GpImage*)metafile, &graphics);
     expect(Ok, stat);
@@ -1295,8 +1541,10 @@ static void test_frameunit(void)
     expect(UnitPixel, unit);
     expectf(0.0, bounds.X);
     expectf(0.0, bounds.Y);
     expect(UnitPixel, unit);
     expectf(0.0, bounds.X);
     expectf(0.0, bounds.Y);
-    expectf(1.0, bounds.Width);
-    expectf(1.0, bounds.Height);
+    ok(bounds.Width == 1.0 || broken(bounds.Width == 0.0) /* xp sp1 */,
+        "expected 1.0, got %f\n", bounds.Width);
+    ok(bounds.Height == 1.0 || broken(bounds.Height == 0.0) /* xp sp1 */,
+        "expected 1.0, got %f\n", bounds.Height);
 
     stat = GdipDeleteGraphics(graphics);
     expect(Ok, stat);
 
     stat = GdipDeleteGraphics(graphics);
     expect(Ok, stat);
@@ -1342,8 +1590,10 @@ START_TEST(metafile)
     test_getdc();
     test_emfonly();
     test_fillrect();
     test_getdc();
     test_emfonly();
     test_fillrect();
+    test_clear();
     test_nullframerect();
     test_pagetransform();
     test_nullframerect();
     test_pagetransform();
+    test_worldtransform();
     test_converttoemfplus();
     test_frameunit();
 
     test_converttoemfplus();
     test_frameunit();
 
index c07f370..bb23fa0 100644 (file)
@@ -76,18 +76,16 @@ static void verify_region(HRGN hrgn, const RECT *rc)
     else
         ok(ret == sizeof(rgn.data.rdh) + sizeof(RECT), "expected sizeof(rgn), got %u\n", ret);
 
     else
         ok(ret == sizeof(rgn.data.rdh) + sizeof(RECT), "expected sizeof(rgn), got %u\n", ret);
 
-    trace("size %u, type %u, count %u, rgn size %u, bound (%d,%d-%d,%d)\n",
+    trace("size %u, type %u, count %u, rgn size %u, bound %s\n",
           rgn.data.rdh.dwSize, rgn.data.rdh.iType,
           rgn.data.rdh.nCount, rgn.data.rdh.nRgnSize,
           rgn.data.rdh.dwSize, rgn.data.rdh.iType,
           rgn.data.rdh.nCount, rgn.data.rdh.nRgnSize,
-          rgn.data.rdh.rcBound.left, rgn.data.rdh.rcBound.top,
-          rgn.data.rdh.rcBound.right, rgn.data.rdh.rcBound.bottom);
+          wine_dbgstr_rect(&rgn.data.rdh.rcBound));
     if (rgn.data.rdh.nCount != 0)
     {
         rect = (const RECT *)rgn.data.Buffer;
     if (rgn.data.rdh.nCount != 0)
     {
         rect = (const RECT *)rgn.data.Buffer;
-        trace("rect (%d,%d-%d,%d)\n", rect->left, rect->top, rect->right, rect->bottom);
-        ok(EqualRect(rect, rc), "expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n",
-           rc->left, rc->top, rc->right, rc->bottom,
-           rect->left, rect->top, rect->right, rect->bottom);
+        trace("rect %s\n", wine_dbgstr_rect(rect));
+        ok(EqualRect(rect, rc), "expected %s, got %s\n",
+           wine_dbgstr_rect(rc), wine_dbgstr_rect(rect));
     }
 
     ok(rgn.data.rdh.dwSize == sizeof(rgn.data.rdh), "expected sizeof(rdh), got %u\n", rgn.data.rdh.dwSize);
     }
 
     ok(rgn.data.rdh.dwSize == sizeof(rgn.data.rdh), "expected sizeof(rdh), got %u\n", rgn.data.rdh.dwSize);
@@ -102,9 +100,8 @@ static void verify_region(HRGN hrgn, const RECT *rc)
         ok(rgn.data.rdh.nCount == 1, "expected 1, got %u\n", rgn.data.rdh.nCount);
         ok(rgn.data.rdh.nRgnSize == sizeof(RECT),  "expected sizeof(RECT), got %u\n", rgn.data.rdh.nRgnSize);
     }
         ok(rgn.data.rdh.nCount == 1, "expected 1, got %u\n", rgn.data.rdh.nCount);
         ok(rgn.data.rdh.nRgnSize == sizeof(RECT),  "expected sizeof(RECT), got %u\n", rgn.data.rdh.nRgnSize);
     }
-    ok(EqualRect(&rgn.data.rdh.rcBound, rc), "expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n",
-       rc->left, rc->top, rc->right, rc->bottom,
-       rgn.data.rdh.rcBound.left, rgn.data.rdh.rcBound.top, rgn.data.rdh.rcBound.right, rgn.data.rdh.rcBound.bottom);
+    ok(EqualRect(&rgn.data.rdh.rcBound, rc), "expected %s, got %s\n",
+       wine_dbgstr_rect(rc), wine_dbgstr_rect(&rgn.data.rdh.rcBound));
 }
 
 static void test_region_data(DWORD *data, UINT size, INT line)
 }
 
 static void test_region_data(DWORD *data, UINT size, INT line)