From 2bca8eac3ad568939f17ee9c6ccd7ece2623d3c1 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Fri, 6 Dec 2019 14:54:21 +0100 Subject: [PATCH] msado15: Implement _Stream_put_Type and _Stream_get_Type. Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard --- configure | 1 + configure.ac | 1 + dlls/msado15/stream.c | 20 +++++++---- dlls/msado15/tests/Makefile.in | 5 +++ dlls/msado15/tests/msado15.c | 63 ++++++++++++++++++++++++++++++++++ 5 files changed, 84 insertions(+), 6 deletions(-) create mode 100644 dlls/msado15/tests/Makefile.in create mode 100644 dlls/msado15/tests/msado15.c diff --git a/configure b/configure index 1035da0e883..5dc6347ee16 100755 --- a/configure +++ b/configure @@ -20585,6 +20585,7 @@ wine_fn_config_makefile dlls/msacm32.drv enable_msacm32_drv wine_fn_config_makefile dlls/msacm32 enable_msacm32 wine_fn_config_makefile dlls/msacm32/tests enable_tests wine_fn_config_makefile dlls/msado15 enable_msado15 +wine_fn_config_makefile dlls/msado15/tests enable_tests wine_fn_config_makefile dlls/msadp32.acm enable_msadp32_acm wine_fn_config_makefile dlls/msasn1 enable_msasn1 wine_fn_config_makefile dlls/mscat32 enable_mscat32 diff --git a/configure.ac b/configure.ac index 06ac9c6c713..b0ba0941342 100644 --- a/configure.ac +++ b/configure.ac @@ -3439,6 +3439,7 @@ WINE_CONFIG_MAKEFILE(dlls/msacm32.drv) WINE_CONFIG_MAKEFILE(dlls/msacm32) WINE_CONFIG_MAKEFILE(dlls/msacm32/tests) WINE_CONFIG_MAKEFILE(dlls/msado15) +WINE_CONFIG_MAKEFILE(dlls/msado15/tests) WINE_CONFIG_MAKEFILE(dlls/msadp32.acm) WINE_CONFIG_MAKEFILE(dlls/msasn1) WINE_CONFIG_MAKEFILE(dlls/mscat32) diff --git a/dlls/msado15/stream.c b/dlls/msado15/stream.c index 48a485d5991..8e88b9aa651 100644 --- a/dlls/msado15/stream.c +++ b/dlls/msado15/stream.c @@ -32,8 +32,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(msado15); struct stream { - _Stream Stream_iface; - LONG refs; + _Stream Stream_iface; + LONG refs; + StreamTypeEnum type; }; static inline struct stream *impl_from_Stream( _Stream *iface ) @@ -130,14 +131,20 @@ static HRESULT WINAPI stream_put_Position( _Stream *iface, LONG pos ) static HRESULT WINAPI stream_get_Type( _Stream *iface, StreamTypeEnum *type ) { - FIXME( "%p, %p\n", iface, type ); - return E_NOTIMPL; + struct stream *stream = impl_from_Stream( iface ); + TRACE( "%p, %p\n", stream, type ); + + *type = stream->type; + return S_OK; } static HRESULT WINAPI stream_put_Type( _Stream *iface, StreamTypeEnum type ) { - FIXME( "%p, %u\n", iface, type ); - return E_NOTIMPL; + struct stream *stream = impl_from_Stream( iface ); + TRACE( "%p, %u\n", stream, type ); + + stream->type = type; + return S_OK; } static HRESULT WINAPI stream_get_LineSeparator( _Stream *iface, LineSeparatorEnum *sep ) @@ -305,6 +312,7 @@ HRESULT Stream_create( void **obj ) if (!(stream = heap_alloc_zero( sizeof(*stream) ))) return E_OUTOFMEMORY; stream->Stream_iface.lpVtbl = &stream_vtbl; stream->refs = 1; + stream->type = adTypeText; *obj = &stream->Stream_iface; TRACE( "returning iface %p\n", *obj ); diff --git a/dlls/msado15/tests/Makefile.in b/dlls/msado15/tests/Makefile.in new file mode 100644 index 00000000000..a97f3dd4339 --- /dev/null +++ b/dlls/msado15/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = msado15.dll +IMPORTS = oleaut32 ole32 + +C_SRCS = \ + msado15.c diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c new file mode 100644 index 00000000000..ed465e20723 --- /dev/null +++ b/dlls/msado15/tests/msado15.c @@ -0,0 +1,63 @@ +/* + * Copyright 2019 Hans Leidekker for CodeWeavers + * + * 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 + */ + +#include +#define COBJMACROS +#include +#include +#include +#include "wine/test.h" + +static void test_Stream(void) +{ + _Stream *stream; + StreamTypeEnum type; + LONG refs; + HRESULT hr; + + hr = CoCreateInstance( &CLSID_Stream, NULL, CLSCTX_INPROC_SERVER, &IID__Stream, (void **)&stream ); + ok( hr == S_OK, "got %08x\n", hr ); + + /* check default type */ + type = 0; + hr = _Stream_get_Type( stream, &type ); + ok( hr == S_OK, "got %08x\n", hr ); + ok( type == adTypeText, "got %u\n", type ); + + hr = _Stream_put_Type( stream, adTypeBinary ); + ok( hr == S_OK, "got %08x\n", hr ); + + type = 0; + hr = _Stream_get_Type( stream, &type ); + ok( hr == S_OK, "got %08x\n", hr ); + ok( type == adTypeBinary, "got %u\n", type ); + + /* revert */ + hr = _Stream_put_Type( stream, adTypeText ); + ok( hr == S_OK, "got %08x\n", hr ); + + refs = _Stream_Release( stream ); + ok( !refs, "got %d\n", refs ); +} + +START_TEST(msado15) +{ + CoInitialize( NULL ); + test_Stream(); + CoUninitialize(); +}