static HINSTANCE hinst;
static int killfocus_count;
-static BOOL test_init(void) {
+static IAutoComplete *test_init(void)
+{
HRESULT r;
IAutoComplete* ac;
IUnknown *acSource;
if (r == REGDB_E_CLASSNOTREG)
{
win_skip("CLSID_AutoComplete is not registered\n");
- return FALSE;
+ return NULL;
}
ok(SUCCEEDED(r), "no IID_IAutoComplete (0x%08x)\n", r);
if (r == REGDB_E_CLASSNOTREG)
{
win_skip("CLSID_ACLMulti is not registered\n");
- return FALSE;
+ return NULL;
}
ok(SUCCEEDED(r), "no IID_IACList (0x%08x)\n", r);
r = IAutoComplete_Init(ac, hEdit, acSource, NULL, NULL);
ok(SUCCEEDED(r), "Init failed (0x%08x)\n", r);
- return TRUE;
+ IUnknown_Release(acSource);
+
+ return ac;
}
-static void test_killfocus(void) {
+
+static void test_killfocus(void)
+{
/* Test if WM_KILLFOCUS messages are handled properly by checking if
* the parent receives an EN_KILLFOCUS message. */
SetFocus(hEdit);
SetFocus(0);
ok(killfocus_count == 1, "Expected one EN_KILLFOCUS message, got: %d\n", killfocus_count);
}
-static LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
+
+static LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
switch(msg) {
case WM_CREATE:
/* create edit control */
}
return DefWindowProcA(hWnd, msg, wParam, lParam);
}
-static void createMainWnd(void) {
+
+static void createMainWnd(void)
+{
WNDCLASSA wc;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0;
hMainWnd = CreateWindowExA(0, "MyTestWnd", "Blah", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 130, 105, NULL, NULL, GetModuleHandleA(NULL), 0);
}
-START_TEST(autocomplete) {
+
+START_TEST(autocomplete)
+{
HRESULT r;
MSG msg;
+ IAutoComplete* ac;
r = CoInitialize(NULL);
ok(SUCCEEDED(r), "CoInitialize failed (0x%08x). Tests aborted.\n", r);
if(!ok(hMainWnd != NULL, "Failed to create parent window. Tests aborted.\n"))
return;
- if (!test_init())
+ ac = test_init();
+ if (!ac)
goto cleanup;
test_killfocus();
DispatchMessageA(&msg);
}
+ IAutoComplete_Release(ac);
+
cleanup:
DestroyWindow(hEdit);
DestroyWindow(hMainWnd);
broken(retval == ret_prewin32),\
"Expected %d, got %d\n", ret, retval)
+static BOOL old_shell32 = FALSE;
+
static CHAR CURR_DIR[MAX_PATH];
static const WCHAR UNICODE_PATH[] = {'c',':','\\',0x00ae,'\0','\0'};
/* "c:\®" can be used in all codepages */
/* pTo already exist */
shfo.pFrom = "test1.txt\0";
shfo.pTo = "test2.txt\0";
+ if (old_shell32)
+ shfo.fFlags |= FOF_NOCONFIRMMKDIR;
retval = SHFileOperationA(&shfo);
if (retval == ERROR_SUCCESS)
{
LPSTR ptr;
BOOL on_nt4 = FALSE;
+ if (old_shell32)
+ {
+ win_skip("Too many differences for old shell32\n");
+ return;
+ }
+
shfo.hwnd = NULL;
shfo.wFunc = FO_COPY;
shfo.pFrom = from;
ok(DeleteFileA("ab.txt"), "Expected file to exist\n");
ok(RemoveDirectoryA("one"), "Expected dir to exist\n");
ok(RemoveDirectoryA("two"), "Expected dir to exist\n");
+
+ /* pTo is an empty string */
+ CreateDirectoryA("dir", NULL);
+ createTestFile("dir\\abcdefgh.abc");
+ shfo.pFrom = "dir\\abcdefgh.abc\0";
+ shfo.pTo = "\0";
+ shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
+ retval = SHFileOperation(&shfo);
+ ok(retval == ERROR_SUCCESS ||
+ broken(retval == DE_OPCANCELLED), /* NT4 */
+ "Expected ERROR_SUCCESS, got %d\n", retval);
+ if (retval == ERROR_SUCCESS)
+ ok(DeleteFileA("abcdefgh.abc"), "Expected file to exist\n");
+ ok(DeleteFileA("dir\\abcdefgh.abc"), "Expected file to exist\n");
+ ok(RemoveDirectoryA("dir"), "Expected dir to exist\n");
}
/* tests the FO_MOVE action */
set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
+ if (old_shell32)
+ shfo2.fFlags |= FOF_NOCONFIRMMKDIR;
ok(!SHFileOperationA(&shfo2), "Move many files\n");
ok(DeleteFileA("test6.txt"), "The file is not moved - many files are "
"specified as a target\n");
retval = SHFileOperationA(&shfo2);
if (dir_exists("test6.txt"))
{
- /* Vista and W2K8 (broken or new behavior ?) */
- ok(retval == DE_DESTSAMETREE, "Expected DE_DESTSAMETREE, got %d\n", retval);
- ok(DeleteFileA("test6.txt\\test1.txt"), "The file is not moved\n");
- RemoveDirectoryA("test6.txt");
- ok(DeleteFileA("test7.txt\\test2.txt"), "The file is not moved\n");
- RemoveDirectoryA("test7.txt");
+ if (retval == ERROR_SUCCESS)
+ {
+ /* Old shell32 */
+ DeleteFileA("test6.txt\\test1.txt");
+ DeleteFileA("test6.txt\\test2.txt");
+ RemoveDirectoryA("test6.txt\\test4.txt");
+ RemoveDirectoryA("test6.txt");
+ }
+ else
+ {
+ /* Vista and W2K8 (broken or new behavior ?) */
+ ok(retval == DE_DESTSAMETREE, "Expected DE_DESTSAMETREE, got %d\n", retval);
+ ok(DeleteFileA("test6.txt\\test1.txt"), "The file is not moved\n");
+ RemoveDirectoryA("test6.txt");
+ ok(DeleteFileA("test7.txt\\test2.txt"), "The file is not moved\n");
+ RemoveDirectoryA("test7.txt");
+ }
}
else
{
set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
+ if (old_shell32)
+ shfo.fFlags |= FOF_NOCONFIRMMKDIR;
retval = SHFileOperationA(&shfo);
if (dir_exists("test6.txt"))
{
+ /* Old shell32 */
/* Vista and W2K8 (broken or new behavior ?) */
ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
ok(DeleteFileA("test6.txt\\test1.txt"), "The file is not moved. Many files are specified\n");
else
{
ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+ if (old_shell32)
+ {
+ DeleteFile("a.txt\\a.txt");
+ RemoveDirectoryA("a.txt");
+ }
+ else
+ ok(DeleteFile("a.txt"), "Expected a.txt to exist\n");
ok(!file_exists("test1.txt"), "Expected test1.txt to not exist\n");
- ok(DeleteFile("a.txt"), "Expected a.txt to exist\n");
}
ok(!file_exists("b.txt"), "Expected b.txt to not exist\n");
retval = SHFileOperationA(&shfo);
if (dir_exists("test1.txt"))
{
+ /* Old shell32 */
/* Vista and W2K8 (broken or new behavior ?) */
ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
ok(DeleteFileA("test1.txt\\test2.txt"), "Expected test1.txt\\test2.txt to exist\n");
retval = SHFileOperationA(&shfo);
if (dir_exists("d.txt"))
{
+ /* Old shell32 */
/* Vista and W2K8 (broken or new behavior ?) */
ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
ok(DeleteFileA("d.txt\\test2.txt"), "Expected d.txt\\test2.txt to exist\n");
retval = SHFileOperationA(&shfo);
if (dir_exists("d.txt"))
{
- /* Vista and W2K8 (broken or new behavior ?) */
- ok(retval == DE_SAMEFILE,
- "Expected DE_SAMEFILE, got %d\n", retval);
- ok(DeleteFileA("d.txt\\test2.txt"), "Expected d.txt\\test2.txt to exist\n");
- ok(!file_exists("d.txt\\test3.txt"), "Expected d.txt\\test3.txt to not exist\n");
- RemoveDirectoryA("d.txt");
- createTestFile("test2.txt");
+ if (old_shell32)
+ {
+ DeleteFileA("d.txt\\test2.txt");
+ DeleteFileA("d.txt\\test3.txt");
+ RemoveDirectoryA("d.txt");
+ createTestFile("test2.txt");
+ }
+ else
+ {
+ /* Vista and W2K8 (broken or new behavior ?) */
+ ok(retval == DE_SAMEFILE,
+ "Expected DE_SAMEFILE, got %d\n", retval);
+ ok(DeleteFileA("d.txt\\test2.txt"), "Expected d.txt\\test2.txt to exist\n");
+ ok(!file_exists("d.txt\\test3.txt"), "Expected d.txt\\test3.txt to not exist\n");
+ RemoveDirectoryA("d.txt");
+ createTestFile("test2.txt");
+ }
}
else
{
{
ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
ok(!file_exists("test2.txt"), "Expected test2.txt to not exist\n");
- ok(file_exists("test3.txt"), "Expected test3.txt to exist\n");
+ if (old_shell32)
+ {
+ DeleteFileA("test3.txt\\test3.txt");
+ RemoveDirectoryA("test3.txt");
+ }
+ else
+ ok(file_exists("test3.txt"), "Expected test3.txt to exist\n");
}
}
ok(!file_existsW(UNICODE_PATH), "The directory should have been removed\n");
}
+extern HRESULT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags);
+
+static void
+test_shlmenu(void) {
+ HRESULT hres;
+ hres = Shell_MergeMenus (0, 0, 0x42, 0x4242, 0x424242, 0);
+ ok (hres == 0x4242, "expected 0x4242 but got %x\n", hres);
+ hres = Shell_MergeMenus ((HMENU)42, 0, 0x42, 0x4242, 0x424242, 0);
+ ok (hres == 0x4242, "expected 0x4242 but got %x\n", hres);
+}
+
+/* Check for old shell32 (4.0.x) */
+static BOOL is_old_shell32(void)
+{
+ SHFILEOPSTRUCTA shfo;
+ CHAR from[5*MAX_PATH];
+ CHAR to[5*MAX_PATH];
+ DWORD retval;
+
+ shfo.hwnd = NULL;
+ shfo.wFunc = FO_COPY;
+ shfo.pFrom = from;
+ shfo.pTo = to;
+ /* FOF_NOCONFIRMMKDIR is needed for old shell32 */
+ shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI | FOF_MULTIDESTFILES | FOF_NOCONFIRMMKDIR;
+ shfo.hNameMappings = NULL;
+ shfo.lpszProgressTitle = NULL;
+
+ set_curr_dir_path(from, "test1.txt\0test2.txt\0test3.txt\0");
+ set_curr_dir_path(to, "test6.txt\0test7.txt\0");
+ retval = SHFileOperationA(&shfo);
+
+ /* Delete extra files on old shell32 and Vista+*/
+ DeleteFileA("test6.txt\\test1.txt");
+ /* Delete extra files on old shell32 */
+ DeleteFileA("test6.txt\\test2.txt");
+ DeleteFileA("test6.txt\\test3.txt");
+ /* Delete extra directory on old shell32 and Vista+ */
+ RemoveDirectoryA("test6.txt");
+ /* Delete extra files/directories on Vista+*/
+ DeleteFileA("test7.txt\\test2.txt");
+ RemoveDirectoryA("test7.txt");
+
+ if (retval == ERROR_SUCCESS)
+ return TRUE;
+
+ return FALSE;
+}
+
START_TEST(shlfileop)
{
InitFunctionPointers();
clean_after_shfo_tests();
+ init_shfo_tests();
+ old_shell32 = is_old_shell32();
+ if (old_shell32)
+ win_skip("Need to cater for old shell32 (4.0.x) on Win95\n");
+ clean_after_shfo_tests();
+
init_shfo_tests();
test_get_file_info();
test_get_file_info_iconlist();
clean_after_shfo_tests();
test_unicode();
+
+ test_shlmenu();
}