Sebastian Lackner : wbemprox/tests: Add tests for Win32_SystemEnclosure.

Alexandre Julliard julliard at wine.codeweavers.com
Fri May 22 04:48:25 CDT 2015


Module: wine
Branch: master
Commit: 856b03501a2ff896aad58a43dad272bd2aa7005e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=856b03501a2ff896aad58a43dad272bd2aa7005e

Author: Sebastian Lackner <sebastian at fds-team.de>
Date:   Fri May 22 07:55:14 2015 +0200

wbemprox/tests: Add tests for Win32_SystemEnclosure.

---

 dlls/wbemprox/tests/query.c | 115 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 115 insertions(+)

diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c
index 56c97ff..bc85e62 100644
--- a/dlls/wbemprox/tests/query.c
+++ b/dlls/wbemprox/tests/query.c
@@ -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 );




More information about the wine-cvs mailing list