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
8fc96f20
Commit
8fc96f20
authored
Dec 22, 2009
by
Nikolay Sivov
Committed by
Alexandre Julliard
Dec 22, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/tests: Add ability to create any number of edit buddies.
parent
6d270a1d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
35 deletions
+36
-35
updown.c
dlls/comctl32/tests/updown.c
+36
-35
No files found.
dlls/comctl32/tests/updown.c
View file @
8fc96f20
...
...
@@ -59,7 +59,7 @@
#define EDIT_SEQ_INDEX 1
#define UPDOWN_SEQ_INDEX 2
static
HWND
parent_wnd
,
edit
;
static
HWND
parent_wnd
,
g_
edit
;
static
struct
msg_sequence
*
sequences
[
NUM_MSG_SEQUENCES
];
...
...
@@ -242,19 +242,20 @@ static LRESULT WINAPI edit_subclass_proc(HWND hwnd, UINT message, WPARAM wParam,
static
HWND
create_edit_control
(
void
)
{
WNDPROC
oldproc
;
HWND
hwnd
;
RECT
rect
;
GetClientRect
(
parent_wnd
,
&
rect
);
edit
=
CreateWindowExA
(
0
,
"EDIT"
,
NULL
,
WS_CHILD
|
WS_BORDER
|
WS_VISIBLE
,
hwnd
=
CreateWindowExA
(
0
,
WC_EDITA
,
NULL
,
WS_CHILD
|
WS_BORDER
|
WS_VISIBLE
,
0
,
0
,
rect
.
right
,
rect
.
bottom
,
parent_wnd
,
NULL
,
GetModuleHandleA
(
NULL
),
NULL
);
if
(
!
edit
)
return
NULL
;
if
(
!
hwnd
)
return
NULL
;
oldproc
=
(
WNDPROC
)
SetWindowLongPtrA
(
edit
,
GWLP_WNDPROC
,
oldproc
=
(
WNDPROC
)
SetWindowLongPtrA
(
hwnd
,
GWLP_WNDPROC
,
(
LONG_PTR
)
edit_subclass_proc
);
SetWindowLongPtrA
(
edit
,
GWLP_USERDATA
,
(
LONG_PTR
)
oldproc
);
SetWindowLongPtrA
(
hwnd
,
GWLP_USERDATA
,
(
LONG_PTR
)
oldproc
);
return
edit
;
return
hwnd
;
}
static
LRESULT
WINAPI
updown_subclass_proc
(
HWND
hwnd
,
UINT
message
,
WPARAM
wParam
,
LPARAM
lParam
)
...
...
@@ -280,7 +281,7 @@ static LRESULT WINAPI updown_subclass_proc(HWND hwnd, UINT message, WPARAM wPara
return
ret
;
}
static
HWND
create_updown_control
(
DWORD
style
)
static
HWND
create_updown_control
(
DWORD
style
,
HWND
buddy
)
{
WNDPROC
oldproc
;
HWND
updown
;
...
...
@@ -288,7 +289,7 @@ static HWND create_updown_control(DWORD style)
GetClientRect
(
parent_wnd
,
&
rect
);
updown
=
CreateUpDownControl
(
WS_CHILD
|
WS_BORDER
|
WS_VISIBLE
|
style
,
0
,
0
,
rect
.
right
,
rect
.
bottom
,
parent_wnd
,
1
,
GetModuleHandleA
(
NULL
),
edit
,
0
,
0
,
rect
.
right
,
rect
.
bottom
,
parent_wnd
,
1
,
GetModuleHandleA
(
NULL
),
buddy
,
100
,
0
,
50
);
if
(
!
updown
)
return
NULL
;
...
...
@@ -304,7 +305,7 @@ static void test_updown_pos(void)
HWND
updown
;
int
r
;
updown
=
create_updown_control
(
UDS_ALIGNRIGHT
);
updown
=
create_updown_control
(
UDS_ALIGNRIGHT
,
g_edit
);
flush_sequences
(
sequences
,
NUM_MSG_SEQUENCES
);
...
...
@@ -365,7 +366,7 @@ static void test_updown_pos32(void)
int
r
;
int
low
,
high
;
updown
=
create_updown_control
(
UDS_ALIGNRIGHT
);
updown
=
create_updown_control
(
UDS_ALIGNRIGHT
,
g_edit
);
flush_sequences
(
sequences
,
NUM_MSG_SEQUENCES
);
...
...
@@ -437,18 +438,18 @@ static void test_updown_buddy(void)
{
HWND
updown
,
buddyReturn
;
updown
=
create_updown_control
(
UDS_ALIGNRIGHT
);
updown
=
create_updown_control
(
UDS_ALIGNRIGHT
,
g_edit
);
flush_sequences
(
sequences
,
NUM_MSG_SEQUENCES
);
buddyReturn
=
(
HWND
)
SendMessage
(
updown
,
UDM_GETBUDDY
,
0
,
0
);
ok
(
buddyReturn
==
edit
,
"Expected edit handle
\n
"
);
ok
(
buddyReturn
==
g_
edit
,
"Expected edit handle
\n
"
);
buddyReturn
=
(
HWND
)
SendMessage
(
updown
,
UDM_SETBUDDY
,
(
WPARAM
)
edit
,
0
);
ok
(
buddyReturn
==
edit
,
"Expected edit handle
\n
"
);
buddyReturn
=
(
HWND
)
SendMessage
(
updown
,
UDM_SETBUDDY
,
(
WPARAM
)
g_
edit
,
0
);
ok
(
buddyReturn
==
g_
edit
,
"Expected edit handle
\n
"
);
buddyReturn
=
(
HWND
)
SendMessage
(
updown
,
UDM_GETBUDDY
,
0
,
0
);
ok
(
buddyReturn
==
edit
,
"Expected edit handle
\n
"
);
ok
(
buddyReturn
==
g_
edit
,
"Expected edit handle
\n
"
);
ok_sequence
(
sequences
,
UPDOWN_SEQ_INDEX
,
test_updown_buddy_seq
,
"test updown buddy"
,
TRUE
);
ok_sequence
(
sequences
,
EDIT_SEQ_INDEX
,
add_updown_with_edit_seq
,
"test updown buddy_edit"
,
FALSE
);
...
...
@@ -462,7 +463,7 @@ static void test_updown_base(void)
int
r
;
CHAR
text
[
10
];
updown
=
create_updown_control
(
UDS_ALIGNRIGHT
);
updown
=
create_updown_control
(
UDS_ALIGNRIGHT
,
g_edit
);
flush_sequences
(
sequences
,
NUM_MSG_SEQUENCES
);
...
...
@@ -499,18 +500,18 @@ static void test_updown_base(void)
DestroyWindow
(
updown
);
/* switch base with buddy attached */
updown
=
create_updown_control
(
UDS_SETBUDDYINT
|
UDS_ALIGNRIGHT
);
updown
=
create_updown_control
(
UDS_SETBUDDYINT
|
UDS_ALIGNRIGHT
,
g_edit
);
r
=
SendMessage
(
updown
,
UDM_SETPOS
,
0
,
10
);
expect
(
50
,
r
);
GetWindowTextA
(
edit
,
text
,
sizeof
(
text
)
/
sizeof
(
CHAR
));
GetWindowTextA
(
g_
edit
,
text
,
sizeof
(
text
)
/
sizeof
(
CHAR
));
ok
(
lstrcmpA
(
text
,
"10"
)
==
0
,
"Expected '10', got '%s'
\n
"
,
text
);
r
=
SendMessage
(
updown
,
UDM_SETBASE
,
16
,
0
);
expect
(
10
,
r
);
GetWindowTextA
(
edit
,
text
,
sizeof
(
text
)
/
sizeof
(
CHAR
));
GetWindowTextA
(
g_
edit
,
text
,
sizeof
(
text
)
/
sizeof
(
CHAR
));
/* FIXME: currently hex output isn't properly formatted, but for this
test only change from initial text matters */
ok
(
lstrcmpA
(
text
,
"10"
)
!=
0
,
"Expected '0x000A', got '%s'
\n
"
,
text
);
...
...
@@ -523,7 +524,7 @@ static void test_updown_unicode(void)
HWND
updown
;
int
r
;
updown
=
create_updown_control
(
UDS_ALIGNRIGHT
);
updown
=
create_updown_control
(
UDS_ALIGNRIGHT
,
g_edit
);
flush_sequences
(
sequences
,
NUM_MSG_SEQUENCES
);
...
...
@@ -563,14 +564,14 @@ static void test_updown_create(void)
flush_sequences
(
sequences
,
NUM_MSG_SEQUENCES
);
updown
=
create_updown_control
(
UDS_ALIGNRIGHT
);
updown
=
create_updown_control
(
UDS_ALIGNRIGHT
,
g_edit
);
ok
(
updown
!=
NULL
,
"Failed to create updown control
\n
"
);
ok_sequence
(
sequences
,
PARENT_SEQ_INDEX
,
add_updown_to_parent_seq
,
"add updown control to parent"
,
TRUE
);
ok_sequence
(
sequences
,
EDIT_SEQ_INDEX
,
add_updown_with_edit_seq
,
"add updown control with edit"
,
FALSE
);
flush_sequences
(
sequences
,
NUM_MSG_SEQUENCES
);
GetWindowTextA
(
edit
,
text
,
MAX_PATH
);
GetWindowTextA
(
g_
edit
,
text
,
MAX_PATH
);
ok
(
lstrlenA
(
text
)
==
0
,
"Expected empty string
\n
"
);
ok_sequence
(
sequences
,
EDIT_SEQ_INDEX
,
get_edit_text_seq
,
"get edit text"
,
FALSE
);
...
...
@@ -634,44 +635,44 @@ static void test_UDS_SETBUDDYINT(void)
/* cleanup buddy */
text
[
0
]
=
'\0'
;
SetWindowTextA
(
edit
,
text
);
SetWindowTextA
(
g_
edit
,
text
);
/* creating without UDS_SETBUDDYINT */
updown
=
create_updown_control
(
UDS_ALIGNRIGHT
);
updown
=
create_updown_control
(
UDS_ALIGNRIGHT
,
g_edit
);
/* try to set UDS_SETBUDDYINT after creation */
style
=
GetWindowLongA
(
updown
,
GWL_STYLE
);
SetWindowLongA
(
updown
,
GWL_STYLE
,
style
|
UDS_SETBUDDYINT
);
style
=
GetWindowLongA
(
updown
,
GWL_STYLE
);
ok
(
style
&
UDS_SETBUDDYINT
,
"Expected UDS_SETBUDDY to be set
\n
"
);
SendMessage
(
updown
,
UDM_SETPOS
,
0
,
20
);
GetWindowTextA
(
edit
,
text
,
sizeof
(
text
)
/
sizeof
(
CHAR
));
GetWindowTextA
(
g_
edit
,
text
,
sizeof
(
text
)
/
sizeof
(
CHAR
));
ok
(
lstrlenA
(
text
)
==
0
,
"Expected empty string
\n
"
);
DestroyWindow
(
updown
);
/* creating with UDS_SETBUDDYINT */
updown
=
create_updown_control
(
UDS_SETBUDDYINT
|
UDS_ALIGNRIGHT
);
GetWindowTextA
(
edit
,
text
,
sizeof
(
text
)
/
sizeof
(
CHAR
));
updown
=
create_updown_control
(
UDS_SETBUDDYINT
|
UDS_ALIGNRIGHT
,
g_edit
);
GetWindowTextA
(
g_
edit
,
text
,
sizeof
(
text
)
/
sizeof
(
CHAR
));
/* 50 is initial value here */
ok
(
lstrcmpA
(
text
,
"50"
)
==
0
,
"Expected '50', got '%s'
\n
"
,
text
);
/* now remove style flag */
style
=
GetWindowLongA
(
updown
,
GWL_STYLE
);
SetWindowLongA
(
updown
,
GWL_STYLE
,
style
&
~
UDS_SETBUDDYINT
);
SendMessage
(
updown
,
UDM_SETPOS
,
0
,
20
);
GetWindowTextA
(
edit
,
text
,
sizeof
(
text
)
/
sizeof
(
CHAR
));
GetWindowTextA
(
g_
edit
,
text
,
sizeof
(
text
)
/
sizeof
(
CHAR
));
ok
(
lstrcmpA
(
text
,
"20"
)
==
0
,
"Expected '20', got '%s'
\n
"
,
text
);
/* set edit text directly, check position */
strcpy
(
text
,
"10"
);
SetWindowTextA
(
edit
,
text
);
SetWindowTextA
(
g_
edit
,
text
);
ret
=
SendMessageA
(
updown
,
UDM_GETPOS
,
0
,
0
);
expect
(
10
,
ret
);
strcpy
(
text
,
"11"
);
SetWindowTextA
(
edit
,
text
);
SetWindowTextA
(
g_
edit
,
text
);
ret
=
SendMessageA
(
updown
,
UDM_GETPOS
,
0
,
0
);
expect
(
11
,
LOWORD
(
ret
));
expect
(
0
,
HIWORD
(
ret
));
/* set to invalid value */
strcpy
(
text
,
"21st"
);
SetWindowTextA
(
edit
,
text
);
SetWindowTextA
(
g_
edit
,
text
);
ret
=
SendMessageA
(
updown
,
UDM_GETPOS
,
0
,
0
);
expect
(
11
,
LOWORD
(
ret
));
expect
(
TRUE
,
HIWORD
(
ret
));
...
...
@@ -679,7 +680,7 @@ static void test_UDS_SETBUDDYINT(void)
style
=
GetWindowLongA
(
updown
,
GWL_STYLE
);
SetWindowLongA
(
updown
,
GWL_STYLE
,
style
|
UDS_SETBUDDYINT
);
SendMessage
(
updown
,
UDM_SETPOS
,
0
,
30
);
GetWindowTextA
(
edit
,
text
,
sizeof
(
text
)
/
sizeof
(
CHAR
));
GetWindowTextA
(
g_
edit
,
text
,
sizeof
(
text
)
/
sizeof
(
CHAR
));
ok
(
lstrcmpA
(
text
,
"30"
)
==
0
,
"Expected '30', got '%s'
\n
"
,
text
);
DestroyWindow
(
updown
);
}
...
...
@@ -691,8 +692,8 @@ START_TEST(updown)
parent_wnd
=
create_parent_window
();
ok
(
parent_wnd
!=
NULL
,
"Failed to create parent window!
\n
"
);
edit
=
create_edit_control
();
ok
(
edit
!=
NULL
,
"Failed to create edit control
\n
"
);
g_
edit
=
create_edit_control
();
ok
(
g_
edit
!=
NULL
,
"Failed to create edit control
\n
"
);
test_updown_create
();
test_updown_pos
();
...
...
@@ -702,6 +703,6 @@ START_TEST(updown)
test_updown_unicode
();
test_UDS_SETBUDDYINT
();
DestroyWindow
(
edit
);
DestroyWindow
(
g_
edit
);
DestroyWindow
(
parent_wnd
);
}
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