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

windows.storage.applicationdata/tests: Add IApplicationDataStatics::get_Current() tests.

parent f36a84d7
......@@ -55,6 +55,48 @@ static void check_interface_( unsigned int line, void *obj, const IID *iid )
IUnknown_Release( unk );
}
static void test_ApplicationDataStatics(void)
{
static const WCHAR *application_data_statics_name = L"Windows.Storage.ApplicationData";
IApplicationDataStatics *application_data_statics;
IApplicationData *application_data;
IActivationFactory *factory;
HSTRING str;
HRESULT hr;
LONG ref;
hr = WindowsCreateString( application_data_statics_name, wcslen( application_data_statics_name ), &str );
ok( hr == S_OK, "got hr %#lx.\n", hr );
hr = RoGetActivationFactory( str, &IID_IActivationFactory, (void **)&factory );
WindowsDeleteString( str );
ok( hr == S_OK || broken( hr == REGDB_E_CLASSNOTREG ), "got hr %#lx.\n", hr );
if (hr == REGDB_E_CLASSNOTREG)
{
win_skip( "%s runtimeclass not registered, skipping tests.\n", wine_dbgstr_w( application_data_statics_name ) );
return;
}
check_interface( factory, &IID_IUnknown );
check_interface( factory, &IID_IInspectable );
check_interface( factory, &IID_IAgileObject );
hr = IActivationFactory_QueryInterface( factory, &IID_IApplicationDataStatics, (void **)&application_data_statics );
ok( hr == S_OK, "got hr %#lx.\n", hr );
hr = IApplicationDataStatics_get_Current( application_data_statics, NULL );
todo_wine ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr );
hr = IApplicationDataStatics_get_Current( application_data_statics, &application_data );
todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr );
todo_wine ok( application_data != NULL, "got NULL application_data %p.\n", application_data );
if (application_data) IApplicationData_Release( application_data );
ref = IApplicationDataStatics_Release( application_data_statics );
ok( ref == 2, "got ref %ld.\n", ref );
ref = IActivationFactory_Release( factory );
ok( ref == 1, "got ref %ld.\n", ref );
}
static void test_PackageStatics(void)
{
static const WCHAR *package_statics_name = L"Windows.ApplicationModel.Package";
......@@ -143,6 +185,7 @@ int main( int argc, char const *argv[] )
hr = RoInitialize( RO_INIT_MULTITHREADED );
ok( hr == S_OK, "RoInitialize failed, hr %#lx\n", hr );
test_ApplicationDataStatics();
test_PackageStatics();
RoUninitialize();
......
......@@ -571,6 +571,7 @@ static void test_PackageStatics(void)
hr = IPackageStatics_get_Current( package_statics, &package );
todo_wine ok( hr == 0x80073d54, "got hr %#lx.\n", hr );
todo_wine ok( !package, "got package %p.\n", package );
if (package) IPackage_Release( package );
ref = IPackageStatics_Release( package_statics );
ok( ref == 2, "got ref %ld.\n", ref );
......
......@@ -49,6 +49,7 @@ static void test_ApplicationDataStatics(void)
{
static const WCHAR *application_data_statics_name = L"Windows.Storage.ApplicationData";
IApplicationDataStatics *application_data_statics;
IApplicationData *application_data = NULL;
IActivationFactory *factory;
HSTRING str;
HRESULT hr;
......@@ -73,6 +74,13 @@ static void test_ApplicationDataStatics(void)
hr = IActivationFactory_QueryInterface( factory, &IID_IApplicationDataStatics, (void **)&application_data_statics );
ok( hr == S_OK, "got hr %#lx.\n", hr );
hr = IApplicationDataStatics_get_Current( application_data_statics, NULL );
todo_wine ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr );
hr = IApplicationDataStatics_get_Current( application_data_statics, &application_data );
todo_wine ok( hr == 0x80073d54, "got hr %#lx.\n", hr );
todo_wine ok( !application_data, "got application_data %p.\n", application_data );
if (application_data) IApplicationData_Release( application_data );
ref = IApplicationDataStatics_Release( application_data_statics );
ok( ref == 2, "got ref %ld.\n", ref );
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