[PATCH v2 1/2] wbemprox/tests: Add IEnumWbemClassObject::Next() tests.
Hans Leidekker
hans at codeweavers.com
Tue Jul 28 04:35:07 CDT 2020
From: Gijs Vermeulen <gijsvrm at gmail.com>
Signed-off-by: Gijs Vermeulen <gijsvrm at gmail.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
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 73740f18c8..e99e221c30 100644
--- a/dlls/wbemprox/tests/query.c
+++ b/dlls/wbemprox/tests/query.c
@@ -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 );
--
2.27.0
More information about the wine-devel
mailing list