Module: wine Branch: master Commit: 19979df9650bb56bc2b3003a0cc5c86a932adda4 URL: http://source.winehq.org/git/wine.git/?a=commit;h=19979df9650bb56bc2b3003a0c...
Author: David Hedberg david.hedberg@gmail.com Date: Fri Aug 20 07:45:57 2010 +0200
shell32/tests: Add initial tests for the IExplorerBrowser control.
---
dlls/shell32/tests/Makefile.in | 1 + dlls/shell32/tests/ebrowser.c | 108 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+), 0 deletions(-)
diff --git a/dlls/shell32/tests/Makefile.in b/dlls/shell32/tests/Makefile.in index f02b546..1d15fc0 100644 --- a/dlls/shell32/tests/Makefile.in +++ b/dlls/shell32/tests/Makefile.in @@ -9,6 +9,7 @@ C_SRCS = \ appbar.c \ autocomplete.c \ brsfolder.c \ + ebrowser.c \ generated.c \ progman_dde.c \ shelllink.c \ diff --git a/dlls/shell32/tests/ebrowser.c b/dlls/shell32/tests/ebrowser.c new file mode 100644 index 0000000..35c87bd --- /dev/null +++ b/dlls/shell32/tests/ebrowser.c @@ -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(); +}