Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
635ace83
Commit
635ace83
authored
Nov 22, 2005
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Nov 22, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test showing that SaveDC after GetDC should return 1.
parent
248c090d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
94 additions
and
2 deletions
+94
-2
dc.c
dlls/gdi/tests/dc.c
+94
-2
No files found.
dlls/gdi/tests/dc.c
View file @
635ace83
...
...
@@ -2,6 +2,7 @@
* Unit tests for dc functions
*
* Copyright (c) 2005 Huw Davies
* Copyright (c) 2005 Dmitry Timoshkov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -20,7 +21,6 @@
#include <assert.h>
#include <stdio.h>
#include <math.h>
#include "wine/test.h"
#include "winbase.h"
...
...
@@ -28,8 +28,99 @@
#include "winuser.h"
#include "winerror.h"
static
void
dump_region
(
HRGN
hrgn
)
{
DWORD
i
,
size
;
RGNDATA
*
data
=
NULL
;
RECT
*
rect
;
if
(
!
hrgn
)
{
printf
(
"(null) region
\n
"
);
return
;
}
if
(
!
(
size
=
GetRegionData
(
hrgn
,
0
,
NULL
)))
return
;
if
(
!
(
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
)))
return
;
GetRegionData
(
hrgn
,
size
,
data
);
printf
(
"%ld rects:"
,
data
->
rdh
.
nCount
);
for
(
i
=
0
,
rect
=
(
RECT
*
)
data
->
Buffer
;
i
<
data
->
rdh
.
nCount
;
i
++
,
rect
++
)
printf
(
" (%ld,%ld)-(%ld,%ld)"
,
rect
->
left
,
rect
->
top
,
rect
->
right
,
rect
->
bottom
);
printf
(
"
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
}
static
void
test_savedc_2
(
void
)
{
HWND
hwnd
;
HDC
hdc
;
HRGN
hrgn
;
RECT
rc
,
rc_clip
;
int
ret
;
hwnd
=
CreateWindowExA
(
0
,
"static"
,
""
,
WS_POPUP
,
0
,
0
,
100
,
100
,
0
,
0
,
0
,
NULL
);
assert
(
hwnd
!=
0
);
ShowWindow
(
hwnd
,
SW_SHOW
);
UpdateWindow
(
hwnd
);
hrgn
=
CreateRectRgn
(
0
,
0
,
0
,
0
);
assert
(
hrgn
!=
0
);
hdc
=
GetDC
(
hwnd
);
ok
(
hdc
!=
NULL
,
"CreateDC rets %p
\n
"
,
hdc
);
ret
=
GetClipBox
(
hdc
,
&
rc_clip
);
ok
(
ret
==
SIMPLEREGION
,
"GetClipBox returned %d instead of SIMPLEREGION
\n
"
,
ret
);
ret
=
GetClipRgn
(
hdc
,
hrgn
);
ok
(
ret
==
0
,
"GetClipRgn returned %d instead of 0
\n
"
,
ret
);
ret
=
GetRgnBox
(
hrgn
,
&
rc
);
ok
(
ret
==
NULLREGION
,
"GetRgnBox returned %d (%ld,%ld-%ld,%ld) instead of NULLREGION
\n
"
,
ret
,
rc
.
left
,
rc
.
top
,
rc
.
right
,
rc
.
bottom
);
/*dump_region(hrgn);*/
SetRect
(
&
rc
,
0
,
0
,
100
,
100
);
ok
(
EqualRect
(
&
rc
,
&
rc_clip
),
"rects are not equal: (%ld,%ld-%ld,%ld) - (%ld,%ld-%ld,%ld)
\n
"
,
rc
.
left
,
rc
.
top
,
rc
.
right
,
rc
.
bottom
,
rc_clip
.
left
,
rc_clip
.
top
,
rc_clip
.
right
,
rc_clip
.
bottom
);
ret
=
SaveDC
(
hdc
);
todo_wine
{
ok
(
ret
==
1
,
"ret = %d
\n
"
,
ret
);
}
ret
=
IntersectClipRect
(
hdc
,
0
,
0
,
50
,
50
);
#if 0 /* XP returns COMPLEXREGION although dump_region reports only 1 rect */
ok(ret == SIMPLEREGION, "IntersectClipRect returned %d instead of SIMPLEREGION\n", ret);
#endif
if
(
ret
!=
SIMPLEREGION
)
{
trace
(
"Windows BUG: IntersectClipRect returned %d instead of SIMPLEREGION
\n
"
,
ret
);
/* let's make sure that it's a simple region */
ret
=
GetClipRgn
(
hdc
,
hrgn
);
ok
(
ret
==
1
,
"GetClipRgn returned %d instead of 1
\n
"
,
ret
);
dump_region
(
hrgn
);
}
ret
=
GetClipBox
(
hdc
,
&
rc_clip
);
ok
(
ret
==
SIMPLEREGION
,
"GetClipBox returned %d instead of SIMPLEREGION
\n
"
,
ret
);
SetRect
(
&
rc
,
0
,
0
,
50
,
50
);
ok
(
EqualRect
(
&
rc
,
&
rc_clip
),
"rects are not equal
\n
"
);
ret
=
RestoreDC
(
hdc
,
1
);
ok
(
ret
,
"ret = %d
\n
"
,
ret
);
ret
=
GetClipBox
(
hdc
,
&
rc_clip
);
ok
(
ret
==
SIMPLEREGION
,
"GetClipBox returned %d instead of SIMPLEREGION
\n
"
,
ret
);
SetRect
(
&
rc
,
0
,
0
,
100
,
100
);
ok
(
EqualRect
(
&
rc
,
&
rc_clip
),
"rects are not equal
\n
"
);
DeleteObject
(
hrgn
);
ReleaseDC
(
hwnd
,
hdc
);
DestroyWindow
(
hwnd
);
}
void
test_savedc
(
void
)
static
void
test_savedc
(
void
)
{
HDC
hdc
=
CreateDCA
(
"DISPLAY"
,
NULL
,
NULL
,
NULL
);
int
ret
;
...
...
@@ -85,4 +176,5 @@ void test_savedc(void)
START_TEST
(
dc
)
{
test_savedc
();
test_savedc_2
();
}
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