Laurent Vromman : gdi32: Add a test for CloseFigure.
Alexandre Julliard
julliard at winehq.org
Tue Nov 6 08:24:41 CST 2007
Module: wine
Branch: master
Commit: 6f140f9bec8d6d472073ed184c19e73a70d7a559
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6f140f9bec8d6d472073ed184c19e73a70d7a559
Author: Laurent Vromman <laurent at vromman.org>
Date: Mon Nov 5 17:55:17 2007 +0100
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 683bdba..553f475 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 33497bc..6753298 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();
}
More information about the wine-cvs
mailing list