gdi32: Add a test for CloseFigure.

This commit is contained in:
Laurent Vromman 2007-11-05 17:55:17 +01:00 committed by Alexandre Julliard
parent 2b77fed4cd
commit 6f140f9bec
2 changed files with 32 additions and 2 deletions

View File

@ -235,9 +235,8 @@ BOOL WINAPI CloseFigure(HDC hdc)
}
else
{
/* FIXME: Shouldn't we draw a line to the beginning of the
figure? */
/* Set PT_CLOSEFIGURE on the last entry and start a new stroke */
/* It is not necessary to draw a line, PT_CLOSEFIGURE is a virtual closing line itself */
if(dc->path.numEntriesUsed)
{
dc->path.pFlags[dc->path.numEntriesUsed-1]|=PT_CLOSEFIGURE;

View File

@ -391,10 +391,41 @@ done:
ReleaseDC(0, hdc);
}
static void test_closefigure(void) {
BOOL retb;
int nSize, nSizeWitness;
HDC hdc = GetDC(0);
BeginPath(hdc);
MoveToEx(hdc, 95, 95, NULL);
LineTo(hdc, 95, 0);
LineTo(hdc, 0, 95);
retb = CloseFigure(hdc);
EndPath(hdc);
nSize = GetPath(hdc, NULL, NULL, 0);
AbortPath(hdc);
BeginPath(hdc);
MoveToEx(hdc, 95, 95, NULL);
LineTo(hdc, 95, 0);
LineTo(hdc, 0, 95);
EndPath(hdc);
nSizeWitness = GetPath(hdc, NULL, NULL, 0);
/* This test shows CloseFigure does not have to add a point at the end of the path */
ok(nSize == nSizeWitness, "Wrong number of points, no point should be added by CloseFigure\n");
ReleaseDC(0, hdc);
}
START_TEST(path)
{
test_widenpath();
test_arcto();
test_anglearc();
test_polydraw();
test_closefigure();
}