Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
f44c1e65
Commit
f44c1e65
authored
Oct 24, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32/tests: Add tests for path open/closed states.
parent
095a9a68
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
235 additions
and
2 deletions
+235
-2
path.c
dlls/gdi32/path.c
+2
-2
path.c
dlls/gdi32/tests/path.c
+233
-0
No files found.
dlls/gdi32/path.c
View file @
f44c1e65
...
@@ -2240,7 +2240,7 @@ BOOL nulldrv_FlattenPath( PHYSDEV dev )
...
@@ -2240,7 +2240,7 @@ BOOL nulldrv_FlattenPath( PHYSDEV dev )
{
{
DC
*
dc
=
get_nulldrv_dc
(
dev
);
DC
*
dc
=
get_nulldrv_dc
(
dev
);
if
(
dc
->
path
.
state
=
=
PATH_Closed
)
if
(
dc
->
path
.
state
!
=
PATH_Closed
)
{
{
SetLastError
(
ERROR_CAN_NOT_COMPLETE
);
SetLastError
(
ERROR_CAN_NOT_COMPLETE
);
return
FALSE
;
return
FALSE
;
...
@@ -2252,7 +2252,7 @@ BOOL nulldrv_WidenPath( PHYSDEV dev )
...
@@ -2252,7 +2252,7 @@ BOOL nulldrv_WidenPath( PHYSDEV dev )
{
{
DC
*
dc
=
get_nulldrv_dc
(
dev
);
DC
*
dc
=
get_nulldrv_dc
(
dev
);
if
(
dc
->
path
.
state
==
PATH_Open
)
if
(
dc
->
path
.
state
!=
PATH_Closed
)
{
{
SetLastError
(
ERROR_CAN_NOT_COMPLETE
);
SetLastError
(
ERROR_CAN_NOT_COMPLETE
);
return
FALSE
;
return
FALSE
;
...
...
dlls/gdi32/tests/path.c
View file @
f44c1e65
...
@@ -33,6 +33,238 @@
...
@@ -33,6 +33,238 @@
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
static
void
test_path_state
(
void
)
{
BYTE
buffer
[
sizeof
(
BITMAPINFO
)
+
256
*
sizeof
(
RGBQUAD
)];
BITMAPINFO
*
bi
=
(
BITMAPINFO
*
)
buffer
;
HDC
hdc
;
HBITMAP
orig
,
dib
;
void
*
bits
;
BOOL
ret
;
hdc
=
CreateCompatibleDC
(
0
);
memset
(
buffer
,
0
,
sizeof
(
buffer
)
);
bi
->
bmiHeader
.
biSize
=
sizeof
(
bi
->
bmiHeader
);
bi
->
bmiHeader
.
biHeight
=
256
;
bi
->
bmiHeader
.
biWidth
=
256
;
bi
->
bmiHeader
.
biBitCount
=
32
;
bi
->
bmiHeader
.
biPlanes
=
1
;
bi
->
bmiHeader
.
biCompression
=
BI_RGB
;
dib
=
CreateDIBSection
(
0
,
bi
,
DIB_RGB_COLORS
,
(
void
**
)
&
bits
,
NULL
,
0
);
orig
=
SelectObject
(
hdc
,
dib
);
BeginPath
(
hdc
);
LineTo
(
hdc
,
100
,
100
);
ret
=
WidenPath
(
hdc
);
ok
(
!
ret
,
"WidenPath succeeded
\n
"
);
/* selecting another bitmap doesn't affect the path */
SelectObject
(
hdc
,
orig
);
ret
=
WidenPath
(
hdc
);
ok
(
!
ret
,
"WidenPath succeeded
\n
"
);
SelectObject
(
hdc
,
dib
);
ret
=
WidenPath
(
hdc
);
ok
(
!
ret
,
"WidenPath succeeded
\n
"
);
ret
=
EndPath
(
hdc
);
ok
(
ret
,
"EndPath failed error %u
\n
"
,
GetLastError
()
);
ret
=
WidenPath
(
hdc
);
ok
(
ret
,
"WidenPath failed error %u
\n
"
,
GetLastError
()
);
SelectObject
(
hdc
,
orig
);
ret
=
WidenPath
(
hdc
);
ok
(
ret
,
"WidenPath failed error %u
\n
"
,
GetLastError
()
);
BeginPath
(
hdc
);
LineTo
(
hdc
,
100
,
100
);
ret
=
WidenPath
(
hdc
);
ok
(
!
ret
,
"WidenPath succeeded
\n
"
);
SaveDC
(
hdc
);
SelectObject
(
hdc
,
dib
);
ret
=
EndPath
(
hdc
);
ok
(
ret
,
"EndPath failed error %u
\n
"
,
GetLastError
()
);
ret
=
WidenPath
(
hdc
);
ok
(
ret
,
"WidenPath failed error %u
\n
"
,
GetLastError
()
);
/* path should be open again after RestoreDC */
RestoreDC
(
hdc
,
-
1
);
ret
=
WidenPath
(
hdc
);
ok
(
!
ret
,
"WidenPath succeeded
\n
"
);
ret
=
EndPath
(
hdc
);
ok
(
ret
,
"EndPath failed error %u
\n
"
,
GetLastError
()
);
SaveDC
(
hdc
);
BeginPath
(
hdc
);
RestoreDC
(
hdc
,
-
1
);
ret
=
WidenPath
(
hdc
);
ok
(
ret
,
"WidenPath failed error %u
\n
"
,
GetLastError
()
);
/* test all functions with no path at all */
AbortPath
(
hdc
);
SetLastError
(
0xdeadbeef
);
ret
=
WidenPath
(
hdc
);
ok
(
!
ret
,
"WidenPath succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_CAN_NOT_COMPLETE
||
broken
(
GetLastError
()
==
0xdeadbeef
),
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ret
=
FlattenPath
(
hdc
);
ok
(
!
ret
,
"FlattenPath succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_CAN_NOT_COMPLETE
||
broken
(
GetLastError
()
==
0xdeadbeef
),
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ret
=
StrokePath
(
hdc
);
ok
(
!
ret
,
"StrokePath succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_CAN_NOT_COMPLETE
||
broken
(
GetLastError
()
==
0xdeadbeef
),
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ret
=
FillPath
(
hdc
);
ok
(
!
ret
,
"FillPath succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_CAN_NOT_COMPLETE
||
broken
(
GetLastError
()
==
0xdeadbeef
),
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ret
=
StrokeAndFillPath
(
hdc
);
ok
(
!
ret
,
"StrokeAndFillPath succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_CAN_NOT_COMPLETE
||
broken
(
GetLastError
()
==
0xdeadbeef
),
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ret
=
SelectClipPath
(
hdc
,
RGN_OR
);
ok
(
!
ret
,
"SelectClipPath succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_CAN_NOT_COMPLETE
||
broken
(
GetLastError
()
==
0xdeadbeef
),
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ret
=
EndPath
(
hdc
);
ok
(
!
ret
,
"SelectClipPath succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_CAN_NOT_COMPLETE
||
broken
(
GetLastError
()
==
0xdeadbeef
),
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ret
=
CloseFigure
(
hdc
);
ok
(
!
ret
,
"CloseFigure succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_CAN_NOT_COMPLETE
||
broken
(
GetLastError
()
==
0xdeadbeef
),
"wrong error %u
\n
"
,
GetLastError
()
);
/* test all functions with an open path */
AbortPath
(
hdc
);
BeginPath
(
hdc
);
SetLastError
(
0xdeadbeef
);
ret
=
WidenPath
(
hdc
);
ok
(
!
ret
,
"WidenPath succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_CAN_NOT_COMPLETE
||
broken
(
GetLastError
()
==
0xdeadbeef
),
"wrong error %u
\n
"
,
GetLastError
()
);
AbortPath
(
hdc
);
BeginPath
(
hdc
);
SetLastError
(
0xdeadbeef
);
ret
=
FlattenPath
(
hdc
);
ok
(
!
ret
,
"FlattenPath succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_CAN_NOT_COMPLETE
||
broken
(
GetLastError
()
==
0xdeadbeef
),
"wrong error %u
\n
"
,
GetLastError
()
);
AbortPath
(
hdc
);
BeginPath
(
hdc
);
SetLastError
(
0xdeadbeef
);
ret
=
StrokePath
(
hdc
);
ok
(
!
ret
,
"StrokePath succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_CAN_NOT_COMPLETE
||
broken
(
GetLastError
()
==
0xdeadbeef
),
"wrong error %u
\n
"
,
GetLastError
()
);
AbortPath
(
hdc
);
BeginPath
(
hdc
);
SetLastError
(
0xdeadbeef
);
ret
=
FillPath
(
hdc
);
ok
(
!
ret
,
"FillPath succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_CAN_NOT_COMPLETE
||
broken
(
GetLastError
()
==
0xdeadbeef
),
"wrong error %u
\n
"
,
GetLastError
()
);
AbortPath
(
hdc
);
BeginPath
(
hdc
);
SetLastError
(
0xdeadbeef
);
ret
=
StrokeAndFillPath
(
hdc
);
ok
(
!
ret
,
"StrokeAndFillPath succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_CAN_NOT_COMPLETE
||
broken
(
GetLastError
()
==
0xdeadbeef
),
"wrong error %u
\n
"
,
GetLastError
()
);
AbortPath
(
hdc
);
BeginPath
(
hdc
);
Rectangle
(
hdc
,
1
,
1
,
10
,
10
);
/* region needs some contents */
SetLastError
(
0xdeadbeef
);
ret
=
SelectClipPath
(
hdc
,
RGN_OR
);
ok
(
!
ret
,
"SelectClipPath succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_CAN_NOT_COMPLETE
||
broken
(
GetLastError
()
==
0xdeadbeef
),
"wrong error %u
\n
"
,
GetLastError
()
);
AbortPath
(
hdc
);
BeginPath
(
hdc
);
ret
=
CloseFigure
(
hdc
);
ok
(
ret
,
"CloseFigure failed
\n
"
);
/* test all functions with a closed path */
AbortPath
(
hdc
);
BeginPath
(
hdc
);
EndPath
(
hdc
);
ret
=
WidenPath
(
hdc
);
ok
(
ret
,
"WidenPath failed
\n
"
);
AbortPath
(
hdc
);
BeginPath
(
hdc
);
EndPath
(
hdc
);
ret
=
FlattenPath
(
hdc
);
ok
(
ret
,
"FlattenPath failed
\n
"
);
AbortPath
(
hdc
);
BeginPath
(
hdc
);
EndPath
(
hdc
);
ret
=
StrokePath
(
hdc
);
ok
(
ret
,
"StrokePath failed
\n
"
);
AbortPath
(
hdc
);
BeginPath
(
hdc
);
EndPath
(
hdc
);
ret
=
FillPath
(
hdc
);
ok
(
ret
,
"FillPath failed
\n
"
);
AbortPath
(
hdc
);
BeginPath
(
hdc
);
EndPath
(
hdc
);
ret
=
StrokeAndFillPath
(
hdc
);
ok
(
ret
,
"StrokeAndFillPath failed
\n
"
);
AbortPath
(
hdc
);
BeginPath
(
hdc
);
Rectangle
(
hdc
,
1
,
1
,
10
,
10
);
/* region needs some contents */
EndPath
(
hdc
);
ret
=
SelectClipPath
(
hdc
,
RGN_OR
);
ok
(
ret
,
"SelectClipPath failed
\n
"
);
AbortPath
(
hdc
);
BeginPath
(
hdc
);
EndPath
(
hdc
);
SetLastError
(
0xdeadbeef
);
ret
=
CloseFigure
(
hdc
);
ok
(
!
ret
,
"CloseFigure succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_CAN_NOT_COMPLETE
||
broken
(
GetLastError
()
==
0xdeadbeef
),
"wrong error %u
\n
"
,
GetLastError
()
);
AbortPath
(
hdc
);
BeginPath
(
hdc
);
EndPath
(
hdc
);
SetLastError
(
0xdeadbeef
);
ret
=
EndPath
(
hdc
);
ok
(
!
ret
,
"SelectClipPath succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_CAN_NOT_COMPLETE
||
broken
(
GetLastError
()
==
0xdeadbeef
),
"wrong error %u
\n
"
,
GetLastError
()
);
DeleteDC
(
hdc
);
DeleteObject
(
dib
);
}
static
void
test_widenpath
(
void
)
static
void
test_widenpath
(
void
)
{
{
HDC
hdc
=
GetDC
(
0
);
HDC
hdc
=
GetDC
(
0
);
...
@@ -504,6 +736,7 @@ static void test_linedda(void)
...
@@ -504,6 +736,7 @@ static void test_linedda(void)
START_TEST
(
path
)
START_TEST
(
path
)
{
{
test_path_state
();
test_widenpath
();
test_widenpath
();
test_arcto
();
test_arcto
();
test_anglearc
();
test_anglearc
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment