From: Jeff Smith whydoubt@gmail.com
--- dlls/gdiplus/tests/graphics.c | 97 +++++++++++++++++++++++++++++++++++ include/gdiplusflat.h | 1 + 2 files changed, 98 insertions(+)
diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index 89baff64fa4..40b624df1ba 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -1828,6 +1828,9 @@ static void test_Get_Release_DC(void) /* GdipMeasureString */ status = GdipResetClip(graphics); expect(ObjectBusy, status); + status = GdipResetPageTransform(graphics); + todo_wine + expect(ObjectBusy, status); status = GdipResetWorldTransform(graphics); expect(ObjectBusy, status); /* GdipRestoreGraphics */ @@ -1844,6 +1847,9 @@ static void test_Get_Release_DC(void) expect(ObjectBusy, status); status = GdipSetPageScale(graphics, 1.0); expect(ObjectBusy, status); + status = GdipSetPageScale(graphics, 0.0); + todo_wine + expect(ObjectBusy, status); status = GdipSetPageUnit(graphics, UnitWorld); expect(ObjectBusy, status); status = GdipSetPixelOffsetMode(graphics, PixelOffsetModeDefault); @@ -4058,6 +4064,96 @@ static void test_transform(void) } }
+static void test_set_page_transform(void) +{ + static const struct + { + GpUnit unit; + BOOL isInvalid; + } td_unit[] = + { + {UnitWorld, TRUE}, + {UnitDisplay}, + {UnitPixel}, + {UnitPoint}, + {UnitInch}, + {UnitDocument}, + {UnitMillimeter}, + {UnitMillimeter + 1, TRUE}, + }; + static const struct { + REAL scale; + BOOL isInvalid; + } td_scale[] = + { + {-1.0, TRUE}, + {0.0, TRUE}, + {0.5}, + {1.0}, + {2.0}, + }; + GpStatus status; + GpGraphics *graphics; + HDC hdc = GetDC( hwnd ); + GpUnit unit; + REAL scale; + UINT i; + + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + + for (i = 0; i < ARRAY_SIZE(td_unit); i++) + { + winetest_push_context("%u", i); + status = GdipSetPageUnit(graphics, td_unit[i].unit); + todo_wine_if(td_unit[i].unit > UnitMillimeter) + expect(td_unit[i].isInvalid ? InvalidParameter : Ok, status); + if (status == Ok) + { + status = GdipGetPageUnit(graphics, &unit); + expect(Ok, status); + expect(td_unit[i].unit, unit); + } + winetest_pop_context(); + } + + for (i = 0; i < ARRAY_SIZE(td_scale); i++) + { + winetest_push_context("%u", i); + status = GdipSetPageScale(graphics, td_scale[i].scale); + expect(td_scale[i].isInvalid ? InvalidParameter : Ok, status); + if (status == Ok) + { + status = GdipGetPageScale(graphics, &scale); + expect(Ok, status); + expectf_(td_scale[i].scale, scale, 0); + } + winetest_pop_context(); + } + + status = GdipGetPageUnit(graphics, &unit); + expect(Ok, status); + todo_wine + expect(UnitMillimeter, unit); + status = GdipGetPageScale(graphics, &scale); + expect(Ok, status); + expectf_(2.0, scale, 0); + status = GdipResetPageTransform(graphics); + todo_wine + expect(Ok, status); + status = GdipGetPageUnit(graphics, &unit); + expect(Ok, status); + todo_wine + expect(UnitDisplay, unit); + status = GdipGetPageScale(graphics, &scale); + expect(Ok, status); + todo_wine + expectf_(1.0, scale, 0); + + GdipDeleteGraphics(graphics); + ReleaseDC(hwnd, hdc); +} + static void test_pen_thickness(void) { static const struct test_data @@ -7275,6 +7371,7 @@ START_TEST(graphics) test_measure_string(); test_font_height_scaling(); test_transform(); + test_set_page_transform(); test_pen_thickness(); test_GdipMeasureString(); test_constructor_destructor(); diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index 10f4d435a85..8950ab3258b 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -290,6 +290,7 @@ GpStatus WINGDIPAPI GdipRecordMetafileFileNameI(GDIPCONST WCHAR*,HDC,EmfType, GDIPCONST GpRect*,MetafileFrameUnit,GDIPCONST WCHAR*,GpMetafile**); GpStatus WINGDIPAPI GdipReleaseDC(GpGraphics*,HDC); GpStatus WINGDIPAPI GdipResetClip(GpGraphics*); +GpStatus WINGDIPAPI GdipResetPageTransform(GpGraphics*); GpStatus WINGDIPAPI GdipResetWorldTransform(GpGraphics*); GpStatus WINGDIPAPI GdipRestoreGraphics(GpGraphics*,GraphicsState); GpStatus WINGDIPAPI GdipRotateWorldTransform(GpGraphics*,REAL,GpMatrixOrder);
From: Jeff Smith whydoubt@gmail.com
--- dlls/gdiplus/graphics.c | 23 ++++++++++++++++++----- dlls/gdiplus/tests/graphics.c | 4 ---- 2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 58b2de213a6..32c45458c8f 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -7536,14 +7536,27 @@ cleanup:
GpStatus WINGDIPAPI GdipResetPageTransform(GpGraphics *graphics) { - static int calls; + GpStatus stat;
- TRACE("(%p) stub\n", graphics); + TRACE("(%p)\n", graphics);
- if(!(calls++)) - FIXME("not implemented\n"); + if(!graphics) + return InvalidParameter;
- return NotImplemented; + if(graphics->busy) + return ObjectBusy; + + if (is_metafile_graphics(graphics)) + { + stat = METAFILE_SetPageTransform((GpMetafile*)graphics->image, UnitDisplay, 1.0); + if (stat != Ok) + return stat; + } + + graphics->scale = 1.0; + graphics->unit = UnitDisplay; + + return Ok; }
GpStatus WINGDIPAPI GdipGraphicsSetAbort(GpGraphics *graphics, GdiplusAbort *pabort) diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index 40b624df1ba..784a88d9a70 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -1829,7 +1829,6 @@ static void test_Get_Release_DC(void) status = GdipResetClip(graphics); expect(ObjectBusy, status); status = GdipResetPageTransform(graphics); - todo_wine expect(ObjectBusy, status); status = GdipResetWorldTransform(graphics); expect(ObjectBusy, status); @@ -4139,15 +4138,12 @@ static void test_set_page_transform(void) expect(Ok, status); expectf_(2.0, scale, 0); status = GdipResetPageTransform(graphics); - todo_wine expect(Ok, status); status = GdipGetPageUnit(graphics, &unit); expect(Ok, status); - todo_wine expect(UnitDisplay, unit); status = GdipGetPageScale(graphics, &scale); expect(Ok, status); - todo_wine expectf_(1.0, scale, 0);
GdipDeleteGraphics(graphics);
From: Jeff Smith whydoubt@gmail.com
--- dlls/gdiplus/graphics.c | 5 ++++- dlls/gdiplus/tests/graphics.c | 1 - 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 32c45458c8f..6cc0c3bfbe3 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -6164,12 +6164,15 @@ GpStatus WINGDIPAPI GdipSetPageScale(GpGraphics *graphics, REAL scale)
TRACE("(%p, %.2f)\n", graphics, scale);
- if(!graphics || (scale <= 0.0)) + if(!graphics) return InvalidParameter;
if(graphics->busy) return ObjectBusy;
+ if(scale <= 0.0) + return InvalidParameter; + if (is_metafile_graphics(graphics)) { stat = METAFILE_SetPageTransform((GpMetafile*)graphics->image, graphics->unit, scale); diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index 784a88d9a70..5f502b72593 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -1847,7 +1847,6 @@ static void test_Get_Release_DC(void) status = GdipSetPageScale(graphics, 1.0); expect(ObjectBusy, status); status = GdipSetPageScale(graphics, 0.0); - todo_wine expect(ObjectBusy, status); status = GdipSetPageUnit(graphics, UnitWorld); expect(ObjectBusy, status);
From: Jeff Smith whydoubt@gmail.com
--- dlls/gdiplus/graphics.c | 2 +- dlls/gdiplus/tests/graphics.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 6cc0c3bfbe3..371629a5bef 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -6197,7 +6197,7 @@ GpStatus WINGDIPAPI GdipSetPageUnit(GpGraphics *graphics, GpUnit unit) if(graphics->busy) return ObjectBusy;
- if(unit == UnitWorld) + if(unit == UnitWorld || unit > UnitMillimeter) return InvalidParameter;
if (is_metafile_graphics(graphics)) diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index 5f502b72593..724be3f1030 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -4104,7 +4104,6 @@ static void test_set_page_transform(void) { winetest_push_context("%u", i); status = GdipSetPageUnit(graphics, td_unit[i].unit); - todo_wine_if(td_unit[i].unit > UnitMillimeter) expect(td_unit[i].isInvalid ? InvalidParameter : Ok, status); if (status == Ok) { @@ -4131,7 +4130,6 @@ static void test_set_page_transform(void)
status = GdipGetPageUnit(graphics, &unit); expect(Ok, status); - todo_wine expect(UnitMillimeter, unit); status = GdipGetPageScale(graphics, &scale); expect(Ok, status);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=139115
Your paranoid android.
=== debian11b (64 bit WoW report) ===
dinput: device8.c:2238: Test failed: 0x500: got key_state[0] 0
This merge request was approved by Esme Povirk.