gdiplus: Added a test for GdipGetDC/GdipReleaseDC behaviour + fixes to be able to run it.
This commit is contained in:
parent
ac23eb7939
commit
4570501155
|
@ -213,8 +213,8 @@
|
|||
@ stub GdipEnumerateMetafileSrcRectDestPointsI
|
||||
@ stub GdipEnumerateMetafileSrcRectDestRect
|
||||
@ stub GdipEnumerateMetafileSrcRectDestRectI
|
||||
@ stdcall GdipFillClosedCurve2(ptr ptr ptr long long)
|
||||
@ stdcall GdipFillClosedCurve2I(ptr ptr ptr long long)
|
||||
@ stdcall GdipFillClosedCurve2(ptr ptr ptr long long long)
|
||||
@ stdcall GdipFillClosedCurve2I(ptr ptr ptr long long long)
|
||||
@ stub GdipFillClosedCurve
|
||||
@ stub GdipFillClosedCurveI
|
||||
@ stdcall GdipFillEllipse(ptr ptr long long long long)
|
||||
|
|
|
@ -2584,7 +2584,7 @@ GpStatus WINGDIPAPI GdipSetClipRegion(GpGraphics *graphics, GpRegion *region,
|
|||
return NotImplemented;
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipSetMetafileDownLevelRasterizationLimit(GpGraphics *graphics,
|
||||
GpStatus WINGDIPAPI GdipSetMetafileDownLevelRasterizationLimit(GpMetafile *metafile,
|
||||
UINT limitDpi)
|
||||
{
|
||||
static int calls;
|
||||
|
@ -2681,6 +2681,9 @@ GpStatus WINGDIPAPI GdipGetDC(GpGraphics *graphics, HDC *hdc)
|
|||
{
|
||||
FIXME("(%p, %p): stub\n", graphics, hdc);
|
||||
|
||||
if(!graphics || !hdc)
|
||||
return InvalidParameter;
|
||||
|
||||
*hdc = NULL;
|
||||
return NotImplemented;
|
||||
}
|
||||
|
@ -2689,6 +2692,12 @@ GpStatus WINGDIPAPI GdipReleaseDC(GpGraphics *graphics, HDC hdc)
|
|||
{
|
||||
FIXME("(%p, %p): stub\n", graphics, hdc);
|
||||
|
||||
if(!graphics)
|
||||
return InvalidParameter;
|
||||
|
||||
if(graphics->hdc != hdc)
|
||||
return InvalidParameter;
|
||||
|
||||
return NotImplemented;
|
||||
}
|
||||
|
||||
|
|
|
@ -462,6 +462,269 @@ static void test_GdipDrawLinesI(void)
|
|||
ReleaseDC(0, hdc);
|
||||
}
|
||||
|
||||
static void test_Get_Release_DC(void)
|
||||
{
|
||||
GpStatus status;
|
||||
GpGraphics *graphics = NULL;
|
||||
GpPen *pen;
|
||||
GpSolidFill *brush;
|
||||
GpPath *path;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC retdc;
|
||||
REAL r;
|
||||
CompositingQuality quality;
|
||||
CompositingMode compmode;
|
||||
InterpolationMode intmode;
|
||||
GpMatrix *m;
|
||||
GpRegion *region;
|
||||
GpUnit unit;
|
||||
PixelOffsetMode offsetmode;
|
||||
SmoothingMode smoothmode;
|
||||
TextRenderingHint texthint;
|
||||
GpPointF ptf[5];
|
||||
GpPoint pt[5];
|
||||
GpRectF rectf[2];
|
||||
GpRect rect[2];
|
||||
INT i;
|
||||
|
||||
pt[0].X = 10;
|
||||
pt[0].Y = 10;
|
||||
pt[1].X = 20;
|
||||
pt[1].Y = 15;
|
||||
pt[2].X = 40;
|
||||
pt[2].Y = 80;
|
||||
pt[3].X = -20;
|
||||
pt[3].Y = 20;
|
||||
pt[4].X = 50;
|
||||
pt[4].Y = 110;
|
||||
|
||||
for(i = 0; i < 5;i++){
|
||||
ptf[i].X = (REAL)pt[i].X;
|
||||
ptf[i].Y = (REAL)pt[i].Y;
|
||||
}
|
||||
|
||||
rect[0].X = 0;
|
||||
rect[0].Y = 0;
|
||||
rect[0].Width = 50;
|
||||
rect[0].Height = 70;
|
||||
rect[1].X = 0;
|
||||
rect[1].Y = 0;
|
||||
rect[1].Width = 10;
|
||||
rect[1].Height = 20;
|
||||
|
||||
for(i = 0; i < 2;i++){
|
||||
rectf[i].X = (REAL)rect[i].X;
|
||||
rectf[i].Y = (REAL)rect[i].Y;
|
||||
rectf[i].Height = (REAL)rect[i].Height;
|
||||
rectf[i].Width = (REAL)rect[i].Width;
|
||||
}
|
||||
|
||||
GdipCreateMatrix(&m);
|
||||
GdipCreateRegion(®ion);
|
||||
GdipCreateSolidFill((ARGB)0xdeadbeef, &brush);
|
||||
GdipCreatePath(FillModeAlternate, &path);
|
||||
|
||||
status = GdipCreateFromHDC(hdc, &graphics);
|
||||
expect(Ok, status);
|
||||
ok(graphics != NULL, "Expected graphics to be initialized\n");
|
||||
status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
|
||||
expect(Ok, status);
|
||||
|
||||
/* NULL arguments */
|
||||
status = GdipGetDC(NULL, NULL);
|
||||
expect(InvalidParameter, status);
|
||||
status = GdipGetDC(graphics, NULL);
|
||||
expect(InvalidParameter, status);
|
||||
status = GdipGetDC(NULL, &retdc);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipReleaseDC(NULL, (HDC)0);
|
||||
expect(InvalidParameter, status);
|
||||
status = GdipReleaseDC(graphics, (HDC)0);
|
||||
expect(InvalidParameter, status);
|
||||
status = GdipReleaseDC(NULL, (HDC)0xdeadbeef);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
retdc = NULL;
|
||||
status = GdipGetDC(graphics, &retdc);
|
||||
todo_wine expect(Ok, status);
|
||||
todo_wine ok(retdc == hdc, "Invalid HDC returned\n");
|
||||
/* call it once more */
|
||||
status = GdipGetDC(graphics, &retdc);
|
||||
todo_wine expect(ObjectBusy, status);
|
||||
|
||||
/* try all Graphics calls here */
|
||||
status = Ok;
|
||||
status = GdipDrawArc(graphics, pen, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawArcI(graphics, pen, 0, 0, 1, 1, 0.0, 0.0);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawBezier(graphics, pen, 0.0, 10.0, 20.0, 15.0, 35.0, -10.0, 10.0, 10.0);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawBezierI(graphics, pen, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawBeziers(graphics, pen, ptf, 5);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawBeziersI(graphics, pen, pt, 5);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawClosedCurve(graphics, pen, ptf, 5);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawClosedCurveI(graphics, pen, pt, 5);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawClosedCurve2(graphics, pen, ptf, 5, 1.0);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawClosedCurve2I(graphics, pen, pt, 5, 1.0);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawCurve(graphics, pen, ptf, 5);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawCurveI(graphics, pen, pt, 5);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawCurve2(graphics, pen, ptf, 5, 1.0);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawCurve2I(graphics, pen, pt, 5, 1.0);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawEllipse(graphics, pen, 0.0, 0.0, 100.0, 50.0);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawEllipseI(graphics, pen, 0, 0, 100, 50);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
/* GdipDrawImage/GdipDrawImageI */
|
||||
/* GdipDrawImagePointsRect/GdipDrawImagePointsRectI */
|
||||
/* GdipDrawImageRectRect/GdipDrawImageRectRectI */
|
||||
/* GdipDrawImageRect/GdipDrawImageRectI */
|
||||
status = GdipDrawLine(graphics, pen, 0.0, 0.0, 100.0, 200.0);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawLineI(graphics, pen, 0, 0, 100, 200);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawLines(graphics, pen, ptf, 5);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawLinesI(graphics, pen, pt, 5);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawPath(graphics, pen, path);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawPie(graphics, pen, 0.0, 0.0, 100.0, 100.0, 0.0, 90.0);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawPieI(graphics, pen, 0, 0, 100, 100, 0.0, 90.0);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawRectangle(graphics, pen, 0.0, 0.0, 100.0, 300.0);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawRectangleI(graphics, pen, 0, 0, 100, 300);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawRectangles(graphics, pen, rectf, 2);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawRectanglesI(graphics, pen, rect, 2);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
/* GdipDrawString */
|
||||
status = GdipFillClosedCurve2(graphics, (GpBrush*)brush, ptf, 5, 1.0, FillModeAlternate);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipFillClosedCurve2I(graphics, (GpBrush*)brush, pt, 5, 1.0, FillModeAlternate);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipFillEllipse(graphics, (GpBrush*)brush, 0.0, 0.0, 100.0, 100.0);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipFillEllipseI(graphics, (GpBrush*)brush, 0, 0, 100, 100);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipFillPath(graphics, (GpBrush*)brush, path);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipFillPie(graphics, (GpBrush*)brush, 0.0, 0.0, 100.0, 100.0, 0.0, 15.0);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipFillPieI(graphics, (GpBrush*)brush, 0, 0, 100, 100, 0.0, 15.0);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipFillPolygon(graphics, (GpBrush*)brush, ptf, 5, FillModeAlternate);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipFillPolygonI(graphics, (GpBrush*)brush, pt, 5, FillModeAlternate);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipFillPolygon2(graphics, (GpBrush*)brush, ptf, 5);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipFillPolygon2I(graphics, (GpBrush*)brush, pt, 5);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipFillRectangle(graphics, (GpBrush*)brush, 0.0, 0.0, 100.0, 100.0);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipFillRectangleI(graphics, (GpBrush*)brush, 0, 0, 100, 100);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipFillRectangles(graphics, (GpBrush*)brush, rectf, 2);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipFillRectanglesI(graphics, (GpBrush*)brush, rect, 2);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipFillRegion(graphics, (GpBrush*)brush, region);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipFlush(graphics, FlushIntentionFlush);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipGetCompositingMode(graphics, &compmode);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipGetCompositingQuality(graphics, &quality);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipGetInterpolationMode(graphics, &intmode);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipGetPageScale(graphics, &r);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipGetPageUnit(graphics, &unit);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipGetPixelOffsetMode(graphics, &offsetmode);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipGetSmoothingMode(graphics, &smoothmode);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipGetTextRenderingHint(graphics, &texthint);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipGetWorldTransform(graphics, m);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
/* GdipMeasureCharacterRanges */
|
||||
/* GdipMeasureString */
|
||||
status = GdipResetWorldTransform(graphics);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
/* GdipRestoreGraphics */
|
||||
status = GdipRotateWorldTransform(graphics, 15.0, MatrixOrderPrepend);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
/* GdipSaveGraphics */
|
||||
status = GdipScaleWorldTransform(graphics, 1.0, 1.0, MatrixOrderPrepend);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipSetCompositingMode(graphics, CompositingModeSourceOver);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipSetCompositingQuality(graphics, CompositingQualityDefault);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipSetInterpolationMode(graphics, InterpolationModeDefault);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipSetPageScale(graphics, 1.0);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipSetPageUnit(graphics, UnitWorld);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipSetPixelOffsetMode(graphics, PixelOffsetModeDefault);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipSetSmoothingMode(graphics, SmoothingModeDefault);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipSetTextRenderingHint(graphics, TextRenderingHintSystemDefault);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipSetWorldTransform(graphics, m);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipTranslateWorldTransform(graphics, 0.0, 0.0, MatrixOrderPrepend);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipSetClipRectI(graphics, 0, 0, 10, 10, CombineModeReplace);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
/* GdipSetClipRegion */
|
||||
status = GdipDrawPolygon(graphics, pen, ptf, 5);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipDrawPolygonI(graphics, pen, pt, 5);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipGetDpiX(graphics, &r);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipGetDpiY(graphics, &r);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
status = GdipMultiplyWorldTransform(graphics, m, MatrixOrderPrepend);
|
||||
status = GdipGetClip(graphics, region);
|
||||
todo_wine expect(ObjectBusy, status); status = Ok;
|
||||
|
||||
status = GdipReleaseDC(graphics, retdc);
|
||||
todo_wine expect(Ok, status);
|
||||
|
||||
GdipDeletePen(pen);
|
||||
GdipDeleteGraphics(graphics);
|
||||
|
||||
GdipDeletePath(path);
|
||||
GdipDeleteBrush((GpBrush*)brush);
|
||||
GdipDeleteRegion(region);
|
||||
GdipDeleteMatrix(m);
|
||||
|
||||
ReleaseDC(0, hdc);
|
||||
}
|
||||
|
||||
START_TEST(graphics)
|
||||
{
|
||||
struct GdiplusStartupInput gdiplusStartupInput;
|
||||
|
@ -481,6 +744,7 @@ START_TEST(graphics)
|
|||
test_GdipDrawArcI();
|
||||
test_GdipDrawLineI();
|
||||
test_GdipDrawLinesI();
|
||||
test_Get_Release_DC();
|
||||
|
||||
GdiplusShutdown(gdiplusToken);
|
||||
}
|
||||
|
|
|
@ -100,6 +100,8 @@ GpStatus WINGDIPAPI GdipDrawCurve(GpGraphics*,GpPen*,GDIPCONST GpPointF*,INT);
|
|||
GpStatus WINGDIPAPI GdipDrawCurveI(GpGraphics*,GpPen*,GDIPCONST GpPoint*,INT);
|
||||
GpStatus WINGDIPAPI GdipDrawCurve2(GpGraphics*,GpPen*,GDIPCONST GpPointF*,INT,REAL);
|
||||
GpStatus WINGDIPAPI GdipDrawCurve2I(GpGraphics*,GpPen*,GDIPCONST GpPoint*,INT,REAL);
|
||||
GpStatus WINGDIPAPI GdipDrawEllipse(GpGraphics*,GpPen*,REAL,REAL,REAL,REAL);
|
||||
GpStatus WINGDIPAPI GdipDrawEllipseI(GpGraphics*,GpPen*,INT,INT,INT,INT);
|
||||
GpStatus WINGDIPAPI GdipDrawImage(GpGraphics*,GpImage*,REAL,REAL);
|
||||
GpStatus WINGDIPAPI GdipDrawImageI(GpGraphics*,GpImage*,INT,INT);
|
||||
GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics*,GpImage*,
|
||||
|
@ -511,6 +513,10 @@ GpStatus WINGDIPAPI GdipTranslateRegion(GpRegion *, REAL, REAL);
|
|||
GpStatus WINGDIPAPI GdipTranslateRegionI(GpRegion *, INT, INT);
|
||||
|
||||
GpStatus WINGDIPAPI GdipFlush(GpGraphics*, GpFlushIntention);
|
||||
GpStatus WINGDIPAPI GdipSetMetafileDownLevelRasterizationLimit(GpMetafile*,UINT);
|
||||
GpStatus WINGDIPAPI GdipSetClipRectI(GpGraphics*,INT,INT,INT,INT,CombineMode);
|
||||
GpStatus WINGDIPAPI GdipFillRegion(GpGraphics*,GpBrush*,GpRegion*);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue