-sync user32_winetest with wine 1.1.32
[reactos.git] / rostests / winetests / user32 / listbox.c
index c872357..942c780 100644 (file)
@@ -50,7 +50,7 @@ static HWND
 create_listbox (DWORD add_style, HWND parent)
 {
   HWND handle;
-  int ctl_id=0;
+  INT_PTR ctl_id=0;
   if (parent)
     ctl_id=1;
   handle=CreateWindow ("LISTBOX", "TestList",
@@ -59,10 +59,10 @@ create_listbox (DWORD add_style, HWND parent)
                             parent, (HMENU)ctl_id, NULL, 0);
 
   assert (handle);
-  SendMessage (handle, LB_ADDSTRING, 0, (LPARAM) (LPCTSTR) strings[0]);
-  SendMessage (handle, LB_ADDSTRING, 0, (LPARAM) (LPCTSTR) strings[1]);
-  SendMessage (handle, LB_ADDSTRING, 0, (LPARAM) (LPCTSTR) strings[2]);
-  SendMessage (handle, LB_ADDSTRING, 0, (LPARAM) (LPCTSTR) strings[3]);
+  SendMessage (handle, LB_ADDSTRING, 0, (LPARAM) strings[0]);
+  SendMessage (handle, LB_ADDSTRING, 0, (LPARAM) strings[1]);
+  SendMessage (handle, LB_ADDSTRING, 0, (LPARAM) strings[2]);
+  SendMessage (handle, LB_ADDSTRING, 0, (LPARAM) strings[3]);
 
 #ifdef VISIBLE
   ShowWindow (handle, SW_SHOW);
@@ -287,7 +287,7 @@ static void test_ownerdraw(void)
     cls.cbWndExtra = 0;
     cls.hInstance = GetModuleHandle(0);
     cls.hIcon = 0;
-    cls.hCursor = LoadCursor(0, (LPSTR)IDC_ARROW);
+    cls.hCursor = LoadCursor(0, IDC_ARROW);
     cls.hbrBackground = GetStockObject(WHITE_BRUSH);
     cls.lpszMenuName = NULL;
     cls.lpszClassName = "main_window_class";
@@ -303,6 +303,7 @@ static void test_ownerdraw(void)
     hLB = create_listbox(LBS_OWNERDRAWFIXED | WS_CHILD | WS_VISIBLE, parent);
     assert(hLB);
 
+    SetForegroundWindow(hLB);
     UpdateWindow(hLB);
 
     /* make height short enough */
@@ -569,6 +570,7 @@ static void test_listbox_LB_DIR(void)
     char pathBuffer[MAX_PATH];
     char * p;
     char driveletter;
+    const char *wildcard = "*";
     HANDLE file;
 
     file = CreateFileA( "wtest1.tmp.c", GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL );
@@ -587,12 +589,13 @@ static void test_listbox_LB_DIR(void)
     /* Test for standard usage */
 
     /* This should list all the files in the test directory. */
-    strcpy(pathBuffer, "*");
+    strcpy(pathBuffer, wildcard);
     SendMessage(hList, LB_RESETCONTENT, 0, 0);
     res = SendMessage(hList, LB_DIR, 0, (LPARAM)pathBuffer);
     if (res == -1)  /* "*" wildcard doesn't work on win9x */
     {
-        strcpy(pathBuffer, "*.*");
+        wildcard = "*.*";
+        strcpy(pathBuffer, wildcard);
         res = SendMessage(hList, LB_DIR, 0, (LPARAM)pathBuffer);
     }
     ok (res >= 0, "SendMessage(LB_DIR, 0, *) failed - 0x%08x\n", GetLastError());
@@ -647,15 +650,9 @@ static void test_listbox_LB_DIR(void)
     }
 
     /* Test DDL_DIRECTORY */
-    strcpy(pathBuffer, "*");
+    strcpy(pathBuffer, wildcard);
     SendMessage(hList, LB_RESETCONTENT, 0, 0);
     res = SendMessage(hList, LB_DIR, DDL_DIRECTORY, (LPARAM)pathBuffer);
-    if (res == -1 || res <= itemCount_allFiles)  /* "*" wildcard doesn't work on win9x */
-    {
-        strcpy(pathBuffer, "*.*");
-        SendMessage(hList, LB_RESETCONTENT, 0, 0);
-        res = SendMessage(hList, LB_DIR, DDL_DIRECTORY, (LPARAM)pathBuffer);
-    }
     ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY, *) failed - 0x%08x\n", GetLastError());
 
     /* There should be some content in the listbox.
@@ -711,7 +708,7 @@ static void test_listbox_LB_DIR(void)
 
 
     /* Test DDL_DRIVES|DDL_EXCLUSIVE */
-    strcpy(pathBuffer, "*");
+    strcpy(pathBuffer, wildcard);
     SendMessage(hList, LB_RESETCONTENT, 0, 0);
     res = SendMessage(hList, LB_DIR, DDL_DRIVES|DDL_EXCLUSIVE, (LPARAM)pathBuffer);
     ok (res >= 0, "SendMessage(LB_DIR, DDL_DRIVES|DDL_EXCLUSIVE, *)  failed - 0x%08x\n", GetLastError());
@@ -758,7 +755,7 @@ static void test_listbox_LB_DIR(void)
         itemCount_justFiles, itemCount_justDrives);
 
     /* Test DDL_DRIVES. */
-    strcpy(pathBuffer, "*");
+    strcpy(pathBuffer, wildcard);
     SendMessage(hList, LB_RESETCONTENT, 0, 0);
     res = SendMessage(hList, LB_DIR, DDL_DRIVES, (LPARAM)pathBuffer);
     ok (res > 0, "SendMessage(LB_DIR, DDL_DRIVES, *)  failed - 0x%08x\n", GetLastError());
@@ -769,8 +766,7 @@ static void test_listbox_LB_DIR(void)
      * been added.
      */
     itemCount = SendMessage(hList, LB_GETCOUNT, 0, 0);
-    ok (itemCount == itemCount_justDrives + itemCount_allFiles ||
-        broken(itemCount == itemCount_justDrives),  /* "*" wildcard broken on win9x */
+    ok (itemCount == itemCount_justDrives + itemCount_allFiles,
         "SendMessage(LB_DIR, DDL_DRIVES, *) filled with %d entries, expected %d\n",
         itemCount, itemCount_justDrives + itemCount_allFiles);
     ok(res + 1 == itemCount, "SendMessage(LB_DIR, DDL_DRIVES, *) returned incorrect index!\n");
@@ -822,7 +818,7 @@ static void test_listbox_LB_DIR(void)
 
 
     /* Test DDL_DIRECTORY|DDL_DRIVES. This does *not* imply DDL_EXCLUSIVE */
-    strcpy(pathBuffer, "*");
+    strcpy(pathBuffer, wildcard);
     SendMessage(hList, LB_RESETCONTENT, 0, 0);
     res = SendMessage(hList, LB_DIR, DDL_DIRECTORY|DDL_DRIVES, (LPARAM)pathBuffer);
     ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES, *) failed - 0x%08x\n", GetLastError());
@@ -831,8 +827,7 @@ static void test_listbox_LB_DIR(void)
      * be exactly the number of plain files, plus the number of mapped drives.
      */
     itemCount = SendMessage(hList, LB_GETCOUNT, 0, 0);
-    ok (itemCount == itemCount_allFiles + itemCount_justDrives + itemCount_allDirs ||
-        broken(itemCount == itemCount_justDrives + itemCount_allDirs), /* "*" wildcard broken on win9x */
+    ok (itemCount == itemCount_allFiles + itemCount_justDrives + itemCount_allDirs,
         "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES) filled with %d entries, expected %d\n",
         itemCount, itemCount_allFiles + itemCount_justDrives + itemCount_allDirs);
     ok(res + 1 == itemCount, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES, w*.c) returned incorrect index!\n");
@@ -898,7 +893,7 @@ static void test_listbox_LB_DIR(void)
     }
 
     /* Test DDL_DIRECTORY|DDL_EXCLUSIVE. */
-    strcpy(pathBuffer, "*");
+    strcpy(pathBuffer, wildcard);
     SendMessage(hList, LB_RESETCONTENT, 0, 0);
     res = SendMessage(hList, LB_DIR, DDL_DIRECTORY|DDL_EXCLUSIVE, (LPARAM)pathBuffer);
     ok (res != -1, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_EXCLUSIVE, *) failed err %u\n", GetLastError());
@@ -940,7 +935,7 @@ static void test_listbox_LB_DIR(void)
         itemCount, 0);
 
     /* Test DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE. */
-    strcpy(pathBuffer, "*");
+    strcpy(pathBuffer, wildcard);
     SendMessage(hList, LB_RESETCONTENT, 0, 0);
     res = SendMessage(hList, LB_DIR, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE, (LPARAM)pathBuffer);
     ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE, w*.c,) failed - 0x%08x\n", GetLastError());