Hans Leidekker : wbemprox/tests: Add tests for Win32_Printer.
Alexandre Julliard
julliard at winehq.org
Fri Mar 2 12:16:45 CST 2018
Module: wine
Branch: master
Commit: 151f3fc2f2b44999f7fbe171ab227f5da509a30f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=151f3fc2f2b44999f7fbe171ab227f5da509a30f
Author: Hans Leidekker <hans at codeweavers.com>
Date: Fri Mar 2 11:55:00 2018 +0100
wbemprox/tests: Add tests for Win32_Printer.
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wbemprox/tests/query.c | 66 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c
index 93d07ea..d95fdd9 100644
--- a/dlls/wbemprox/tests/query.c
+++ b/dlls/wbemprox/tests/query.c
@@ -1641,6 +1641,71 @@ static void test_Win32_VideoController( IWbemServices *services )
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)
{
static const WCHAR cimv2W[] = {'R','O','O','T','\\','C','I','M','V','2',0};
@@ -1684,6 +1749,7 @@ START_TEST(query)
test_Win32_IP4RouteTable( services );
test_Win32_Processor( services );
test_Win32_VideoController( services );
+ test_Win32_Printer( services );
SysFreeString( path );
IWbemServices_Release( services );
More information about the wine-cvs
mailing list