gdi32/tests: Add a few more path tests.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Alexandre Julliard 2016-06-16 00:25:03 +09:00
parent a2aeb36933
commit bd53a012b4
1 changed files with 48 additions and 5 deletions

View File

@ -38,6 +38,7 @@ static void test_path_state(void)
BYTE buffer[sizeof(BITMAPINFO) + 256 * sizeof(RGBQUAD)];
BITMAPINFO *bi = (BITMAPINFO *)buffer;
HDC hdc;
HRGN rgn;
HBITMAP orig, dib;
void *bits;
BOOL ret;
@ -138,6 +139,12 @@ static void test_path_state(void)
ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
"wrong error %u\n", GetLastError() );
SetLastError( 0xdeadbeef );
rgn = PathToRegion( hdc );
ok( !rgn, "PathToRegion succeeded\n" );
ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
"wrong error %u\n", GetLastError() );
SetLastError( 0xdeadbeef );
ret = EndPath( hdc );
ok( !ret, "SelectClipPath succeeded\n" );
@ -200,6 +207,15 @@ static void test_path_state(void)
ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
"wrong error %u\n", GetLastError() );
AbortPath( hdc );
BeginPath( hdc );
Rectangle( hdc, 1, 1, 10, 10 ); /* region needs some contents */
SetLastError( 0xdeadbeef );
rgn = PathToRegion( hdc );
ok( !rgn, "PathToRegion succeeded\n" );
ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
"wrong error %u\n", GetLastError() );
AbortPath( hdc );
BeginPath( hdc );
ret = CloseFigure( hdc );
@ -211,39 +227,66 @@ static void test_path_state(void)
EndPath( hdc );
ret = WidenPath( hdc );
ok( ret, "WidenPath failed\n" );
ok( GetPath( hdc, NULL, NULL, 0 ) != -1, "path deleted\n" );
AbortPath( hdc );
BeginPath( hdc );
EndPath( hdc );
ret = FlattenPath( hdc );
ok( ret, "FlattenPath failed\n" );
ok( GetPath( hdc, NULL, NULL, 0 ) != -1, "path deleted\n" );
AbortPath( hdc );
BeginPath( hdc );
EndPath( hdc );
ret = StrokePath( hdc );
ok( ret, "StrokePath failed\n" );
ok( GetPath( hdc, NULL, NULL, 0 ) == -1, "path not deleted\n" );
AbortPath( hdc );
BeginPath( hdc );
EndPath( hdc );
ret = FillPath( hdc );
ok( ret, "FillPath failed\n" );
ok( GetPath( hdc, NULL, NULL, 0 ) == -1, "path not deleted\n" );
AbortPath( hdc );
BeginPath( hdc );
EndPath( hdc );
ret = StrokeAndFillPath( hdc );
ok( ret, "StrokeAndFillPath failed\n" );
ok( GetPath( hdc, NULL, NULL, 0 ) == -1, "path not deleted\n" );
AbortPath( hdc );
BeginPath( hdc );
Rectangle( hdc, 1, 1, 10, 10 ); /* region needs some contents */
EndPath( hdc );
ret = SelectClipPath( hdc, RGN_OR );
ok( ret, "SelectClipPath failed\n" );
ok( GetPath( hdc, NULL, NULL, 0 ) == -1, "path not deleted\n" );
BeginPath( hdc );
EndPath( hdc );
SetLastError( 0xdeadbeef );
ret = SelectClipPath( hdc, RGN_OR );
todo_wine ok( !ret, "SelectClipPath succeeded on empty path\n" );
ok( GetLastError() == 0xdeadbeef, "wrong error %u\n", GetLastError() );
ok( GetPath( hdc, NULL, NULL, 0 ) == -1, "path not deleted\n" );
BeginPath( hdc );
Rectangle( hdc, 1, 1, 10, 10 ); /* region needs some contents */
EndPath( hdc );
rgn = PathToRegion( hdc );
ok( rgn != 0, "PathToRegion failed\n" );
DeleteObject( rgn );
ok( GetPath( hdc, NULL, NULL, 0 ) == -1, "path not deleted\n" );
BeginPath( hdc );
EndPath( hdc );
SetLastError( 0xdeadbeef );
rgn = PathToRegion( hdc );
todo_wine ok( !rgn, "PathToRegion succeeded on empty path\n" );
ok( GetLastError() == 0xdeadbeef, "wrong error %u\n", GetLastError() );
DeleteObject( rgn );
ok( GetPath( hdc, NULL, NULL, 0 ) == -1, "path not deleted\n" );
AbortPath( hdc );
BeginPath( hdc );
EndPath( hdc );
SetLastError( 0xdeadbeef );
@ -257,7 +300,7 @@ static void test_path_state(void)
EndPath( hdc );
SetLastError( 0xdeadbeef );
ret = EndPath( hdc );
ok( !ret, "SelectClipPath succeeded\n" );
ok( !ret, "EndPath succeeded\n" );
ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
"wrong error %u\n", GetLastError() );