Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
February 2018
- 74 participants
- 1541 messages
[PATCH] bcrypt/tests: Correctly check the size in BCryptGetProperty.
by Alistair Leslie-Hughes
From: Sebastian Lackner <sebastian(a)fds-team.de>
Updated to make the test pass.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
dlls/bcrypt/bcrypt_main.c | 2 +-
dlls/bcrypt/tests/bcrypt.c | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
index 72b5df2..28cf2d8 100644
--- a/dlls/bcrypt/bcrypt_main.c
+++ b/dlls/bcrypt/bcrypt_main.c
@@ -532,7 +532,7 @@ static NTSTATUS get_alg_property( enum alg_id id, const WCHAR *prop, UCHAR *buf,
}
if (!strcmpW( prop, BCRYPT_CHAINING_MODE ))
{
- if (size >= sizeof(BCRYPT_CHAIN_MODE_CBC))
+ if (size >= sizeof(BCRYPT_CHAIN_MODE_CBC) * sizeof(WCHAR))
{
memcpy(buf, BCRYPT_CHAIN_MODE_CBC, sizeof(BCRYPT_CHAIN_MODE_CBC));
*ret_size = sizeof(BCRYPT_CHAIN_MODE_CBC) * sizeof(WCHAR);
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
index 6fa04b0..b716688 100644
--- a/dlls/bcrypt/tests/bcrypt.c
+++ b/dlls/bcrypt/tests/bcrypt.c
@@ -452,6 +452,12 @@ static void test_aes(void)
ok(size == 64, "got %u\n", size);
size = 0;
+ ret = pBCryptGetProperty(alg, BCRYPT_CHAINING_MODE, mode, sizeof(mode) - 1, &size, 0);
+ ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
+ ok(size == 64, "got %u\n", size);
+
+ size = 0;
+ memset(mode, 0, sizeof(mode));
ret = pBCryptGetProperty(alg, BCRYPT_CHAINING_MODE, mode, sizeof(mode), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(!lstrcmpW((const WCHAR *)mode, BCRYPT_CHAIN_MODE_CBC), "got %s\n", mode);
--
1.9.1
Feb. 28, 2018
[PATCH] adsldp: Implement IADsADSystemInfo::get_ComputerName(). (v2)
by Dmitry Timoshkov
v2: fixed a typo ('==' vs. '!=').
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/adsldp/Makefile.in | 1 +
dlls/adsldp/adsldp.c | 25 +++++++++++++++++++++++--
dlls/adsldp/tests/sysinfo.c | 1 -
3 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/dlls/adsldp/Makefile.in b/dlls/adsldp/Makefile.in
index e033d91a7e..c96e264666 100644
--- a/dlls/adsldp/Makefile.in
+++ b/dlls/adsldp/Makefile.in
@@ -1,4 +1,5 @@
MODULE = adsldp.dll
+IMPORTS = oleaut32 secur32
C_SRCS = \
adsldp.c
diff --git a/dlls/adsldp/adsldp.c b/dlls/adsldp/adsldp.c
index 15f1d23acd..4fc0de41eb 100644
--- a/dlls/adsldp/adsldp.c
+++ b/dlls/adsldp/adsldp.c
@@ -28,6 +28,8 @@
#include "objbase.h"
#include "rpcproxy.h"
#include "iads.h"
+#define SECURITY_WIN32
+#include "security.h"
#include "wine/debug.h"
@@ -120,8 +122,27 @@ static HRESULT WINAPI sysinfo_get_UserName(IADsADSystemInfo *iface, BSTR *retval
static HRESULT WINAPI sysinfo_get_ComputerName(IADsADSystemInfo *iface, BSTR *retval)
{
- FIXME("%p,%p: stub\n", iface, retval);
- return E_NOTIMPL;
+ UINT size;
+ WCHAR *name;
+
+ TRACE("%p,%p\n", iface, retval);
+
+ size = 0;
+ GetComputerObjectNameW(NameFullyQualifiedDN, NULL, &size);
+ if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
+ return HRESULT_FROM_WIN32(GetLastError());
+
+ name = SysAllocStringLen(NULL, size);
+ if (!name) return E_OUTOFMEMORY;
+
+ if (!GetComputerObjectNameW(NameFullyQualifiedDN, name, &size))
+ {
+ SysFreeString(name);
+ return HRESULT_FROM_WIN32(GetLastError());
+ }
+
+ *retval = name;
+ return S_OK;
}
static HRESULT WINAPI sysinfo_get_SiteName(IADsADSystemInfo *iface, BSTR *retval)
diff --git a/dlls/adsldp/tests/sysinfo.c b/dlls/adsldp/tests/sysinfo.c
index 73435a6129..1e3939f0db 100644
--- a/dlls/adsldp/tests/sysinfo.c
+++ b/dlls/adsldp/tests/sysinfo.c
@@ -79,7 +79,6 @@ static void test_ComputerName(void)
ok(hr == S_OK, "got %#x\n", hr);
hr = IADsADSystemInfo_get_ComputerName(sysinfo, &bstr);
-todo_wine
ok(hr == S_OK || hr == HRESULT_FROM_WIN32(ERROR_CANT_ACCESS_DOMAIN_INFO), "got %#x\n", hr);
if (hr == S_OK)
{
--
2.16.2
Feb. 28, 2018
[PATCH] secur32: Make GetComputerObjectName() tests pass when computer is part of a domain.
by Dmitry Timoshkov
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/secur32/tests/secur32.c | 91 +++++++++++++++++++++++++++++++-------------
1 file changed, 65 insertions(+), 26 deletions(-)
diff --git a/dlls/secur32/tests/secur32.c b/dlls/secur32/tests/secur32.c
index df9e627f8e..40c272ada3 100644
--- a/dlls/secur32/tests/secur32.c
+++ b/dlls/secur32/tests/secur32.c
@@ -28,6 +28,7 @@
#include <security.h>
#include <schannel.h>
#include <wincred.h>
+#include <winsock2.h>
#include "wine/test.h"
@@ -67,20 +68,40 @@ static void testGetComputerObjectNameA(void)
UINT i;
for (i = 0; i < (sizeof(formats) / sizeof(formats[0])); i++) {
+ size = 0;
+ SetLastError(0xdeadbeef);
+ rc = pGetComputerObjectNameA(formats[i], NULL, &size);
+ ok(!rc, "GetComputerObjectName(%u) should fail\n", formats[i]);
+ switch (formats[i])
+ {
+ case NameUnknown:
+ ok(GetLastError() == ERROR_INVALID_PARAMETER, "%u: got %u\n", formats[i], GetLastError());
+ break;
+ default:
+ ok(GetLastError() == ERROR_NONE_MAPPED ||
+ GetLastError() == ERROR_NO_SUCH_USER ||
+ GetLastError() == ERROR_CANT_ACCESS_DOMAIN_INFO ||
+ GetLastError() == ERROR_INSUFFICIENT_BUFFER,
+ "%u: got %u\n", formats[i], GetLastError());
+ break;
+ }
+
+ if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) continue;
+
size = sizeof(name);
- ZeroMemory(name, sizeof(name));
+ SetLastError(0xdeadbeef);
rc = pGetComputerObjectNameA(formats[i], name, &size);
- ok(rc || ((formats[i] == NameUnknown) &&
- (GetLastError() == ERROR_INVALID_PARAMETER)) ||
- (GetLastError() == ERROR_CANT_ACCESS_DOMAIN_INFO) ||
- (GetLastError() == ERROR_NO_SUCH_DOMAIN) ||
- (GetLastError() == ERROR_NO_SUCH_USER) ||
- (GetLastError() == ERROR_NONE_MAPPED) ||
- (GetLastError() == ERROR_ACCESS_DENIED),
- "GetComputerObjectNameA(%d) failed: %d\n",
- formats[i], GetLastError());
- if (rc)
- trace("GetComputerObjectNameA() returned %s\n", name);
+ switch (formats[i])
+ {
+ case NameUnknown:
+ ok(!rc, "GetComputerObjectName(%u) should fail\n", formats[i]);
+ ok(GetLastError() == ERROR_INVALID_PARAMETER, "%u: got %u\n", formats[i], GetLastError());
+ break;
+ default:
+ ok(rc, "GetComputerObjectName(%u) error %u\n", formats[i], GetLastError());
+ trace("GetComputerObjectName(%u) returned %s\n", formats[i], name);
+ break;
+ }
}
}
@@ -92,22 +113,40 @@ static void testGetComputerObjectNameW(void)
UINT i;
for (i = 0; i < (sizeof(formats) / sizeof(formats[0])); i++) {
+ size = 0;
+ SetLastError(0xdeadbeef);
+ rc = pGetComputerObjectNameW(formats[i], NULL, &size);
+ ok(!rc || broken(rc) /* win10 */, "GetComputerObjectName(%u) should fail\n", formats[i]);
+ switch (formats[i])
+ {
+ case NameUnknown:
+ ok(GetLastError() == ERROR_INVALID_PARAMETER, "%u: got %u\n", formats[i], GetLastError());
+ break;
+ default:
+ ok(GetLastError() == ERROR_NONE_MAPPED ||
+ GetLastError() == ERROR_NO_SUCH_USER ||
+ GetLastError() == ERROR_CANT_ACCESS_DOMAIN_INFO ||
+ GetLastError() == WSAHOST_NOT_FOUND ||
+ GetLastError() == ERROR_INSUFFICIENT_BUFFER,
+ "%u: got %u\n", formats[i], GetLastError());
+ break;
+ }
+
+ if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) continue;
+
size = sizeof(nameW)/sizeof(nameW[0]);
- ZeroMemory(nameW, sizeof(nameW));
+ SetLastError(0xdeadbeef);
rc = pGetComputerObjectNameW(formats[i], nameW, &size);
- ok(rc || ((formats[i] == NameUnknown) &&
- (GetLastError() == ERROR_INVALID_PARAMETER)) ||
- (GetLastError() == ERROR_CANT_ACCESS_DOMAIN_INFO) ||
- (GetLastError() == ERROR_NO_SUCH_DOMAIN) ||
- (GetLastError() == ERROR_NO_SUCH_USER) ||
- (GetLastError() == ERROR_NONE_MAPPED) ||
- (GetLastError() == ERROR_ACCESS_DENIED),
- "GetComputerObjectNameW(%d) failed: %d\n",
- formats[i], GetLastError());
- if (rc) {
- char name[256];
- WideCharToMultiByte( CP_ACP, 0, nameW, -1, name, sizeof(name), NULL, NULL );
- trace("GetComputerObjectNameW() returned %s\n", name);
+ switch (formats[i])
+ {
+ case NameUnknown:
+ ok(!rc, "GetComputerObjectName(%u) should fail\n", formats[i]);
+ ok(GetLastError() == ERROR_INVALID_PARAMETER, "%u: got %u\n", formats[i], GetLastError());
+ break;
+ default:
+ ok(rc, "GetComputerObjectName(%u) error %u\n", formats[i], GetLastError());
+ trace("GetComputerObjectName(%u) returned %s\n", formats[i], wine_dbgstr_w(nameW));
+ break;
}
}
}
--
2.16.2
Feb. 28, 2018
[PATCH] adsldp: Implement IADsADSystemInfo::get_ComputerName().
by Dmitry Timoshkov
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/adsldp/Makefile.in | 1 +
dlls/adsldp/adsldp.c | 25 +++++++++++++++++++++++--
dlls/adsldp/tests/sysinfo.c | 1 -
3 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/dlls/adsldp/Makefile.in b/dlls/adsldp/Makefile.in
index e033d91a7e..c96e264666 100644
--- a/dlls/adsldp/Makefile.in
+++ b/dlls/adsldp/Makefile.in
@@ -1,4 +1,5 @@
MODULE = adsldp.dll
+IMPORTS = oleaut32 secur32
C_SRCS = \
adsldp.c
diff --git a/dlls/adsldp/adsldp.c b/dlls/adsldp/adsldp.c
index 15f1d23acd..6f118ec88d 100644
--- a/dlls/adsldp/adsldp.c
+++ b/dlls/adsldp/adsldp.c
@@ -28,6 +28,8 @@
#include "objbase.h"
#include "rpcproxy.h"
#include "iads.h"
+#define SECURITY_WIN32
+#include "security.h"
#include "wine/debug.h"
@@ -120,8 +122,27 @@ static HRESULT WINAPI sysinfo_get_UserName(IADsADSystemInfo *iface, BSTR *retval
static HRESULT WINAPI sysinfo_get_ComputerName(IADsADSystemInfo *iface, BSTR *retval)
{
- FIXME("%p,%p: stub\n", iface, retval);
- return E_NOTIMPL;
+ UINT size;
+ WCHAR *name;
+
+ TRACE("%p,%p\n", iface, retval);
+
+ size = 0;
+ GetComputerObjectNameW(NameFullyQualifiedDN, NULL, &size);
+ if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
+ return HRESULT_FROM_WIN32(GetLastError());
+
+ name = SysAllocStringLen(NULL, size);
+ if (!name) return E_OUTOFMEMORY;
+
+ if (!GetComputerObjectNameW(NameFullyQualifiedDN, name, &size))
+ {
+ SysFreeString(name);
+ return HRESULT_FROM_WIN32(GetLastError());
+ }
+
+ *retval = name;
+ return S_OK;
}
static HRESULT WINAPI sysinfo_get_SiteName(IADsADSystemInfo *iface, BSTR *retval)
diff --git a/dlls/adsldp/tests/sysinfo.c b/dlls/adsldp/tests/sysinfo.c
index 73435a6129..1e3939f0db 100644
--- a/dlls/adsldp/tests/sysinfo.c
+++ b/dlls/adsldp/tests/sysinfo.c
@@ -79,7 +79,6 @@ static void test_ComputerName(void)
ok(hr == S_OK, "got %#x\n", hr);
hr = IADsADSystemInfo_get_ComputerName(sysinfo, &bstr);
-todo_wine
ok(hr == S_OK || hr == HRESULT_FROM_WIN32(ERROR_CANT_ACCESS_DOMAIN_INFO), "got %#x\n", hr);
if (hr == S_OK)
{
--
2.16.2
Feb. 28, 2018
Re: [PATCH 1/5] quartz/tests: Expand and separate state change tests.
by Marvin
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=36248
Your paranoid android.
=== w2003std (32 bit filtergraph) ===
filtergraph.c:442: Test failed: Wait failed
=== wvistau64 (32 bit filtergraph) ===
filtergraph.c:442: Test failed: Wait failed
=== w8 (32 bit filtergraph) ===
filtergraph.c:442: Test failed: Wait failed
=== w864 (32 bit filtergraph) ===
filtergraph.c:442: Test failed: Wait failed
=== w1064 (32 bit filtergraph) ===
filtergraph.c:442: Test failed: Wait failed
=== w1064 (64 bit filtergraph) ===
filtergraph.c:442: Test failed: Wait failed
Feb. 28, 2018
[PATCH 5/5] quartz/tests: Remove some unnecessary error-checking.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/quartz/tests/filtergraph.c | 60 +++--------------------------------------
1 file changed, 3 insertions(+), 57 deletions(-)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c
index 8f510da..a2856e6 100644
--- a/dlls/quartz/tests/filtergraph.c
+++ b/dlls/quartz/tests/filtergraph.c
@@ -1816,12 +1816,10 @@ static HRESULT get_connected_filter_name(TestFilterImpl *pFilter, char *FilterNa
hr = IPin_ConnectedTo(pFilter->ppPins[0], &pin);
ok(hr == S_OK, "IPin_ConnectedTo failed with %x\n", hr);
- if (FAILED(hr)) return hr;
hr = IPin_QueryPinInfo(pin, &pinInfo);
ok(hr == S_OK, "IPin_QueryPinInfo failed with %x\n", hr);
IPin_Release(pin);
- if (FAILED(hr)) return hr;
SetLastError(0xdeadbeef);
hr = IBaseFilter_QueryFilterInfo(pinInfo.pFilter, &filterInfo);
@@ -1832,7 +1830,6 @@ static HRESULT get_connected_filter_name(TestFilterImpl *pFilter, char *FilterNa
}
ok(hr == S_OK, "IBaseFilter_QueryFilterInfo failed with %x\n", hr);
IBaseFilter_Release(pinInfo.pFilter);
- if (FAILED(hr)) return hr;
IFilterGraph_Release(filterInfo.pGraph);
@@ -1932,28 +1929,23 @@ static void test_render_filter_priority(void)
* on the order in which filters are added to the graph, thus indicating
* no preference given to exact match. */
pgraph2 = create_graph();
- if (!pgraph2) return;
hr = createtestfilter(&GUID_NULL, PinData1, &ptestfilter);
ok(hr == S_OK, "createtestfilter failed with %08x\n", hr);
- if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter->IBaseFilter_iface, wszFilterInstanceName1);
ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
hr = createtestfilter(&GUID_NULL, PinData2, &ptestfilter2);
ok(hr == S_OK, "createtestfilter failed with %08x\n", hr);
- if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->IBaseFilter_iface, wszFilterInstanceName2);
ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
IBaseFilter_Release(&ptestfilter2->IBaseFilter_iface);
- ptestfilter2 = NULL;
hr = createtestfilter(&GUID_NULL, PinData3, &ptestfilter2);
ok(hr == S_OK, "createtestfilter failed with %08x\n", hr);
- if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->IBaseFilter_iface, wszFilterInstanceName3);
ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
@@ -1964,41 +1956,27 @@ static void test_render_filter_priority(void)
hr = get_connected_filter_name(ptestfilter, ConnectedFilterName1);
IFilterGraph2_Release(pgraph2);
- pgraph2 = NULL;
IBaseFilter_Release(&ptestfilter->IBaseFilter_iface);
- ptestfilter = NULL;
IBaseFilter_Release(&ptestfilter2->IBaseFilter_iface);
- ptestfilter2 = NULL;
-
- if (hr == E_NOTIMPL)
- {
- win_skip("Needed functions are not implemented\n");
- return;
- }
pgraph2 = create_graph();
- if (!pgraph2) goto out;
hr = createtestfilter(&GUID_NULL, PinData1, &ptestfilter);
ok(hr == S_OK, "createtestfilter failed with %08x\n", hr);
- if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter->IBaseFilter_iface, wszFilterInstanceName1);
ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
hr = createtestfilter(&GUID_NULL, PinData3, &ptestfilter2);
ok(hr == S_OK, "createtestfilter failed with %08x\n", hr);
- if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->IBaseFilter_iface, wszFilterInstanceName3);
ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
IBaseFilter_Release(&ptestfilter2->IBaseFilter_iface);
- ptestfilter2 = NULL;
hr = createtestfilter(&GUID_NULL, PinData2, &ptestfilter2);
ok(hr == S_OK, "createtestfilter failed with %08x\n", hr);
- if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->IBaseFilter_iface, wszFilterInstanceName2);
ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
@@ -2014,49 +1992,39 @@ static void test_render_filter_priority(void)
"expected connected filters to be different but got %s both times\n", ConnectedFilterName1);
IFilterGraph2_Release(pgraph2);
- pgraph2 = NULL;
IBaseFilter_Release(&ptestfilter->IBaseFilter_iface);
- ptestfilter = NULL;
IBaseFilter_Release(&ptestfilter2->IBaseFilter_iface);
- ptestfilter2 = NULL;
/* Test if any preference is given to existing renderer which renders the pin directly vs
an existing renderer which renders the pin indirectly, through an additional middle filter,
again trying different orders of creation. Native appears not to give a preference. */
pgraph2 = create_graph();
- if (!pgraph2) goto out;
hr = createtestfilter(&GUID_NULL, PinData1, &ptestfilter);
ok(hr == S_OK, "createtestfilter failed with %08x\n", hr);
- if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter->IBaseFilter_iface, wszFilterInstanceName1);
ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
hr = createtestfilter(&GUID_NULL, PinData2, &ptestfilter2);
ok(hr == S_OK, "createtestfilter failed with %08x\n", hr);
- if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->IBaseFilter_iface, wszFilterInstanceName2);
ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
IBaseFilter_Release(&ptestfilter2->IBaseFilter_iface);
- ptestfilter2 = NULL;
hr = createtestfilter(&GUID_NULL, PinData4, &ptestfilter2);
ok(hr == S_OK, "createtestfilter failed with %08x\n", hr);
- if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->IBaseFilter_iface, wszFilterInstanceName3);
ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
IBaseFilter_Release(&ptestfilter2->IBaseFilter_iface);
- ptestfilter2 = NULL;
hr = createtestfilter(&GUID_NULL, PinData5, &ptestfilter2);
ok(hr == S_OK, "createtestfilter failed with %08x\n", hr);
- if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->IBaseFilter_iface, wszFilterInstanceName4);
ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
@@ -2069,45 +2037,35 @@ static void test_render_filter_priority(void)
"unexpected connected filter: %s\n", ConnectedFilterName1);
IFilterGraph2_Release(pgraph2);
- pgraph2 = NULL;
IBaseFilter_Release(&ptestfilter->IBaseFilter_iface);
- ptestfilter = NULL;
IBaseFilter_Release(&ptestfilter2->IBaseFilter_iface);
- ptestfilter2 = NULL;
pgraph2 = create_graph();
- if (!pgraph2) goto out;
hr = createtestfilter(&GUID_NULL, PinData1, &ptestfilter);
ok(hr == S_OK, "createtestfilter failed with %08x\n", hr);
- if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter->IBaseFilter_iface, wszFilterInstanceName1);
ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
hr = createtestfilter(&GUID_NULL, PinData4, &ptestfilter2);
ok(hr == S_OK, "createtestfilter failed with %08x\n", hr);
- if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->IBaseFilter_iface, wszFilterInstanceName3);
ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
IBaseFilter_Release(&ptestfilter2->IBaseFilter_iface);
- ptestfilter2 = NULL;
hr = createtestfilter(&GUID_NULL, PinData5, &ptestfilter2);
ok(hr == S_OK, "createtestfilter failed with %08x\n", hr);
- if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->IBaseFilter_iface, wszFilterInstanceName4);
ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
IBaseFilter_Release(&ptestfilter2->IBaseFilter_iface);
- ptestfilter2 = NULL;
hr = createtestfilter(&GUID_NULL, PinData2, &ptestfilter2);
ok(hr == S_OK, "createtestfilter failed with %08x\n", hr);
- if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->IBaseFilter_iface, wszFilterInstanceName2);
ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
@@ -2122,23 +2080,17 @@ static void test_render_filter_priority(void)
"expected connected filters to be different but got %s both times\n", ConnectedFilterName1);
IFilterGraph2_Release(pgraph2);
- pgraph2 = NULL;
IBaseFilter_Release(&ptestfilter->IBaseFilter_iface);
- ptestfilter = NULL;
IBaseFilter_Release(&ptestfilter2->IBaseFilter_iface);
- ptestfilter2 = NULL;
/* Test if renderers are tried before non-renderers (intermediary filters). */
pgraph2 = create_graph();
- if (!pgraph2) goto out;
hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper2, (LPVOID*)&pMapper2);
ok(hr == S_OK, "CoCreateInstance failed with %08x\n", hr);
- if (!pMapper2) goto out;
hr = createtestfilter(&GUID_NULL, PinData1, &ptestfilter);
ok(hr == S_OK, "createtestfilter failed with %08x\n", hr);
- if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter->IBaseFilter_iface, wszFilterInstanceName1);
ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
@@ -2148,17 +2100,14 @@ static void test_render_filter_priority(void)
(IUnknown *)&Filter1ClassFactory.IClassFactory_iface, CLSCTX_INPROC_SERVER,
REGCLS_MULTIPLEUSE, &cookie1);
ok(hr == S_OK, "CoRegisterClassObject failed with %08x\n", hr);
- if (FAILED(hr)) goto out;
hr = CoRegisterClassObject(Filter2ClassFactory.clsid,
(IUnknown *)&Filter2ClassFactory.IClassFactory_iface, CLSCTX_INPROC_SERVER,
REGCLS_MULTIPLEUSE, &cookie2);
ok(hr == S_OK, "CoRegisterClassObject failed with %08x\n", hr);
- if (FAILED(hr)) goto out;
hr = CoRegisterClassObject(Filter3ClassFactory.clsid,
(IUnknown *)&Filter3ClassFactory.IClassFactory_iface, CLSCTX_INPROC_SERVER,
REGCLS_MULTIPLEUSE, &cookie3);
ok(hr == S_OK, "CoRegisterClassObject failed with %08x\n", hr);
- if (FAILED(hr)) goto out;
rgf2.dwVersion = 2;
rgf2.dwMerit = MERIT_UNLIKELY;
@@ -2225,12 +2174,9 @@ static void test_render_filter_priority(void)
ok(hr == S_OK, "IFilterMapper2_UnregisterFilter failed with %x\n", hr);
}
- out:
-
- if (ptestfilter) IBaseFilter_Release(&ptestfilter->IBaseFilter_iface);
- if (ptestfilter2) IBaseFilter_Release(&ptestfilter2->IBaseFilter_iface);
- if (pgraph2) IFilterGraph2_Release(pgraph2);
- if (pMapper2) IFilterMapper2_Release(pMapper2);
+ IBaseFilter_Release(&ptestfilter->IBaseFilter_iface);
+ IFilterGraph2_Release(pgraph2);
+ IFilterMapper2_Release(pMapper2);
hr = CoRevokeClassObject(cookie1);
ok(hr == S_OK, "CoRevokeClassObject failed with %08x\n", hr);
--
2.7.4
Feb. 28, 2018
[PATCH 4/5] quartz/tests: Add more tests for IMediaSeeking.
by Zebediah Figura
Also remove uninteresting IMediaControl test.
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/quartz/tests/filtergraph.c | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c
index ce319cf..8f510da 100644
--- a/dlls/quartz/tests/filtergraph.c
+++ b/dlls/quartz/tests/filtergraph.c
@@ -284,12 +284,11 @@ static void test_basic_video(IFilterGraph2 *graph)
IBasicVideo_Release(pbv);
}
-static void test_mediacontrol(IFilterGraph2 *graph)
+static void test_media_seeking(IFilterGraph2 *graph)
{
IMediaSeeking *seeking;
IMediaFilter *filter;
- IMediaControl *control;
- LONGLONG pos;
+ LONGLONG pos, stop, duration;
GUID format;
HRESULT hr;
@@ -300,9 +299,6 @@ static void test_mediacontrol(IFilterGraph2 *graph)
hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaFilter, (void **)&filter);
ok(hr == S_OK, "QueryInterface(IMediaFilter) failed: %08x\n", hr);
- hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
- ok(hr == S_OK, "QueryInterface(IMediaControl) failed: %08x\n", hr);
-
format = GUID_NULL;
hr = IMediaSeeking_GetTimeFormat(seeking, &format);
ok(hr == S_OK, "GetTimeFormat failed: %#x\n", hr);
@@ -327,21 +323,31 @@ static void test_mediacontrol(IFilterGraph2 *graph)
ok(hr == S_OK, "GetCurrentPosition failed: %#x\n", hr);
ok(pos == 0, "got %s\n", wine_dbgstr_longlong(pos));
+ hr = IMediaSeeking_GetDuration(seeking, &duration);
+ ok(hr == S_OK, "GetDuration failed: %#x\n", hr);
+ ok(duration > 0, "got %s\n", wine_dbgstr_longlong(duration));
+
+ hr = IMediaSeeking_GetStopPosition(seeking, &stop);
+ ok(hr == S_OK, "GetCurrentPosition failed: %08x\n", hr);
+ ok(stop == duration || stop == duration + 1, "expected %s, got %s\n",
+ wine_dbgstr_longlong(duration), wine_dbgstr_longlong(stop));
+
hr = IMediaSeeking_SetPositions(seeking, NULL, AM_SEEKING_ReturnTime, NULL, AM_SEEKING_NoPositioning);
ok(hr == S_OK, "SetPositions failed: %#x\n", hr);
hr = IMediaSeeking_SetPositions(seeking, NULL, AM_SEEKING_NoPositioning, NULL, AM_SEEKING_ReturnTime);
ok(hr == S_OK, "SetPositions failed: %#x\n", hr);
+ pos = 0;
+ hr = IMediaSeeking_SetPositions(seeking, &pos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
+ ok(hr == S_OK, "SetPositions failed: %08x\n", hr);
+
IMediaFilter_SetSyncSource(filter, NULL);
pos = 0xdeadbeef;
hr = IMediaSeeking_GetCurrentPosition(seeking, &pos);
- ok(hr == S_OK, "GetCurrentPosition failed: %#x\n", hr);
- ok(pos == 0, "got %s\n", wine_dbgstr_longlong(pos));
+ ok(hr == S_OK, "GetCurrentPosition failed: %08x\n", hr);
+ ok(pos == 0, "Position != 0 (%s)\n", wine_dbgstr_longlong(pos));
+ IFilterGraph2_SetDefaultSyncSource(graph);
- hr = IMediaControl_GetState(control, 1000, NULL);
- ok(hr == E_POINTER, "expected E_POINTER, got %#x\n", hr);
-
- IMediaControl_Release(control);
IMediaSeeking_Release(seeking);
IMediaFilter_Release(filter);
}
@@ -487,7 +493,7 @@ todo_wine
static void rungraph(IFilterGraph2 *graph)
{
test_basic_video(graph);
- test_mediacontrol(graph);
+ test_media_seeking(graph);
test_state_change(graph);
test_media_event(graph);
}
--
2.7.4
Feb. 28, 2018
[PATCH 3/5] quartz/tests: Simply test_render_with_multithread().
by Zebediah Figura
Use CoCreateInstance directly, and try to run the graph on a real file.
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/quartz/tests/filtergraph.c | 67 ++++++++---------------------------------
1 file changed, 12 insertions(+), 55 deletions(-)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c
index 704ef75..ce319cf 100644
--- a/dlls/quartz/tests/filtergraph.c
+++ b/dlls/quartz/tests/filtergraph.c
@@ -579,78 +579,35 @@ static void test_render_run(const WCHAR *file)
static DWORD WINAPI call_RenderFile_multithread(LPVOID lParam)
{
- IFilterGraph2 *filter_graph = lParam;
+ WCHAR *filename = load_resource(avifile);
+ IFilterGraph2 *graph = lParam;
HRESULT hr;
- WCHAR mp3file[] = {'t','e','s','t','.','m','p','3',0};
- HANDLE handle;
- handle = CreateFileW(mp3file, 0, 0, NULL, CREATE_ALWAYS, 0, NULL);
- if (handle == INVALID_HANDLE_VALUE)
- {
- skip("Could not read test file %s, skipping test\n", wine_dbgstr_w(mp3file));
- return 1;
- }
- CloseHandle(handle);
+ hr = IFilterGraph2_RenderFile(graph, filename, NULL);
+todo_wine
+ ok(SUCCEEDED(hr), "RenderFile failed: %x\n", hr);
- hr = IFilterGraph2_RenderFile(filter_graph, mp3file, NULL);
- todo_wine ok(hr == VFW_E_CANNOT_RENDER || /* xp or older + DirectX 9 */
- hr == VFW_E_NO_TRANSPORT || /* win7 or newer */
- broken(hr == CLASS_E_CLASSNOTAVAILABLE), /* xp or older + DirectX 8 or older */
- "Expected 0x%08x or 0x%08x, returned 0x%08x\n", VFW_E_CANNOT_RENDER, VFW_E_NO_TRANSPORT, hr);
+ if (SUCCEEDED(hr))
+ rungraph(graph);
- DeleteFileW(mp3file);
return 0;
}
static void test_render_with_multithread(void)
{
- HRESULT hr;
- HMODULE hmod;
- static HRESULT (WINAPI *pDllGetClassObject)(REFCLSID rclsid, REFIID riid, void **out);
- IClassFactory *classfactory = NULL;
- static IGraphBuilder *graph_builder;
- static IFilterGraph2 *filter_graph;
+ IFilterGraph2 *graph;
HANDLE thread;
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
- hmod = LoadLibraryA("quartz.dll");
- if (!hmod)
- {
- skip("Fail to load quartz.dll.\n");
- return;
- }
+ graph = create_graph();
- pDllGetClassObject = (void*)GetProcAddress(hmod, "DllGetClassObject");
- if (!pDllGetClassObject)
- {
- skip("Fail to get DllGetClassObject.\n");
- return;
- }
+ thread = CreateThread(NULL, 0, call_RenderFile_multithread, graph, 0, NULL);
- hr = pDllGetClassObject(&CLSID_FilterGraph, &IID_IClassFactory, (void **)&classfactory);
- ok(hr == S_OK, "DllGetClassObject failed 0x%08x\n", hr);
- if (FAILED(hr))
- {
- skip("Can't create IClassFactory 0x%08x.\n", hr);
- return;
- }
-
- hr = IClassFactory_CreateInstance(classfactory, NULL, &IID_IUnknown, (LPVOID*)&graph_builder);
- ok(hr == S_OK, "IClassFactory_CreateInstance failed 0x%08x\n", hr);
-
- hr = IGraphBuilder_QueryInterface(graph_builder, &IID_IFilterGraph2, (void**)&filter_graph);
- ok(hr == S_OK, "IGraphBuilder_QueryInterface failed 0x%08x\n", hr);
-
- thread = CreateThread(NULL, 0, call_RenderFile_multithread, filter_graph, 0, NULL);
-
- WaitForSingleObject(thread, 1000);
- IFilterGraph2_Release(filter_graph);
- IGraphBuilder_Release(graph_builder);
- IClassFactory_Release(classfactory);
+ ok(WaitForSingleObject(thread, 1000) == WAIT_OBJECT_0, "wait failed\n");
+ IFilterGraph2_Release(graph);
CloseHandle(thread);
CoUninitialize();
- return;
}
static void test_graph_builder(void)
--
2.7.4
Feb. 28, 2018
[PATCH 2/5] quartz/tests: Expand and separate media event tests.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/quartz/tests/filtergraph.c | 133 ++++++++++++++++++++++++++--------------
1 file changed, 87 insertions(+), 46 deletions(-)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c
index 44f306e..704ef75 100644
--- a/dlls/quartz/tests/filtergraph.c
+++ b/dlls/quartz/tests/filtergraph.c
@@ -398,57 +398,98 @@ static void test_state_change(IFilterGraph2 *graph)
IMediaControl_Release(control);
}
+static void test_media_event(IFilterGraph2 *graph)
+{
+ IMediaEvent *media_event;
+ IMediaSeeking *seeking;
+ IMediaControl *control;
+ IMediaFilter *filter;
+ LONG_PTR lparam1, lparam2;
+ LONGLONG current, stop;
+ OAFilterState state;
+ int got_eos = 0;
+ HANDLE event;
+ HRESULT hr;
+ LONG code;
+
+ hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaFilter, (void **)&filter);
+ ok(hr == S_OK, "QueryInterface(IMediaFilter) failed: %#x\n", hr);
+
+ hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
+ ok(hr == S_OK, "QueryInterface(IMediaControl) failed: %#x\n", hr);
+
+ hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaEvent, (void **)&media_event);
+ ok(hr == S_OK, "QueryInterface(IMediaEvent) failed: %#x\n", hr);
+
+ hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaSeeking, (void **)&seeking);
+ ok(hr == S_OK, "QueryInterface(IMediaEvent) failed: %#x\n", hr);
+
+ hr = IMediaControl_Stop(control);
+ ok(SUCCEEDED(hr), "Stop() failed: %#x\n", hr);
+ hr = IMediaControl_GetState(control, 1000, &state);
+ ok(hr == S_OK, "GetState() timed out\n");
+
+ hr = IMediaSeeking_GetDuration(seeking, &stop);
+ ok(hr == S_OK, "GetDuration() failed: %#x\n", hr);
+ current = 0;
+ hr = IMediaSeeking_SetPositions(seeking, ¤t, AM_SEEKING_AbsolutePositioning, &stop, AM_SEEKING_AbsolutePositioning);
+ ok(hr == S_OK, "SetPositions() failed: %#x\n", hr);
+
+ hr = IMediaFilter_SetSyncSource(filter, NULL);
+ ok(hr == S_OK, "SetSyncSource() failed: %#x\n", hr);
+
+ hr = IMediaEvent_GetEventHandle(media_event, (OAEVENT *)&event);
+ ok(hr == S_OK, "GetEventHandle() failed: %#x\n", hr);
+
+ /* flush existing events */
+ while ((hr = IMediaEvent_GetEvent(media_event, &code, &lparam1, &lparam2, 0)) == S_OK);
+
+ ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "event should not be signaled\n");
+
+ hr = IMediaControl_Run(control);
+ ok(SUCCEEDED(hr), "Run() failed: %#x\n", hr);
+
+ while (!got_eos)
+ {
+ if (WaitForSingleObject(event, 1000) == WAIT_TIMEOUT)
+ break;
+
+ while ((hr = IMediaEvent_GetEvent(media_event, &code, &lparam1, &lparam2, 0)) == S_OK)
+ {
+ if (code == EC_COMPLETE)
+ {
+ got_eos = 1;
+ break;
+ }
+ }
+ }
+ ok(got_eos, "didn't get EOS\n");
+
+ hr = IMediaSeeking_GetCurrentPosition(seeking, ¤t);
+ ok(hr == S_OK, "GetCurrentPosition() failed: %#x\n", hr);
+todo_wine
+ ok(current == stop, "expected %s, got %s\n", wine_dbgstr_longlong(stop), wine_dbgstr_longlong(current));
+
+ hr = IMediaControl_Stop(control);
+ ok(SUCCEEDED(hr), "Run() failed: %#x\n", hr);
+ hr = IMediaControl_GetState(control, 1000, &state);
+ ok(hr == S_OK, "GetState() timed out\n");
+
+ hr = IFilterGraph2_SetDefaultSyncSource(graph);
+ ok(hr == S_OK, "SetDefaultSinkSource() failed: %#x\n", hr);
+
+ IMediaSeeking_Release(seeking);
+ IMediaEvent_Release(media_event);
+ IMediaControl_Release(control);
+ IMediaFilter_Release(filter);
+}
+
static void rungraph(IFilterGraph2 *graph)
{
- HRESULT hr;
- IMediaControl* pmc;
- IMediaEvent* pme;
- IMediaFilter* pmf;
- HANDLE hEvent;
-
test_basic_video(graph);
test_mediacontrol(graph);
test_state_change(graph);
-
- hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&pmc);
- ok(hr==S_OK, "Cannot get IMediaControl interface returned: %x\n", hr);
-
- hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaFilter, (void **)&pmf);
- ok(hr==S_OK, "Cannot get IMediaFilter interface returned: %x\n", hr);
-
- IMediaControl_Stop(pmc);
-
- IMediaFilter_SetSyncSource(pmf, NULL);
-
- IMediaFilter_Release(pmf);
-
- hr = IMediaControl_Run(pmc);
- ok(hr==S_FALSE, "Cannot run the graph returned: %x\n", hr);
-
- Sleep(10);
- /* Crash fun */
- trace("run -> stop\n");
- hr = IMediaControl_Stop(pmc);
- ok(hr==S_OK || hr == S_FALSE, "Cannot stop the graph returned: %x\n", hr);
-
- IFilterGraph2_SetDefaultSyncSource(graph);
-
- hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaEvent, (LPVOID*)&pme);
- ok(hr==S_OK, "Cannot get IMediaEvent interface returned: %x\n", hr);
-
- hr = IMediaEvent_GetEventHandle(pme, (OAEVENT*)&hEvent);
- ok(hr==S_OK, "Cannot get event handle returned: %x\n", hr);
-
- ok(WaitForSingleObject(hEvent, 2000) == WAIT_OBJECT_0, "Wait failed\n");
-
- hr = IMediaEvent_Release(pme);
- ok(hr==2, "Releasing mediaevent returned: %x\n", hr);
-
- hr = IMediaControl_Stop(pmc);
- ok(hr==S_OK, "Cannot stop the graph returned: %x\n", hr);
-
- hr = IMediaControl_Release(pmc);
- ok(hr==1, "Releasing mediacontrol returned: %x\n", hr);
+ test_media_event(graph);
}
static void test_graph_builder_connect(WCHAR *filename)
--
2.7.4
Feb. 28, 2018
[PATCH 1/5] quartz/tests: Expand and separate state change tests.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/quartz/tests/filtergraph.c | 92 +++++++++++++++++++++++++----------------
1 file changed, 56 insertions(+), 36 deletions(-)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c
index 8e9d17e..44f306e 100644
--- a/dlls/quartz/tests/filtergraph.c
+++ b/dlls/quartz/tests/filtergraph.c
@@ -346,6 +346,58 @@ static void test_mediacontrol(IFilterGraph2 *graph)
IMediaFilter_Release(filter);
}
+static void test_state_change(IFilterGraph2 *graph)
+{
+ IMediaControl *control;
+ OAFilterState state;
+ HRESULT hr;
+
+ hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
+ ok(hr == S_OK, "QueryInterface(IMediaControl) failed: %x\n", hr);
+
+ hr = IMediaControl_GetState(control, 1000, &state);
+ ok(hr == S_OK, "GetState() failed: %x\n", hr);
+ ok(state == State_Stopped, "wrong state %d\n", state);
+
+ hr = IMediaControl_Run(control);
+ ok(SUCCEEDED(hr), "Run() failed: %x\n", hr);
+ hr = IMediaControl_GetState(control, INFINITE, &state);
+ ok(SUCCEEDED(hr), "GetState() failed: %x\n", hr);
+ ok(state == State_Running, "wrong state %d\n", state);
+
+ hr = IMediaControl_Stop(control);
+ ok(SUCCEEDED(hr), "Stop() failed: %x\n", hr);
+ hr = IMediaControl_GetState(control, 1000, &state);
+ ok(hr == S_OK, "GetState() failed: %x\n", hr);
+ ok(state == State_Stopped, "wrong state %d\n", state);
+
+ hr = IMediaControl_Pause(control);
+ ok(SUCCEEDED(hr), "Pause() failed: %x\n", hr);
+ hr = IMediaControl_GetState(control, 1000, &state);
+ ok(hr == S_OK, "GetState() failed: %x\n", hr);
+ ok(state == State_Paused, "wrong state %d\n", state);
+
+ hr = IMediaControl_Run(control);
+ ok(SUCCEEDED(hr), "Run() failed: %x\n", hr);
+ hr = IMediaControl_GetState(control, 1000, &state);
+ ok(hr == S_OK, "GetState() failed: %x\n", hr);
+ ok(state == State_Running, "wrong state %d\n", state);
+
+ hr = IMediaControl_Pause(control);
+ ok(SUCCEEDED(hr), "Pause() failed: %x\n", hr);
+ hr = IMediaControl_GetState(control, 1000, &state);
+ ok(hr == S_OK, "GetState() failed: %x\n", hr);
+ ok(state == State_Paused, "wrong state %d\n", state);
+
+ hr = IMediaControl_Stop(control);
+ ok(SUCCEEDED(hr), "Stop() failed: %x\n", hr);
+ hr = IMediaControl_GetState(control, 1000, &state);
+ ok(hr == S_OK, "GetState() failed: %x\n", hr);
+ ok(state == State_Stopped, "wrong state %d\n", state);
+
+ IMediaControl_Release(control);
+}
+
static void rungraph(IFilterGraph2 *graph)
{
HRESULT hr;
@@ -354,6 +406,10 @@ static void rungraph(IFilterGraph2 *graph)
IMediaFilter* pmf;
HANDLE hEvent;
+ test_basic_video(graph);
+ test_mediacontrol(graph);
+ test_state_change(graph);
+
hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&pmc);
ok(hr==S_OK, "Cannot get IMediaControl interface returned: %x\n", hr);
@@ -366,9 +422,6 @@ static void rungraph(IFilterGraph2 *graph)
IMediaFilter_Release(pmf);
- test_basic_video(graph);
- test_mediacontrol(graph);
-
hr = IMediaControl_Run(pmc);
ok(hr==S_FALSE, "Cannot run the graph returned: %x\n", hr);
@@ -380,39 +433,6 @@ static void rungraph(IFilterGraph2 *graph)
IFilterGraph2_SetDefaultSyncSource(graph);
- Sleep(10);
- trace("stop -> pause\n");
- hr = IMediaControl_Pause(pmc);
- ok(hr==S_OK || hr == S_FALSE, "Cannot pause the graph returned: %x\n", hr);
-
- Sleep(10);
- trace("pause -> run\n");
- hr = IMediaControl_Run(pmc);
- ok(hr==S_OK || hr == S_FALSE, "Cannot start the graph returned: %x\n", hr);
-
- Sleep(10);
- trace("run -> pause\n");
- hr = IMediaControl_Pause(pmc);
- ok(hr==S_OK || hr == S_FALSE, "Cannot pause the graph returned: %x\n", hr);
-
- Sleep(10);
- trace("pause -> stop\n");
- hr = IMediaControl_Stop(pmc);
- ok(hr==S_OK || hr == S_FALSE, "Cannot stop the graph returned: %x\n", hr);
-
- Sleep(10);
- trace("pause -> run\n");
- hr = IMediaControl_Run(pmc);
- ok(hr==S_OK || hr == S_FALSE, "Cannot start the graph returned: %x\n", hr);
-
- trace("run -> stop\n");
- hr = IMediaControl_Stop(pmc);
- ok(hr==S_OK || hr == S_FALSE, "Cannot stop the graph returned: %x\n", hr);
-
- trace("stop -> run\n");
- hr = IMediaControl_Run(pmc);
- ok(hr==S_OK || hr == S_FALSE, "Cannot start the graph returned: %x\n", hr);
-
hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaEvent, (LPVOID*)&pme);
ok(hr==S_OK, "Cannot get IMediaEvent interface returned: %x\n", hr);
--
2.7.4
Feb. 28, 2018