···15631563 if(hbmDst)
15641564 DeleteObject(hbmDst);
1565156515661566- if(hdcDst)
15671567- DeleteDC(hdcDst);
15661566+ DeleteDC(hdcDst);
1568156715691568 if(hbmMask)
15701569 DeleteObject(hbmMask);
···21812180 rgb[2].rgbBlue = 0xff;
21822181 check_color_table("remove all, add 8", hdc, himl, ilc, rgb, default_table);
2183218221842184- /* remove all, add 4. Color table remains the same since it's inplicitly
21832183+ /* remove all, add 4. Color table remains the same since it's implicitly
21852184 been set by the previous _Add */
21862185 ret = pImageList_Remove(himl, -1);
21872186 ok(ret, "got %d\n", ret);
+202-3
modules/rostests/winetests/comctl32/listbox.c
···784784 DestroyWindow( hList );
785785}
786786787787+static void test_changing_selection_styles(void)
788788+{
789789+ static const DWORD styles[] =
790790+ {
791791+ 0,
792792+ LBS_NODATA | LBS_OWNERDRAWFIXED
793793+ };
794794+ static const DWORD selstyles[] =
795795+ {
796796+ 0,
797797+ LBS_MULTIPLESEL,
798798+ LBS_EXTENDEDSEL,
799799+ LBS_MULTIPLESEL | LBS_EXTENDEDSEL
800800+ };
801801+ static const LONG selexpect_single[] = { 0, 0, 1 };
802802+ static const LONG selexpect_single2[] = { 1, 0, 0 };
803803+ static const LONG selexpect_multi[] = { 1, 0, 1 };
804804+ static const LONG selexpect_multi2[] = { 1, 1, 0 };
805805+806806+ HWND parent, listbox;
807807+ DWORD style;
808808+ LONG ret;
809809+ UINT i, j, k;
810810+811811+ parent = create_parent();
812812+ ok(parent != NULL, "Failed to create parent window.\n");
813813+ for (i = 0; i < ARRAY_SIZE(styles); i++)
814814+ {
815815+ /* Test if changing selection styles affects selection storage */
816816+ for (j = 0; j < ARRAY_SIZE(selstyles); j++)
817817+ {
818818+ LONG setcursel_expect, selitemrange_expect, getselcount_expect;
819819+ const LONG *selexpect;
820820+821821+ listbox = CreateWindowA(WC_LISTBOXA, "TestList", styles[i] | selstyles[j] | WS_CHILD | WS_VISIBLE,
822822+ 0, 0, 100, 100, parent, (HMENU)ID_LISTBOX, NULL, 0);
823823+ ok(listbox != NULL, "%u: Failed to create ListBox window.\n", j);
824824+825825+ if (selstyles[j] & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL))
826826+ {
827827+ setcursel_expect = LB_ERR;
828828+ selitemrange_expect = LB_OKAY;
829829+ getselcount_expect = 2;
830830+ selexpect = selexpect_multi;
831831+ }
832832+ else
833833+ {
834834+ setcursel_expect = 2;
835835+ selitemrange_expect = LB_ERR;
836836+ getselcount_expect = LB_ERR;
837837+ selexpect = selexpect_single;
838838+ }
839839+840840+ for (k = 0; k < ARRAY_SIZE(selexpect_multi); k++)
841841+ {
842842+ ret = SendMessageA(listbox, LB_INSERTSTRING, -1, (LPARAM)"x");
843843+ ok(ret == k, "%u: Unexpected return value %d, expected %d.\n", j, ret, k);
844844+ }
845845+ ret = SendMessageA(listbox, LB_GETCOUNT, 0, 0);
846846+ ok(ret == ARRAY_SIZE(selexpect_multi), "%u: Unexpected count %d.\n", j, ret);
847847+848848+ /* Select items with different methods */
849849+ ret = SendMessageA(listbox, LB_SETCURSEL, 2, 0);
850850+ ok(ret == setcursel_expect, "%u: Unexpected return value %d.\n", j, ret);
851851+ ret = SendMessageA(listbox, LB_SELITEMRANGE, TRUE, MAKELPARAM(0, 0));
852852+ ok(ret == selitemrange_expect, "%u: Unexpected return value %d.\n", j, ret);
853853+ ret = SendMessageA(listbox, LB_SELITEMRANGE, TRUE, MAKELPARAM(2, 2));
854854+ ok(ret == selitemrange_expect, "%u: Unexpected return value %d.\n", j, ret);
855855+856856+ /* Verify that the proper items are selected */
857857+ for (k = 0; k < ARRAY_SIZE(selexpect_multi); k++)
858858+ {
859859+ ret = SendMessageA(listbox, LB_GETSEL, k, 0);
860860+ ok(ret == selexpect[k], "%u: Unexpected selection state %d, expected %d.\n",
861861+ j, ret, selexpect[k]);
862862+ }
863863+864864+ /* Now change the selection style */
865865+ style = GetWindowLongA(listbox, GWL_STYLE);
866866+ ok((style & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == selstyles[j],
867867+ "%u: unexpected window styles %#x.\n", j, style);
868868+ if (selstyles[j] & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL))
869869+ style &= ~selstyles[j];
870870+ else
871871+ style |= LBS_MULTIPLESEL | LBS_EXTENDEDSEL;
872872+ SetWindowLongA(listbox, GWL_STYLE, style);
873873+ style = GetWindowLongA(listbox, GWL_STYLE);
874874+ ok(!(style & selstyles[j]), "%u: unexpected window styles %#x.\n", j, style);
875875+876876+ /* Verify that the same items are selected */
877877+ ret = SendMessageA(listbox, LB_GETSELCOUNT, 0, 0);
878878+ ok(ret == getselcount_expect, "%u: expected %d from LB_GETSELCOUNT, got %d\n",
879879+ j, getselcount_expect, ret);
880880+881881+ for (k = 0; k < ARRAY_SIZE(selexpect_multi); k++)
882882+ {
883883+ ret = SendMessageA(listbox, LB_GETSEL, k, 0);
884884+ ok(ret == selexpect[k], "%u: Unexpected selection state %d, expected %d.\n",
885885+ j, ret, selexpect[k]);
886886+ }
887887+888888+ /* Lastly see if we can still change the selection as before with old style */
889889+ if (setcursel_expect != LB_ERR) setcursel_expect = 0;
890890+ ret = SendMessageA(listbox, LB_SETCURSEL, 0, 0);
891891+ ok(ret == setcursel_expect, "%u: Unexpected return value %d.\n", j, ret);
892892+ ret = SendMessageA(listbox, LB_SELITEMRANGE, TRUE, MAKELPARAM(1, 1));
893893+ ok(ret == selitemrange_expect, "%u: Unexpected return value %d.\n", j, ret);
894894+ ret = SendMessageA(listbox, LB_SELITEMRANGE, FALSE, MAKELPARAM(2, 2));
895895+ ok(ret == selitemrange_expect, "%u: Unexpected return value %d.\n", j, ret);
896896+897897+ /* And verify the selections */
898898+ selexpect = (selstyles[j] & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) ? selexpect_multi2 : selexpect_single2;
899899+ ret = SendMessageA(listbox, LB_GETSELCOUNT, 0, 0);
900900+ ok(ret == getselcount_expect, "%u: expected %d from LB_GETSELCOUNT, got %d\n",
901901+ j, getselcount_expect, ret);
902902+903903+ for (k = 0; k < ARRAY_SIZE(selexpect_multi); k++)
904904+ {
905905+ ret = SendMessageA(listbox, LB_GETSEL, k, 0);
906906+ ok(ret == selexpect[k], "%u: Unexpected selection state %d, expected %d.\n",
907907+ j, ret, selexpect[k]);
908908+ }
909909+910910+ DestroyWindow(listbox);
911911+ }
912912+ }
913913+ DestroyWindow(parent);
914914+}
915915+787916static void test_itemfrompoint(void)
788917{
789918 /* WS_POPUP is required in order to have a more accurate size calculation (
···18121941 strcpy(pathBuffer, "C:\\");
18131942 res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, 0, DDL_DIRECTORY | DDL_EXCLUSIVE);
18141943 ok(res, "DlgDirList failed to list C:\\ folders\n");
18151815- todo_wine ok(!strcmp(pathBuffer, "*"), "DlgDirList set the invalid path spec '%s', expected '*'\n", pathBuffer);
19441944+ ok(!strcmp(pathBuffer, "*"), "DlgDirList set the invalid path spec '%s', expected '*'\n", pathBuffer);
1816194518171946 strcpy(pathBuffer, "C:\\*");
18181947 res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, 0, DDL_DIRECTORY | DDL_EXCLUSIVE);
···18231952 SetLastError(0xdeadbeef);
18241953 strcpy(pathBuffer, "C:\\INVALID$$DIR");
18251954 res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, 0, DDL_DIRECTORY | DDL_EXCLUSIVE);
18261826- todo_wine ok(!res, "DlgDirList should have failed with 0 but %d was returned\n", res);
18271827- todo_wine ok(GetLastError() == ERROR_NO_WILDCARD_CHARACTERS,
19551955+ ok(!res, "DlgDirList should have failed with 0 but %d was returned\n", res);
19561956+ ok(GetLastError() == ERROR_NO_WILDCARD_CHARACTERS,
18281957 "GetLastError should return 0x589, got 0x%X\n",GetLastError());
1829195818301959 DestroyWindow(hWnd);
···18671996 GetUpdateRect( listbox, &r, TRUE );
18681997 ok( !IsRectEmpty( &r ), "got empty rect\n");
1869199819991999+ ret = SendMessageA( listbox, LB_SETCOUNT, -5, 0 );
20002000+ ok( ret == 0, "got %d\n", ret );
20012001+ ret = SendMessageA( listbox, LB_GETCOUNT, 0, 0 );
20022002+ ok( ret == -5, "got %d\n", ret );
20032003+18702004 DestroyWindow( listbox );
1871200518722006 for (i = 0; i < ARRAY_SIZE(styles); ++i)
···19032037 ok_sequence(sequences, LB_SEQ_INDEX, getlistboxinfo_seq, "GetListBoxInfo()", FALSE);
1904203819052039 DestroyWindow(listbox);
20402040+ DestroyWindow(parent);
20412041+}
20422042+20432043+static void test_init_storage( void )
20442044+{
20452045+ static const DWORD styles[] =
20462046+ {
20472047+ LBS_HASSTRINGS,
20482048+ LBS_NODATA | LBS_OWNERDRAWFIXED,
20492049+ };
20502050+ HWND parent, listbox;
20512051+ LONG ret, items_size;
20522052+ int i, j;
20532053+20542054+ parent = create_parent();
20552055+ for (i = 0; i < ARRAY_SIZE(styles); i++)
20562056+ {
20572057+ listbox = CreateWindowA(WC_LISTBOXA, "TestList", styles[i] | WS_CHILD,
20582058+ 0, 0, 100, 100, parent, (HMENU)ID_LISTBOX, NULL, 0);
20592059+20602060+ items_size = SendMessageA(listbox, LB_INITSTORAGE, 100, 0);
20612061+ ok(items_size >= 100, "expected at least 100, got %d\n", items_size);
20622062+20632063+ ret = SendMessageA(listbox, LB_INITSTORAGE, 0, 0);
20642064+ ok(ret == items_size, "expected %d, got %d\n", items_size, ret);
20652065+20662066+ /* it doesn't grow since the space was already reserved */
20672067+ ret = SendMessageA(listbox, LB_INITSTORAGE, items_size, 0);
20682068+ ok(ret == items_size, "expected %d, got %d\n", items_size, ret);
20692069+20702070+ /* it doesn't shrink the reserved space */
20712071+ ret = SendMessageA(listbox, LB_INITSTORAGE, 42, 0);
20722072+ ok(ret == items_size, "expected %d, got %d\n", items_size, ret);
20732073+20742074+ /* now populate almost all of it so it's not reserved anymore */
20752075+ if (styles[i] & LBS_NODATA)
20762076+ {
20772077+ ret = SendMessageA(listbox, LB_SETCOUNT, items_size - 1, 0);
20782078+ ok(ret == 0, "unexpected return value %d\n", ret);
20792079+ }
20802080+ else
20812081+ {
20822082+ for (j = 0; j < items_size - 1; j++)
20832083+ {
20842084+ ret = SendMessageA(listbox, LB_INSERTSTRING, -1, (LPARAM)"");
20852085+ ok(ret == j, "expected %d, got %d\n", j, ret);
20862086+ }
20872087+ }
20882088+20892089+ /* we still have one more reserved slot, so it doesn't grow yet */
20902090+ ret = SendMessageA(listbox, LB_INITSTORAGE, 1, 0);
20912091+ ok(ret == items_size, "expected %d, got %d\n", items_size, ret);
20922092+20932093+ /* fill the slot and check again, it should grow this time */
20942094+ ret = SendMessageA(listbox, LB_INSERTSTRING, -1, (LPARAM)"");
20952095+ ok(ret == items_size - 1, "expected %d, got %d\n", items_size - 1, ret);
20962096+ ret = SendMessageA(listbox, LB_INITSTORAGE, 0, 0);
20972097+ ok(ret == items_size, "expected %d, got %d\n", items_size, ret);
20982098+ ret = SendMessageA(listbox, LB_INITSTORAGE, 1, 0);
20992099+ ok(ret > items_size, "expected it to grow past %d, got %d\n", items_size, ret);
21002100+21012101+ DestroyWindow(listbox);
21022102+ }
19062103 DestroyWindow(parent);
19072104}
19082105···24202617 test_LB_SELITEMRANGE();
24212618 test_LB_SETCURSEL();
24222619 test_listbox_height();
26202620+ test_changing_selection_styles();
24232621 test_itemfrompoint();
24242622 test_listbox_item_data();
24252623 test_listbox_LB_DIR();
24262624 test_listbox_dlgdir();
24272625 test_set_count();
26262626+ test_init_storage();
24282627 test_GetListBoxInfo();
24292628 test_missing_lbuttonup();
24302629 test_extents();
···13641364 visibleItem = (HTREEITEM)SendMessageA(pHdr->hwndFrom, TVM_GETNEXTITEM,
13651365 TVGN_NEXTVISIBLE, (LPARAM)visibleItem);
13661366 *(HTREEITEM*)&rect = visibleItem;
13671367- ok(visibleItem != NULL, "There must be a visible item after the first visisble item.\n");
13671367+ ok(visibleItem != NULL, "There must be a visible item after the first one.\n");
13681368 ok(SendMessageA(pHdr->hwndFrom, TVM_GETITEMRECT, TRUE, (LPARAM)&rect),
13691369 "Failed to get rect for second visible item.\n");
13701370 }
+75-1
modules/rostests/winetests/comctl32/updown.c
···2828 * - check UDM_SETBUDDY message
2929 * - check UDM_GETBUDDY message
3030 * - up-down control and buddy control must have the same parent
3131- * - up-down control notifies its parent window when its position changes with UDN_DELTAPOS + WM_VSCROLL or WM_HSCROLL
3231 * - check UDS_ALIGN[LEFT,RIGHT]...check that width of buddy window is decreased
3332 * - check that UDS_SETBUDDYINT sets the caption of the buddy window when it is changed
3433 * - check that the thousands operator is set for large numbers
···165164 { 0 }
166165};
167166167167+static const struct message test_updown_pos_notifications_seq[] = {
168168+ { WM_CTLCOLOREDIT, sent|optional },
169169+ { WM_COMMAND, sent|wparam, MAKELONG(0, EN_SETFOCUS) },
170170+ { WM_NOTIFY, sent|id, 0, 0, UDN_DELTAPOS },
171171+ { WM_COMMAND, sent|wparam, MAKELONG(0, EN_UPDATE) },
172172+ { WM_COMMAND, sent|wparam, MAKELONG(0, EN_CHANGE) },
173173+ { WM_VSCROLL, sent|wparam, MAKELONG(SB_THUMBPOSITION, 51) },
174174+ { WM_CTLCOLOREDIT, sent|optional },
175175+ { WM_VSCROLL, sent|wparam, MAKELONG(SB_ENDSCROLL, 51) },
176176+ /* no WM_NOTIFY(NM_RELEASEDCAPTURE) message */
177177+ { 0 }
178178+};
179179+180180+static const struct message test_updown_pos_notifications_horz_seq[] = {
181181+ { WM_CTLCOLOREDIT, sent|optional },
182182+ { WM_COMMAND, sent|wparam, MAKELONG(0, EN_SETFOCUS) },
183183+ { WM_NOTIFY, sent|id, 0, 0, UDN_DELTAPOS },
184184+ { WM_COMMAND, sent|wparam, MAKELONG(0, EN_UPDATE) },
185185+ { WM_COMMAND, sent|wparam, MAKELONG(0, EN_CHANGE) },
186186+ { WM_HSCROLL, sent|wparam, MAKELONG(SB_THUMBPOSITION, 51) },
187187+ { WM_CTLCOLOREDIT, sent|optional },
188188+ { WM_HSCROLL, sent|wparam, MAKELONG(SB_ENDSCROLL, 51) },
189189+ /* no WM_NOTIFY(NM_RELEASEDCAPTURE) message */
190190+ { 0 }
191191+};
192192+168193static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
169194{
170195 static LONG defwndproc_counter = 0;
···186211 if (defwndproc_counter) msg.flags |= defwinproc;
187212 msg.wParam = wParam;
188213 msg.lParam = lParam;
214214+ if (message == WM_NOTIFY && lParam)
215215+ msg.id = ((NMHDR*)lParam)->code;
189216 add_message(sequences, PARENT_SEQ_INDEX, &msg);
190217 }
191218···900927 DestroyWindow(updown);
901928}
902929930930+static void test_updown_pos_notifications(void)
931931+{
932932+ HWND updown;
933933+ RECT rect;
934934+ UINT x, y;
935935+ int result;
936936+937937+ /* test updown control notifications without UDS_HORZ style */
938938+ updown = create_updown_control(UDS_ALIGNRIGHT | UDS_SETBUDDYINT, g_edit);
939939+ SetFocus(updown);
940940+ flush_sequences(sequences, NUM_MSG_SEQUENCES);
941941+942942+ /* click on the up-arrow button */
943943+ GetClientRect(updown, &rect);
944944+ x = rect.left + (rect.right - rect.left) / 2;
945945+ y = rect.top + (rect.bottom - rect.top) / 4;
946946+ result = SendMessageA(updown, WM_LBUTTONDOWN, 0, MAKELPARAM(x, y));
947947+ expect(result, 0);
948948+ result = SendMessageA(updown, WM_LBUTTONUP, 0, MAKELPARAM(x, y));
949949+ expect(result, 0);
950950+951951+ ok_sequence(sequences, PARENT_SEQ_INDEX, test_updown_pos_notifications_seq,
952952+ "test updown to parent notify (vertical)", FALSE);
953953+954954+ DestroyWindow(updown);
955955+956956+ /* test updown control notifications with UDS_HORZ style */
957957+ updown = create_updown_control(UDS_ALIGNRIGHT | UDS_SETBUDDYINT | UDS_HORZ, g_edit);
958958+ SetFocus(updown);
959959+ flush_sequences(sequences, NUM_MSG_SEQUENCES);
960960+961961+ /* click on the right-arrow button */
962962+ GetClientRect(updown, &rect);
963963+ x = rect.left + (rect.right - rect.left) * 3 / 4;
964964+ y = rect.top + (rect.bottom - rect.top) / 2;
965965+ result = SendMessageA(updown, WM_LBUTTONDOWN, 0, MAKELPARAM(x, y));
966966+ expect(result, 0);
967967+ result = SendMessageA(updown, WM_LBUTTONUP, 0, MAKELPARAM(x, y));
968968+ expect(result, 0);
969969+970970+ ok_sequence(sequences, PARENT_SEQ_INDEX, test_updown_pos_notifications_horz_seq,
971971+ "test updown to parent notify (horizontal)", FALSE);
972972+973973+ DestroyWindow(updown);
974974+}
975975+903976static void init_functions(void)
904977{
905978 HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
···9311004 test_updown_unicode();
9321005 test_UDS_SETBUDDYINT();
9331006 test_CreateUpDownControl();
10071007+ test_updown_pos_notifications();
93410089351009 DestroyWindow(g_edit);
9361010 DestroyWindow(parent_wnd);