mirror of
https://gitlab.winehq.org/wine/wine.git
synced 2024-11-19 17:06:04 -07:00
iertutil/tests: Add IUriRuntimeClassFactory tests.
This commit is contained in:
parent
8734c9db41
commit
bc82bbdc80
Notes:
Alexandre Julliard
2024-11-05 22:27:45 +01:00
Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6773
4 changed files with 107 additions and 0 deletions
1
configure
vendored
1
configure
vendored
|
@ -22124,6 +22124,7 @@ wine_fn_config_makefile dlls/ieframe enable_ieframe
|
|||
wine_fn_config_makefile dlls/ieframe/tests enable_tests
|
||||
wine_fn_config_makefile dlls/ieproxy enable_ieproxy
|
||||
wine_fn_config_makefile dlls/iertutil enable_iertutil
|
||||
wine_fn_config_makefile dlls/iertutil/tests enable_tests
|
||||
wine_fn_config_makefile dlls/ifsmgr.vxd enable_win16
|
||||
wine_fn_config_makefile dlls/imaadp32.acm enable_imaadp32_acm
|
||||
wine_fn_config_makefile dlls/imagehlp enable_imagehlp
|
||||
|
|
|
@ -2701,6 +2701,7 @@ WINE_CONFIG_MAKEFILE(dlls/ieframe)
|
|||
WINE_CONFIG_MAKEFILE(dlls/ieframe/tests)
|
||||
WINE_CONFIG_MAKEFILE(dlls/ieproxy)
|
||||
WINE_CONFIG_MAKEFILE(dlls/iertutil)
|
||||
WINE_CONFIG_MAKEFILE(dlls/iertutil/tests)
|
||||
WINE_CONFIG_MAKEFILE(dlls/ifsmgr.vxd,enable_win16)
|
||||
WINE_CONFIG_MAKEFILE(dlls/imaadp32.acm)
|
||||
WINE_CONFIG_MAKEFILE(dlls/imagehlp)
|
||||
|
|
5
dlls/iertutil/tests/Makefile.in
Normal file
5
dlls/iertutil/tests/Makefile.in
Normal file
|
@ -0,0 +1,5 @@
|
|||
TESTDLL = iertutil.dll
|
||||
IMPORTS = combase uuid
|
||||
|
||||
SOURCES = \
|
||||
iertutil.c
|
100
dlls/iertutil/tests/iertutil.c
Normal file
100
dlls/iertutil/tests/iertutil.c
Normal file
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* Copyright 2024 Zhiyi Zhang for CodeWeavers
|
||||
*
|
||||
* 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 <stdarg.h>
|
||||
#include "initguid.h"
|
||||
#include "roapi.h"
|
||||
#include "winbase.h"
|
||||
#include "winstring.h"
|
||||
#include "wine/debug.h"
|
||||
#include "wine/test.h"
|
||||
|
||||
#define WIDL_using_Windows_Foundation
|
||||
#include "windows.foundation.h"
|
||||
|
||||
static void test_IUriRuntimeClassFactory(void)
|
||||
{
|
||||
static const WCHAR *class_name = L"Windows.Foundation.Uri";
|
||||
IAgileObject *agile_object = NULL, *tmp_agile_object = NULL;
|
||||
IInspectable *inspectable = NULL, *tmp_inspectable = NULL;
|
||||
IUriRuntimeClassFactory *uri_factory = NULL;
|
||||
IActivationFactory *factory = NULL;
|
||||
IUriRuntimeClass *uri_class = NULL;
|
||||
HSTRING str, uri;
|
||||
HRESULT hr;
|
||||
|
||||
hr = RoInitialize(RO_INIT_MULTITHREADED);
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = WindowsCreateString(class_name, wcslen(class_name), &str);
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
hr = RoGetActivationFactory(str, &IID_IActivationFactory, (void **)&factory);
|
||||
ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG), "RoGetActivationFactory failed, hr %#lx.\n", hr);
|
||||
WindowsDeleteString(str);
|
||||
if (hr == REGDB_E_CLASSNOTREG)
|
||||
{
|
||||
win_skip("%s runtimeclass not registered, skipping tests.\n", wine_dbgstr_w(class_name));
|
||||
RoUninitialize();
|
||||
return;
|
||||
}
|
||||
|
||||
hr = IActivationFactory_QueryInterface(factory, &IID_IInspectable, (void **)&inspectable);
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = IActivationFactory_QueryInterface(factory, &IID_IAgileObject, (void **)&agile_object);
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = IActivationFactory_QueryInterface(factory, &IID_IUriRuntimeClassFactory, (void **)&uri_factory);
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = IUriRuntimeClassFactory_QueryInterface(uri_factory, &IID_IInspectable, (void **)&tmp_inspectable);
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
ok(tmp_inspectable == inspectable, "QueryInterface IID_IInspectable returned %p, expected %p.\n",
|
||||
tmp_inspectable, inspectable);
|
||||
IInspectable_Release(tmp_inspectable);
|
||||
IInspectable_Release(inspectable);
|
||||
|
||||
hr = IUriRuntimeClassFactory_QueryInterface(uri_factory, &IID_IAgileObject, (void **)&tmp_agile_object);
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
ok(tmp_agile_object == agile_object, "QueryInterface IID_IAgileObject returned %p, expected %p.\n",
|
||||
tmp_agile_object, agile_object);
|
||||
IAgileObject_Release(tmp_agile_object);
|
||||
IAgileObject_Release(agile_object);
|
||||
|
||||
/* Test IUriRuntimeClassFactory_CreateUri() */
|
||||
hr = WindowsCreateString(L"https://www.winehq.org", wcslen(L"https://www.winehq.org"), &uri);
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = IUriRuntimeClassFactory_CreateUri(uri_factory, NULL, &uri_class);
|
||||
ok(hr == E_POINTER, "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = IUriRuntimeClassFactory_CreateUri(uri_factory, uri, &uri_class);
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
IUriRuntimeClass_Release(uri_class);
|
||||
|
||||
WindowsDeleteString(uri);
|
||||
|
||||
IUriRuntimeClassFactory_Release(uri_factory);
|
||||
IActivationFactory_Release(factory);
|
||||
RoUninitialize();
|
||||
}
|
||||
|
||||
START_TEST(iertutil)
|
||||
{
|
||||
test_IUriRuntimeClassFactory();
|
||||
}
|
Loading…
Reference in a new issue