[SHDOCVW_WINETEST]

* Sync with Wine 1.5.26.

svn path=/trunk/; revision=58811
This commit is contained in:
Amine Khaldi 2013-04-21 16:40:23 +00:00
parent 53db72e990
commit a8618f38c2
6 changed files with 24 additions and 2807 deletions

View file

@ -1,13 +1,9 @@
add_definitions(
-D__ROS_LONG64__
-D_DLL -D__USE_CRTIMP)
add_definitions(-D__ROS_LONG64__)
list(APPEND SOURCE
intshcut.c
shdocvw.c
shortcut.c
webbrowser.c
testlist.c)
add_executable(shdocvw_winetest ${SOURCE})

View file

@ -1,224 +0,0 @@
/*
* Unit tests to document InternetShortcut's behaviour
*
* Copyright 2008 Damjan Jovanovic
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include <stdio.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winerror.h"
#include "shlobj.h"
#include "shobjidl.h"
#include "shlguid.h"
#include "ole2.h"
#include "initguid.h"
#include "isguids.h"
#include "intshcut.h"
#include "wine/test.h"
static HRESULT WINAPI Unknown_QueryInterface(IUnknown *pUnknown, REFIID riid, void **ppvObject)
{
if (IsEqualGUID(&IID_IUnknown, riid))
{
*ppvObject = pUnknown;
return S_OK;
}
return E_NOINTERFACE;
}
static ULONG WINAPI Unknown_AddRef(IUnknown *pUnknown)
{
return 2;
}
static ULONG WINAPI Unknown_Release(IUnknown *pUnknown)
{
return 1;
}
static IUnknownVtbl unknownVtbl = {
Unknown_QueryInterface,
Unknown_AddRef,
Unknown_Release
};
static IUnknown unknown = {
&unknownVtbl
};
static const char *printGUID(const GUID *guid)
{
static char guidSTR[39];
if (!guid) return NULL;
sprintf(guidSTR, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
guid->Data1, guid->Data2, guid->Data3,
guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
return guidSTR;
}
static void test_Aggregability(void)
{
HRESULT hr;
IUnknown *pUnknown = NULL;
hr = CoCreateInstance(&CLSID_InternetShortcut, NULL, CLSCTX_ALL, &IID_IUnknown, (void**)&pUnknown);
ok(SUCCEEDED(hr), "could not create instance of CLSID_InternetShortcut with IID_IUnknown, hr = 0x%x\n", hr);
if (pUnknown)
IUnknown_Release(pUnknown);
hr = CoCreateInstance(&CLSID_InternetShortcut, NULL, CLSCTX_ALL, &IID_IUniformResourceLocatorA, (void**)&pUnknown);
ok(SUCCEEDED(hr), "could not create instance of CLSID_InternetShortcut with IID_IUniformResourceLocatorA, hr = 0x%x\n", hr);
if (pUnknown)
IUnknown_Release(pUnknown);
hr = CoCreateInstance(&CLSID_InternetShortcut, &unknown, CLSCTX_ALL, &IID_IUnknown, (void**)&pUnknown);
ok(FAILED(hr), "aggregation didn't fail like it should, hr = 0x%x\n", hr);
if (pUnknown)
IUnknown_Release(pUnknown);
}
static void can_query_interface(IUnknown *pUnknown, REFIID riid)
{
HRESULT hr;
IUnknown *newInterface;
hr = IUnknown_QueryInterface(pUnknown, riid, (void**)&newInterface);
ok(SUCCEEDED(hr), "interface %s could not be queried\n", printGUID(riid));
if (SUCCEEDED(hr))
IUnknown_Release(newInterface);
}
static void test_QueryInterface(void)
{
HRESULT hr;
IUnknown *pUnknown;
hr = CoCreateInstance(&CLSID_InternetShortcut, NULL, CLSCTX_ALL, &IID_IUnknown, (void**)&pUnknown);
if (SUCCEEDED(hr))
{
can_query_interface(pUnknown, &IID_IUniformResourceLocatorA);
can_query_interface(pUnknown, &IID_IUniformResourceLocatorW);
can_query_interface(pUnknown, &IID_IPersistFile);
IUnknown_Release(pUnknown);
}
else
skip("could not create a CLSID_InternetShortcut for QueryInterface tests, hr=0x%x\n", hr);
}
static CHAR *set_and_get_url(IUniformResourceLocatorA *urlA, LPCSTR input, DWORD flags)
{
HRESULT hr;
hr = urlA->lpVtbl->SetURL(urlA, input, flags);
if (SUCCEEDED(hr))
{
CHAR *output;
hr = urlA->lpVtbl->GetURL(urlA, &output);
if (SUCCEEDED(hr))
return output;
else
skip("GetUrl failed, hr=0x%x\n", hr);
}
else
skip("SetUrl (%s, 0x%x) failed, hr=0x%x\n", input, flags, hr);
return NULL;
}
static void check_string_transform(IUniformResourceLocatorA *urlA, LPCSTR input, DWORD flags, LPCSTR expectedOutput)
{
CHAR *output = set_and_get_url(urlA, input, flags);
if (output != NULL)
{
ok(lstrcmpA(output, expectedOutput) == 0, "unexpected URL change %s -> %s (expected %s)\n",
input, output, expectedOutput);
CoTaskMemFree(output);
}
}
static void test_NullURLs(void)
{
HRESULT hr;
IUniformResourceLocatorA *urlA;
hr = CoCreateInstance(&CLSID_InternetShortcut, NULL, CLSCTX_ALL, &IID_IUniformResourceLocatorA, (void**)&urlA);
if (SUCCEEDED(hr))
{
LPSTR url = NULL;
hr = urlA->lpVtbl->GetURL(urlA, &url);
ok(SUCCEEDED(hr), "getting uninitialized URL unexpectedly failed, hr=0x%x\n", hr);
ok(url == NULL, "uninitialized URL is not NULL but %s\n", url);
hr = urlA->lpVtbl->SetURL(urlA, NULL, 0);
ok(SUCCEEDED(hr), "setting NULL URL unexpectedly failed, hr=0x%x\n", hr);
hr = urlA->lpVtbl->GetURL(urlA, &url);
ok(SUCCEEDED(hr), "getting NULL URL unexpectedly failed, hr=0x%x\n", hr);
ok(url == NULL, "URL unexpectedly not NULL but %s\n", url);
urlA->lpVtbl->Release(urlA);
}
else
skip("could not create a CLSID_InternetShortcut for NullURL tests, hr=0x%x\n", hr);
}
static void test_SetURLFlags(void)
{
HRESULT hr;
IUniformResourceLocatorA *urlA;
hr = CoCreateInstance(&CLSID_InternetShortcut, NULL, CLSCTX_ALL, &IID_IUniformResourceLocatorA, (void**)&urlA);
if (SUCCEEDED(hr))
{
check_string_transform(urlA, "somerandomstring", 0, "somerandomstring");
check_string_transform(urlA, "www.winehq.org", 0, "www.winehq.org");
todo_wine
{
check_string_transform(urlA, "www.winehq.org", IURL_SETURL_FL_GUESS_PROTOCOL, "http://www.winehq.org/");
check_string_transform(urlA, "ftp.winehq.org", IURL_SETURL_FL_GUESS_PROTOCOL, "ftp://ftp.winehq.org/");
}
urlA->lpVtbl->Release(urlA);
}
else
skip("could not create a CLSID_InternetShortcut for SetUrl tests, hr=0x%x\n", hr);
}
static void test_InternetShortcut(void)
{
test_Aggregability();
test_QueryInterface();
test_NullURLs();
test_SetURLFlags();
}
START_TEST(intshcut)
{
OleInitialize(NULL);
test_InternetShortcut();
OleUninitialize();
}

View file

@ -21,13 +21,13 @@
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "wininet.h"
#include "winnls.h"
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <wininet.h>
#include <winnls.h>
#include "wine/test.h"
#include <wine/test.h>
/* ################ */
@ -133,7 +133,7 @@ static void test_URLSubRegQueryA(void)
"got 0x%x and %d (expected S_OK and %d)\n", hr, used, len - 2);
}
/* only space for the terminating 0: function still succeded */
/* only space for the terminating 0: function still succeeded */
memset(buffer, '#', sizeof(buffer)-1);
buffer[sizeof(buffer)-1] = '\0';
hr = pURLSubRegQueryA(regpath_iemain, start_page, REG_SZ, buffer, 1, -1);
@ -268,7 +268,7 @@ static void test_ParseURLFromOutsideSourceA(void)
if (0) {
/* that test crash on native shdocvw */
res = pParseURLFromOutsideSourceA(ParseURL_table[i].url, buffer, NULL, &dummy);
pParseURLFromOutsideSourceA(ParseURL_table[i].url, buffer, NULL, &dummy);
}
memset(buffer, '#', sizeof(buffer)-1);

View file

@ -25,7 +25,7 @@
* configured. This is documented at http://www.virtualplastic.net/html/ui_shell.html
* You can also google for a tool called "ShellObjectEditor" by "Tropical
* Technologies". This mechanism would be cool for wine, since we could
* map Gnome's virtual devices to FolderShortcuts and have them appear in the
* map GNOME's virtual devices to FolderShortcuts and have them appear in the
* file dialogs. These unit tests are meant to document how this mechanism
* works on windows.
*
@ -34,18 +34,23 @@
#include <stdarg.h>
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include "shlobj.h"
#include "shobjidl.h"
#include "shlguid.h"
#include "ole2.h"
//#include "initguid.h"
#include <shlobj.h>
//#include "shobjidl.h"
//#include "shlguid.h"
//#include "ole2.h"
#include "wine/test.h"
#include <wine/test.h>
/* The following definitions and helper functions are meant to make the de-/registration
* of the various necessary registry keys easier. */

View file

@ -1,22 +1,14 @@
/* Automatically generated file; DO NOT EDIT!! */
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define STANDALONE
#include "wine/test.h"
#include <wine/test.h>
extern void func_intshcut(void);
extern void func_shdocvw(void);
extern void func_shortcut(void);
extern void func_protocol(void);
extern void func_webbrowser(void);
const struct test winetest_testlist[] =
{
{ "intshcut", func_intshcut },
{ "shdocvw", func_shdocvw },
{ "shortcut", func_shortcut },
{ "webbrowser", func_webbrowser },
{ 0, 0 }
};

File diff suppressed because it is too large Load diff