[PATCH 5/5] msado15: Implement _Stream_put_Type and _Stream_get_Type.
Hans Leidekker
hans at codeweavers.com
Fri Dec 6 05:18:14 CST 2019
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
configure.ac | 1 +
dlls/msado15/stream.c | 20 +++++++----
dlls/msado15/tests/Makefile.in | 5 +++
dlls/msado15/tests/msado15.c | 63 ++++++++++++++++++++++++++++++++++
4 files changed, 83 insertions(+), 6 deletions(-)
create mode 100644 dlls/msado15/tests/Makefile.in
create mode 100644 dlls/msado15/tests/msado15.c
diff --git a/configure.ac b/configure.ac
index 06ac9c6c71..b0ba094134 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 48a485d599..8e88b9aa65 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 0000000000..a97f3dd433
--- /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 0000000000..ed465e2072
--- /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 <stdio.h>
+#define COBJMACROS
+#include <initguid.h>
+#include <oledb.h>
+#include <msado15_backcompat.h>
+#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();
+}
--
2.20.1
More information about the wine-devel
mailing list