Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/Makefile.in | 1 + dlls/quartz/tests/avisplitter.c | 132 ---------------------------------- dlls/quartz/tests/filesource.c | 155 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 156 insertions(+), 132 deletions(-) create mode 100644 dlls/quartz/tests/filesource.c
diff --git a/dlls/quartz/tests/Makefile.in b/dlls/quartz/tests/Makefile.in index 2df9ca1..8ecced9 100644 --- a/dlls/quartz/tests/Makefile.in +++ b/dlls/quartz/tests/Makefile.in @@ -4,6 +4,7 @@ IMPORTS = oleaut32 ole32 advapi32 user32 C_SRCS = \ avisplitter.c \ dsoundrender.c \ + filesource.c \ filtergraph.c \ filtermapper.c \ memallocator.c \ diff --git a/dlls/quartz/tests/avisplitter.c b/dlls/quartz/tests/avisplitter.c index bc933d1..757b71c 100644 --- a/dlls/quartz/tests/avisplitter.c +++ b/dlls/quartz/tests/avisplitter.c @@ -139,137 +139,6 @@ static void test_basefilter(void) IBaseFilter_Release(base); }
-static void test_filesourcefilter(void) -{ - static const WCHAR prefix[] = {'w','i','n',0}; - static const struct - { - const char *label; - const char *data; - DWORD size; - const GUID *subtype; - } - tests[] = - { - { - "AVI", - "\x52\x49\x46\x46xxxx\x41\x56\x49\x20", - 12, - &MEDIASUBTYPE_Avi, - }, - { - "MPEG1 System", - "\x00\x00\x01\xBA\x21\x00\x01\x00\x01\x80\x00\x01\x00\x00\x01\xBB", - 16, - &MEDIASUBTYPE_MPEG1System, - }, - { - "MPEG1 Video", - "\x00\x00\x01\xB3", - 4, - &MEDIASUBTYPE_MPEG1Video, - }, - { - "MPEG1 Audio", - "\xFF\xE0", - 2, - &MEDIASUBTYPE_MPEG1Audio, - }, - { - "MPEG2 Program", - "\x00\x00\x01\xBA\x40", - 5, - &MEDIASUBTYPE_MPEG2_PROGRAM, - }, - { - "WAVE", - "\x52\x49\x46\x46xxxx\x57\x41\x56\x45", - 12, - &MEDIASUBTYPE_WAVE, - }, - { - "unknown format", - "Hello World", - 11, - NULL, /* FIXME: should be &MEDIASUBTYPE_NULL */ - }, - }; - WCHAR path[MAX_PATH], temp[MAX_PATH]; - IFileSourceFilter *filesource; - DWORD ret, written; - IBaseFilter *base; - AM_MEDIA_TYPE mt; - OLECHAR *olepath; - BOOL success; - HANDLE file; - HRESULT hr; - int i; - - ret = GetTempPathW(MAX_PATH, temp); - ok(ret, "GetTempPathW failed with error %u\n", GetLastError()); - ret = GetTempFileNameW(temp, prefix, 0, path); - ok(ret, "GetTempFileNameW failed with error %u\n", GetLastError()); - - for (i = 0; i < ARRAY_SIZE(tests); i++) - { - trace("Running test for %s\n", tests[i].label); - - file = CreateFileW(path, GENERIC_READ | GENERIC_WRITE, 0, NULL, - CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - ok(file != INVALID_HANDLE_VALUE, "CreateFileW failed with error %u\n", GetLastError()); - success = WriteFile(file, tests[i].data, tests[i].size, &written, NULL); - ok(success, "WriteFile failed with error %u\n", GetLastError()); - ok(written == tests[i].size, "could not write test data\n"); - CloseHandle(file); - - hr = CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER, - &IID_IBaseFilter, (void **)&base); - ok(hr == S_OK, "CoCreateInstance failed with %08x\n", hr); - hr = IBaseFilter_QueryInterface(base, &IID_IFileSourceFilter, (void **)&filesource); - ok(hr == S_OK, "IBaseFilter_QueryInterface failed with %08x\n", hr); - - olepath = (void *)0xdeadbeef; - hr = IFileSourceFilter_GetCurFile(filesource, &olepath, NULL); - ok(hr == S_OK, "expected S_OK, got %08x\n", hr); - ok(olepath == NULL, "expected NULL, got %p\n", olepath); - - hr = IFileSourceFilter_Load(filesource, NULL, NULL); - ok(hr == E_POINTER, "expected E_POINTER, got %08x\n", hr); - - hr = IFileSourceFilter_Load(filesource, path, NULL); - ok(hr == S_OK, "IFileSourceFilter_Load failed with %08x\n", hr); - - hr = IFileSourceFilter_GetCurFile(filesource, NULL, &mt); - ok(hr == E_POINTER, "expected E_POINTER, got %08x\n", hr); - - olepath = NULL; - hr = IFileSourceFilter_GetCurFile(filesource, &olepath, NULL); - ok(hr == S_OK, "expected S_OK, got %08x\n", hr); - CoTaskMemFree(olepath); - - olepath = NULL; - memset(&mt, 0x11, sizeof(mt)); - hr = IFileSourceFilter_GetCurFile(filesource, &olepath, &mt); - ok(hr == S_OK, "expected S_OK, got %08x\n", hr); - ok(!lstrcmpW(olepath, path), - "expected %s, got %s\n", wine_dbgstr_w(path), wine_dbgstr_w(olepath)); - if (tests[i].subtype) - { - ok(IsEqualGUID(&mt.majortype, &MEDIATYPE_Stream), - "expected MEDIATYPE_Stream, got %s\n", wine_dbgstr_guid(&mt.majortype)); - ok(IsEqualGUID(&mt.subtype, tests[i].subtype), - "expected %s, got %s\n", wine_dbgstr_guid(tests[i].subtype), wine_dbgstr_guid(&mt.subtype)); - } - CoTaskMemFree(olepath); - - IFileSourceFilter_Release(filesource); - IBaseFilter_Release(base); - - success = DeleteFileW(path); - ok(success, "DeleteFileW failed with error %u\n", GetLastError()); - } -} - static const WCHAR avifile[] = {'t','e','s','t','.','a','v','i',0};
static WCHAR *load_resource(const WCHAR *name) @@ -557,7 +426,6 @@ START_TEST(avisplitter)
test_query_interface(); test_basefilter(); - test_filesourcefilter(); test_filter_graph();
release_avisplitter(); diff --git a/dlls/quartz/tests/filesource.c b/dlls/quartz/tests/filesource.c new file mode 100644 index 0000000..15a091b --- /dev/null +++ b/dlls/quartz/tests/filesource.c @@ -0,0 +1,155 @@ +/* + * File source filter unit tests + * + * Copyright 2016 Sebastian Lackner + * + * 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 "wine/test.h" + +static void test_file_source_filter(void) +{ + static const WCHAR prefix[] = {'w','i','n',0}; + static const struct + { + const char *label; + const char *data; + DWORD size; + const GUID *subtype; + } + tests[] = + { + { + "AVI", + "\x52\x49\x46\x46xxxx\x41\x56\x49\x20", + 12, + &MEDIASUBTYPE_Avi, + }, + { + "MPEG1 System", + "\x00\x00\x01\xBA\x21\x00\x01\x00\x01\x80\x00\x01\x00\x00\x01\xBB", + 16, + &MEDIASUBTYPE_MPEG1System, + }, + { + "MPEG1 Video", + "\x00\x00\x01\xB3", + 4, + &MEDIASUBTYPE_MPEG1Video, + }, + { + "MPEG1 Audio", + "\xFF\xE0", + 2, + &MEDIASUBTYPE_MPEG1Audio, + }, + { + "MPEG2 Program", + "\x00\x00\x01\xBA\x40", + 5, + &MEDIASUBTYPE_MPEG2_PROGRAM, + }, + { + "WAVE", + "\x52\x49\x46\x46xxxx\x57\x41\x56\x45", + 12, + &MEDIASUBTYPE_WAVE, + }, + { + "unknown format", + "Hello World", + 11, + NULL, /* FIXME: should be &MEDIASUBTYPE_NULL */ + }, + }; + WCHAR path[MAX_PATH], temp[MAX_PATH]; + IFileSourceFilter *filesource; + IBaseFilter *filter; + AM_MEDIA_TYPE mt; + OLECHAR *olepath; + DWORD written; + HANDLE file; + HRESULT hr; + BOOL ret; + int i; + + GetTempPathW(MAX_PATH, temp); + GetTempFileNameW(temp, prefix, 0, path); + + for (i = 0; i < ARRAY_SIZE(tests); i++) + { + trace("Running test for %s.\n", tests[i].label); + + file = CreateFileW(path, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); + ok(file != INVALID_HANDLE_VALUE, "Failed to create file, error %u.\n", GetLastError()); + ret = WriteFile(file, tests[i].data, tests[i].size, &written, NULL); + ok(ret, "Failed to write file, error %u.\n", GetLastError()); + CloseHandle(file); + + CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER, + &IID_IBaseFilter, (void **)&filter); + IBaseFilter_QueryInterface(filter, &IID_IFileSourceFilter, (void **)&filesource); + + olepath = (void *)0xdeadbeef; + hr = IFileSourceFilter_GetCurFile(filesource, &olepath, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!olepath, "Got path %s.\n", wine_dbgstr_w(olepath)); + + hr = IFileSourceFilter_Load(filesource, NULL, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + + hr = IFileSourceFilter_Load(filesource, path, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IFileSourceFilter_GetCurFile(filesource, NULL, &mt); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + + olepath = NULL; + hr = IFileSourceFilter_GetCurFile(filesource, &olepath, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + CoTaskMemFree(olepath); + + olepath = NULL; + memset(&mt, 0x11, sizeof(mt)); + hr = IFileSourceFilter_GetCurFile(filesource, &olepath, &mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!lstrcmpW(olepath, path), "Expected path %s, got %s.\n", + wine_dbgstr_w(path), wine_dbgstr_w(olepath)); + ok(IsEqualGUID(&mt.majortype, &MEDIATYPE_Stream), "Got major type %s.\n", + wine_dbgstr_guid(&mt.majortype)); + if (tests[i].subtype) + ok(IsEqualGUID(&mt.subtype, tests[i].subtype), "Expected subtype %s, got %s.\n", + wine_dbgstr_guid(tests[i].subtype), wine_dbgstr_guid(&mt.subtype)); + CoTaskMemFree(olepath); + + IFileSourceFilter_Release(filesource); + IBaseFilter_Release(filter); + + ret = DeleteFileW(path); + ok(ret, "Failed to delete file, error %u\n", GetLastError()); + } +} + +START_TEST(filesource) +{ + CoInitialize(NULL); + + test_file_source_filter(); + + CoUninitialize(); +}
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/filesource.c | 53 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-)
diff --git a/dlls/quartz/tests/filesource.c b/dlls/quartz/tests/filesource.c index 15a091b..55c9bf2 100644 --- a/dlls/quartz/tests/filesource.c +++ b/dlls/quartz/tests/filesource.c @@ -2,6 +2,7 @@ * File source filter unit tests * * Copyright 2016 Sebastian Lackner + * Copyright 2018 Zebediah Figura * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,6 +23,54 @@ #include "dshow.h" #include "wine/test.h"
+static IBaseFilter *create_file_source(void) +{ + IBaseFilter *filter = NULL; + HRESULT hr = CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER, + &IID_IBaseFilter, (void **)&filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); + return filter; +} + +#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) +{ + IUnknown *iface = iface_ptr; + HRESULT hr, expected_hr; + IUnknown *unk; + + expected_hr = supported ? S_OK : E_NOINTERFACE; + + hr = IUnknown_QueryInterface(iface, iid, (void **)&unk); + ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr); + if (SUCCEEDED(hr)) + IUnknown_Release(unk); +} + +static void test_interfaces(void) +{ + IBaseFilter *filter = create_file_source(); + + check_interface(filter, &IID_IBaseFilter, TRUE); + check_interface(filter, &IID_IFileSourceFilter, TRUE); + +todo_wine + check_interface(filter, &IID_IAMFilterMiscFlags, FALSE); + check_interface(filter, &IID_IBasicAudio, FALSE); + check_interface(filter, &IID_IBasicVideo, FALSE); + check_interface(filter, &IID_IKsPropertySet, FALSE); + check_interface(filter, &IID_IMediaPosition, FALSE); + check_interface(filter, &IID_IMediaSeeking, FALSE); + check_interface(filter, &IID_IPersistPropertyBag, FALSE); + check_interface(filter, &IID_IPin, FALSE); + check_interface(filter, &IID_IQualityControl, FALSE); + check_interface(filter, &IID_IQualProp, FALSE); + check_interface(filter, &IID_IReferenceClock, FALSE); + check_interface(filter, &IID_IVideoWindow, FALSE); + + IBaseFilter_Release(filter); +} + static void test_file_source_filter(void) { static const WCHAR prefix[] = {'w','i','n',0}; @@ -101,8 +150,7 @@ static void test_file_source_filter(void) ok(ret, "Failed to write file, error %u.\n", GetLastError()); CloseHandle(file);
- CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER, - &IID_IBaseFilter, (void **)&filter); + filter = create_file_source(); IBaseFilter_QueryInterface(filter, &IID_IFileSourceFilter, (void **)&filesource);
olepath = (void *)0xdeadbeef; @@ -149,6 +197,7 @@ START_TEST(filesource) { CoInitialize(NULL);
+ test_interfaces(); test_file_source_filter();
CoUninitialize();
This reverts 9dedc4a795bfbd0ec5c65a3a9d4788875b2ebc09.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/filesource.c | 37 ------------------------------------- dlls/quartz/tests/filesource.c | 1 - 2 files changed, 38 deletions(-)
diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c index 67af560..e5904dc 100644 --- a/dlls/quartz/filesource.c +++ b/dlls/quartz/filesource.c @@ -41,7 +41,6 @@ typedef struct AsyncReader { BaseFilter filter; IFileSourceFilter IFileSourceFilter_iface; - IAMFilterMiscFlags IAMFilterMiscFlags_iface;
IPin * pOutputPin; LPOLESTR pszFileName; @@ -63,15 +62,9 @@ static inline AsyncReader *impl_from_IFileSourceFilter(IFileSourceFilter *iface) return CONTAINING_RECORD(iface, AsyncReader, IFileSourceFilter_iface); }
-static inline AsyncReader *impl_from_IAMFilterMiscFlags(IAMFilterMiscFlags *iface) -{ - return CONTAINING_RECORD(iface, AsyncReader, IAMFilterMiscFlags_iface); -} - static const IBaseFilterVtbl AsyncReader_Vtbl; static const IFileSourceFilterVtbl FileSource_Vtbl; static const IAsyncReaderVtbl FileAsyncReader_Vtbl; -static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl;
static HRESULT FileAsyncReader_Construct(HANDLE hFile, IBaseFilter * pBaseFilter, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
@@ -432,7 +425,6 @@ HRESULT AsyncReader_create(IUnknown * pUnkOuter, LPVOID * ppv) BaseFilter_Init(&pAsyncRead->filter, &AsyncReader_Vtbl, &CLSID_AsyncReader, (DWORD_PTR)(__FILE__ ": AsyncReader.csFilter"), &BaseFuncTable);
pAsyncRead->IFileSourceFilter_iface.lpVtbl = &FileSource_Vtbl; - pAsyncRead->IAMFilterMiscFlags_iface.lpVtbl = &IAMFilterMiscFlags_Vtbl; pAsyncRead->pOutputPin = NULL;
pAsyncRead->pszFileName = NULL; @@ -465,8 +457,6 @@ static HRESULT WINAPI AsyncReader_QueryInterface(IBaseFilter * iface, REFIID rii *ppv = &This->filter.IBaseFilter_iface; else if (IsEqualIID(riid, &IID_IFileSourceFilter)) *ppv = &This->IFileSourceFilter_iface; - else if (IsEqualIID(riid, &IID_IAMFilterMiscFlags)) - *ppv = &This->IAMFilterMiscFlags_iface;
if (*ppv) { @@ -1412,30 +1402,3 @@ static const IAsyncReaderVtbl FileAsyncReader_Vtbl = FileAsyncReader_BeginFlush, FileAsyncReader_EndFlush, }; - - -static HRESULT WINAPI AMFilterMiscFlags_QueryInterface(IAMFilterMiscFlags *iface, REFIID riid, void **ppv) { - AsyncReader *This = impl_from_IAMFilterMiscFlags(iface); - return IBaseFilter_QueryInterface(&This->filter.IBaseFilter_iface, riid, ppv); -} - -static ULONG WINAPI AMFilterMiscFlags_AddRef(IAMFilterMiscFlags *iface) { - AsyncReader *This = impl_from_IAMFilterMiscFlags(iface); - return IBaseFilter_AddRef(&This->filter.IBaseFilter_iface); -} - -static ULONG WINAPI AMFilterMiscFlags_Release(IAMFilterMiscFlags *iface) { - AsyncReader *This = impl_from_IAMFilterMiscFlags(iface); - return IBaseFilter_Release(&This->filter.IBaseFilter_iface); -} - -static ULONG WINAPI AMFilterMiscFlags_GetMiscFlags(IAMFilterMiscFlags *iface) { - return AM_FILTER_MISC_FLAGS_IS_SOURCE; -} - -static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl = { - AMFilterMiscFlags_QueryInterface, - AMFilterMiscFlags_AddRef, - AMFilterMiscFlags_Release, - AMFilterMiscFlags_GetMiscFlags -}; diff --git a/dlls/quartz/tests/filesource.c b/dlls/quartz/tests/filesource.c index 55c9bf2..b9040e2 100644 --- a/dlls/quartz/tests/filesource.c +++ b/dlls/quartz/tests/filesource.c @@ -54,7 +54,6 @@ static void test_interfaces(void) check_interface(filter, &IID_IBaseFilter, TRUE); check_interface(filter, &IID_IFileSourceFilter, TRUE);
-todo_wine check_interface(filter, &IID_IAMFilterMiscFlags, FALSE); check_interface(filter, &IID_IBasicAudio, FALSE); check_interface(filter, &IID_IBasicVideo, FALSE);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/strmbase/enumpins.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/strmbase/enumpins.c b/dlls/strmbase/enumpins.c index 55fa7ec..abfaf69 100644 --- a/dlls/strmbase/enumpins.c +++ b/dlls/strmbase/enumpins.c @@ -162,19 +162,19 @@ static HRESULT WINAPI IEnumPinsImpl_Next(IEnumPins * iface, ULONG cPins, IPin ** return S_OK; }
-static HRESULT WINAPI IEnumPinsImpl_Skip(IEnumPins * iface, ULONG cPins) +static HRESULT WINAPI IEnumPinsImpl_Skip(IEnumPins *iface, ULONG count) { - IEnumPinsImpl *This = impl_from_IEnumPins(iface); + IEnumPinsImpl *enum_pins = impl_from_IEnumPins(iface);
- TRACE("(%p)->(%u)\n", iface, cPins); + TRACE("enum_pins %p, count %u.\n", enum_pins, count);
- if (This->Version != This->receive_version(This->base)) + if (enum_pins->Version != enum_pins->receive_version(enum_pins->base)) return VFW_E_ENUM_OUT_OF_SYNC;
- if (This->receive_pincount(This->base) >= This->uIndex + cPins) + if (enum_pins->uIndex + count > enum_pins->receive_pincount(enum_pins->base)) return S_FALSE;
- This->uIndex += cPins; + enum_pins->uIndex += count; return S_OK; }
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);
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=42572
Your paranoid android.
=== build (build log) ===
make: *** No rule to make target 'dlls/strmbase/tests'. Stop. Task: The exe32 Wine crossbuild failed
Zebediah Figura z.figura12@gmail.com writes:
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);
It's better to avoid dependencies between test files when possible. load_resource() is only a few lines and can be duplicated where needed.
On 27/09/18 03:15, Alexandre Julliard wrote:
Zebediah Figura z.figura12@gmail.com writes:
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);
It's better to avoid dependencies between test files when possible. load_resource() is only a few lines and can be duplicated where needed.
The impetus to adding a common header is not so much load_resource() as to be able to reuse the whole testfilter/testpin infrastructure. It's useful to be able to connect stock filters to custom filters to test things like how media types are negotiated, how allocators are negotiated, how data flows, how EOS/flush/segment notifications are generated and passed on. Completely avoiding that interdependency would necessitate duplication of at least 800 lines of code, once per filter (of which there are at least 9 in quartz), which seems to me less than desirable, and I figured that as long as code sharing would be desirable than we might as well share some other utility functions.
I guess one alternative is not to give each source filter its own unit test, though I'd really rather not do this: it makes more organizational sense this way, and filters often need subtle differences in how their test functions are written. test_enum_pins() is a good example: the file source filter exposes one pin only after IFileSourceFilter_Load() is called, but the ACM wrapper exposes two pins always, and the AVI splitter exposes the sink pin always and any number of source pins only after its input is connected...
I'm still open to using strmbase instead, if this is workable. I proposed this several months ago to no reply [1], and while I can see why it's architecturally distasteful, it would eliminate most of the code sharing or duplication otherwise necessary (plus several hundred lines of code from filtergraph.c itself).
[1] https://www.winehq.org/pipermail/wine-devel/2018-May/126573.html
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/filesource.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
diff --git a/dlls/quartz/tests/filesource.c b/dlls/quartz/tests/filesource.c index 9baff12..db7c51e 100644 --- a/dlls/quartz/tests/filesource.c +++ b/dlls/quartz/tests/filesource.c @@ -25,6 +25,8 @@
#include "util.h"
+static const WCHAR source_id[] = {'O','u','t','p','u','t',0}; + static IBaseFilter *create_file_source(void) { IBaseFilter *filter = NULL; @@ -295,12 +297,47 @@ todo_wine ok(ret, "Failed to delete file, error %u.\n", GetLastError()); }
+static void test_find_pin(void) +{ + const WCHAR *filename = load_resource(avifile); + IBaseFilter *filter = create_file_source(); + IEnumPins *enumpins; + IPin *pin, *pin2; + HRESULT hr; + ULONG ref; + BOOL ret; + + hr = IBaseFilter_FindPin(filter, source_id, &pin); + ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr); + + load_file(filter, filename); + + hr = IBaseFilter_FindPin(filter, source_id, &pin); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IBaseFilter_EnumPins(filter, &enumpins); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enumpins, 1, &pin2, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(pin == pin2, "Expected pin %p, got %p.\n", pin, pin2); + + IPin_Release(pin2); + IPin_Release(pin); + IEnumPins_Release(enumpins); + 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_find_pin(); test_file_source_filter();
CoUninitialize();
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=42573
Your paranoid android.
=== build (build log) ===
make: *** No rule to make target 'dlls/strmbase/tests'. Stop. Task: The exe32 Wine crossbuild failed