Commit 790109da authored by Mohamad Al-Jaf's avatar Mohamad Al-Jaf Committed by Alexandre Julliard

windows.networking.hostname/tests: Add IHostNameFactory::CreateHostName() tests.

parent e814a2b1
...@@ -48,10 +48,13 @@ static void check_interface_( unsigned int line, void *obj, const IID *iid ) ...@@ -48,10 +48,13 @@ static void check_interface_( unsigned int line, void *obj, const IID *iid )
static void test_HostnameStatics(void) static void test_HostnameStatics(void)
{ {
static const WCHAR *hostname_statics_name = L"Windows.Networking.HostName"; static const WCHAR *hostname_statics_name = L"Windows.Networking.HostName";
static const WCHAR *ip = L"192.168.0.0";
IHostNameFactory *hostnamefactory; IHostNameFactory *hostnamefactory;
IActivationFactory *factory; IActivationFactory *factory;
HSTRING str; HSTRING str, rawname;
IHostName *hostname;
HRESULT hr; HRESULT hr;
INT32 res;
LONG ref; LONG ref;
hr = WindowsCreateString( hostname_statics_name, wcslen( hostname_statics_name ), &str ); hr = WindowsCreateString( hostname_statics_name, wcslen( hostname_statics_name ), &str );
...@@ -72,7 +75,29 @@ static void test_HostnameStatics(void) ...@@ -72,7 +75,29 @@ static void test_HostnameStatics(void)
hr = IActivationFactory_QueryInterface( factory, &IID_IHostNameFactory, (void **)&hostnamefactory ); hr = IActivationFactory_QueryInterface( factory, &IID_IHostNameFactory, (void **)&hostnamefactory );
ok( hr == S_OK, "got hr %#lx.\n", hr ); ok( hr == S_OK, "got hr %#lx.\n", hr );
hr = WindowsCreateString( ip, wcslen( ip ), &str );
ok( hr == S_OK, "got hr %#lx.\n", hr );
hr = IHostNameFactory_CreateHostName( hostnamefactory, NULL, &hostname );
todo_wine ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr );
hr = IHostNameFactory_CreateHostName( hostnamefactory, str, NULL );
todo_wine ok( hr == E_POINTER, "got hr %#lx.\n", hr );
hr = IHostNameFactory_CreateHostName( hostnamefactory, NULL, NULL );
todo_wine ok( hr == E_POINTER, "got hr %#lx.\n", hr );
hr = IHostNameFactory_CreateHostName( hostnamefactory, str, &hostname );
todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr );
todo_wine ok( hostname != NULL, "got NULL hostname %p.\n", hostname );
hr = IHostName_get_RawName( hostname, NULL );
todo_wine ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr );
hr = IHostName_get_RawName( hostname, &rawname );
todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr );
hr = WindowsCompareStringOrdinal( str, rawname, &res );
todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr );
todo_wine ok( !res, "got unexpected string %s.\n", debugstr_hstring(rawname) );
WindowsDeleteString( str );
WindowsDeleteString( rawname );
ref = IHostNameFactory_Release( hostnamefactory ); ref = IHostNameFactory_Release( hostnamefactory );
ok( ref == 2, "got ref %ld.\n", ref ); ok( ref == 2, "got ref %ld.\n", ref );
ref = IActivationFactory_Release( factory ); ref = IActivationFactory_Release( factory );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment