Commit 525fd823 authored by Laurent Vromman's avatar Laurent Vromman Committed by Alexandre Julliard

gdi32: Correction of WidenPath behaviour when pen width is 1.

parent 94b9b614
......@@ -1795,6 +1795,11 @@ static BOOL PATH_WidenPath(DC *dc)
penWidth = elp->elpWidth;
HeapFree( GetProcessHeap(), 0, elp );
/* pen width must be strictly higher than 1 */
if(penWidth == 1) {
return TRUE;
}
/* FIXME : If extPen, use the shape on corners */
penWidthIn = penWidth / 2;
penWidthOut = penWidth / 2;
......
......@@ -19,6 +19,7 @@
*/
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
......@@ -31,7 +32,7 @@
static void test_widenpath(void)
{
HDC hdc = GetDC(0);
HPEN greenPen;
HPEN greenPen, narrowPen;
HPEN oldPen;
POINT pnt[6];
INT nSize;
......@@ -67,6 +68,8 @@ static void test_widenpath(void)
ok(nSize != -1, "GetPath fails after calling WidenPath.\n");
ok(nSize > 6, "Path number of points is to low. Should be more than 6 but is %d\n", nSize);
AbortPath(hdc);
todo_wine {
/* Test WidenPath with an empty path */
SetLastError(0xdeadbeef);
......@@ -74,6 +77,17 @@ static void test_widenpath(void)
ok(WidenPath(hdc) == FALSE, "WidenPath fails while widening an empty path. Error : %d\n", GetLastError());
}
AbortPath(hdc);
/* Test when the pen width is equal to 1. The path should not change */
narrowPen = CreatePen(PS_SOLID, 1, RGB(0,0,0));
oldPen = SelectObject(hdc, narrowPen);
BeginPath(hdc);
Polyline(hdc, pnt, 6);
EndPath(hdc);
nSize = GetPath(hdc, NULL, NULL, 0);
ok(nSize == 6, "WidenPath fails detecting 1px wide pen. Path length is %d, should be 6\n", nSize);
ReleaseDC(0, hdc);
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment