user32-Sorted_Listbox: Update patchset.

This commit is contained in:
Sebastian Lackner 2017-08-17 22:13:10 +02:00
parent be0aab1653
commit 41cf5ea976
5 changed files with 156 additions and 21 deletions

View File

@ -8792,12 +8792,14 @@ fi
# |
if test "$enable_user32_Sorted_Listbox" -eq 1; then
patch_apply user32-Sorted_Listbox/0001-user32-tests-Add-a-message-test-for-an-owner-drawn-s.patch
patch_apply user32-Sorted_Listbox/0002-user32-Fix-order-of-items-passed-in-WM_COMPAREITEM-d.patch
patch_apply user32-Sorted_Listbox/0003-user32-Fix-the-listbox-sorting-algorithm.patch
patch_apply user32-Sorted_Listbox/0004-user32-For-an-owner-drawn-listbox-without-strings-WM.patch
patch_apply user32-Sorted_Listbox/0002-user32-tests-Add-some-message-tests-for-not-an-owner.patch
patch_apply user32-Sorted_Listbox/0003-user32-Fix-order-of-items-passed-in-WM_COMPAREITEM-d.patch
patch_apply user32-Sorted_Listbox/0004-user32-Fix-the-listbox-sorting-algorithm.patch
patch_apply user32-Sorted_Listbox/0005-user32-For-an-owner-drawn-listbox-without-strings-WM.patch
(
printf '%s\n' '+ { "Dmitry Timoshkov", "user32/tests: Add a message test for an owner-drawn sorted listbox.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "user32: Fix order of items passed in WM_COMPAREITEM data.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "user32/tests: Add some message tests for not an owner-drawn listbox.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "user32: Fix order of items passed in WM_COMPAREITEM data.", 2 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "user32: Fix the listbox sorting algorithm.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "user32: For an owner-drawn listbox without strings WM_MEASUREITEM still needs correct itemData.", 1 },';
) >> "$patchlist"

View File

@ -0,0 +1,124 @@
From e61138a34cb8fb869ceb1c6427dbe3cfb708ec03 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Wed, 16 Aug 2017 12:58:24 +0800
Subject: user32/tests: Add some message tests for not an owner-drawn listbox.
---
dlls/user32/tests/msg.c | 69 +++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 64 insertions(+), 5 deletions(-)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 383f8e22299..5054599611d 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -14484,6 +14484,13 @@ static const struct message wm_lb_deletestring_reset[] =
};
static const struct message wm_lb_addstring[] =
{
+ { LB_ADDSTRING, sent|wparam|lparam, 0, 0xf30604ef },
+ { LB_ADDSTRING, sent|wparam|lparam, 0, 0xf30604ed },
+ { LB_ADDSTRING, sent|wparam|lparam, 0, 0xf30604ee },
+ { 0 }
+};
+static const struct message wm_lb_addstring_ownerdraw[] =
+{
{ LB_ADDSTRING, sent|wparam|lparam, 0, 0xf30604ed },
{ WM_MEASUREITEM, sent|wparam|lparam|parent, 0xf0f2, 0xf30604ed },
{ LB_ADDSTRING, sent|wparam|lparam, 0, 0xf30604ee },
@@ -14492,7 +14499,7 @@ static const struct message wm_lb_addstring[] =
{ WM_MEASUREITEM, sent|wparam|lparam|parent, 0xf2f2, 0xf30604ef },
{ 0 }
};
-static const struct message wm_lb_addstring_sort[] =
+static const struct message wm_lb_addstring_sort_ownerdraw[] =
{
{ LB_ADDSTRING, sent|wparam|lparam, 0, 0xf30604ed },
{ WM_MEASUREITEM, sent|wparam|lparam|parent, 0xf0f2, 0xf30604ed },
@@ -14580,6 +14587,8 @@ static void test_listbox_messages(void)
flush_sequence();
+ log_all_parent_messages++;
+
ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 0");
ok(ret == 0, "expected 0, got %ld\n", ret);
ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 1");
@@ -14587,13 +14596,11 @@ static void test_listbox_messages(void)
ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 2");
ok(ret == 2, "expected 2, got %ld\n", ret);
- ok_sequence(wm_lb_addstring, "LB_ADDSTRING", FALSE);
+ ok_sequence(wm_lb_addstring_ownerdraw, "LB_ADDSTRING", FALSE);
check_lb_state(listbox, 3, LB_ERR, 0, 0);
flush_sequence();
- log_all_parent_messages++;
-
trace("selecting item 0\n");
ret = SendMessageA(listbox, LB_SETCURSEL, 0, 0);
ok(ret == 0, "expected 0, got %ld\n", ret);
@@ -14674,7 +14681,59 @@ todo_wine
todo_wine
ok(ret == 2, "expected 2, got %ld\n", ret);
- ok_sequence(wm_lb_addstring_sort, "LB_ADDSTRING", TRUE);
+ ok_sequence(wm_lb_addstring_sort_ownerdraw, "LB_ADDSTRING", TRUE);
+ check_lb_state(listbox, 3, LB_ERR, 0, 0);
+
+ log_all_parent_messages--;
+
+ DestroyWindow(listbox);
+
+ /* with LBS_HASSTRINGS */
+ listbox = CreateWindowExA(WS_EX_NOPARENTNOTIFY, "ListBox", NULL,
+ WS_CHILD | LBS_NOTIFY | LBS_HASSTRINGS | WS_VISIBLE,
+ 10, 10, 80, 80, parent, (HMENU)ID_LISTBOX, 0, NULL);
+ listbox_orig_proc = (WNDPROC)SetWindowLongPtrA(listbox, GWLP_WNDPROC, (ULONG_PTR)listbox_hook_proc);
+
+ check_lb_state(listbox, 0, LB_ERR, 0, 0);
+
+ flush_sequence();
+
+ log_all_parent_messages++;
+
+ ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 2");
+ ok(ret == 0, "expected 0, got %ld\n", ret);
+ ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 0");
+ ok(ret == 1, "expected 1, got %ld\n", ret);
+ ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 1");
+ ok(ret == 2, "expected 2, got %ld\n", ret);
+
+ ok_sequence(wm_lb_addstring, "LB_ADDSTRING", FALSE);
+ check_lb_state(listbox, 3, LB_ERR, 0, 0);
+
+ log_all_parent_messages--;
+
+ DestroyWindow(listbox);
+
+ /* with LBS_HASSTRINGS and LBS_SORT */
+ listbox = CreateWindowExA(WS_EX_NOPARENTNOTIFY, "ListBox", NULL,
+ WS_CHILD | LBS_NOTIFY | LBS_HASSTRINGS | LBS_SORT | WS_VISIBLE,
+ 10, 10, 80, 80, parent, (HMENU)ID_LISTBOX, 0, NULL);
+ listbox_orig_proc = (WNDPROC)SetWindowLongPtrA(listbox, GWLP_WNDPROC, (ULONG_PTR)listbox_hook_proc);
+
+ check_lb_state(listbox, 0, LB_ERR, 0, 0);
+
+ flush_sequence();
+
+ log_all_parent_messages++;
+
+ ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 2");
+ ok(ret == 0, "expected 0, got %ld\n", ret);
+ ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 0");
+ ok(ret == 0, "expected 0, got %ld\n", ret);
+ ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 1");
+ ok(ret == 1, "expected 1, got %ld\n", ret);
+
+ ok_sequence(wm_lb_addstring, "LB_ADDSTRING", FALSE);
check_lb_state(listbox, 3, LB_ERR, 0, 0);
log_all_parent_messages--;
--
2.13.1

View File

@ -1,17 +1,26 @@
From 25f564b7d279386c882c144fd6591d012049dcb7 Mon Sep 17 00:00:00 2001
From 8e2e80724c647b878bfa464fc8a0e6495d714a92 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Wed, 8 Mar 2017 16:48:26 +0800
Subject: user32: Fix order of items passed in WM_COMPAREITEM data.
Subject: user32: Fix order of items passed in WM_COMPAREITEM data. (v2)
---
dlls/user32/listbox.c | 10 +++++-----
dlls/user32/listbox.c | 12 ++++++------
dlls/user32/tests/msg.c | 4 ----
2 files changed, 5 insertions(+), 9 deletions(-)
2 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c
index 689cb106c4..4269ef0717 100644
index 0b3225b09e0..75257a92a67 100644
--- a/dlls/user32/listbox.c
+++ b/dlls/user32/listbox.c
@@ -847,7 +847,7 @@ static INT LISTBOX_FindStringPos( LB_DESCR *descr, LPCWSTR str, BOOL exact )
{
index = (min + max) / 2;
if (HAS_STRINGS(descr))
- res = LISTBOX_lstrcmpiW( descr->locale, str, descr->items[index].str);
+ res = LISTBOX_lstrcmpiW( descr->locale, descr->items[index].str, str );
else
{
COMPAREITEMSTRUCT cis;
@@ -858,15 +858,15 @@ static INT LISTBOX_FindStringPos( LB_DESCR *descr, LPCWSTR str, BOOL exact )
cis.hwndItem = descr->self;
/* note that some application (MetaStock) expects the second item
@ -34,10 +43,10 @@ index 689cb106c4..4269ef0717 100644
}
return exact ? -1 : max;
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 3a492b37bd..f806e5366e 100644
index 7a7ee74c983..88137c45fe2 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -2265,9 +2265,7 @@ static void add_message_(int line, const struct recvd_message *msg)
@@ -2278,9 +2278,7 @@ static void add_message_(int line, const struct recvd_message *msg)
ok(msg->wParam == cis->CtlID, "expected %#x, got %#lx\n", cis->CtlID, msg->wParam);
ok(cis->hwndItem == ctrl, "expected %p, got %p\n", ctrl, cis->hwndItem);
@ -47,7 +56,7 @@ index 3a492b37bd..f806e5366e 100644
ok((int)cis->itemID2 == -1, "expected -1, got %d\n", cis->itemID2);
sprintf( seq->output, "%s: %p WM_COMPAREITEM: CtlType %#x, CtlID %#x, itemID1 %#x, itemData1 %#lx, itemID2 %#x, itemData2 %#lx",
@@ -14649,10 +14647,8 @@ static void test_listbox_messages(void)
@@ -14682,10 +14680,8 @@ static void test_listbox_messages(void)
ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 0");
ok(ret == 0, "expected 0, got %ld\n", ret);
ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 1");
@ -57,7 +66,7 @@ index 3a492b37bd..f806e5366e 100644
-todo_wine
ok(ret == 2, "expected 2, got %ld\n", ret);
ok_sequence(wm_lb_addstring_sort, "LB_ADDSTRING", TRUE);
ok_sequence(wm_lb_addstring_sort_ownerdraw, "LB_ADDSTRING", TRUE);
--
2.11.0
2.13.1

View File

@ -1,4 +1,4 @@
From 3a44891b4f5f206363492fc3ff91e8a97a70857d Mon Sep 17 00:00:00 2001
From 003b3ed2618590e3e7283735aaa159d3d9cbb592 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Wed, 8 Mar 2017 17:52:10 +0800
Subject: user32: For an owner-drawn listbox without strings WM_MEASUREITEM
@ -10,7 +10,7 @@ Subject: user32: For an owner-drawn listbox without strings WM_MEASUREITEM
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c
index 5eb266b15a..4572b81bf3 100644
index 71a01a1d4fe..873e3a20969 100644
--- a/dlls/user32/listbox.c
+++ b/dlls/user32/listbox.c
@@ -1566,7 +1566,7 @@ static LRESULT LISTBOX_InsertItem( LB_DESCR *descr, INT index,
@ -23,18 +23,18 @@ index 5eb266b15a..4572b81bf3 100644
TRACE("owner=%p CtlID=%08x, itemID=%08x, itemData=%08lx\n",
descr->owner, mis.CtlID, mis.itemID, mis.itemData);
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index f806e5366e..34385bd266 100644
index 88137c45fe2..d7007d57115 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -14651,7 +14651,7 @@ static void test_listbox_messages(void)
@@ -14684,7 +14684,7 @@ static void test_listbox_messages(void)
ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 2");
ok(ret == 2, "expected 2, got %ld\n", ret);
- ok_sequence(wm_lb_addstring_sort, "LB_ADDSTRING", TRUE);
+ ok_sequence(wm_lb_addstring_sort, "LB_ADDSTRING", FALSE);
- ok_sequence(wm_lb_addstring_sort_ownerdraw, "LB_ADDSTRING", TRUE);
+ ok_sequence(wm_lb_addstring_sort_ownerdraw, "LB_ADDSTRING", FALSE);
check_lb_state(listbox, 3, LB_ERR, 0, 0);
log_all_parent_messages--;
--
2.11.0
2.13.1