gdi32/tests: Add tests for EMF PolyPolyline record creation.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2016-03-09 11:17:05 +00:00 committed by Alexandre Julliard
parent 6e05189ba4
commit a36b4a6abb
1 changed files with 108 additions and 0 deletions

View File

@ -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();