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
b43afeef
Commit
b43afeef
authored
Dec 01, 2005
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Dec 01, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test for LB_SELITEMRANGE, make it pass under Wine.
parent
e3774d79
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
5 deletions
+94
-5
listbox.c
dlls/user/listbox.c
+7
-5
listbox.c
dlls/user/tests/listbox.c
+87
-0
No files found.
dlls/user/listbox.c
View file @
b43afeef
...
...
@@ -1380,11 +1380,13 @@ static LRESULT LISTBOX_SelectItemRange( LB_DESCR *descr, INT first,
/* A few sanity checks */
if
(
descr
->
style
&
LBS_NOSEL
)
return
LB_ERR
;
if
((
last
==
-
1
)
&&
(
descr
->
nb_items
==
0
))
return
LB_OKAY
;
if
(
!
(
descr
->
style
&
LBS_MULTIPLESEL
))
return
LB_ERR
;
if
(
last
==
-
1
)
last
=
descr
->
nb_items
-
1
;
if
((
first
<
0
)
||
(
first
>=
descr
->
nb_items
))
return
LB_ERR
;
if
((
last
<
0
)
||
(
last
>=
descr
->
nb_items
))
return
LB_ERR
;
if
(
!
descr
->
nb_items
)
return
LB_OKAY
;
if
(
last
>=
descr
->
nb_items
)
last
=
descr
->
nb_items
-
1
;
if
(
first
<
0
)
first
=
0
;
if
(
last
<
first
)
return
LB_OKAY
;
if
(
on
)
/* Turn selection on */
{
...
...
@@ -1424,7 +1426,7 @@ static LRESULT LISTBOX_SetSelection( LB_DESCR *descr, INT index,
if
(
descr
->
style
&
LBS_MULTIPLESEL
)
{
if
(
index
==
-
1
)
/* Select all items */
return
LISTBOX_SelectItemRange
(
descr
,
0
,
-
1
,
on
);
return
LISTBOX_SelectItemRange
(
descr
,
0
,
descr
->
nb_items
,
on
);
else
/* Only one item */
return
LISTBOX_SelectItemRange
(
descr
,
index
,
index
,
on
);
}
...
...
dlls/user/tests/listbox.c
View file @
b43afeef
...
...
@@ -304,6 +304,92 @@ static void test_ownerdraw(void)
DestroyWindow
(
parent
);
}
#define listbox_test_query(exp, got) \
ok(exp.selected == got.selected, "expected selected %d, got %d\n", exp.selected, got.selected); \
ok(exp.anchor == got.anchor, "expected anchor %d, got %d\n", exp.anchor, got.anchor); \
ok(exp.caret == got.caret, "expected caret %d, got %d\n", exp.caret, got.caret); \
ok(exp.selcount == got.selcount, "expected selcount %d, got %d\n", exp.selcount, got.selcount);
static
void
test_selection
(
void
)
{
static
const
struct
listbox_stat
test_nosel
=
{
0
,
LB_ERR
,
0
,
0
};
static
const
struct
listbox_stat
test_1
=
{
0
,
LB_ERR
,
0
,
2
};
static
const
struct
listbox_stat
test_2
=
{
0
,
LB_ERR
,
0
,
3
};
static
const
struct
listbox_stat
test_3
=
{
0
,
LB_ERR
,
0
,
4
};
HWND
hLB
;
struct
listbox_stat
answer
;
INT
ret
;
trace
(
"testing LB_SELITEMRANGE
\n
"
);
hLB
=
create_listbox
(
LBS_EXTENDEDSEL
,
0
);
assert
(
hLB
);
listbox_query
(
hLB
,
&
answer
);
listbox_test_query
(
test_nosel
,
answer
);
ret
=
SendMessage
(
hLB
,
LB_SELITEMRANGE
,
TRUE
,
MAKELPARAM
(
1
,
2
));
ok
(
ret
==
LB_OKAY
,
"LB_SELITEMRANGE returned %d instead of LB_OKAY
\n
"
,
ret
);
listbox_query
(
hLB
,
&
answer
);
listbox_test_query
(
test_1
,
answer
);
SendMessage
(
hLB
,
LB_SETSEL
,
FALSE
,
(
LPARAM
)
-
1
);
listbox_query
(
hLB
,
&
answer
);
listbox_test_query
(
test_nosel
,
answer
);
ret
=
SendMessage
(
hLB
,
LB_SELITEMRANGE
,
TRUE
,
MAKELPARAM
(
0
,
4
));
ok
(
ret
==
LB_OKAY
,
"LB_SELITEMRANGE returned %d instead of LB_OKAY
\n
"
,
ret
);
listbox_query
(
hLB
,
&
answer
);
listbox_test_query
(
test_3
,
answer
);
SendMessage
(
hLB
,
LB_SETSEL
,
FALSE
,
(
LPARAM
)
-
1
);
listbox_query
(
hLB
,
&
answer
);
listbox_test_query
(
test_nosel
,
answer
);
ret
=
SendMessage
(
hLB
,
LB_SELITEMRANGE
,
TRUE
,
MAKELPARAM
(
-
5
,
5
));
ok
(
ret
==
LB_OKAY
,
"LB_SELITEMRANGE returned %d instead of LB_OKAY
\n
"
,
ret
);
listbox_query
(
hLB
,
&
answer
);
listbox_test_query
(
test_nosel
,
answer
);
SendMessage
(
hLB
,
LB_SETSEL
,
FALSE
,
(
LPARAM
)
-
1
);
listbox_query
(
hLB
,
&
answer
);
listbox_test_query
(
test_nosel
,
answer
);
ret
=
SendMessage
(
hLB
,
LB_SELITEMRANGE
,
TRUE
,
MAKELPARAM
(
2
,
10
));
ok
(
ret
==
LB_OKAY
,
"LB_SELITEMRANGE returned %d instead of LB_OKAY
\n
"
,
ret
);
listbox_query
(
hLB
,
&
answer
);
listbox_test_query
(
test_1
,
answer
);
SendMessage
(
hLB
,
LB_SETSEL
,
FALSE
,
(
LPARAM
)
-
1
);
listbox_query
(
hLB
,
&
answer
);
listbox_test_query
(
test_nosel
,
answer
);
ret
=
SendMessage
(
hLB
,
LB_SELITEMRANGE
,
TRUE
,
MAKELPARAM
(
4
,
10
));
ok
(
ret
==
LB_OKAY
,
"LB_SELITEMRANGE returned %d instead of LB_OKAY
\n
"
,
ret
);
listbox_query
(
hLB
,
&
answer
);
listbox_test_query
(
test_nosel
,
answer
);
SendMessage
(
hLB
,
LB_SETSEL
,
FALSE
,
(
LPARAM
)
-
1
);
listbox_query
(
hLB
,
&
answer
);
listbox_test_query
(
test_nosel
,
answer
);
ret
=
SendMessage
(
hLB
,
LB_SELITEMRANGE
,
TRUE
,
MAKELPARAM
(
10
,
1
));
ok
(
ret
==
LB_OKAY
,
"LB_SELITEMRANGE returned %d instead of LB_OKAY
\n
"
,
ret
);
listbox_query
(
hLB
,
&
answer
);
listbox_test_query
(
test_2
,
answer
);
SendMessage
(
hLB
,
LB_SETSEL
,
FALSE
,
(
LPARAM
)
-
1
);
listbox_query
(
hLB
,
&
answer
);
listbox_test_query
(
test_nosel
,
answer
);
ret
=
SendMessage
(
hLB
,
LB_SELITEMRANGE
,
TRUE
,
MAKELPARAM
(
1
,
-
1
));
ok
(
ret
==
LB_OKAY
,
"LB_SELITEMRANGE returned %d instead of LB_OKAY
\n
"
,
ret
);
listbox_query
(
hLB
,
&
answer
);
listbox_test_query
(
test_2
,
answer
);
DestroyWindow
(
hLB
);
}
START_TEST
(
listbox
)
{
const
struct
listbox_test
SS
=
...
...
@@ -376,4 +462,5 @@ START_TEST(listbox)
check_item_height
();
test_ownerdraw
();
test_selection
();
}
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