Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
f76caee6
Commit
f76caee6
authored
May 14, 2023
by
Zhiyi Zhang
Committed by
Alexandre Julliard
May 29, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus/tests: Add pen custom line cap record and play back tests.
parent
c1da4fb1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
126 additions
and
0 deletions
+126
-0
metafile.c
dlls/gdiplus/tests/metafile.c
+126
-0
No files found.
dlls/gdiplus/tests/metafile.c
View file @
f76caee6
...
...
@@ -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
.
0
f
,
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
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment