wbemprox/tests: Add IEnumWbemClassObject::Next() tests.
Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com> Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
97aeeb0142
commit
2cc89668fe
|
@ -25,6 +25,7 @@
|
|||
#include "initguid.h"
|
||||
#include "objidl.h"
|
||||
#include "wbemcli.h"
|
||||
#include "wine/heap.h"
|
||||
#include "wine/test.h"
|
||||
|
||||
static HRESULT exec_query( IWbemServices *services, const WCHAR *str, IEnumWbemClassObject **result )
|
||||
|
@ -158,6 +159,70 @@ static void test_associators( IWbemServices *services )
|
|||
}
|
||||
}
|
||||
|
||||
static void test_IEnumWbemClassObject_Next( IWbemServices *services )
|
||||
{
|
||||
BSTR wql = SysAllocString( L"wql" ), query = SysAllocString( L"SELECT * FROM Win32_IP4RouteTable" );
|
||||
IWbemClassObject **obj, *obj1;
|
||||
IEnumWbemClassObject *result;
|
||||
DWORD count, num_objects = 0;
|
||||
HRESULT hr;
|
||||
int i;
|
||||
|
||||
hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
count = 2;
|
||||
hr = IEnumWbemClassObject_Next( result, 10000, 1, NULL, &count );
|
||||
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
||||
ok( count == 2, "expected 0, got %u\n", count );
|
||||
|
||||
hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj1, NULL );
|
||||
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
||||
|
||||
count = 2;
|
||||
hr = IEnumWbemClassObject_Next( result, 10000, 0, &obj1, &count );
|
||||
todo_wine ok( hr == S_OK, "got %08x\n", hr );
|
||||
todo_wine ok( count == 0, "expected 0, got %u\n", count );
|
||||
|
||||
for (;;)
|
||||
{
|
||||
hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj1, &count );
|
||||
if (hr != S_OK) break;
|
||||
num_objects++;
|
||||
IWbemClassObject_Release(obj1);
|
||||
}
|
||||
|
||||
hr = IEnumWbemClassObject_Reset( result );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
obj = heap_alloc( num_objects * sizeof( IWbemClassObject * ) );
|
||||
|
||||
count = 0;
|
||||
hr = IEnumWbemClassObject_Next( result, 10000, num_objects, obj, &count );
|
||||
todo_wine ok( hr == S_OK, "got %08x\n", hr );
|
||||
todo_wine ok( count == num_objects, "expected %u, got %u\n", num_objects, count );
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
IWbemClassObject_Release( obj[i] );
|
||||
|
||||
hr = IEnumWbemClassObject_Reset( result );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
count = 0;
|
||||
hr = IEnumWbemClassObject_Next( result, 10000, num_objects + 1, obj, &count );
|
||||
todo_wine ok( hr == S_FALSE, "got %08x\n", hr );
|
||||
todo_wine ok( count == num_objects, "expected %u, got %u\n", num_objects, count );
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
IWbemClassObject_Release( obj[i] );
|
||||
|
||||
heap_free( obj );
|
||||
|
||||
IEnumWbemClassObject_Release( result );
|
||||
SysFreeString( query );
|
||||
SysFreeString( wql );
|
||||
}
|
||||
|
||||
static void _check_property( ULONG line, IWbemClassObject *obj, const WCHAR *prop, VARTYPE vartype, CIMTYPE cimtype )
|
||||
{
|
||||
CIMTYPE type = 0xdeadbeef;
|
||||
|
@ -1636,6 +1701,7 @@ START_TEST(query)
|
|||
ok( hr == S_OK, "failed to set proxy blanket %08x\n", hr );
|
||||
|
||||
test_GetNames( services );
|
||||
test_IEnumWbemClassObject_Next( services );
|
||||
test_associators( services );
|
||||
test_notification_query_async( services );
|
||||
test_query_async( services );
|
||||
|
|
Loading…
Reference in New Issue