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
d476761f
Commit
d476761f
authored
Sep 12, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/tests: Added some tests for Get/SetLayeredWindowAttributes.
parent
05b4181c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
89 additions
and
3 deletions
+89
-3
win.c
dlls/user32/tests/win.c
+89
-3
No files found.
dlls/user32/tests/win.c
View file @
d476761f
...
@@ -47,6 +47,8 @@ void dump_region(HRGN hrgn);
...
@@ -47,6 +47,8 @@ void dump_region(HRGN hrgn);
static
HWND
(
WINAPI
*
pGetAncestor
)(
HWND
,
UINT
);
static
HWND
(
WINAPI
*
pGetAncestor
)(
HWND
,
UINT
);
static
BOOL
(
WINAPI
*
pGetWindowInfo
)(
HWND
,
WINDOWINFO
*
);
static
BOOL
(
WINAPI
*
pGetWindowInfo
)(
HWND
,
WINDOWINFO
*
);
static
UINT
(
WINAPI
*
pGetWindowModuleFileNameA
)(
HWND
,
LPSTR
,
UINT
);
static
UINT
(
WINAPI
*
pGetWindowModuleFileNameA
)(
HWND
,
LPSTR
,
UINT
);
static
BOOL
(
WINAPI
*
pGetLayeredWindowAttributes
)(
HWND
,
COLORREF
*
,
BYTE
*
,
DWORD
*
);
static
BOOL
(
WINAPI
*
pSetLayeredWindowAttributes
)(
HWND
,
COLORREF
,
BYTE
,
DWORD
);
static
BOOL
test_lbuttondown_flag
;
static
BOOL
test_lbuttondown_flag
;
static
HWND
hwndMessage
;
static
HWND
hwndMessage
;
...
@@ -4809,11 +4811,94 @@ static void test_hwnd_message(void)
...
@@ -4809,11 +4811,94 @@ static void test_hwnd_message(void)
DestroyWindow
(
hwnd
);
DestroyWindow
(
hwnd
);
}
}
static
void
test_layered_window
(
void
)
{
HWND
hwnd
;
COLORREF
key
=
0
;
BYTE
alpha
=
0
;
DWORD
flags
=
0
;
BOOL
ret
;
if
(
!
pGetLayeredWindowAttributes
||
!
pSetLayeredWindowAttributes
)
{
win_skip
(
"layered windows not supported
\n
"
);
return
;
}
hwnd
=
CreateWindowExA
(
0
,
"MainWindowClass"
,
"message window"
,
WS_CAPTION
,
100
,
100
,
200
,
200
,
0
,
0
,
0
,
NULL
);
assert
(
hwnd
);
ret
=
pGetLayeredWindowAttributes
(
hwnd
,
&
key
,
&
alpha
,
&
flags
);
ok
(
!
ret
,
"GetLayeredWindowAttributes should fail on non-layered window
\n
"
);
ret
=
pSetLayeredWindowAttributes
(
hwnd
,
0
,
0
,
LWA_ALPHA
);
ok
(
!
ret
,
"SetLayeredWindowAttributes should fail on non-layered window
\n
"
);
SetWindowLong
(
hwnd
,
GWL_EXSTYLE
,
GetWindowLong
(
hwnd
,
GWL_EXSTYLE
)
|
WS_EX_LAYERED
);
ret
=
pGetLayeredWindowAttributes
(
hwnd
,
&
key
,
&
alpha
,
&
flags
);
ok
(
!
ret
,
"GetLayeredWindowAttributes should fail on layered but not initialized window
\n
"
);
ret
=
pSetLayeredWindowAttributes
(
hwnd
,
0x123456
,
44
,
LWA_ALPHA
);
ok
(
ret
,
"SetLayeredWindowAttributes should succeed on layered window
\n
"
);
ret
=
pGetLayeredWindowAttributes
(
hwnd
,
&
key
,
&
alpha
,
&
flags
);
ok
(
ret
,
"GetLayeredWindowAttributes should succeed on layered window
\n
"
);
ok
(
key
==
0x123456
,
"wrong color key %x
\n
"
,
key
);
ok
(
alpha
==
44
,
"wrong alpha %u
\n
"
,
alpha
);
ok
(
flags
==
LWA_ALPHA
,
"wrong flags %x
\n
"
,
flags
);
/* clearing WS_EX_LAYERED resets attributes */
SetWindowLong
(
hwnd
,
GWL_EXSTYLE
,
GetWindowLong
(
hwnd
,
GWL_EXSTYLE
)
&
~
WS_EX_LAYERED
);
ret
=
pGetLayeredWindowAttributes
(
hwnd
,
&
key
,
&
alpha
,
&
flags
);
ok
(
!
ret
,
"GetLayeredWindowAttributes should fail on no longer layered window
\n
"
);
SetWindowLong
(
hwnd
,
GWL_EXSTYLE
,
GetWindowLong
(
hwnd
,
GWL_EXSTYLE
)
|
WS_EX_LAYERED
);
ret
=
pGetLayeredWindowAttributes
(
hwnd
,
&
key
,
&
alpha
,
&
flags
);
ok
(
!
ret
,
"GetLayeredWindowAttributes should fail on layered but not initialized window
\n
"
);
ret
=
pSetLayeredWindowAttributes
(
hwnd
,
0x654321
,
22
,
LWA_COLORKEY
|
LWA_ALPHA
);
ok
(
ret
,
"SetLayeredWindowAttributes should succeed on layered window
\n
"
);
ret
=
pGetLayeredWindowAttributes
(
hwnd
,
&
key
,
&
alpha
,
&
flags
);
ok
(
ret
,
"GetLayeredWindowAttributes should succeed on layered window
\n
"
);
ok
(
key
==
0x654321
,
"wrong color key %x
\n
"
,
key
);
ok
(
alpha
==
22
,
"wrong alpha %u
\n
"
,
alpha
);
ok
(
flags
==
(
LWA_COLORKEY
|
LWA_ALPHA
),
"wrong flags %x
\n
"
,
flags
);
/* alpha not changed if LWA_ALPHA is not set */
ret
=
pSetLayeredWindowAttributes
(
hwnd
,
0x888888
,
33
,
LWA_COLORKEY
);
ok
(
ret
,
"SetLayeredWindowAttributes should succeed on layered window
\n
"
);
alpha
=
0
;
ret
=
pGetLayeredWindowAttributes
(
hwnd
,
&
key
,
&
alpha
,
&
flags
);
ok
(
ret
,
"GetLayeredWindowAttributes should succeed on layered window
\n
"
);
ok
(
key
==
0x888888
,
"wrong color key %x
\n
"
,
key
);
ok
(
alpha
==
22
,
"wrong alpha %u
\n
"
,
alpha
);
ok
(
flags
==
LWA_COLORKEY
,
"wrong flags %x
\n
"
,
flags
);
/* color key always changed */
ret
=
pSetLayeredWindowAttributes
(
hwnd
,
0x999999
,
44
,
0
);
ok
(
ret
,
"SetLayeredWindowAttributes should succeed on layered window
\n
"
);
alpha
=
0
;
ret
=
pGetLayeredWindowAttributes
(
hwnd
,
&
key
,
&
alpha
,
&
flags
);
ok
(
ret
,
"GetLayeredWindowAttributes should succeed on layered window
\n
"
);
ok
(
key
==
0x999999
,
"wrong color key %x
\n
"
,
key
);
ok
(
alpha
==
22
,
"wrong alpha %u
\n
"
,
alpha
);
ok
(
flags
==
0
,
"wrong flags %x
\n
"
,
flags
);
/* default alpha is 0 */
SetWindowLong
(
hwnd
,
GWL_EXSTYLE
,
GetWindowLong
(
hwnd
,
GWL_EXSTYLE
)
&
~
WS_EX_LAYERED
);
SetWindowLong
(
hwnd
,
GWL_EXSTYLE
,
GetWindowLong
(
hwnd
,
GWL_EXSTYLE
)
|
WS_EX_LAYERED
);
ret
=
pSetLayeredWindowAttributes
(
hwnd
,
0x222222
,
55
,
0
);
ok
(
ret
,
"SetLayeredWindowAttributes should succeed on layered window
\n
"
);
ret
=
pGetLayeredWindowAttributes
(
hwnd
,
&
key
,
&
alpha
,
&
flags
);
ok
(
ret
,
"GetLayeredWindowAttributes should succeed on layered window
\n
"
);
ok
(
key
==
0x222222
,
"wrong color key %x
\n
"
,
key
);
ok
(
alpha
==
0
,
"wrong alpha %u
\n
"
,
alpha
);
ok
(
flags
==
0
,
"wrong flags %x
\n
"
,
flags
);
DestroyWindow
(
hwnd
);
}
START_TEST
(
win
)
START_TEST
(
win
)
{
{
pGetAncestor
=
(
void
*
)
GetProcAddress
(
GetModuleHandleA
(
"user32.dll"
),
"GetAncestor"
);
HMODULE
user32
=
GetModuleHandleA
(
"user32.dll"
);
pGetWindowInfo
=
(
void
*
)
GetProcAddress
(
GetModuleHandleA
(
"user32.dll"
),
"GetWindowInfo"
);
pGetAncestor
=
(
void
*
)
GetProcAddress
(
user32
,
"GetAncestor"
);
pGetWindowModuleFileNameA
=
(
void
*
)
GetProcAddress
(
GetModuleHandleA
(
"user32.dll"
),
"GetWindowModuleFileNameA"
);
pGetWindowInfo
=
(
void
*
)
GetProcAddress
(
user32
,
"GetWindowInfo"
);
pGetWindowModuleFileNameA
=
(
void
*
)
GetProcAddress
(
user32
,
"GetWindowModuleFileNameA"
);
pGetLayeredWindowAttributes
=
(
void
*
)
GetProcAddress
(
user32
,
"GetLayeredWindowAttributes"
);
pSetLayeredWindowAttributes
=
(
void
*
)
GetProcAddress
(
user32
,
"SetLayeredWindowAttributes"
);
if
(
!
RegisterWindowClasses
())
assert
(
0
);
if
(
!
RegisterWindowClasses
())
assert
(
0
);
...
@@ -4878,6 +4963,7 @@ START_TEST(win)
...
@@ -4878,6 +4963,7 @@ START_TEST(win)
test_gettext
();
test_gettext
();
test_GetUpdateRect
();
test_GetUpdateRect
();
test_Expose
();
test_Expose
();
test_layered_window
();
/* add the tests above this line */
/* add the tests above this line */
UnhookWindowsHookEx
(
hhook
);
UnhookWindowsHookEx
(
hhook
);
...
...
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