From: Alistair Leslie-Hughes leslie_alistair@hotmail.com
v2: Initialize test variable.
Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com Signed-off-by: Hans Leidekker hans@codeweavers.com --- dlls/msado15/connection.c | 14 ++++++++++---- dlls/msado15/tests/msado15.c | 15 ++++++++++++++- 2 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/dlls/msado15/connection.c b/dlls/msado15/connection.c index c9799862bf..037ab52199 100644 --- a/dlls/msado15/connection.c +++ b/dlls/msado15/connection.c @@ -36,6 +36,7 @@ struct connection LONG refs;
ObjectStateEnum state; + LONG timeout; };
static inline struct connection *impl_from_Connection( _Connection *iface ) @@ -126,14 +127,18 @@ static HRESULT WINAPI connection_put_ConnectionString( _Connection *iface, BSTR
static HRESULT WINAPI connection_get_CommandTimeout( _Connection *iface, LONG *timeout ) { - FIXME( "%p, %p\n", iface, timeout ); - return E_NOTIMPL; + struct connection *connection = impl_from_Connection( iface ); + TRACE( "%p, %p\n", connection, timeout ); + *timeout = connection->timeout; + return S_OK; }
static HRESULT WINAPI connection_put_CommandTimeout( _Connection *iface, LONG timeout ) { - FIXME( "%p, %d\n", iface, timeout ); - return E_NOTIMPL; + struct connection *connection = impl_from_Connection( iface ); + TRACE( "%p, %d\n", connection, timeout ); + connection->timeout = timeout; + return S_OK; }
static HRESULT WINAPI connection_get_ConnectionTimeout( _Connection *iface, LONG *timeout ) @@ -342,6 +347,7 @@ HRESULT Connection_create( void **obj ) connection->Connection_iface.lpVtbl = &connection_vtbl; connection->refs = 1; connection->state = adStateClosed; + connection->timeout = 30;
*obj = &connection->Connection_iface; TRACE( "returning iface %p\n", *obj ); diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c index 8249a398ba..a63ab445a1 100644 --- a/dlls/msado15/tests/msado15.c +++ b/dlls/msado15/tests/msado15.c @@ -286,7 +286,7 @@ static void test_Connection(void) _Connection *connection; IRunnableObject *runtime; ISupportErrorInfo *errorinfo; - LONG state; + LONG state, timeout;
hr = CoCreateInstance(&CLSID_Connection, NULL, CLSCTX_INPROC_SERVER, &IID__Connection, (void**)&connection); ok( hr == S_OK, "got %08x\n", hr ); @@ -310,6 +310,19 @@ if (0) /* Crashes on windows */ ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr); ok(state == adStateClosed, "Unexpected state value 0x%08x\n", state);
+ timeout = 0; + hr = _Connection_get_CommandTimeout(connection, &timeout); + ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr); + ok(timeout == 30, "Unexpected timeout value %d\n", timeout); + + hr = _Connection_put_CommandTimeout(connection, 300); + ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr); + + timeout = 0; + hr = _Connection_get_CommandTimeout(connection, &timeout); + ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr); + ok(timeout == 300, "Unexpected timeout value %d\n", timeout); + _Connection_Release(connection); }