[SHELL32_WINETEST] Sync with Wine Staging 1.9.14.
authorAmine Khaldi <amine.khaldi@reactos.org>
Tue, 12 Jul 2016 10:49:51 +0000 (10:49 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Tue, 12 Jul 2016 10:49:51 +0000 (10:49 +0000)
svn path=/trunk/; revision=71900

rostests/winetests/shell32/appbar.c
rostests/winetests/shell32/assoc.c
rostests/winetests/shell32/brsfolder.c
rostests/winetests/shell32/ebrowser.c
rostests/winetests/shell32/shlfolder.c

index ca72f3f..dbac4e6 100644 (file)
@@ -196,9 +196,8 @@ static void register_testwindow_class(void)
 
 #define test_window_rects(a, b) \
     ok(!IntersectRect(&rc, &windows[a].allocated_rect, &windows[b].allocated_rect), \
-        "rectangles intersect (%i,%i,%i,%i)/(%i,%i,%i,%i)\n", \
-        windows[a].allocated_rect.left, windows[a].allocated_rect.top, windows[a].allocated_rect.right, windows[a].allocated_rect.bottom, \
-        windows[b].allocated_rect.left, windows[b].allocated_rect.top, windows[b].allocated_rect.right, windows[b].allocated_rect.bottom)
+        "rectangles intersect %s / %s\n", wine_dbgstr_rect(&windows[a].allocated_rect), \
+        wine_dbgstr_rect(&windows[b].allocated_rect))
 
 static void test_setpos(void)
 {
index c425038..2cd06d2 100644 (file)
@@ -104,31 +104,36 @@ static void getstring_test(LPCWSTR assocName, HKEY progIdKey, ASSOCSTR str, LPCW
 {
     IQueryAssociations *assoc;
     HRESULT hr;
-    WCHAR *buffer;
+    WCHAR *buffer = NULL;
     DWORD len;
 
     hr = CoCreateInstance(&CLSID_QueryAssociations, NULL, CLSCTX_INPROC_SERVER, &IID_IQueryAssociations, (void*)&assoc);
     ok_(__FILE__, line)(hr == S_OK, "failed to create IQueryAssociations, 0x%x\n", hr);
-    hr = IQueryAssociations_Init(assoc, 0, assocName, progIdKey, NULL);
+    hr = IQueryAssociations_Init(assoc, ASSOCF_NONE, assocName, progIdKey, NULL);
     ok_(__FILE__, line)(hr == S_OK, "IQueryAssociations::Init failed, 0x%x\n", hr);
 
-    hr = IQueryAssociations_GetString(assoc, 0, str, NULL, NULL, &len);
-    if (hr != S_FALSE) {
-        if (expected_string) {
-            ok_(__FILE__, line)(SUCCEEDED(hr), "GetString returned 0x%x, expected success\n", hr);
-        } else {
-            ok_(__FILE__, line)(FAILED(hr), "GetString returned 0x%x, expected failure\n", hr);
+    hr = IQueryAssociations_GetString(assoc, ASSOCF_NONE, str, NULL, NULL, &len);
+    if (expected_string) {
+        ok_(__FILE__, line)(hr == S_FALSE, "GetString returned 0x%x, expected S_FALSE\n", hr);
+        if (hr != S_FALSE) {
+            /* don't try to allocate memory using uninitialized len */
+            IQueryAssociations_Release(assoc);
+            return;
         }
-    }
 
-    buffer = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
-    ok_(__FILE__, line)(buffer != NULL, "out of memory\n");
-    hr = IQueryAssociations_GetString(assoc, 0, str, NULL, buffer, &len);
+        buffer = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+        ok_(__FILE__, line)(buffer != NULL, "out of memory\n");
+        hr = IQueryAssociations_GetString(assoc, 0, str, NULL, buffer, &len);
+        ok_(__FILE__, line)(hr == S_OK, "GetString returned 0x%x, expected S_OK\n", hr);
 
-    if (expected_string) {
         ok_(__FILE__, line)(lstrcmpW(buffer, expected_string) == 0, "GetString returned %s, expected %s\n",
                 wine_dbgstr_w(buffer), wine_dbgstr_w(expected_string));
+    } else {
+        ok_(__FILE__, line)(FAILED(hr), "GetString returned 0x%x, expected failure\n", hr);
     }
+
+    IQueryAssociations_Release(assoc);
+    HeapFree(GetProcessHeap(), 0, buffer);
 }
 
 static void test_IQueryAssociations_GetString(void)
@@ -176,17 +181,18 @@ static void test_IQueryAssociations_GetString(void)
     getstring_test(test_progidW, NULL, ASSOCSTR_DEFAULTICON, test_iconW, __LINE__);
     getstring_test(NULL, test_progid_key, ASSOCSTR_DEFAULTICON, test_iconW, __LINE__);
 
-    RegDeleteKeyW(HKEY_CLASSES_ROOT, test_extensionW);
+    RegDeleteKeyW(test_progid_key, DefaultIconW);
     RegDeleteKeyW(HKEY_CLASSES_ROOT, test_progidW);
+    RegDeleteKeyW(HKEY_CLASSES_ROOT, test_extensionW);
 
     hr = CoCreateInstance(&CLSID_QueryAssociations, NULL, CLSCTX_INPROC_SERVER, &IID_IQueryAssociations, (void*)&assoc);
     ok(hr == S_OK, "failed to create object, 0x%x\n", hr);
 
-    hr = IQueryAssociations_Init(assoc, 0, httpW, NULL, NULL);
+    hr = IQueryAssociations_Init(assoc, ASSOCF_NONE, httpW, NULL, NULL);
     ok(hr == S_OK, "Init failed, 0x%x\n", hr);
 
     len = 0;
-    hr = IQueryAssociations_GetString(assoc, 0, ASSOCSTR_EXECUTABLE, NULL, NULL, &len);
+    hr = IQueryAssociations_GetString(assoc, ASSOCF_NONE, ASSOCSTR_EXECUTABLE, NULL, NULL, &len);
     ok(hr == S_FALSE, "got 0x%08x\n", hr);
     ok(len > 0, "got wrong needed length, %d\n", len);
 
@@ -195,7 +201,7 @@ static void test_IQueryAssociations_GetString(void)
         WCHAR buffW[MAX_PATH];
         DWORD len;
 
-        hr = IQueryAssociations_Init(assoc, 0, ptr->key, NULL, NULL);
+        hr = IQueryAssociations_Init(assoc, ASSOCF_NONE, ptr->key, NULL, NULL);
         ok(hr == S_OK, "%d: Init failed, 0x%x\n", i, hr);
 
         len = ptr->len;
@@ -232,17 +238,17 @@ static void test_IQueryAssociations_Init(void)
     hr = CoCreateInstance(&CLSID_QueryAssociations, NULL, CLSCTX_INPROC_SERVER, &IID_IQueryAssociations, (void*)&assoc);
     ok(hr == S_OK, "failed to create object, 0x%x\n", hr);
 
-    hr = IQueryAssociations_Init(assoc, 0, NULL, NULL, NULL);
+    hr = IQueryAssociations_Init(assoc, ASSOCF_NONE, NULL, NULL, NULL);
     ok(hr == E_INVALIDARG, "Init failed, 0x%08x\n", hr);
 
-    hr = IQueryAssociations_Init(assoc, 0, httpW, NULL, NULL);
+    hr = IQueryAssociations_Init(assoc, ASSOCF_NONE, httpW, NULL, NULL);
     ok(hr == S_OK, "Init failed, 0x%08x\n", hr);
 
-    hr = IQueryAssociations_Init(assoc, 0, badW, NULL, NULL);
+    hr = IQueryAssociations_Init(assoc, ASSOCF_NONE, badW, NULL, NULL);
     ok(hr == S_OK || broken(hr == S_FALSE) /* pre-vista */, "Init failed, 0x%08x\n", hr);
 
     len = 0;
-    hr = IQueryAssociations_GetString(assoc, 0, ASSOCSTR_EXECUTABLE, NULL, NULL, &len);
+    hr = IQueryAssociations_GetString(assoc, ASSOCF_NONE, ASSOCSTR_EXECUTABLE, NULL, NULL, &len);
     ok(hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) || broken(hr == E_FAIL) /* pre-vista */, "got 0x%08x\n", hr);
 
     IQueryAssociations_Release(assoc);
index 0ef5bb1..bf29d11 100644 (file)
@@ -248,10 +248,8 @@ static void test_click_make_new_folder_button(void)
     shfileop.fFlags = FOF_NOCONFIRMATION|FOF_NOERRORUI|FOF_SILENT;
     SHFileOperationA(&shfileop);
 
-    if (pidl)
-        CoTaskMemFree(pidl);
-    if (test_folder_pidl)
-        CoTaskMemFree(test_folder_pidl);
+    CoTaskMemFree(pidl);
+    CoTaskMemFree(test_folder_pidl);
     test_folder_object->lpVtbl->Release(test_folder_object);
 
     CoUninitialize();
@@ -346,16 +344,12 @@ static void test_selection(void)
     /* test without flags */
     bi.ulFlags = 0;
     pidl = SHBrowseForFolderA(&bi);
-
-    if (pidl)
-        CoTaskMemFree(pidl);
+    CoTaskMemFree(pidl);
 
     /* test with flag */
     bi.ulFlags = BIF_NEWDIALOGSTYLE;
     pidl = SHBrowseForFolderA(&bi);
-
-    if (pidl)
-        CoTaskMemFree(pidl);
+    CoTaskMemFree(pidl);
 
     IShellFolder_Release(desktop_object);
 
index 57f52c9..56d20dc 100644 (file)
@@ -818,8 +818,7 @@ static void test_initialization(void)
         ok(hr == S_OK, "Got 0x%08x\n", hr);
 
         GetClientRect(eb_hwnd, &eb_rc);
-        ok(EqualRect(&eb_rc, &exp_rc), "Got client rect (%d, %d)-(%d, %d)\n",
-           eb_rc.left, eb_rc.top, eb_rc.right, eb_rc.bottom);
+        ok(EqualRect(&eb_rc, &exp_rc), "Got client rect %s\n", wine_dbgstr_rect(&eb_rc));
 
         GetWindowRect(eb_hwnd, &eb_rc);
         ok(eb_rc.right - eb_rc.left == 50, "Got window width %d\n", eb_rc.right - eb_rc.left);
@@ -1142,8 +1141,7 @@ static void test_basics(void)
 
         GetClientRect(eb_hwnd, &eb_rc);
         MapWindowPoints(eb_hwnd, hwnd, (POINT*)&eb_rc, 2);
-        ok(EqualRect(&eb_rc, &exp_rc), "Got rect (%d, %d) - (%d, %d)\n",
-           eb_rc.left, eb_rc.top, eb_rc.right, eb_rc.bottom);
+        ok(EqualRect(&eb_rc, &exp_rc), "Got rect %s\n", wine_dbgstr_rect(&eb_rc));
 
         /* Try resizing with invalid hdwp */
         rc.bottom = 25;
@@ -1152,16 +1150,14 @@ static void test_basics(void)
         ok(hr == E_FAIL, "Got 0x%08x\n", hr);
         GetClientRect(eb_hwnd, &eb_rc);
         MapWindowPoints(eb_hwnd, hwnd, (POINT*)&eb_rc, 2);
-        ok(EqualRect(&eb_rc, &exp_rc), "Got rect (%d, %d) - (%d, %d)\n",
-           eb_rc.left, eb_rc.top, eb_rc.right, eb_rc.bottom);
+        ok(EqualRect(&eb_rc, &exp_rc), "Got rect %s\n", wine_dbgstr_rect(&eb_rc));
 
         hdwp = NULL;
         hr = IExplorerBrowser_SetRect(peb, &hdwp, rc);
         ok(hr == S_OK, "Got 0x%08x\n", hr);
         GetClientRect(eb_hwnd, &eb_rc);
         MapWindowPoints(eb_hwnd, hwnd, (POINT*)&eb_rc, 2);
-        ok(EqualRect(&eb_rc, &exp_rc2), "Got rect (%d, %d) - (%d, %d)\n",
-           eb_rc.left, eb_rc.top, eb_rc.right, eb_rc.bottom);
+        ok(EqualRect(&eb_rc, &exp_rc2), "Got rect %s\n", wine_dbgstr_rect(&eb_rc));
 
         IShellBrowser_Release(psb);
     }
index 3e0a7a1..8f62a48 100644 (file)
@@ -3088,7 +3088,7 @@ static void test_SHGetIDListFromObject(void)
     punkimpl->ifaces = ifaces;
     punkimpl->unknown = 0;
 
-    hres = pSHGetIDListFromObject((IUnknown*)punkimpl, &pidl);
+    hres = pSHGetIDListFromObject(&punkimpl->IUnknown_iface, &pidl);
     ok(hres == E_NOINTERFACE, "Got %x\n", hres);
     ok(ifaces[0].count, "interface not requested.\n");
     ok(ifaces[1].count, "interface not requested.\n");
@@ -3260,7 +3260,7 @@ static void test_SHGetItemFromObject(void)
     punkimpl->unknown = 0;
 
     /* The same as SHGetIDListFromObject */
-    hres = pSHGetIDListFromObject((IUnknown*)punkimpl, &pidl);
+    hres = pSHGetIDListFromObject(&punkimpl->IUnknown_iface, &pidl);
     ok(hres == E_NOINTERFACE, "Got %x\n", hres);
     ok(ifaces[0].count, "interface not requested.\n");
     ok(ifaces[1].count, "interface not requested.\n");