From: Vijay Kiran Kamuju Subject: [PATCH 1/2] dhtmled.ocx: Add initial tests Message-Id: Date: Fri, 19 Feb 2021 19:35:30 +0100 Signed-off-by: Vijay Kiran Kamuju
Signed-off-by: Vijay Kiran Kamuju <infyquest@gmail.com>
From 74d0e0e2f75ed0d44650f620b47c063833c5d521 Mon Sep 17 00:00:00 2001 From: Vijay Kiran Kamuju Date: Sun, 14 Feb 2021 15:57:41 +0100 Subject: [PATCH 1/2] dhtmled.ocx: Add initial tests Signed-off-by: Vijay Kiran Kamuju --- configure | 1 + configure.ac | 1 + dlls/dhtmled.ocx/tests/Makefile.in | 5 + dlls/dhtmled.ocx/tests/oleobj.c | 158 +++++++++++++++++++++++++++++ 4 files changed, 165 insertions(+) create mode 100644 dlls/dhtmled.ocx/tests/Makefile.in create mode 100644 dlls/dhtmled.ocx/tests/oleobj.c diff --git a/configure b/configure index 08936ff0ec1..f88b878123a 100755 --- a/configure +++ b/configure @@ -20447,6 +20447,7 @@ wine_fn_config_makefile dlls/devenum/tests enable_tests wine_fn_config_makefile dlls/dhcpcsvc enable_dhcpcsvc wine_fn_config_makefile dlls/dhcpcsvc/tests enable_tests wine_fn_config_makefile dlls/dhtmled.ocx enable_dhtmled_ocx +wine_fn_config_makefile dlls/dhtmled.ocx/tests enable_tests wine_fn_config_makefile dlls/difxapi enable_difxapi wine_fn_config_makefile dlls/dinput enable_dinput wine_fn_config_makefile dlls/dinput/tests enable_tests diff --git a/configure.ac b/configure.ac index caff5d1fe52..f8d94b382f9 100644 --- a/configure.ac +++ b/configure.ac @@ -3181,6 +3181,7 @@ WINE_CONFIG_MAKEFILE(dlls/devenum/tests) WINE_CONFIG_MAKEFILE(dlls/dhcpcsvc) WINE_CONFIG_MAKEFILE(dlls/dhcpcsvc/tests) WINE_CONFIG_MAKEFILE(dlls/dhtmled.ocx) +WINE_CONFIG_MAKEFILE(dlls/dhtmled.ocx/tests) WINE_CONFIG_MAKEFILE(dlls/difxapi) WINE_CONFIG_MAKEFILE(dlls/dinput) WINE_CONFIG_MAKEFILE(dlls/dinput/tests) diff --git a/dlls/dhtmled.ocx/tests/Makefile.in b/dlls/dhtmled.ocx/tests/Makefile.in new file mode 100644 index 00000000000..bf29f658dd9 --- /dev/null +++ b/dlls/dhtmled.ocx/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = dhtmled.ocx +IMPORTS = ole32 + +C_SRCS = \ + oleobj.c diff --git a/dlls/dhtmled.ocx/tests/oleobj.c b/dlls/dhtmled.ocx/tests/oleobj.c new file mode 100644 index 00000000000..ffddde1bc82 --- /dev/null +++ b/dlls/dhtmled.ocx/tests/oleobj.c @@ -0,0 +1,158 @@ +/* + * Copyright 2021 Vijay Kiran Kamuju + * + * 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 + */ + +#define COBJMACROS + +#include +#include + +#include "wine/test.h" + +DEFINE_GUID(CLSID_DHTMLEdit, 0x2d360200, 0xfff5, 0x11d1, 0x8d, 0x03, 0x00, 0xa0, 0xc9, 0x59, 0xbc, 0x0a); + +static HRESULT cs_qi(REFIID,void**); + +static HRESULT WINAPI clientsite_QueryInterface(IOleClientSite* This, + REFIID riid, void **obj) +{ + return cs_qi(riid, obj); +} + +static ULONG WINAPI clientsite_AddRef(IOleClientSite* This) +{ + return 2; +} + +static ULONG WINAPI clientsite_Release(IOleClientSite* This) +{ + return 1; +} + +static HRESULT WINAPI clientsite_SaveObject(IOleClientSite* This) +{ + ok(0, "saveobject\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI clientsite_GetMoniker(IOleClientSite* This, + DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk) +{ + ok(0, "getmoniker\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI clientsite_GetContainer(IOleClientSite* This, + IOleContainer **ppContainer) +{ + ok(0, "getcontainer\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI clientsite_ShowObject(IOleClientSite* This) +{ + ok(0, "showobject\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI clientsite_OnShowWindow(IOleClientSite* This, + BOOL fShow) +{ + ok(0, "onshowwindow\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI clientsite_RequestNewObjectLayout(IOleClientSite* This) +{ + ok(0, "requestnewobjectlayout\n"); + return E_NOTIMPL; +} + +static IOleClientSiteVtbl clientsite_vtbl = { + clientsite_QueryInterface, + clientsite_AddRef, + clientsite_Release, + clientsite_SaveObject, + clientsite_GetMoniker, + clientsite_GetContainer, + clientsite_ShowObject, + clientsite_OnShowWindow, + clientsite_RequestNewObjectLayout +}; + +static IOleClientSite clientsite = { + &clientsite_vtbl +}; + +static HRESULT cs_qi(REFIID riid, void **ppv) +{ + if(IsEqualGUID(riid, &IID_IUnknown)) { + *ppv = &clientsite; + }else if(IsEqualGUID(riid, &IID_IOleClientSite)) { + *ppv = &clientsite; + }else { + trace("QI(%s)\n", wine_dbgstr_guid(riid)); + *ppv = NULL; + return E_NOINTERFACE; + } + + return S_OK; +} + +static void test_dhtmledit(void) +{ + IOleObject *oleobj; + IOleClientSite *site; + HRESULT hr; + DWORD status; + + hr = CoCreateInstance(&CLSID_DHTMLEdit, NULL, CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER, + &IID_IOleObject, (void**)&oleobj); + + if(hr == REGDB_E_CLASSNOTREG) { + win_skip("CLSID_DHTMLEdit not registered\n"); + return; + } + + ok(hr == S_OK, "CoCreateInstance(CLSID_DHTMLEdit) failed: %08x\n", hr); + + hr = IOleObject_SetClientSite(oleobj, &clientsite); + ok(hr == S_OK, "SetClientSite failed: %08x\n", hr); + + hr = IOleObject_GetMiscStatus(oleobj, DVASPECT_CONTENT, &status); + ok(hr == S_OK, "GetMiscStatus failed: %08x\n", hr); + ok(status == (OLEMISC_SETCLIENTSITEFIRST|OLEMISC_ACTIVATEWHENVISIBLE|OLEMISC_INSIDEOUT + |OLEMISC_CANTLINKINSIDE|OLEMISC_RECOMPOSEONRESIZE), "status = %x\n", status); + + hr = IOleObject_GetClientSite(oleobj, &site); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(site == &clientsite, "got %p, %p\n", site, &clientsite); + + hr = IOleObject_Close(oleobj, OLECLOSE_NOSAVE); + ok(hr == S_OK, "Close failed: %08x\n", hr); + + IOleObject_Release(oleobj); +} + +START_TEST(oleobj) +{ + CoInitialize(NULL); + + test_dhtmledit(); + + CoUninitialize(); +} -- 2.30.1