From 6f140f9bec8d6d472073ed184c19e73a70d7a559 Mon Sep 17 00:00:00 2001 From: Laurent Vromman Date: Mon, 5 Nov 2007 17:55:17 +0100 Subject: [PATCH] gdi32: Add a test for CloseFigure. --- dlls/gdi32/path.c | 3 +-- dlls/gdi32/tests/path.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c index 683bdba0a2e..553f4755760 100644 --- a/dlls/gdi32/path.c +++ b/dlls/gdi32/path.c @@ -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; diff --git a/dlls/gdi32/tests/path.c b/dlls/gdi32/tests/path.c index 33497bc3c6c..67532985e85 100644 --- a/dlls/gdi32/tests/path.c +++ b/dlls/gdi32/tests/path.c @@ -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(); }