shell32/tests: Add initial tests for the IExplorerBrowser control.

This commit is contained in:
David Hedberg 2010-08-20 07:45:57 +02:00 committed by Alexandre Julliard
parent d66269696f
commit 19979df965
2 changed files with 109 additions and 0 deletions

View File

@ -9,6 +9,7 @@ C_SRCS = \
appbar.c \
autocomplete.c \
brsfolder.c \
ebrowser.c \
generated.c \
progman_dde.c \
shelllink.c \

View File

@ -0,0 +1,108 @@
/*
* Unit tests for the Explorer Browser control
*
* Copyright 2010 David Hedberg
*
* 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 <stdio.h>
#define COBJMACROS
#include "shlobj.h"
#include "wine/test.h"
/*********************************************************************
* Some simple helpers
*/
static HRESULT ebrowser_instantiate(IExplorerBrowser **peb)
{
return CoCreateInstance(&CLSID_ExplorerBrowser, NULL, CLSCTX_INPROC_SERVER,
&IID_IExplorerBrowser, (void**)peb);
}
static void test_QueryInterface(void)
{
IExplorerBrowser *peb;
IUnknown *punk;
HRESULT hr;
LONG lres;
hr = ebrowser_instantiate(&peb);
ok(hr == S_OK, "Got 0x%08x\n", hr);
#define test_qinterface(iid, exp) \
do { \
hr = IExplorerBrowser_QueryInterface(peb, &iid, (void**)&punk); \
ok(hr == exp, "(%s:)Expected (0x%08x), got (0x%08x)\n", \
#iid, exp, hr); \
if(SUCCEEDED(hr)) IUnknown_Release(punk); \
} while(0)
test_qinterface(IID_IUnknown, S_OK);
test_qinterface(IID_IExplorerBrowser, S_OK);
todo_wine test_qinterface(IID_IShellBrowser, S_OK);
todo_wine test_qinterface(IID_IOleWindow, S_OK);
todo_wine test_qinterface(IID_ICommDlgBrowser, S_OK);
todo_wine test_qinterface(IID_ICommDlgBrowser2, S_OK);
todo_wine test_qinterface(IID_ICommDlgBrowser3, S_OK);
todo_wine test_qinterface(IID_IServiceProvider, S_OK);
todo_wine test_qinterface(IID_IObjectWithSite, S_OK);
todo_wine test_qinterface(IID_IConnectionPointContainer, S_OK);
test_qinterface(IID_IOleObject, E_NOINTERFACE);
test_qinterface(IID_IViewObject, E_NOINTERFACE);
test_qinterface(IID_IViewObject2, E_NOINTERFACE);
test_qinterface(IID_IViewObjectEx, E_NOINTERFACE);
test_qinterface(IID_IConnectionPoint, E_NOINTERFACE);
test_qinterface(IID_IShellView, E_NOINTERFACE);
test_qinterface(IID_INameSpaceTreeControlEvents, E_NOINTERFACE);
#undef test_qinterface
lres = IExplorerBrowser_Release(peb);
ok(lres == 0, "Got %d\n", lres);
}
static BOOL test_instantiate_control(void)
{
IExplorerBrowser *peb;
HRESULT hr;
hr = ebrowser_instantiate(&peb);
ok(hr == S_OK || hr == REGDB_E_CLASSNOTREG, "Got (0x%08x)\n", hr);
if(FAILED(hr))
return FALSE;
IExplorerBrowser_Release(peb);
return TRUE;
}
START_TEST(ebrowser)
{
OleInitialize(NULL);
if(!test_instantiate_control())
{
win_skip("No ExplorerBrowser control..\n");
OleUninitialize();
return;
}
test_QueryInterface();
OleUninitialize();
}