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
52d90e3c
Commit
52d90e3c
authored
Jul 17, 2017
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/tests: Add some tests for WindowFromDC and destroyed windows.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
08193ed7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
87 additions
and
16 deletions
+87
-16
dce.c
dlls/user32/tests/dce.c
+87
-16
No files found.
dlls/user32/tests/dce.c
View file @
52d90e3c
...
...
@@ -52,11 +52,14 @@ static void test_dc_attributes(void)
rop
=
GetROP2
(
hdc
);
ok
(
rop
==
R2_WHITE
,
"wrong ROP2 %d
\n
"
,
rop
);
ok
(
WindowFromDC
(
hdc
)
==
hwnd_cache
,
"wrong window
\n
"
);
ReleaseDC
(
hwnd_cache
,
hdc
);
ok
(
WindowFromDC
(
hdc
)
==
0
,
"wrong window
\n
"
);
hdc
=
GetDC
(
hwnd_cache
);
rop
=
GetROP2
(
hdc
);
ok
(
rop
==
def_rop
,
"wrong ROP2 %d after release
\n
"
,
rop
);
SetROP2
(
hdc
,
R2_WHITE
);
ok
(
WindowFromDC
(
hdc
)
==
hwnd_cache
,
"wrong window
\n
"
);
ReleaseDC
(
hwnd_cache
,
hdc
);
old_hdc
=
hdc
;
...
...
@@ -115,6 +118,7 @@ static void test_dc_attributes(void)
ok
(
rop
==
0
,
"got %d
\n
"
,
rop
);
rop
=
GetROP2
(
old_hdc
);
ok
(
rop
==
0
,
"got %d
\n
"
,
rop
);
ok
(
WindowFromDC
(
old_hdc
)
==
0
,
"wrong window
\n
"
);
/* test own DC */
...
...
@@ -124,11 +128,14 @@ static void test_dc_attributes(void)
ok
(
rop
==
R2_WHITE
,
"wrong ROP2 %d
\n
"
,
rop
);
old_hdc
=
hdc
;
ok
(
WindowFromDC
(
hdc
)
==
hwnd_owndc
,
"wrong window
\n
"
);
ReleaseDC
(
hwnd_owndc
,
hdc
);
ok
(
WindowFromDC
(
hdc
)
==
hwnd_owndc
,
"wrong window
\n
"
);
hdc
=
GetDC
(
hwnd_owndc
);
ok
(
old_hdc
==
hdc
,
"didn't get same DC %p/%p
\n
"
,
old_hdc
,
hdc
);
rop
=
GetROP2
(
hdc
);
ok
(
rop
==
R2_WHITE
,
"wrong ROP2 %d after release
\n
"
,
rop
);
ok
(
WindowFromDC
(
hdc
)
==
hwnd_owndc
,
"wrong window
\n
"
);
ReleaseDC
(
hwnd_owndc
,
hdc
);
rop
=
GetROP2
(
hdc
);
ok
(
rop
==
R2_WHITE
,
"wrong ROP2 %d after second release
\n
"
,
rop
);
...
...
@@ -141,11 +148,14 @@ static void test_dc_attributes(void)
ok
(
rop
==
R2_WHITE
,
"wrong ROP2 %d
\n
"
,
rop
);
old_hdc
=
hdc
;
ok
(
WindowFromDC
(
hdc
)
==
hwnd_classdc
,
"wrong window
\n
"
);
ReleaseDC
(
hwnd_classdc
,
hdc
);
ok
(
WindowFromDC
(
hdc
)
==
hwnd_classdc
,
"wrong window
\n
"
);
hdc
=
GetDC
(
hwnd_classdc
);
ok
(
old_hdc
==
hdc
,
"didn't get same DC %p/%p
\n
"
,
old_hdc
,
hdc
);
rop
=
GetROP2
(
hdc
);
ok
(
rop
==
R2_WHITE
,
"wrong ROP2 %d after release
\n
"
,
rop
);
ok
(
WindowFromDC
(
hdc
)
==
hwnd_classdc
,
"wrong window
\n
"
);
ReleaseDC
(
hwnd_classdc
,
hdc
);
rop
=
GetROP2
(
hdc
);
ok
(
rop
==
R2_WHITE
,
"wrong ROP2 %d after second release
\n
"
,
rop
);
...
...
@@ -154,12 +164,15 @@ static void test_dc_attributes(void)
old_hdc
=
GetDC
(
hwnd_classdc
);
SetROP2
(
old_hdc
,
R2_BLACK
);
ok
(
WindowFromDC
(
old_hdc
)
==
hwnd_classdc
,
"wrong window
\n
"
);
hdc
=
GetDC
(
hwnd_classdc2
);
ok
(
old_hdc
==
hdc
,
"didn't get same DC %p/%p
\n
"
,
old_hdc
,
hdc
);
rop
=
GetROP2
(
hdc
);
ok
(
rop
==
R2_BLACK
,
"wrong ROP2 %d for other window
\n
"
,
rop
);
ok
(
WindowFromDC
(
hdc
)
==
hwnd_classdc2
,
"wrong window
\n
"
);
ReleaseDC
(
hwnd_classdc
,
old_hdc
);
ReleaseDC
(
hwnd_classdc
,
hdc
);
ok
(
WindowFromDC
(
hdc
)
==
hwnd_classdc2
,
"wrong window
\n
"
);
rop
=
GetROP2
(
hdc
);
ok
(
rop
==
R2_BLACK
,
"wrong ROP2 %d after release
\n
"
,
rop
);
}
...
...
@@ -597,19 +610,83 @@ static void test_dc_layout(void)
static
void
test_destroyed_window
(
void
)
{
HDC
dc
;
HDC
dc
,
old_dc
;
HDC
hdcs
[
30
];
int
i
,
rop
;
dc
=
GetDCEx
(
hwnd_cache
,
0
,
DCX_USESTYLE
);
ok
(
!
dc
,
"Got a non-NULL DC (%p) for a destroyed window.
\n
"
,
dc
);
dc
=
GetDC
(
hwnd_cache
);
SetROP2
(
dc
,
R2_WHITE
);
rop
=
GetROP2
(
dc
);
ok
(
rop
==
R2_WHITE
,
"wrong ROP2 %d
\n
"
,
rop
);
ok
(
WindowFromDC
(
dc
)
==
hwnd_cache
,
"wrong window
\n
"
);
old_dc
=
dc
;
DestroyWindow
(
hwnd_cache
);
rop
=
GetROP2
(
dc
);
todo_wine
ok
(
rop
==
0
,
"wrong ROP2 %d
\n
"
,
rop
);
ok
(
WindowFromDC
(
dc
)
==
0
,
"wrong window
\n
"
);
ok
(
!
ReleaseDC
(
hwnd_cache
,
dc
),
"ReleaseDC succeeded
\n
"
);
dc
=
GetDC
(
hwnd_cache
);
ok
(
!
dc
,
"Got a non-NULL DC (%p) for a destroyed window
\n
"
,
dc
);
for
(
i
=
0
;
i
<
30
;
i
++
)
{
dc
=
hdcs
[
i
]
=
GetDCEx
(
hwnd_parent
,
0
,
DCX_CACHE
|
DCX_USESTYLE
);
if
(
dc
==
old_dc
)
break
;
}
ok
(
i
<
30
,
"DC for destroyed window not reused
\n
"
);
while
(
i
>
0
)
ReleaseDC
(
hwnd_parent
,
hdcs
[
--
i
]
);
dc
=
GetDC
(
hwnd_classdc
);
SetROP2
(
dc
,
R2_WHITE
);
rop
=
GetROP2
(
dc
);
ok
(
rop
==
R2_WHITE
,
"wrong ROP2 %d
\n
"
,
rop
);
ok
(
WindowFromDC
(
dc
)
==
hwnd_classdc
,
"wrong window
\n
"
);
old_dc
=
dc
;
dc
=
GetDC
(
hwnd_classdc2
);
ok
(
old_dc
==
dc
,
"wrong DC
\n
"
);
rop
=
GetROP2
(
dc
);
ok
(
rop
==
R2_WHITE
,
"wrong ROP2 %d
\n
"
,
rop
);
ok
(
WindowFromDC
(
dc
)
==
hwnd_classdc2
,
"wrong window
\n
"
);
DestroyWindow
(
hwnd_classdc2
);
dc
=
GetDCEx
(
hwnd_owndc
,
0
,
DCX_USESTYLE
);
ok
(
!
dc
,
"Got a non-NULL DC (%p) for a destroyed window.
\n
"
,
dc
);
rop
=
GetROP2
(
dc
);
ok
(
rop
==
R2_WHITE
,
"wrong ROP2 %d
\n
"
,
rop
);
ok
(
WindowFromDC
(
dc
)
==
0
,
"wrong window
\n
"
);
todo_wine
ok
(
!
ReleaseDC
(
hwnd_classdc2
,
dc
),
"ReleaseDC succeeded
\n
"
);
dc
=
GetDC
(
hwnd_classdc2
);
ok
(
!
dc
,
"Got a non-NULL DC (%p) for a destroyed window
\n
"
,
dc
);
dc
=
GetDC
(
hwnd_classdc
);
ok
(
dc
!=
0
,
"Got NULL DC
\n
"
);
rop
=
GetROP2
(
dc
);
todo_wine
ok
(
rop
==
R2_WHITE
,
"wrong ROP2 %d
\n
"
,
rop
);
ok
(
WindowFromDC
(
dc
)
==
hwnd_classdc
,
"wrong window
\n
"
);
DestroyWindow
(
hwnd_classdc
);
rop
=
GetROP2
(
dc
);
todo_wine
ok
(
rop
==
R2_WHITE
,
"wrong ROP2 %d
\n
"
,
rop
);
ok
(
WindowFromDC
(
dc
)
==
0
,
"wrong window
\n
"
);
todo_wine
ok
(
!
ReleaseDC
(
hwnd_classdc
,
dc
),
"ReleaseDC succeeded
\n
"
);
dc
=
GetDC
(
hwnd_classdc
);
ok
(
!
dc
,
"Got a non-NULL DC (%p) for a destroyed window
\n
"
,
dc
);
dc
=
GetDC
(
hwnd_owndc
);
ok
(
dc
!=
0
,
"Got NULL DC
\n
"
);
rop
=
GetROP2
(
dc
);
ok
(
rop
==
R2_WHITE
,
"wrong ROP2 %d
\n
"
,
rop
);
ok
(
WindowFromDC
(
dc
)
==
hwnd_owndc
,
"wrong window
\n
"
);
DestroyWindow
(
hwnd_owndc
);
dc
=
GetDCEx
(
hwnd_classdc
,
0
,
DCX_USESTYLE
);
ok
(
!
dc
,
"Got a non-NULL DC (%p) for a destroyed window.
\n
"
,
dc
);
rop
=
GetROP2
(
dc
);
ok
(
rop
==
0
,
"wrong ROP2 %d
\n
"
,
rop
);
ok
(
WindowFromDC
(
dc
)
==
0
,
"wrong window
\n
"
);
ok
(
!
ReleaseDC
(
hwnd_owndc
,
dc
),
"ReleaseDC succeeded
\n
"
);
dc
=
GetDC
(
hwnd_owndc
);
ok
(
!
dc
,
"Got a non-NULL DC (%p) for a destroyed window
\n
"
,
dc
);
dc
=
GetDCEx
(
hwnd_classdc2
,
0
,
DCX_USESTYLE
);
ok
(
!
dc
,
"Got a non-NULL DC (%p) for a destroyed window.
\n
"
,
dc
);
DestroyWindow
(
hwnd_parent
);
}
START_TEST
(
dce
)
...
...
@@ -661,12 +738,6 @@ START_TEST(dce)
test_scroll_window
();
test_invisible_create
();
test_dc_layout
();
DestroyWindow
(
hwnd_parent
);
DestroyWindow
(
hwnd_classdc2
);
DestroyWindow
(
hwnd_classdc
);
DestroyWindow
(
hwnd_owndc
);
DestroyWindow
(
hwnd_cache
);
/* this should be last */
test_destroyed_window
();
}
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