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
f7f7b89e
Commit
f7f7b89e
authored
Aug 17, 2017
by
Fabian Maurer
Committed by
Alexandre Julliard
Aug 28, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/combo: Set listbox popup height correctly and add tests.
Signed-off-by:
Fabian Maurer
<
dark.shadow4@web.de
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d505c2dc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
107 additions
and
8 deletions
+107
-8
combo.c
dlls/user32/combo.c
+0
-8
combo.c
dlls/user32/tests/combo.c
+107
-0
No files found.
dlls/user32/combo.c
View file @
f7f7b89e
...
...
@@ -1033,14 +1033,6 @@ static void CBDropDown( LPHEADCOMBO lphc )
if
(
nHeight
<
nDroppedHeight
-
COMBO_YBORDERSIZE
())
nDroppedHeight
=
nHeight
+
COMBO_YBORDERSIZE
();
if
(
nDroppedHeight
<
nHeight
)
{
if
(
nItems
<
5
)
nDroppedHeight
=
(
nItems
+
1
)
*
nIHeight
;
else
if
(
nDroppedHeight
<
6
*
nIHeight
)
nDroppedHeight
=
6
*
nIHeight
;
}
}
r
.
left
=
rect
.
left
;
...
...
dlls/user32/tests/combo.c
View file @
f7f7b89e
...
...
@@ -29,6 +29,8 @@
#define COMBO_ID 1995
#define COMBO_YBORDERSIZE() 2
static
HWND
hMainWnd
;
#define expect_eq(expr, value, type, fmt); { type val = expr; ok(val == (value), #expr " expected " #fmt " got " #fmt "\n", (value), val); }
...
...
@@ -700,6 +702,110 @@ static void test_listbox_styles(DWORD cb_style)
DestroyWindow
(
combo
);
}
static
void
test_listbox_size
(
DWORD
style
)
{
BOOL
(
WINAPI
*
pGetComboBoxInfo
)(
HWND
,
PCOMBOBOXINFO
);
HWND
hCombo
,
hList
;
COMBOBOXINFO
cbInfo
;
UINT
x
,
y
;
BOOL
ret
;
int
i
,
test
;
const
char
wine_test
[]
=
"Wine Test"
;
static
const
struct
list_size_info
{
int
num_items
;
int
height_combo
;
BOOL
todo
;
}
info_height
[]
=
{
{
2
,
24
},
{
2
,
41
,
TRUE
},
{
2
,
42
},
{
2
,
50
},
{
2
,
60
},
{
2
,
80
},
{
2
,
89
},
{
2
,
90
},
{
2
,
100
},
{
10
,
24
},
{
10
,
41
,
TRUE
},
{
10
,
42
},
{
10
,
50
},
{
10
,
60
},
{
10
,
80
},
{
10
,
89
,
TRUE
},
{
10
,
90
},
{
10
,
100
},
};
pGetComboBoxInfo
=
(
void
*
)
GetProcAddress
(
GetModuleHandleA
(
"user32.dll"
),
"GetComboBoxInfo"
);
if
(
!
pGetComboBoxInfo
)
{
win_skip
(
"GetComboBoxInfo is not available
\n
"
);
return
;
}
for
(
test
=
0
;
test
<
sizeof
(
info_height
)
/
sizeof
(
info_height
[
0
]);
test
++
)
{
const
struct
list_size_info
*
info_test
=
&
info_height
[
test
];
int
height_item
;
/* Height of a list item */
int
height_list
;
/* Height of the list we got */
int
expected_count_list
;
int
expected_height_list
;
int
list_height_nonclient
;
int
list_height_calculated
;
RECT
rect_list_client
,
rect_list_complete
;
hCombo
=
CreateWindowA
(
"ComboBox"
,
"Combo"
,
WS_VISIBLE
|
WS_CHILD
|
style
,
5
,
5
,
100
,
info_test
->
height_combo
,
hMainWnd
,
(
HMENU
)
COMBO_ID
,
NULL
,
0
);
cbInfo
.
cbSize
=
sizeof
(
COMBOBOXINFO
);
SetLastError
(
0xdeadbeef
);
ret
=
pGetComboBoxInfo
(
hCombo
,
&
cbInfo
);
ok
(
ret
,
"Failed to get COMBOBOXINFO structure; LastError: %u
\n
"
,
GetLastError
());
hList
=
cbInfo
.
hwndList
;
for
(
i
=
0
;
i
<
info_test
->
num_items
;
i
++
)
SendMessageA
(
hCombo
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
wine_test
);
/* Click on the button to drop down the list */
x
=
cbInfo
.
rcButton
.
left
+
(
cbInfo
.
rcButton
.
right
-
cbInfo
.
rcButton
.
left
)
/
2
;
y
=
cbInfo
.
rcButton
.
top
+
(
cbInfo
.
rcButton
.
bottom
-
cbInfo
.
rcButton
.
top
)
/
2
;
ret
=
SendMessageA
(
hCombo
,
WM_LBUTTONDOWN
,
0
,
MAKELPARAM
(
x
,
y
));
ok
(
ret
,
"WM_LBUTTONDOWN was not processed. LastError=%d
\n
"
,
GetLastError
());
ok
(
SendMessageA
(
hCombo
,
CB_GETDROPPEDSTATE
,
0
,
0
),
"The dropdown list should have appeared after clicking the button.
\n
"
);
GetClientRect
(
hList
,
&
rect_list_client
);
GetWindowRect
(
hList
,
&
rect_list_complete
);
height_list
=
rect_list_client
.
bottom
-
rect_list_client
.
top
;
height_item
=
(
int
)
SendMessageA
(
hList
,
LB_GETITEMHEIGHT
,
0
,
0
);
list_height_nonclient
=
(
rect_list_complete
.
bottom
-
rect_list_complete
.
top
)
-
(
rect_list_client
.
bottom
-
rect_list_client
.
top
);
/* Calculate the expected client size of the listbox popup from the size of the combobox. */
list_height_calculated
=
info_test
->
height_combo
-
(
cbInfo
.
rcItem
.
bottom
+
COMBO_YBORDERSIZE
())
-
list_height_nonclient
-
1
;
expected_count_list
=
list_height_calculated
/
height_item
;
if
(
expected_count_list
<
0
)
expected_count_list
=
0
;
expected_count_list
=
min
(
expected_count_list
,
info_test
->
num_items
);
expected_height_list
=
expected_count_list
*
height_item
;
todo_wine_if
(
info_test
->
todo
)
ok
(
expected_height_list
==
height_list
,
"Test %d, expected list height to be %d, got %d
\n
"
,
test
,
expected_height_list
,
height_list
);
DestroyWindow
(
hCombo
);
}
}
START_TEST
(
combo
)
{
hMainWnd
=
CreateWindowA
(
"static"
,
"Test"
,
WS_OVERLAPPEDWINDOW
,
10
,
10
,
300
,
300
,
NULL
,
NULL
,
NULL
,
0
);
...
...
@@ -719,6 +825,7 @@ START_TEST(combo)
test_listbox_styles
(
CBS_SIMPLE
);
test_listbox_styles
(
CBS_DROPDOWN
);
test_listbox_styles
(
CBS_DROPDOWNLIST
);
test_listbox_size
(
CBS_DROPDOWN
);
DestroyWindow
(
hMainWnd
);
}
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