2 * Unit test suite for paths
4 * Copyright 2007 Laurent Vromman
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #include "wine/test.h"
32 static void test_widenpath(void)
35 HPEN greenPen
, narrowPen
;
41 /* Create a pen to be used in WidenPath */
42 greenPen
= CreatePen(PS_SOLID
, 10, RGB(0,0,0));
43 oldPen
= SelectObject(hdc
, greenPen
);
59 /* Set a polyline path */
61 Polyline(hdc
, pnt
, 6);
64 /* Widen the polyline path */
65 ok(WidenPath(hdc
), "WidenPath fails while widening a poyline path.\n");
67 /* Test if WidenPath seems to have done his job */
68 nSize
= GetPath(hdc
, NULL
, NULL
, 0);
69 ok(nSize
!= -1, "GetPath fails after calling WidenPath.\n");
70 ok(nSize
> 6, "Path number of points is to low. Should be more than 6 but is %d\n", nSize
);
74 /* Test WidenPath with an open path */
75 SetLastError(0xdeadbeef);
78 error
= GetLastError();
79 ok(ret
== FALSE
&& GetLastError() == ERROR_CAN_NOT_COMPLETE
, "WidenPath fails while widening an open path. Return value is %d, should be %d. Error is %08x, should be %08x\n", ret
, FALSE
, GetLastError(), ERROR_CAN_NOT_COMPLETE
);
83 /* Test when the pen width is equal to 1. The path should not change */
84 narrowPen
= CreatePen(PS_SOLID
, 1, RGB(0,0,0));
85 oldPen
= SelectObject(hdc
, narrowPen
);
87 Polyline(hdc
, pnt
, 6);
89 nSize
= GetPath(hdc
, NULL
, NULL
, 0);
90 ok(nSize
== 6, "WidenPath fails detecting 1px wide pen. Path length is %d, should be 6\n", nSize
);