wbemprox/tests: Add tests for Win32_SystemEnclosure.
This commit is contained in:
parent
d20c5965f1
commit
856b03501a
|
@ -412,6 +412,120 @@ out:
|
|||
SysFreeString( wql );
|
||||
}
|
||||
|
||||
static void test_Win32_SystemEnclosure( IWbemServices *services )
|
||||
{
|
||||
static const WCHAR queryW[] =
|
||||
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_',
|
||||
'S','y','s','t','e','m','E','n','c','l','o','s','u','r','e',0};
|
||||
static const WCHAR captionW[] = {'C','a','p','t','i','o','n',0};
|
||||
static const WCHAR chassistypesW[] = {'C','h','a','s','s','i','s','T','y','p','e','s',0};
|
||||
static const WCHAR descriptionW[] = {'D','e','s','c','r','i','p','t','i','o','n',0};
|
||||
static const WCHAR lockpresentW[] = {'L','o','c','k','P','r','e','s','e','n','t',0};
|
||||
static const WCHAR manufacturerW[] = {'M','a','n','u','f','a','c','t','u','r','e','r',0};
|
||||
static const WCHAR nameW[] = {'N','a','m','e',0};
|
||||
static const WCHAR tagW[] = {'T','a','g',0};
|
||||
BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW );
|
||||
IEnumWbemClassObject *result;
|
||||
IWbemClassObject *obj;
|
||||
CIMTYPE type;
|
||||
ULONG count;
|
||||
VARIANT val;
|
||||
DWORD *data;
|
||||
HRESULT hr;
|
||||
|
||||
hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result );
|
||||
ok( hr == S_OK, "IWbemServices_ExecQuery failed %08x\n", hr );
|
||||
|
||||
hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count );
|
||||
todo_wine
|
||||
ok( hr == S_OK, "IEnumWbemClassObject_Next failed %08x\n", hr );
|
||||
if (hr != S_OK)
|
||||
goto done;
|
||||
|
||||
type = 0xdeadbeef;
|
||||
VariantInit( &val );
|
||||
hr = IWbemClassObject_Get( obj, captionW, 0, &val, &type, NULL );
|
||||
ok( hr == S_OK, "failed to get caption %08x\n", hr );
|
||||
ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) );
|
||||
ok( type == CIM_STRING, "unexpected type 0x%x\n", type );
|
||||
trace( "caption: %s\n", wine_dbgstr_w(V_BSTR( &val )) );
|
||||
VariantClear( &val );
|
||||
|
||||
type = 0xdeadbeef;
|
||||
VariantInit( &val );
|
||||
hr = IWbemClassObject_Get( obj, chassistypesW, 0, &val, &type, NULL );
|
||||
ok( hr == S_OK, "failed to get chassis types %08x\n", hr );
|
||||
ok( V_VT( &val ) == (VT_I4|VT_ARRAY), "unexpected variant type 0x%x\n", V_VT( &val ) );
|
||||
ok( type == (CIM_UINT16|CIM_FLAG_ARRAY), "unexpected type 0x%x\n", type );
|
||||
hr = SafeArrayAccessData( V_ARRAY( &val ), (void **)&data );
|
||||
ok( hr == S_OK, "SafeArrayAccessData failed %x\n", hr );
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
LONG i, lower, upper;
|
||||
|
||||
hr = SafeArrayGetLBound( V_ARRAY( &val ), 1, &lower );
|
||||
ok( hr == S_OK, "SafeArrayGetLBound failed %x\n", hr );
|
||||
hr = SafeArrayGetUBound( V_ARRAY( &val ), 1, &upper );
|
||||
ok( hr == S_OK, "SafeArrayGetUBound failed %x\n", hr );
|
||||
for (i = 0; i < upper - lower + 1; i++)
|
||||
trace( "chassis type: %u\n", data[i] );
|
||||
hr = SafeArrayUnaccessData( V_ARRAY( &val ) );
|
||||
ok( hr == S_OK, "SafeArrayUnaccessData failed %x\n", hr );
|
||||
}
|
||||
VariantClear( &val );
|
||||
|
||||
type = 0xdeadbeef;
|
||||
VariantInit( &val );
|
||||
hr = IWbemClassObject_Get( obj, descriptionW, 0, &val, &type, NULL );
|
||||
ok( hr == S_OK, "failed to get description %08x\n", hr );
|
||||
ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) );
|
||||
ok( type == CIM_STRING, "unexpected type 0x%x\n", type );
|
||||
trace( "description: %s\n", wine_dbgstr_w(V_BSTR( &val )) );
|
||||
VariantClear( &val );
|
||||
|
||||
type = 0xdeadbeef;
|
||||
VariantInit( &val );
|
||||
hr = IWbemClassObject_Get( obj, lockpresentW, 0, &val, &type, NULL );
|
||||
ok( hr == S_OK, "failed to get lockpresent %08x\n", hr );
|
||||
ok( V_VT( &val ) == VT_BOOL, "unexpected variant type 0x%x\n", V_VT( &val ) );
|
||||
ok( type == CIM_BOOLEAN, "unexpected type 0x%x\n", type );
|
||||
trace( "lockpresent: %u\n", V_BOOL( &val ) );
|
||||
VariantClear( &val );
|
||||
|
||||
type = 0xdeadbeef;
|
||||
VariantInit( &val );
|
||||
hr = IWbemClassObject_Get( obj, manufacturerW, 0, &val, &type, NULL );
|
||||
ok( hr == S_OK, "failed to get manufacturer %08x\n", hr );
|
||||
ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) );
|
||||
ok( type == CIM_STRING, "unexpected type 0x%x\n", type );
|
||||
trace( "manufacturer: %s\n", wine_dbgstr_w(V_BSTR( &val )) );
|
||||
VariantClear( &val );
|
||||
|
||||
type = 0xdeadbeef;
|
||||
VariantInit( &val );
|
||||
hr = IWbemClassObject_Get( obj, nameW, 0, &val, &type, NULL );
|
||||
ok( hr == S_OK, "failed to get name %08x\n", hr );
|
||||
ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) );
|
||||
ok( type == CIM_STRING, "unexpected type 0x%x\n", type );
|
||||
trace( "name: %s\n", wine_dbgstr_w(V_BSTR( &val )) );
|
||||
VariantClear( &val );
|
||||
|
||||
type = 0xdeadbeef;
|
||||
VariantInit( &val );
|
||||
hr = IWbemClassObject_Get( obj, tagW, 0, &val, &type, NULL );
|
||||
ok( hr == S_OK, "failed to get tag %08x\n", hr );
|
||||
ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) );
|
||||
ok( type == CIM_STRING, "unexpected type 0x%x\n", type );
|
||||
trace( "tag: %s\n", wine_dbgstr_w(V_BSTR( &val )) );
|
||||
VariantClear( &val );
|
||||
|
||||
IWbemClassObject_Release( obj );
|
||||
done:
|
||||
IEnumWbemClassObject_Release( result );
|
||||
SysFreeString( query );
|
||||
SysFreeString( wql );
|
||||
}
|
||||
|
||||
static void test_StdRegProv( IWbemServices *services )
|
||||
{
|
||||
static const WCHAR enumkeyW[] = {'E','n','u','m','K','e','y',0};
|
||||
|
@ -828,6 +942,7 @@ START_TEST(query)
|
|||
test_Win32_Process( services );
|
||||
test_Win32_Service( services );
|
||||
test_Win32_ComputerSystem( services );
|
||||
test_Win32_SystemEnclosure( services );
|
||||
test_StdRegProv( services );
|
||||
test_notification_query_async( services );
|
||||
test_query_async( services );
|
||||
|
|
Loading…
Reference in New Issue