Commit 151f3fc2 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wbemprox/tests: Add tests for Win32_Printer.

parent be9758f0
...@@ -1641,6 +1641,71 @@ static void test_Win32_VideoController( IWbemServices *services ) ...@@ -1641,6 +1641,71 @@ static void test_Win32_VideoController( IWbemServices *services )
SysFreeString( wql ); SysFreeString( wql );
} }
static void test_Win32_Printer( IWbemServices *services )
{
static const WCHAR deviceidW[] =
{'D','e','v','i','c','e','I','d',0};
static const WCHAR locationW[] =
{'L','o','c','a','t','i','o','n',0};
static const WCHAR portnameW[] =
{'P','o','r','t','N','a','m','e',0};
static const WCHAR queryW[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_',
'P','r','i','n','t','e','r',0};
BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW );
IEnumWbemClassObject *result;
IWbemClassObject *obj;
VARIANT val;
CIMTYPE type;
HRESULT hr;
DWORD count;
hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result );
if (hr != S_OK)
{
win_skip( "Win32_Printer not available\n" );
return;
}
for (;;)
{
hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count );
if (hr != S_OK) break;
type = 0xdeadbeef;
memset( &val, 0, sizeof(val) );
hr = IWbemClassObject_Get( obj, deviceidW, 0, &val, &type, NULL );
ok( hr == S_OK, "got %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( "deviceid %s\n", wine_dbgstr_w(V_BSTR( &val )) );
VariantClear( &val );
type = 0xdeadbeef;
memset( &val, 0, sizeof(val) );
hr = IWbemClassObject_Get( obj, locationW, 0, &val, &type, NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( V_VT( &val ) == VT_BSTR || V_VT( &val ) == VT_NULL, "unexpected variant type 0x%x\n", V_VT( &val ) );
ok( type == CIM_STRING, "unexpected type 0x%x\n", type );
trace( "location %s\n", wine_dbgstr_w(V_BSTR( &val )) );
VariantClear( &val );
type = 0xdeadbeef;
memset( &val, 0, sizeof(val) );
hr = IWbemClassObject_Get( obj, portnameW, 0, &val, &type, NULL );
ok( hr == S_OK, "got %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( "portname %s\n", wine_dbgstr_w(V_BSTR( &val )) );
VariantClear( &val );
IWbemClassObject_Release( obj );
}
SysFreeString( query );
SysFreeString( wql );
}
START_TEST(query) START_TEST(query)
{ {
static const WCHAR cimv2W[] = {'R','O','O','T','\\','C','I','M','V','2',0}; static const WCHAR cimv2W[] = {'R','O','O','T','\\','C','I','M','V','2',0};
...@@ -1684,6 +1749,7 @@ START_TEST(query) ...@@ -1684,6 +1749,7 @@ START_TEST(query)
test_Win32_IP4RouteTable( services ); test_Win32_IP4RouteTable( services );
test_Win32_Processor( services ); test_Win32_Processor( services );
test_Win32_VideoController( services ); test_Win32_VideoController( services );
test_Win32_Printer( services );
SysFreeString( path ); SysFreeString( path );
IWbemServices_Release( services ); IWbemServices_Release( services );
......
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