mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
gdiplus/tests: Add pen custom line cap record and play back tests.
This commit is contained in:
parent
c1da4fb167
commit
f76caee6e7
1 changed files with 126 additions and 0 deletions
|
@ -3874,6 +3874,131 @@ static void test_setclippath(void)
|
|||
expect(Ok, stat);
|
||||
}
|
||||
|
||||
static const emfplus_record pen_dc_records[] =
|
||||
{
|
||||
{ EMR_HEADER },
|
||||
{ EmfPlusRecordTypeHeader },
|
||||
{ EmfPlusRecordTypeObject, ObjectTypePen << 8 },
|
||||
{ EmfPlusRecordTypeObject, (ObjectTypePath << 8) | 1 },
|
||||
{ EmfPlusRecordTypeDrawPath, 1 },
|
||||
{ EMR_SAVEDC, 0, 1 },
|
||||
{ EMR_SETICMMODE, 0, 1 },
|
||||
{ EMR_BITBLT, 0, 1 },
|
||||
{ EMR_RESTOREDC, 0, 1 },
|
||||
{ EmfPlusRecordTypeEndOfFile },
|
||||
{ EMR_EOF },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static const emfplus_record pen_bitmap_records[] =
|
||||
{
|
||||
{ EMR_HEADER },
|
||||
{ EmfPlusRecordTypeHeader },
|
||||
{ EmfPlusRecordTypeObject, ObjectTypePen << 8 },
|
||||
{ EmfPlusRecordTypeObject, (ObjectTypePath << 8) | 1 },
|
||||
{ EmfPlusRecordTypeDrawPath, 1 },
|
||||
{ EmfPlusRecordTypeEndOfFile },
|
||||
{ EMR_EOF },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void test_pen(void)
|
||||
{
|
||||
static const GpPointF dst_points[3] = {{0.0, 0.0}, {100.0, 0.0}, {0.0, 100.0}};
|
||||
static const GpRectF frame = {0.0, 0.0, 100.0, 100.0};
|
||||
GpMetafile *metafile, *clone_metafile;
|
||||
GpPath *draw_path, *line_cap_path;
|
||||
GpCustomLineCap *custom_line_cap;
|
||||
GpGraphics *graphics;
|
||||
HENHMETAFILE hemf;
|
||||
GpBitmap *bitmap;
|
||||
GpStatus stat;
|
||||
ARGB color;
|
||||
GpPen *pen;
|
||||
BOOL ret;
|
||||
HDC hdc;
|
||||
|
||||
/* Record */
|
||||
hdc = CreateCompatibleDC(0);
|
||||
stat = GdipRecordMetafile(hdc, EmfTypeEmfPlusOnly, &frame, MetafileFrameUnitPixel, description, &metafile);
|
||||
expect(Ok, stat);
|
||||
DeleteDC(hdc);
|
||||
|
||||
stat = GdipGetImageGraphicsContext((GpImage *)metafile, &graphics);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipCreatePath(FillModeAlternate, &draw_path);
|
||||
expect(Ok, stat);
|
||||
stat = GdipAddPathLine(draw_path, 25, 25, 25, 75);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipCreatePen1((ARGB)0xffff0000, 1.0f, UnitPixel, &pen);
|
||||
expect(Ok, stat);
|
||||
stat = GdipCreatePath(FillModeAlternate, &line_cap_path);
|
||||
expect(Ok, stat);
|
||||
stat = GdipAddPathRectangle(line_cap_path, 5.0, 5.0, 10.0, 10.0);
|
||||
expect(Ok, stat);
|
||||
stat = GdipCreateCustomLineCap(NULL, line_cap_path, LineCapCustom, 0.0, &custom_line_cap);
|
||||
expect(Ok, stat);
|
||||
stat = GdipSetPenCustomStartCap(pen, custom_line_cap);
|
||||
expect(Ok, stat);
|
||||
stat = GdipSetPenCustomEndCap(pen, custom_line_cap);
|
||||
expect(Ok, stat);
|
||||
stat = GdipDeleteCustomLineCap(custom_line_cap);
|
||||
expect(Ok, stat);
|
||||
stat = GdipDeletePath(line_cap_path);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDrawPath(graphics, pen, draw_path);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDeletePen(pen);
|
||||
expect(Ok, stat);
|
||||
stat = GdipDeletePath(draw_path);
|
||||
expect(Ok, stat);
|
||||
stat = GdipDeleteGraphics(graphics);
|
||||
expect(Ok, stat);
|
||||
|
||||
sync_metafile(&metafile, "pen.emf");
|
||||
GdipCloneImage((GpImage *)metafile, (GpImage **)&clone_metafile);
|
||||
|
||||
stat = GdipGetHemfFromMetafile(metafile, &hemf);
|
||||
expect(Ok, stat);
|
||||
|
||||
check_emfplus(hemf, pen_dc_records, "pen record");
|
||||
|
||||
ret = DeleteEnhMetaFile(hemf);
|
||||
ok(ret != 0, "Failed to delete enhmetafile.\n");
|
||||
stat = GdipDisposeImage((GpImage *)metafile);
|
||||
expect(Ok, stat);
|
||||
|
||||
/* Play back */
|
||||
stat = GdipCreateBitmapFromScan0(100, 100, 0, PixelFormat24bppRGB, NULL, &bitmap);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipGetImageGraphicsContext((GpImage *)bitmap, &graphics);
|
||||
expect(Ok, stat);
|
||||
|
||||
play_metafile(clone_metafile, graphics, pen_bitmap_records, "pen playback", dst_points, &frame, UnitPixel);
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap, 10, 10, &color);
|
||||
expect(Ok, stat);
|
||||
todo_wine
|
||||
expect(0xffff0000, color);
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap, 40, 90, &color);
|
||||
expect(Ok, stat);
|
||||
todo_wine
|
||||
expect(0xffff0000, color);
|
||||
|
||||
stat = GdipDisposeImage((GpImage *)clone_metafile);
|
||||
expect(Ok, stat);
|
||||
stat = GdipDeleteGraphics(graphics);
|
||||
expect(Ok, stat);
|
||||
stat = GdipDisposeImage((GpImage *)bitmap);
|
||||
expect(Ok, stat);
|
||||
}
|
||||
|
||||
START_TEST(metafile)
|
||||
{
|
||||
struct GdiplusStartupInput gdiplusStartupInput;
|
||||
|
@ -3934,6 +4059,7 @@ START_TEST(metafile)
|
|||
test_offsetclip();
|
||||
test_resetclip();
|
||||
test_setclippath();
|
||||
test_pen();
|
||||
|
||||
GdiplusShutdown(gdiplusToken);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue