Michael Stefaniuc : dsound/tests: Refcount tests for IDirectSoundCapture / IUnknown.

Alexandre Julliard julliard at winehq.org
Thu Aug 16 15:26:11 CDT 2012


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

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Thu Aug 16 01:22:58 2012 +0200

dsound/tests: Refcount tests for IDirectSoundCapture / IUnknown.

---

 dlls/dsound/tests/capture.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/dlls/dsound/tests/capture.c b/dlls/dsound/tests/capture.c
index 3d81194..ba52818 100644
--- a/dlls/dsound/tests/capture.c
+++ b/dlls/dsound/tests/capture.c
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#define COBJMACROS
 #include <stdio.h>
 #include "initguid.h"
 #include "windows.h"
@@ -671,6 +672,7 @@ static void test_COM(void)
     IDirectSoundCapture *dsc = (IDirectSoundCapture*)0xdeadbeef;
     IDirectSoundCaptureBuffer *buffer = (IDirectSoundCaptureBuffer*)0xdeadbeef;
     IDirectSoundNotify *notify;
+    IUnknown *unk;
     DSCBUFFERDESC bufdesc;
     WAVEFORMATEX wfx;
     HRESULT hr;
@@ -688,6 +690,17 @@ static void test_COM(void)
     }
     ok(hr == DS_OK, "DirectSoundCaptureCreate failed: %08x, expected DS_OK\n", hr);
 
+    /* Different refcount for IDirectSoundCapture and for IUnknown */
+    refcount = IDirectSoundCapture_AddRef(dsc);
+    ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
+    hr = IDirectSoundCapture_QueryInterface(dsc, &IID_IUnknown, (void**)&unk);
+    ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
+    refcount = IUnknown_AddRef(unk);
+    ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
+    IUnknown_Release(unk);
+    IUnknown_Release(unk);
+    IDirectSoundCapture_Release(dsc);
+
     init_format(&wfx, WAVE_FORMAT_PCM, 44100, 16, 1);
     ZeroMemory(&bufdesc, sizeof(bufdesc));
     bufdesc.dwSize = sizeof(bufdesc);




More information about the wine-cvs mailing list