Hans Leidekker : msado15: Implement Fields_get_Count.

Alexandre Julliard julliard at winehq.org
Wed Dec 11 16:35:02 CST 2019


Module: wine
Branch: master
Commit: a5939587c92c16c5a0eb0e144c434b2ae75f8e10
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=a5939587c92c16c5a0eb0e144c434b2ae75f8e10

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Wed Dec 11 17:18:28 2019 +0100

msado15: Implement Fields_get_Count.

Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msado15/recordset.c     |  8 ++++++--
 dlls/msado15/tests/msado15.c | 48 ++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 52 insertions(+), 4 deletions(-)

diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c
index ed3cdf6bbf..99d22e4db0 100644
--- a/dlls/msado15/recordset.c
+++ b/dlls/msado15/recordset.c
@@ -388,8 +388,12 @@ static HRESULT WINAPI fields_Invoke( Fields *iface, DISPID member, REFIID riid,
 
 static HRESULT WINAPI fields_get_Count( Fields *iface, LONG *count )
 {
-    FIXME( "%p, %p\n", iface, count );
-    return E_NOTIMPL;
+    struct fields *fields = impl_from_Fields( iface );
+
+    TRACE( "%p, %p\n", fields, count );
+
+    *count = fields->count;
+    return S_OK;
 }
 
 static HRESULT WINAPI fields__NewEnum( Fields *iface, IUnknown **obj )
diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c
index e6371b8392..4ef4762ac6 100644
--- a/dlls/msado15/tests/msado15.c
+++ b/dlls/msado15/tests/msado15.c
@@ -77,8 +77,8 @@ static void test_Recordset(void)
 
     count = -1;
     hr = Fields_get_Count( fields2, &count );
-    todo_wine ok( hr == S_OK, "got %08x\n", hr );
-    todo_wine ok( !count, "got %d\n", count );
+    ok( hr == S_OK, "got %08x\n", hr );
+    ok( !count, "got %d\n", count );
 
     refs = _Recordset_Release( recordset );
     ok( !refs, "got %d\n", refs );
@@ -88,6 +88,49 @@ static void test_Recordset(void)
     ok( refs == 1, "got %d\n", refs );
 }
 
+static void test_Fields(void)
+{
+    _Recordset *recordset;
+    Fields *fields;
+    VARIANT val;
+    BSTR name;
+    LONG count;
+    HRESULT hr;
+
+    hr = CoCreateInstance( &CLSID_Recordset, NULL, CLSCTX_INPROC_SERVER, &IID__Recordset, (void **)&recordset );
+    ok( hr == S_OK, "got %08x\n", hr );
+
+    hr = _Recordset_get_Fields( recordset, &fields );
+    ok( hr == S_OK, "got %08x\n", hr );
+
+    count = -1;
+    hr = Fields_get_Count( fields, &count );
+    ok( !count, "got %d\n", count );
+
+    name = SysAllocString( L"field" );
+    V_VT( &val ) = VT_ERROR;
+    V_ERROR( &val ) = DISP_E_PARAMNOTFOUND;
+    hr = Fields_Append( fields, name, adInteger, 4, adFldUnspecified, val );
+    ok( hr == S_OK, "got %08x\n", hr );
+    SysFreeString( name );
+
+    count = -1;
+    hr = Fields_get_Count( fields, &count );
+    ok( count == 1, "got %d\n", count );
+
+    name = SysAllocString( L"field2" );
+    hr = Fields__Append( fields, name, adInteger, 4, adFldUnspecified );
+    ok( hr == S_OK, "got %08x\n", hr );
+    SysFreeString( name );
+
+    count = -1;
+    hr = Fields_get_Count( fields, &count );
+    ok( count == 2, "got %d\n", count );
+
+    Fields_Release( fields );
+    _Recordset_Release( recordset );
+}
+
 static HRESULT str_to_byte_array( const char *data, VARIANT *ret )
 {
     SAFEARRAY *vector;
@@ -406,6 +449,7 @@ START_TEST(msado15)
 {
     CoInitialize( NULL );
     test_Connection();
+    test_Fields();
     test_Recordset();
     test_Stream();
     CoUninitialize();




More information about the wine-cvs mailing list