listbox: add test and make it pass

Lauri Tulmin lauri_ at ut.ee
Tue Feb 1 15:41:57 CST 2005


add test for LB_SELITEMRANGE and make it pass in wine
-------------- next part --------------
Index: dlls/user/tests/listbox.c
===================================================================
RCS file: /home/wine/wine/dlls/user/tests/listbox.c,v
retrieving revision 1.5
diff -u -p -r1.5 listbox.c
--- dlls/user/tests/listbox.c	10 Jan 2005 16:22:33 -0000	1.5
+++ dlls/user/tests/listbox.c	1 Feb 2005 20:47:22 -0000
@@ -64,6 +64,7 @@ struct listbox_test {
   struct listbox_stat  init,  init_todo;
   struct listbox_stat click, click_todo;
   struct listbox_stat  step,  step_todo;
+  struct listbox_stat   sel,   sel_todo;
 };
 
 void
@@ -133,6 +134,13 @@ check (const struct listbox_test test)
   listbox_query (hLB, &answer);
   listbox_ok (test, step, answer);
 
+  DestroyWindow (hLB);
+  hLB=create_listbox (test.prop.add_style);
+
+  SendMessage (hLB, LB_SELITEMRANGE, TRUE, MAKELPARAM(1, 2));
+  listbox_query (hLB, &answer);
+  listbox_ok (test, sel, answer);
+  
   WAIT;
   DestroyWindow (hLB);
 }
@@ -155,6 +163,8 @@ void check_item_height()
 
     itemHeight = SendMessageW(hLB, LB_GETITEMHEIGHT, 0, 0);
     ok (itemHeight == tm.tmHeight, "Item height wrong, got %d, expecting %ld\n", itemHeight, tm.tmHeight);
+
+    DestroyWindow (hLB);
 }
 
 START_TEST(listbox)
@@ -164,43 +174,51 @@ START_TEST(listbox)
     {{0},
      {LB_ERR, LB_ERR,      0, LB_ERR}, {0,0,0,0},
      {     1,      1,      1, LB_ERR}, {0,0,0,0},
-     {     2,      2,      2, LB_ERR}, {0,0,0,0}};
+     {     2,      2,      2, LB_ERR}, {0,0,0,0},
+     {LB_ERR, LB_ERR,      0, LB_ERR}, {0,0,0,0}};
 /* {selected, anchor,  caret, selcount}{TODO fields} */
   const struct listbox_test SS_NS =
     {{LBS_NOSEL},
      {LB_ERR, LB_ERR,      0, LB_ERR}, {0,0,0,0},
      {     1,      1,      1, LB_ERR}, {0,0,0,0},
-     {     2,      2,      2, LB_ERR}, {0,0,0,0}};
+     {     2,      2,      2, LB_ERR}, {0,0,0,0},
+     {LB_ERR, LB_ERR,      0, LB_ERR}, {0,0,0,0}};
   const struct listbox_test MS =
     {{LBS_MULTIPLESEL},
      {     0, LB_ERR,      0,      0}, {0,0,0,0},
      {     1,      1,      1,      1}, {0,0,0,0},
-     {     2,      1,      2,      1}, {0,0,0,0}};
+     {     2,      1,      2,      1}, {0,0,0,0},
+     {     0, LB_ERR,      0,      2}, {0,0,0,0}};
   const struct listbox_test MS_NS =
     {{LBS_MULTIPLESEL | LBS_NOSEL},
      {LB_ERR, LB_ERR,      0, LB_ERR}, {0,0,0,0},
      {     1,      1,      1, LB_ERR}, {0,0,0,0},
-     {     2,      2,      2, LB_ERR}, {0,0,0,0}};
+     {     2,      2,      2, LB_ERR}, {0,0,0,0},
+     {LB_ERR, LB_ERR,      0, LB_ERR}, {0,0,0,0}};
   const struct listbox_test ES =
     {{LBS_EXTENDEDSEL},
      {     0, LB_ERR,      0,      0}, {0,0,0,0},
      {     1,      1,      1,      1}, {0,0,0,0},
-     {     2,      2,      2,      1}, {0,0,0,0}};
+     {     2,      2,      2,      1}, {0,0,0,0},
+     {     0, LB_ERR,      0,      2}, {0,0,0,0}};
   const struct listbox_test ES_NS =
     {{LBS_EXTENDEDSEL | LBS_NOSEL},
      {LB_ERR, LB_ERR,      0, LB_ERR}, {0,0,0,0},
      {     1,      1,      1, LB_ERR}, {0,0,0,0},
-     {     2,      2,      2, LB_ERR}, {0,0,0,0}};
+     {     2,      2,      2, LB_ERR}, {0,0,0,0},
+     {LB_ERR, LB_ERR,      0, LB_ERR}, {0,0,0,0}};
   const struct listbox_test EMS =
     {{LBS_EXTENDEDSEL | LBS_MULTIPLESEL},
      {     0, LB_ERR,      0,      0}, {0,0,0,0},
      {     1,      1,      1,      1}, {0,0,0,0},
-     {     2,      2,      2,      1}, {0,0,0,0}};
+     {     2,      2,      2,      1}, {0,0,0,0},
+     {     0, LB_ERR,      0,      2}, {0,0,0,0}};
   const struct listbox_test EMS_NS =
     {{LBS_EXTENDEDSEL | LBS_MULTIPLESEL | LBS_NOSEL},
      {LB_ERR, LB_ERR,      0, LB_ERR}, {0,0,0,0},
      {     1,      1,      1, LB_ERR}, {0,0,0,0},
-     {     2,      2,      2, LB_ERR}, {0,0,0,0}};
+     {     2,      2,      2, LB_ERR}, {0,0,0,0},
+     {LB_ERR, LB_ERR,      0, LB_ERR}, {0,0,0,0}};
 
   trace (" Testing single selection...\n");
   check (SS);
Index: dlls/user/listbox.c
===================================================================
RCS file: /home/wine/wine/dlls/user/listbox.c,v
retrieving revision 1.9
diff -u -p -r1.9 listbox.c
--- dlls/user/listbox.c	10 Jan 2005 16:22:33 -0000	1.9
+++ dlls/user/listbox.c	1 Feb 2005 20:47:26 -0000
@@ -1365,8 +1365,6 @@ static LRESULT LISTBOX_SelectItemRange( 
     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;
-    /* selected_item reflects last selected/unselected item on multiple sel */
-    descr->selected_item = last;
 
     if (on)  /* Turn selection on */
     {
@@ -1376,7 +1374,6 @@ static LRESULT LISTBOX_SelectItemRange( 
             descr->items[i].selected = TRUE;
             LISTBOX_InvalidateItemRect(descr, i);
         }
-        LISTBOX_SetCaretIndex( descr, last, TRUE );
     }
     else  /* Turn selection off */
     {


More information about the wine-patches mailing list