[Wine-patches] [eterhack] shell32/tests: Synchronize with upstream.
Alexander Morozov
amorozov на etersoft.ru
Вт Янв 25 17:57:21 MSK 2011
----------- следующая часть -----------
From e5b492d67555df65f3e4639d3fc5b902972bbbe1 Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov на etersoft.ru>
Date: Tue, 25 Jan 2011 17:36:24 +0300
Subject: [eterhack 1/3] shell32/tests: Synchronize with upstream.
---
dlls/shell32/tests/Makefile.in | 2 +-
dlls/shell32/tests/shelldispatch.c | 65 ++++++++++++++++++++++++++++++++---
2 files changed, 60 insertions(+), 7 deletions(-)
diff --git a/dlls/shell32/tests/Makefile.in b/dlls/shell32/tests/Makefile.in
index 3399532..53f33b1 100644
--- a/dlls/shell32/tests/Makefile.in
+++ b/dlls/shell32/tests/Makefile.in
@@ -1,5 +1,5 @@
TESTDLL = shell32.dll
-IMPORTS = shell32 ole32 oleaut32 user32 advapi32
+IMPORTS = shell32 ole32 oleaut32 shlwapi user32 advapi32
C_SRCS = \
appbar.c \
diff --git a/dlls/shell32/tests/shelldispatch.c b/dlls/shell32/tests/shelldispatch.c
index 12084e7..0b014bb 100644
--- a/dlls/shell32/tests/shelldispatch.c
+++ b/dlls/shell32/tests/shelldispatch.c
@@ -23,12 +23,27 @@
#define NONAMELESSSTRUCT
#include "shldisp.h"
+#include "shlobj.h"
+#include "shlwapi.h"
#include "wine/test.h"
+static HRESULT (WINAPI *pSHGetFolderPathW)(HWND, int, HANDLE, DWORD, LPWSTR);
+static HRESULT (WINAPI *pSHGetNameFromIDList)(PCIDLIST_ABSOLUTE,SIGDN,PWSTR*);
+static HRESULT (WINAPI *pSHGetSpecialFolderLocation)(HWND, int, LPITEMIDLIST *);
+
+static void init_function_pointers(void)
+{
+ HMODULE hmod;
+
+ hmod = GetModuleHandleA("shell32.dll");
+ pSHGetFolderPathW = (void*)GetProcAddress(hmod, "SHGetFolderPathW");
+ pSHGetNameFromIDList = (void*)GetProcAddress(hmod, "SHGetNameFromIDList");
+ pSHGetSpecialFolderLocation = (void*)GetProcAddress(hmod,
+ "SHGetSpecialFolderLocation");
+}
+
static void test_namespace(void)
{
- static const WCHAR program_filesW[] = {'P','r','o','g','r','a','m',' ',
- 'F','i','l','e','s',0};
static const WCHAR winetestW[] = {'w','i','n','e','t','e','s','t',0};
static const WCHAR backslashW[] = {'\\',0};
@@ -42,6 +57,11 @@ static void test_namespace(void)
r = CoCreateInstance(&CLSID_Shell, NULL, CLSCTX_INPROC_SERVER,
&IID_IShellDispatch, (LPVOID*)&sd);
+ if (r == REGDB_E_CLASSNOTREG) /* NT4 */
+ {
+ win_skip("skipping IShellDispatch tests\n");
+ return;
+ }
ok(SUCCEEDED(r), "CoCreateInstance failed: %08x\n", r);
if (FAILED(r))
return;
@@ -69,8 +89,38 @@ static void test_namespace(void)
ok(r == S_OK, "Folder::get_Title failed: %08x\n", r);
if (r == S_OK)
{
- todo_wine
- ok(!lstrcmpW(title, program_filesW), "bad title\n");
+ /* On Win2000-2003 title is equal to program files directory name in
+ HKLM\Software\Microsoft\Windows\CurrentVersion\ProgramFilesDir.
+ On newer Windows it seems constant and is not changed
+ if the program files directory name is changed */
+ if (pSHGetSpecialFolderLocation && pSHGetNameFromIDList)
+ {
+ LPITEMIDLIST pidl;
+ PWSTR name;
+
+ r = pSHGetSpecialFolderLocation(NULL, CSIDL_PROGRAM_FILES, &pidl);
+ ok(r == S_OK, "SHGetSpecialFolderLocation failed: %08x\n", r);
+ r = pSHGetNameFromIDList(pidl, SIGDN_NORMALDISPLAY, &name);
+ ok(r == S_OK, "SHGetNameFromIDList failed: %08x\n", r);
+ todo_wine
+ ok(!lstrcmpW(title, name), "expected %s, got %s\n",
+ wine_dbgstr_w(name), wine_dbgstr_w(title));
+ CoTaskMemFree(name);
+ CoTaskMemFree(pidl);
+ }
+ else if (pSHGetFolderPathW)
+ {
+ static WCHAR path[MAX_PATH];
+ WCHAR *p;
+
+ r = pSHGetFolderPathW(NULL, CSIDL_PROGRAM_FILES, NULL,
+ SHGFP_TYPE_CURRENT, path);
+ ok(r == S_OK, "SHGetFolderPath failed: %08x\n", r);
+ p = PathFindFileNameW(path);
+ ok(!lstrcmpW(title, p), "expected %s, got %s\n",
+ wine_dbgstr_w(p), wine_dbgstr_w(title));
+ }
+ else skip("skipping Folder::get_Title test\n");
SysFreeString(title);
}
Folder_Release(folder);
@@ -97,7 +147,8 @@ static void test_namespace(void)
ok(r == S_OK, "Folder::get_Title failed: %08x\n", r);
if (r == S_OK)
{
- ok(!lstrcmpW(title, winetestW), "bad title\n");
+ ok(!lstrcmpW(title, winetestW), "bad title: %s\n",
+ wine_dbgstr_w(title));
SysFreeString(title);
}
Folder_Release(folder);
@@ -118,7 +169,8 @@ static void test_namespace(void)
ok(r == S_OK, "Folder::get_Title failed: %08x\n", r);
if (r == S_OK)
{
- ok(!lstrcmpW(title, winetestW), "bad title\n");
+ ok(!lstrcmpW(title, winetestW), "bad title: %s\n",
+ wine_dbgstr_w(title));
SysFreeString(title);
}
Folder_Release(folder);
@@ -140,6 +192,7 @@ START_TEST(shelldispatch)
if (FAILED(r))
return;
+ init_function_pointers();
test_namespace();
CoUninitialize();
--
1.7.3.4
Подробная информация о списке рассылки Wine-patches