Commit c05e6d8f authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/listview: Fix test crashes on comctl32 <5.80.

parent e3b94200
...@@ -48,6 +48,8 @@ BOOL blockEdit; ...@@ -48,6 +48,8 @@ BOOL blockEdit;
/* format reported to control: /* format reported to control:
-1 falls to defproc, anything else returned */ -1 falls to defproc, anything else returned */
INT notifyFormat; INT notifyFormat;
/* indicates we're running < 5.80 version */
BOOL g_is_below_5;
static HWND subclass_editbox(HWND hwndListview); static HWND subclass_editbox(HWND hwndListview);
...@@ -2244,6 +2246,12 @@ static void test_ownerdata(void) ...@@ -2244,6 +2246,12 @@ static void test_ownerdata(void)
LVITEMA item; LVITEMA item;
/* it isn't possible to set LVS_OWNERDATA after creation */ /* it isn't possible to set LVS_OWNERDATA after creation */
if (g_is_below_5)
{
win_skip("set LVS_OWNERDATA after creation leads to crash on < 5.80\n");
}
else
{
hwnd = create_listview_control(0); hwnd = create_listview_control(0);
ok(hwnd != NULL, "failed to create a listview window\n"); ok(hwnd != NULL, "failed to create a listview window\n");
style = GetWindowLongPtrA(hwnd, GWL_STYLE); style = GetWindowLongPtrA(hwnd, GWL_STYLE);
...@@ -2259,6 +2267,7 @@ static void test_ownerdata(void) ...@@ -2259,6 +2267,7 @@ static void test_ownerdata(void)
style = GetWindowLongPtrA(hwnd, GWL_STYLE); style = GetWindowLongPtrA(hwnd, GWL_STYLE);
ok(!(style & LVS_OWNERDATA), "LVS_OWNERDATA isn't expected\n"); ok(!(style & LVS_OWNERDATA), "LVS_OWNERDATA isn't expected\n");
DestroyWindow(hwnd); DestroyWindow(hwnd);
}
/* try to set LVS_OWNERDATA after creation just having it */ /* try to set LVS_OWNERDATA after creation just having it */
hwnd = create_listview_control(LVS_OWNERDATA); hwnd = create_listview_control(LVS_OWNERDATA);
...@@ -2275,6 +2284,12 @@ static void test_ownerdata(void) ...@@ -2275,6 +2284,12 @@ static void test_ownerdata(void)
DestroyWindow(hwnd); DestroyWindow(hwnd);
/* try to remove LVS_OWNERDATA after creation just having it */ /* try to remove LVS_OWNERDATA after creation just having it */
if (g_is_below_5)
{
win_skip("remove LVS_OWNERDATA after creation leads to crash on < 5.80\n");
}
else
{
hwnd = create_listview_control(LVS_OWNERDATA); hwnd = create_listview_control(LVS_OWNERDATA);
ok(hwnd != NULL, "failed to create a listview window\n"); ok(hwnd != NULL, "failed to create a listview window\n");
style = GetWindowLongPtrA(hwnd, GWL_STYLE); style = GetWindowLongPtrA(hwnd, GWL_STYLE);
...@@ -2289,6 +2304,7 @@ static void test_ownerdata(void) ...@@ -2289,6 +2304,7 @@ static void test_ownerdata(void)
style = GetWindowLongPtrA(hwnd, GWL_STYLE); style = GetWindowLongPtrA(hwnd, GWL_STYLE);
ok(style & LVS_OWNERDATA, "LVS_OWNERDATA is expected\n"); ok(style & LVS_OWNERDATA, "LVS_OWNERDATA is expected\n");
DestroyWindow(hwnd); DestroyWindow(hwnd);
}
/* try select an item */ /* try select an item */
hwnd = create_listview_control(LVS_OWNERDATA); hwnd = create_listview_control(LVS_OWNERDATA);
...@@ -3337,6 +3353,27 @@ static void test_indentation(void) ...@@ -3337,6 +3353,27 @@ static void test_indentation(void)
DestroyWindow(hwnd); DestroyWindow(hwnd);
} }
INT CALLBACK DummyCompareEx(LPARAM first, LPARAM second, LPARAM param)
{
return 0;
}
static BOOL is_below_comctl_5(void)
{
HWND hwnd;
BOOL ret;
hwnd = create_listview_control(0);
ok(hwnd != NULL, "failed to create a listview window\n");
insert_item(hwnd, 0);
ret = SendMessage(hwnd, LVM_SORTITEMSEX, 0, (LPARAM)&DummyCompareEx);
DestroyWindow(hwnd);
return !ret;
}
START_TEST(listview) START_TEST(listview)
{ {
HMODULE hComctl32; HMODULE hComctl32;
...@@ -3361,6 +3398,8 @@ START_TEST(listview) ...@@ -3361,6 +3398,8 @@ START_TEST(listview)
ok_sequence(sequences, PARENT_SEQ_INDEX, create_parent_wnd_seq, "create parent window", TRUE); ok_sequence(sequences, PARENT_SEQ_INDEX, create_parent_wnd_seq, "create parent window", TRUE);
flush_sequences(sequences, NUM_MSG_SEQUENCES); flush_sequences(sequences, NUM_MSG_SEQUENCES);
g_is_below_5 = is_below_comctl_5();
test_images(); test_images();
test_checkboxes(); test_checkboxes();
test_items(); test_items();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment