[PATCH v2 1/5] quartz/tests: Add tests for IVMRFilterConfig9 on the VMR9 filter.

Zebediah Figura z.figura12 at gmail.com
Wed Apr 3 22:13:48 CDT 2019


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/quartz/tests/Makefile.in |   1 +
 dlls/quartz/tests/vmr9.c      | 146 ++++++++++++++++++++++++++++++++++
 2 files changed, 147 insertions(+)
 create mode 100644 dlls/quartz/tests/vmr9.c

diff --git a/dlls/quartz/tests/Makefile.in b/dlls/quartz/tests/Makefile.in
index ce59b73fca..1a12ffaa6a 100644
--- a/dlls/quartz/tests/Makefile.in
+++ b/dlls/quartz/tests/Makefile.in
@@ -15,6 +15,7 @@ C_SRCS = \
 	systemclock.c \
 	videorenderer.c \
 	vmr7.c \
+	vmr9.c \
 	waveparser.c
 
 
diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c
new file mode 100644
index 0000000000..2d642c6710
--- /dev/null
+++ b/dlls/quartz/tests/vmr9.c
@@ -0,0 +1,146 @@
+/*
+ * Video Mixing Renderer 9 unit tests
+ *
+ * Copyright 2019 Zebediah Figura
+ *
+ * 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 "dshow.h"
+#include "d3d9.h"
+#include "vmr9.h"
+#include "wine/test.h"
+
+static void test_filter_config(void)
+{
+    IVMRFilterConfig9 *config;
+    DWORD count, mode;
+    HRESULT hr;
+    ULONG ref;
+
+    hr = CoCreateInstance(&CLSID_VideoMixingRenderer9, NULL, CLSCTX_INPROC_SERVER,
+            &IID_IVMRFilterConfig9, (void **)&config);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+    hr = IVMRFilterConfig9_GetRenderingMode(config, &mode);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(mode == VMRMode_Windowed, "Got mode %#x.\n", mode);
+
+    hr = IVMRFilterConfig9_SetRenderingMode(config, VMR9Mode_Windowed);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+    hr = IVMRFilterConfig9_GetRenderingMode(config, &mode);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(mode == VMR9Mode_Windowed, "Got mode %#x.\n", mode);
+
+    hr = IVMRFilterConfig9_SetRenderingMode(config, VMR9Mode_Windowed);
+    ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+
+    ref = IVMRFilterConfig9_Release(config);
+    ok(!ref, "Got outstanding refcount %d.\n", ref);
+
+    hr = CoCreateInstance(&CLSID_VideoMixingRenderer9, NULL, CLSCTX_INPROC_SERVER,
+            &IID_IVMRFilterConfig9, (void **)&config);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+    hr = IVMRFilterConfig9_SetRenderingMode(config, VMR9Mode_Windowless);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+    hr = IVMRFilterConfig9_GetRenderingMode(config, &mode);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(mode == VMR9Mode_Windowless, "Got mode %#x.\n", mode);
+
+    hr = IVMRFilterConfig9_SetRenderingMode(config, VMR9Mode_Windowed);
+    ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+
+    ref = IVMRFilterConfig9_Release(config);
+    ok(!ref, "Got outstanding refcount %d.\n", ref);
+
+    hr = CoCreateInstance(&CLSID_VideoMixingRenderer9, NULL, CLSCTX_INPROC_SERVER,
+            &IID_IVMRFilterConfig9, (void **)&config);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+    hr = IVMRFilterConfig9_SetRenderingMode(config, VMR9Mode_Renderless);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+    hr = IVMRFilterConfig9_GetRenderingMode(config, &mode);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(mode == VMR9Mode_Renderless, "Got mode %#x.\n", mode);
+
+    hr = IVMRFilterConfig9_SetRenderingMode(config, VMR9Mode_Windowless);
+    ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+
+    ref = IVMRFilterConfig9_Release(config);
+    ok(!ref, "Got outstanding refcount %d.\n", ref);
+
+    hr = CoCreateInstance(&CLSID_VideoMixingRenderer9, NULL, CLSCTX_INPROC_SERVER,
+            &IID_IVMRFilterConfig9, (void **)&config);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+    hr = IVMRFilterConfig9_GetNumberOfStreams(config, &count);
+    todo_wine ok(hr == VFW_E_VMR_NOT_IN_MIXER_MODE, "Got hr %#x.\n", hr);
+
+    hr = IVMRFilterConfig9_SetNumberOfStreams(config, 3);
+    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+    hr = IVMRFilterConfig9_GetNumberOfStreams(config, &count);
+    todo_wine {
+        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(count == 3, "Got count %u.\n", count);
+    }
+
+    hr = IVMRFilterConfig9_GetRenderingMode(config, &mode);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(mode == VMR9Mode_Windowed, "Got mode %#x.\n", mode);
+
+    /* Despite MSDN, you can still change the rendering mode after setting the
+     * stream count. */
+    hr = IVMRFilterConfig9_SetRenderingMode(config, VMR9Mode_Windowless);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+    hr = IVMRFilterConfig9_GetRenderingMode(config, &mode);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(mode == VMR9Mode_Windowless, "Got mode %#x.\n", mode);
+
+    hr = IVMRFilterConfig9_GetNumberOfStreams(config, &count);
+    todo_wine {
+        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(count == 3, "Got count %u.\n", count);
+    }
+
+    ref = IVMRFilterConfig9_Release(config);
+    ok(!ref, "Got outstanding refcount %d.\n", ref);
+}
+
+START_TEST(vmr9)
+{
+    IBaseFilter *filter;
+    HRESULT hr;
+
+    CoInitialize(NULL);
+
+    if (FAILED(hr = CoCreateInstance(&CLSID_VideoMixingRenderer9, NULL,
+            CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (void **)&filter)))
+    {
+        skip("Failed to create VMR9, hr %#x.\n", hr);
+        return;
+    }
+    IBaseFilter_Release(filter);
+
+    test_filter_config();
+
+    CoUninitialize();
+}
-- 
2.20.1




More information about the wine-devel mailing list