[PATCH 3/3] gdi32/tests: Add tests for EMF PolyPolyline record creation.
Huw Davies
huw at codeweavers.com
Wed Mar 9 05:17:05 CST 2016
Signed-off-by: Huw Davies <huw at codeweavers.com>
---
dlls/gdi32/tests/metafile.c | 108 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 108 insertions(+)
diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c
index a90c533..5b3bd9f 100644
--- a/dlls/gdi32/tests/metafile.c
+++ b/dlls/gdi32/tests/metafile.c
@@ -1371,6 +1371,59 @@ static const unsigned char EMF_BEZIER_BITS[] =
0x14, 0x00, 0x00, 0x00
};
+static const unsigned char EMF_POLYPOLYLINE_BITS[] =
+{
+ 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x00, 0x90, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00,
+ 0x61, 0x01, 0x00, 0x00, 0xc2, 0x02, 0x00, 0x00,
+ 0x7a, 0xd4, 0x13, 0x00, 0xe8, 0x44, 0x00, 0x00,
+ 0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00,
+ 0x84, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa1, 0x05, 0x00, 0x00, 0x47, 0x03, 0x00, 0x00,
+ 0xfc, 0x01, 0x00, 0x00, 0x28, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc1, 0x07, 0x00,
+ 0x2c, 0x84, 0x04, 0x00, 0x5a, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00,
+ 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x14, 0x00,
+ 0x5a, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0a, 0x00, 0x14, 0x00, 0x64, 0x00, 0xc8, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x64, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00,
+ 0x00, 0x90, 0x00, 0x00, 0x2c, 0x01, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x00, 0x90, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x64, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00,
+ 0x00, 0x90, 0x00, 0x00, 0x2c, 0x01, 0x00, 0x00,
+ 0x90, 0x01, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00,
+ 0x0e, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00
+};
+
/* For debugging or dumping the raw metafiles produced by
* new test functions.
*/
@@ -3492,6 +3545,60 @@ static void test_emf_GetPath(void)
DeleteEnhMetaFile(hemf);
}
+static void test_emf_PolyPolyline(void)
+{
+ HDC hdcMetafile;
+ HENHMETAFILE hemf;
+ POINT pts[4] = {{10, 20}, {100, 200}, {0x9000,300}, {400, 500}};
+ DWORD counts[2];
+ BOOL ret;
+
+ SetLastError(0xdeadbeef);
+ hdcMetafile = CreateEnhMetaFileA(GetDC(0), NULL, NULL, NULL);
+ ok(hdcMetafile != 0, "CreateEnhMetaFileA error %d\n", GetLastError());
+
+ ret = PolyPolyline(hdcMetafile, NULL, NULL, 0);
+ ok( !ret, "PolyPolyline\n" );
+
+ SetLastError( 0xdeadbeef );
+ counts[0] = 0;
+ counts[1] = 1;
+ ret = PolyPolyline(hdcMetafile, pts, counts, 2);
+ ok( !ret, "PolyPolyline\n" );
+ ok( GetLastError() == ERROR_INVALID_PARAMETER, "gle %d\n", GetLastError() );
+
+ SetLastError( 0xdeadbeef );
+ counts[0] = 1;
+ counts[1] = 1;
+ ret = PolyPolyline(hdcMetafile, pts, counts, 2);
+ ok( !ret, "PolyPolyline\n" );
+ ok( GetLastError() == ERROR_INVALID_PARAMETER, "gle %d\n", GetLastError() );
+
+ SetLastError( 0xdeadbeef );
+ counts[0] = 2;
+ counts[1] = 1;
+ ret = PolyPolyline(hdcMetafile, pts, counts, 2);
+ ok( !ret, "PolyPolyline\n" );
+ ok( GetLastError() == ERROR_INVALID_PARAMETER, "gle %d\n", GetLastError() );
+
+ counts[0] = 2;
+ counts[1] = 2;
+ ret = PolyPolyline(hdcMetafile, pts, counts, 2);
+ ok( ret, "PolyPolyline\n" );
+
+ hemf = CloseEnhMetaFile(hdcMetafile);
+ ok(hemf != 0, "CloseEnhMetaFile error %d\n", GetLastError());
+
+ if(compare_emf_bits(hemf, EMF_POLYPOLYLINE_BITS, sizeof(EMF_POLYPOLYLINE_BITS),
+ "emf_PolyPolyline", FALSE) != 0)
+ {
+ dump_emf_bits(hemf, "emf_PolyPolyline");
+ dump_emf_records(hemf, "emf_PolyPolyline");
+ }
+
+ DeleteEnhMetaFile(hemf);
+}
+
START_TEST(metafile)
{
init_function_pointers();
@@ -3506,6 +3613,7 @@ START_TEST(metafile)
test_emf_clipping();
test_emf_polybezier();
test_emf_GetPath();
+ test_emf_PolyPolyline();
/* For win-format metafiles (mfdrv) */
test_mf_SaveDC();
--
2.7.0
More information about the wine-patches
mailing list