[PATCH 2/6] windows.media.speech/tests: Compare refcounts using a helper function.

Bernhard Kölbl besentv at gmail.com
Wed Apr 20 14:34:09 CDT 2022


Signed-off-by: Bernhard Kölbl <besentv at gmail.com>
---
 dlls/windows.media.speech/tests/speech.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c
index e4d65d3afd4..a8064948bd2 100644
--- a/dlls/windows.media.speech/tests/speech.c
+++ b/dlls/windows.media.speech/tests/speech.c
@@ -76,6 +76,14 @@ static inline void check_refcount_(unsigned int line, void *obj, LONG exp)
     ok_(__FILE__, line)(exp == ref, "Unexpected refcount %lu, expected %lu\n", ref, exp);
 }
 
+#define equal_refcount(obj, obj2) equal_refcount_(__LINE__, obj, obj2)
+static inline void equal_refcount_(unsigned int line, void *obj, void *obj2)
+{
+    LONG ref = get_ref(obj);
+    LONG ref2 = get_ref(obj2);
+    ok_(__FILE__, line)(ref == ref2, "Unequal refcount. Got obj_ref %lu, obj2_ref %lu\n", ref, ref2);
+}
+
 #define check_interface(obj, iid, exp) check_interface_(__LINE__, obj, iid, exp)
 static void check_interface_(unsigned int line, void *obj, const IID *iid, BOOL supported)
 {
@@ -996,13 +1004,7 @@ static void test_SpeechRecognizer(void)
         hr = IAsyncOperation_SpeechRecognitionCompilationResult_QueryInterface(operation, &IID_IAsyncInfo, (void **)&info);
         todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
 
-        /* Check if AsyncInfo and AsyncOperation share the same refcount. */
-        IAsyncOperation_SpeechRecognitionCompilationResult_AddRef(operation);
-        todo_wine check_refcount(operation, 3);
-        todo_wine check_refcount(info, 3);
-
-        IAsyncOperation_SpeechRecognitionCompilationResult_Release(operation);
-        todo_wine check_refcount(info, 2);
+        todo_wine equal_refcount(operation, info);
 
         id = 0xdeadbeef;
         hr = IAsyncInfo_get_Id(info, &id);
-- 
2.35.1




More information about the wine-devel mailing list