}
}
-static void test_aclist_expand(HWND hwnd_edit, void *enumerator)
+static void test_aclist_expand(HWND hwnd_edit, void *enumerator, IAutoCompleteDropDown *acdropdown)
{
struct string_enumerator *obj = (struct string_enumerator*)enumerator;
static WCHAR str1[] = {'t','e','s','t',0};
static WCHAR str2[] = {'t','e','s','t','\\','f','o','o','\\','b','a','r','\\','b','a',0};
static WCHAR str2a[] = {'t','e','s','t','\\','f','o','o','\\','b','a','r','\\',0};
static WCHAR str2b[] = {'t','e','s','t','\\','f','o','o','\\','b','a','r','\\','b','a','z','_','b','b','q','\\',0};
+ HRESULT hr;
obj->num_resets = 0;
ok(obj->num_expand == 0, "Expected 0 expansions, got %u\n", obj->num_expand);
dispatch_messages();
ok(obj->num_expand == 4, "Expected 4 expansions, got %u\n", obj->num_expand);
ok(obj->num_resets == 5, "Expected 5 resets, got %u\n", obj->num_resets);
+ SendMessageW(hwnd_edit, WM_SETTEXT, 0, (LPARAM)str1a);
+ SendMessageW(hwnd_edit, EM_SETSEL, ARRAY_SIZE(str1a) - 1, ARRAY_SIZE(str1a) - 1);
+ SendMessageW(hwnd_edit, WM_CHAR, 'f', 1);
+ dispatch_messages();
+ ok(obj->num_expand == 5, "Expected 5 expansions, got %u\n", obj->num_expand);
+ ok(lstrcmpW(obj->last_expand, str1a) == 0, "Expected %s, got %s\n", wine_dbgstr_w(str1a), wine_dbgstr_w(obj->last_expand));
+ ok(obj->num_resets == 6, "Expected 6 resets, got %u\n", obj->num_resets);
+ hr = IAutoCompleteDropDown_ResetEnumerator(acdropdown);
+ ok(hr == S_OK, "IAutoCompleteDropDown_ResetEnumerator failed: %x\n", hr);
+ SendMessageW(hwnd_edit, WM_CHAR, 'o', 1);
+ dispatch_messages();
+ ok(obj->num_expand == 6, "Expected 6 expansions, got %u\n", obj->num_expand);
+ ok(lstrcmpW(obj->last_expand, str1a) == 0, "Expected %s, got %s\n", wine_dbgstr_w(str1a), wine_dbgstr_w(obj->last_expand));
+ ok(obj->num_resets == 7, "Expected 7 resets, got %u\n", obj->num_resets);
}
static void test_prefix_filtering(HWND hwnd_edit)
SendMessageW(hwnd_edit, WM_GETTEXT, ARRAY_SIZE(buffer), (LPARAM)buffer);
ok(lstrcmpW(str_aut, buffer) == 0, "Expected %s, got %s\n", wine_dbgstr_w(str_aut), wine_dbgstr_w(buffer));
- test_aclist_expand(hwnd_edit, enumerator);
+ test_aclist_expand(hwnd_edit, enumerator, acdropdown);
obj->num_resets = 0;
hr = IAutoCompleteDropDown_ResetEnumerator(acdropdown);
IMoniker_Release(mon);
}
+#define WM_EXPECTED_VALUE WM_APP
#define DROPTEST_FILENAME "c:\\wintest.bin"
struct DragParam {
HWND hwnd;
static LRESULT WINAPI drop_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
+ static BOOL expected;
+
switch (msg) {
+ case WM_EXPECTED_VALUE:
+ {
+ expected = lparam;
+ break;
+ }
case WM_DROPFILES:
{
HDROP hDrop = (HDROP)wparam;
char filename[MAX_PATH] = "dummy";
+ POINT pt;
+ BOOL r;
UINT num;
num = DragQueryFileA(hDrop, 0xffffffff, NULL, 0);
ok(num == 1, "expected 1, got %u\n", num);
num = DragQueryFileA(hDrop, 0, filename, sizeof(filename));
ok(num == strlen(DROPTEST_FILENAME), "got %u\n", num);
ok(!strcmp(filename, DROPTEST_FILENAME), "got %s\n", filename);
+ r = DragQueryPoint(hDrop, &pt);
+ ok(r == expected, "expected %d, got %d\n", expected, r);
+ ok(pt.x == 10, "expected 10, got %d\n", pt.x);
+ ok(pt.y == 20, "expected 20, got %d\n", pt.y);
DragFinish(hDrop);
return 0;
}
return 0;
}
-static void test_DragQueryFile(void)
+static void test_DragQueryFile(BOOL non_client_flag)
{
struct DragParam param;
HANDLE hThread;
hDrop = GlobalAlloc(GHND, sizeof(DROPFILES) + (strlen(DROPTEST_FILENAME) + 2) * sizeof(WCHAR));
pDrop = GlobalLock(hDrop);
+ pDrop->pt.x = 10;
+ pDrop->pt.y = 20;
+ pDrop->fNC = non_client_flag;
pDrop->pFiles = sizeof(DROPFILES);
ret = MultiByteToWideChar(CP_ACP, 0, DROPTEST_FILENAME, -1,
(LPWSTR)(pDrop + 1), strlen(DROPTEST_FILENAME) + 1);
pDrop->fWide = TRUE;
GlobalUnlock(hDrop);
+ r = PostMessageA(param.hwnd, WM_EXPECTED_VALUE, 0, !non_client_flag);
+ ok(r, "got %d\n", r);
+
r = PostMessageA(param.hwnd, WM_DROPFILES, (WPARAM)hDrop, 0);
ok(r, "got %d\n", r);
CloseHandle(param.ready);
CloseHandle(hThread);
}
+#undef WM_EXPECTED_VALUE
#undef DROPTEST_FILENAME
static void test_SHCreateSessionKey(void)
test_SHPropStg_functions();
test_SHCreateQueryCancelAutoPlayMoniker();
- test_DragQueryFile();
+ test_DragQueryFile(TRUE);
+ test_DragQueryFile(FALSE);
test_SHCreateSessionKey();
test_dragdrophelper();
path = NULL;
hr = pSHGetKnownFolderPath(folder_id, KF_FLAG_DEFAULT, NULL, &path);
if (FAILED(hr))
+ {
+ ok(path == NULL, "expected path == NULL\n");
continue;
+ }
ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
ok(path != NULL, "expected path != NULL\n");
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "shellapi.h"
+#include "shlwapi.h"
#include "shlobj.h"
#include "wine/test.h"
IShellFolder_Release(psf);
}
+static void test_desktop_displaynameof(void)
+{
+ static WCHAR MyComputer[] = { ':',':','{','2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','8','-','0','8','0','0','2','B','3','0','3','0','9','D','}', 0 };
+ static WCHAR MyDocuments[] = { ':',':','{','4','5','0','D','8','F','B','A','-','A','D','2','5','-','1','1','D','0','-','9','8','A','8','-','0','8','0','0','3','6','1','B','1','1','0','3','}', 0 };
+ static WCHAR RecycleBin[] = { ':',':','{','6','4','5','F','F','0','4','0','-','5','0','8','1','-','1','0','1','B','-','9','F','0','8','-','0','0','A','A','0','0','2','F','9','5','4','E','}', 0 };
+ static WCHAR ControlPanel[]= { ':',':','{','2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','8','-','0','8','0','0','2','B','3','0','3','0','9','D','}','\\',
+ ':',':','{','2','1','E','C','2','0','2','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','D','-','0','8','0','0','2','B','3','0','3','0','9','D','}', 0 };
+ static WCHAR *folders[] = { MyComputer, MyDocuments, RecycleBin, ControlPanel };
+ IShellFolder *desktop;
+ ITEMIDLIST *pidl;
+ STRRET strret;
+ DWORD eaten;
+ HRESULT hr;
+ UINT i;
+
+ hr = SHGetDesktopFolder(&desktop);
+ ok(hr == S_OK, "SHGetDesktopFolder failed with error 0x%08x\n", hr);
+ if (FAILED(hr)) return;
+
+ for (i = 0; i < ARRAY_SIZE(folders); i++)
+ {
+ WCHAR name1[MAX_PATH], name2[MAX_PATH];
+
+ hr = IShellFolder_ParseDisplayName(desktop, NULL, NULL, folders[i], &eaten, &pidl, NULL);
+ ok(hr == S_OK, "IShellFolder::ParseDisplayName failed with error 0x%08x\n", hr);
+ if (FAILED(hr)) continue;
+
+ hr = IShellFolder_GetDisplayNameOf(desktop, pidl, SHGDN_INFOLDER, &strret);
+ ok(hr == S_OK, "IShellFolder::GetDisplayNameOf failed with error 0x%08x\n", hr);
+ hr = StrRetToBufW(&strret, pidl, name1, ARRAY_SIZE(name1));
+ ok(hr == S_OK, "StrRetToBuf failed with error 0x%08x\n", hr);
+
+ hr = IShellFolder_GetDisplayNameOf(desktop, pidl, SHGDN_INFOLDER | SHGDN_FORPARSING | SHGDN_FORADDRESSBAR, &strret);
+ ok(hr == S_OK, "IShellFolder::GetDisplayNameOf failed with error 0x%08x\n", hr);
+ hr = StrRetToBufW(&strret, pidl, name2, ARRAY_SIZE(name2));
+ ok(hr == S_OK, "StrRetToBuf failed with error 0x%08x\n", hr);
+
+ ok(!lstrcmpW(name1, name2), "the display names are not equal: %s vs %s\n", wine_dbgstr_w(name1), wine_dbgstr_w(name2));
+ ok(name1[0] != ':' || name1[1] != ':', "display name is a GUID: %s\n", wine_dbgstr_w(name1));
+
+ hr = IShellFolder_GetDisplayNameOf(desktop, pidl, SHGDN_INFOLDER | SHGDN_FORPARSING, &strret);
+ ok(hr == S_OK, "IShellFolder::GetDisplayNameOf failed with error 0x%08x\n", hr);
+ hr = StrRetToBufW(&strret, pidl, name1, ARRAY_SIZE(name1));
+ ok(hr == S_OK, "StrRetToBuf failed with error 0x%08x\n", hr);
+
+ ok(lstrcmpW(name1, name2), "the display names are equal: %s\n", wine_dbgstr_w(name1));
+ ok(name1[0] == ':' && name1[1] == ':', "display name is not a GUID: %s\n", wine_dbgstr_w(name1));
+
+ ILFree(pidl);
+ }
+ IShellFolder_Release(desktop);
+}
+
START_TEST(shfldr_special)
{
test_parse_for_entire_network();
test_parse_for_control_panel();
test_printers_folder();
test_desktop_folder();
+ test_desktop_displaynameof();
}
return ptr;
}
-static void WINETEST_PRINTF_ATTR(2,3) childPrintf(HANDLE h, const char* fmt, ...)
+static void WINAPIV WINETEST_PRINTF_ATTR(2,3) childPrintf(HANDLE h, const char* fmt, ...)
{
- va_list valist;
+ __ms_va_list valist;
char buffer[1024];
DWORD w;
- va_start(valist, fmt);
+ __ms_va_start(valist, fmt);
vsprintf(buffer, fmt, valist);
- va_end(valist);
+ __ms_va_end(valist);
WriteFile(h, buffer, strlen(buffer), &w, NULL);
}
***/
static char shell_call[2048];
-static void WINETEST_PRINTF_ATTR(2,3) _okShell(int condition, const char *msg, ...)
+static void WINAPIV WINETEST_PRINTF_ATTR(2,3) _okShell(int condition, const char *msg, ...)
{
- va_list valist;
+ __ms_va_list valist;
char buffer[2048];
strcpy(buffer, shell_call);
strcat(buffer, " ");
- va_start(valist, msg);
+ __ms_va_start(valist, msg);
vsprintf(buffer+strlen(buffer), msg, valist);
- va_end(valist);
+ __ms_va_end(valist);
winetest_ok(condition, "%s", buffer);
}
#define okShell_(file, line) (winetest_set_location(file, line), 0) ? (void)0 : _okShell
okShell(rc > 32, "returned %lu\n", rc);
okChildInt("argcA", 4);
okChildString("argvA3", "Exec");
- todo_wine okChildPath("longPath", path);
+ okChildPath("longPath", path);
SetCurrentDirectoryA(curdir);
rc=shell_execute_ex(SEE_MASK_NOZONECHECKS|SEE_MASK_FLAG_NO_UI,
okShell(rc > 32, "returned %lu\n", rc);
okChildInt("argcA", 4);
okChildString("argvA3", "Exec");
- todo_wine okChildPath("longPath", path);
+ okChildPath("longPath", path);
/* Specify it through an environment variable */
rc=shell_execute_ex(SEE_MASK_NOZONECHECKS|SEE_MASK_FLAG_NO_UI,
okShell(rc > 32, "returned %lu\n", rc);
okChildInt("argcA", 4);
okChildString("argvA3", "Exec");
- todo_wine okChildPath("longPath", path);
+ okChildPath("longPath", path);
/* Not a colon-separated directory list */
sprintf(dirpath, "%s:%s", curdir, tmpdir);
int ret;
HANDLE file;
static const WCHAR UNICODE_PATH_TO[] = {'c',':','\\',0x00ae,0x00ae,'\0'};
+ HWND hwnd;
shfoW.hwnd = NULL;
shfoW.wFunc = FO_DELETE;
ok(GetLastError() == ERROR_SUCCESS ||
broken(GetLastError() == ERROR_INVALID_HANDLE), /* WinXp, win2k3 */
"Expected ERROR_SUCCESS, got %d\n", GetLastError());
+
+ /* Check SHCreateDirectoryExW with a Hwnd
+ * returns ERROR_ALREADY_EXISTS where a directory already exists */
+ /* Get any window handle */
+ hwnd = FindWindowA(NULL, NULL);
+ ok(hwnd != 0, "FindWindowA failed to produce a hwnd\n");
+ ret = SHCreateDirectoryExW(hwnd, UNICODE_PATH, NULL);
+ ok(!ret, "SHCreateDirectoryExW returned %d\n", ret);
+ /* Create already-existing directory */
+ ok(file_existsW(UNICODE_PATH), "The directory was not created\n");
+ ret = SHCreateDirectoryExW(hwnd, UNICODE_PATH, NULL);
+ ok(ret == ERROR_ALREADY_EXISTS,
+ "Expected ERROR_ALREADY_EXISTS, got %d\n", ret);
+ RemoveDirectoryW(UNICODE_PATH);
}
static void
for(i = 0; i < done; i++)
ILFree(apidl[i]);
}
+
+ IShellFolder_Release(psf);
}