Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/filesource.c | 104 ++++++++++++++++++++++++++++++++++++++++ dlls/quartz/tests/filtergraph.c | 7 ++- dlls/quartz/tests/util.h | 4 ++ 3 files changed, 111 insertions(+), 4 deletions(-) create mode 100644 dlls/quartz/tests/util.h
diff --git a/dlls/quartz/tests/filesource.c b/dlls/quartz/tests/filesource.c index b9040e2..9baff12 100644 --- a/dlls/quartz/tests/filesource.c +++ b/dlls/quartz/tests/filesource.c @@ -23,6 +23,8 @@ #include "dshow.h" #include "wine/test.h"
+#include "util.h" + static IBaseFilter *create_file_source(void) { IBaseFilter *filter = NULL; @@ -32,6 +34,18 @@ static IBaseFilter *create_file_source(void) return filter; }
+static void load_file(IBaseFilter *filter, const WCHAR *filename) +{ + IFileSourceFilter *filesource; + HRESULT hr; + + hr = IBaseFilter_QueryInterface(filter, &IID_IFileSourceFilter, (void **)&filesource); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IFileSourceFilter_Load(filesource, filename, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + IFileSourceFilter_Release(filesource); +} + #define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported) { @@ -192,11 +206,101 @@ static void test_file_source_filter(void) } }
+static void test_enum_pins(void) +{ + const WCHAR *filename = load_resource(avifile); + IBaseFilter *filter = create_file_source(); + IEnumPins *enum1, *enum2; + IPin *pins[2]; + ULONG count; + HRESULT hr; + ULONG ref; + BOOL ret; + + hr = IBaseFilter_EnumPins(filter, &enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumPins_Skip(enum1, 1); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + load_file(filter, filename); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); +todo_wine + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + IPin_Release(pins[0]); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum1, 1, pins, &count); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(count == 1, "Got count %u.\n", count); + IPin_Release(pins[0]); + + hr = IEnumPins_Next(enum1, 1, pins, &count); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(!count, "Got count %u.\n", count); + + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum1, 2, pins, NULL); + ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum1, 2, pins, &count); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(count == 1, "Got count %u.\n", count); + IPin_Release(pins[0]); + + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Clone(enum1, &enum2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Skip(enum1, 2); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumPins_Skip(enum1, 1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Skip(enum1, 1); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum2, 1, pins, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + IPin_Release(pins[0]); + + IEnumPins_Release(enum2); + IEnumPins_Release(enum1); + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ret = DeleteFileW(filename); + ok(ret, "Failed to delete file, error %u.\n", GetLastError()); +} + START_TEST(filesource) { CoInitialize(NULL);
test_interfaces(); + test_enum_pins(); test_file_source_filter();
CoUninitialize(); diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index 74a3b68..d125403 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -26,6 +26,8 @@ #include "wine/heap.h" #include "wine/test.h"
+#include "util.h" + typedef struct TestFilterImpl { IBaseFilter IBaseFilter_iface; @@ -39,10 +41,7 @@ typedef struct TestFilterImpl UINT nPins; } TestFilterImpl;
-static const WCHAR avifile[] = {'t','e','s','t','.','a','v','i',0}; -static const WCHAR mpegfile[] = {'t','e','s','t','.','m','p','g',0}; - -static WCHAR *load_resource(const WCHAR *name) +WCHAR *load_resource(const WCHAR *name) { static WCHAR pathW[MAX_PATH]; DWORD written; diff --git a/dlls/quartz/tests/util.h b/dlls/quartz/tests/util.h new file mode 100644 index 0000000..fe08c65 --- /dev/null +++ b/dlls/quartz/tests/util.h @@ -0,0 +1,4 @@ +static const WCHAR avifile[] = {'t','e','s','t','.','a','v','i',0}; +static const WCHAR mpegfile[] = {'t','e','s','t','.','m','p','g',0}; + +WCHAR *load_resource(const WCHAR *name);