[PATCH 1/6] amstream: Fix AMAudioData::QueryInterface.

Anton Baskanov baskanov at gmail.com
Wed Jul 27 07:51:48 CDT 2016


Signed-off-by: Anton Baskanov <baskanov at gmail.com>
---
 dlls/amstream/audiodata.c       |  1 -
 dlls/amstream/tests/Makefile.in |  3 +-
 dlls/amstream/tests/audiodata.c | 67 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 69 insertions(+), 2 deletions(-)
 create mode 100755 dlls/amstream/tests/audiodata.c

diff --git a/dlls/amstream/audiodata.c b/dlls/amstream/audiodata.c
index c3bc1a6..7adb0c2 100644
--- a/dlls/amstream/audiodata.c
+++ b/dlls/amstream/audiodata.c
@@ -43,7 +43,6 @@ static HRESULT WINAPI IAudioDataImpl_QueryInterface(IAudioData *iface, REFIID ri
     TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid(riid), ret_iface);
 
     if (IsEqualGUID(riid, &IID_IUnknown) ||
-        IsEqualGUID(riid, &IID_IMemoryData) ||
         IsEqualGUID(riid, &IID_IAudioData))
     {
         IAudioData_AddRef(iface);
diff --git a/dlls/amstream/tests/Makefile.in b/dlls/amstream/tests/Makefile.in
index 915ea0f..8288e9f 100644
--- a/dlls/amstream/tests/Makefile.in
+++ b/dlls/amstream/tests/Makefile.in
@@ -2,4 +2,5 @@ TESTDLL   = amstream.dll
 IMPORTS   = quartz ddraw oleaut32 ole32 user32
 
 C_SRCS = \
-	amstream.c
+	amstream.c \
+	audiodata.c
diff --git a/dlls/amstream/tests/audiodata.c b/dlls/amstream/tests/audiodata.c
new file mode 100755
index 0000000..7ea6b8d
--- /dev/null
+++ b/dlls/amstream/tests/audiodata.c
@@ -0,0 +1,67 @@
+/*
+ * Unit tests for AMAudioData
+ *
+ * Copyright 2016 Anton Baskanov
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#define COBJMACROS
+
+#include "wine/test.h"
+#include "amstream.h"
+
+static IUnknown *create_audio_data(void)
+{
+    IUnknown *audio_data = NULL;
+    HRESULT result = CoCreateInstance(&CLSID_AMAudioData, NULL, CLSCTX_INPROC_SERVER,
+            &IID_IUnknown, (void **)&audio_data);
+    ok(S_OK == result, "got 0x%08x\n", result);
+    return audio_data;
+}
+
+static void test_query_interface(void)
+{
+    IUnknown *unknown = create_audio_data();
+    IMemoryData *memory_data = NULL;
+    IAudioData *audio_data = NULL;
+
+    HRESULT result = S_OK;
+
+    result = IUnknown_QueryInterface(unknown, &IID_IMemoryData, (void **)&memory_data);
+    ok(E_NOINTERFACE == result, "got 0x%08x\n", result);
+    if (S_OK == result)
+    {
+        IMemoryData_Release(memory_data);
+    }
+
+    result = IUnknown_QueryInterface(unknown, &IID_IAudioData, (void **)&audio_data);
+    ok(S_OK == result, "got 0x%08x\n", result);
+    if (S_OK == result)
+    {
+        IAudioData_Release(audio_data);
+    }
+
+    IUnknown_Release(unknown);
+}
+
+START_TEST(audiodata)
+{
+    CoInitialize(NULL);
+
+    test_query_interface();
+
+    CoUninitialize();
+}
-- 
1.9.1




More information about the wine-patches mailing list