Huw Davies : oledb32/tests: Add some tests for IDCInfo.

Alexandre Julliard julliard at winehq.org
Thu Sep 10 09:08:30 CDT 2009


Module: wine
Branch: master
Commit: 678f98ea88c07a9950bda20647588a0c7923abf3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=678f98ea88c07a9950bda20647588a0c7923abf3

Author: Huw Davies <huw at codeweavers.com>
Date:   Wed Sep  9 17:18:37 2009 +0100

oledb32/tests: Add some tests for IDCInfo.

---

 .gitignore                     |    2 +
 configure                      |    9 +++
 configure.ac                   |    1 +
 dlls/oledb32/tests/Makefile.in |   15 ++++
 dlls/oledb32/tests/convert.c   |  152 ++++++++++++++++++++++++++++++++++++++++
 dlls/oledb32/tests/convert.idl |    1 +
 6 files changed, 180 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index 799496f..359f44e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -82,6 +82,8 @@ dlls/oleaut32/tests/tmarshal.tlb
 dlls/oleaut32/tests/tmarshal_i.c
 dlls/oledb32/convert.h
 dlls/oledb32/convert_i.c
+dlls/oledb32/tests/convert.h
+dlls/oledb32/tests/convert_i.c
 dlls/qmgr/qmgr_local.h
 dlls/qmgr/qmgr_local_i.c
 dlls/qmgrprxy/qmgrprxy.h
diff --git a/configure b/configure
index 59f988e..e32773b 100755
--- a/configure
+++ b/configure
@@ -15993,6 +15993,14 @@ dlls/oledb32/Makefile: dlls/oledb32/Makefile.in dlls/Makedll.rules"
 ac_config_files="$ac_config_files dlls/oledb32/Makefile"
 
 ALL_MAKEFILES="$ALL_MAKEFILES \\
+	dlls/oledb32/tests/Makefile"
+test "x$enable_tests" != xno && ALL_TEST_DIRS="$ALL_TEST_DIRS \\
+	oledb32/tests"
+ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS
+dlls/oledb32/tests/Makefile: dlls/oledb32/tests/Makefile.in dlls/Maketest.rules"
+ac_config_files="$ac_config_files dlls/oledb32/tests/Makefile"
+
+ALL_MAKEFILES="$ALL_MAKEFILES \\
 	dlls/oledlg/Makefile"
 test "x$enable_oledlg" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\
 	oledlg"
@@ -18929,6 +18937,7 @@ do
     "dlls/olecli.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/olecli.dll16/Makefile" ;;
     "dlls/olecli32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/olecli32/Makefile" ;;
     "dlls/oledb32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/oledb32/Makefile" ;;
+    "dlls/oledb32/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/oledb32/tests/Makefile" ;;
     "dlls/oledlg/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/oledlg/Makefile" ;;
     "dlls/olepro32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/olepro32/Makefile" ;;
     "dlls/olesvr.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/olesvr.dll16/Makefile" ;;
diff --git a/configure.ac b/configure.ac
index ba9a454..ac5a861 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2359,6 +2359,7 @@ WINE_CONFIG_MAKEFILE([dlls/oleaut32/tests/Makefile],[dlls/Maketest.rules],[dlls]
 WINE_CONFIG_MAKEFILE([dlls/olecli.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16])
 WINE_CONFIG_MAKEFILE([dlls/olecli32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
 WINE_CONFIG_MAKEFILE([dlls/oledb32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
+WINE_CONFIG_MAKEFILE([dlls/oledb32/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests])
 WINE_CONFIG_MAKEFILE([dlls/oledlg/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
 WINE_CONFIG_MAKEFILE([dlls/olepro32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
 WINE_CONFIG_MAKEFILE([dlls/olesvr.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16])
diff --git a/dlls/oledb32/tests/Makefile.in b/dlls/oledb32/tests/Makefile.in
new file mode 100644
index 0000000..f19a670
--- /dev/null
+++ b/dlls/oledb32/tests/Makefile.in
@@ -0,0 +1,15 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+TESTDLL   = oledb32.dll
+IMPORTS   = ole32 gdi32 advapi32 kernel32
+
+CTESTS = \
+	convert.c
+
+IDL_I_SRCS = convert.idl
+
+ at MAKE_TEST_RULES@
+
+ at DEPENDENCIES@  # everything below this line is overwritten by make depend
diff --git a/dlls/oledb32/tests/convert.c b/dlls/oledb32/tests/convert.c
new file mode 100644
index 0000000..8d7dd49
--- /dev/null
+++ b/dlls/oledb32/tests/convert.c
@@ -0,0 +1,152 @@
+/* OLE DB Conversion library tests
+ *
+ * Copyright 2009 Huw Davies
+ *
+ * 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 <stdarg.h>
+
+#define COBJMACROS
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
+
+#include "windef.h"
+#include "winbase.h"
+#include "ole2.h"
+#include "msdadc.h"
+
+#include "oledberr.h"
+
+#include "initguid.h"
+#include "msdaguid.h"
+
+#include "wine/test.h"
+
+static void test_dcinfo(void)
+{
+    IDCInfo *info;
+    HRESULT hr;
+    DCINFOTYPE types[2];
+    DCINFO *inf;
+
+    hr = CoCreateInstance(&CLSID_OLEDB_CONVERSIONLIBRARY, NULL, CLSCTX_INPROC_SERVER, &IID_IDCInfo, (void**)&info);
+    if(FAILED(hr))
+    {
+        win_skip("Unable to load oledb conversion library\n");
+        return;
+    }
+
+    types[0] = DCINFOTYPE_VERSION;
+    hr = IDCInfo_GetInfo(info, 1, types, &inf);
+    ok(hr == S_OK, "got %08x\n", hr);
+
+    ok(inf->eInfoType == DCINFOTYPE_VERSION, "got %08x\n", inf->eInfoType);
+    ok(V_VT(&inf->vData) == VT_UI4, "got %08x\n", V_VT(&inf->vData));
+    ok(V_UI4(&inf->vData) == 0x110, "got %08x\n", V_UI4(&inf->vData));
+
+    V_UI4(&inf->vData) = 0x200;
+    hr = IDCInfo_SetInfo(info, 1, inf);
+    ok(hr == S_OK, "got %08x\n", hr);
+    CoTaskMemFree(inf);
+
+    hr = IDCInfo_GetInfo(info, 1, types, &inf);
+    ok(hr == S_OK, "got %08x\n", hr);
+    ok(inf->eInfoType == DCINFOTYPE_VERSION, "got %08x\n", inf->eInfoType);
+    ok(V_VT(&inf->vData) == VT_UI4, "got %08x\n", V_VT(&inf->vData));
+    ok(V_UI4(&inf->vData) == 0x200, "got %08x\n", V_UI4(&inf->vData));
+
+    V_UI4(&inf->vData) = 0x100;
+    hr = IDCInfo_SetInfo(info, 1, inf);
+    ok(hr == S_OK, "got %08x\n", hr);
+    CoTaskMemFree(inf);
+
+    hr = IDCInfo_GetInfo(info, 1, types, &inf);
+    ok(hr == S_OK, "got %08x\n", hr);
+    ok(inf->eInfoType == DCINFOTYPE_VERSION, "got %08x\n", inf->eInfoType);
+    ok(V_VT(&inf->vData) == VT_UI4, "got %08x\n", V_VT(&inf->vData));
+    ok(V_UI4(&inf->vData) == 0x100, "got %08x\n", V_UI4(&inf->vData));
+
+    V_UI4(&inf->vData) = 0x500;
+    hr = IDCInfo_SetInfo(info, 1, inf);
+    ok(hr == S_OK, "got %08x\n", hr);
+    CoTaskMemFree(inf);
+
+    hr = IDCInfo_GetInfo(info, 1, types, &inf);
+    ok(hr == S_OK, "got %08x\n", hr);
+    ok(inf->eInfoType == DCINFOTYPE_VERSION, "got %08x\n", inf->eInfoType);
+    ok(V_VT(&inf->vData) == VT_UI4, "got %08x\n", V_VT(&inf->vData));
+    ok(V_UI4(&inf->vData) == 0x500, "got %08x\n", V_UI4(&inf->vData));
+
+    V_UI4(&inf->vData) = 0xffff;
+    hr = IDCInfo_SetInfo(info, 1, inf);
+    ok(hr == S_OK, "got %08x\n", hr);
+    CoTaskMemFree(inf);
+
+    hr = IDCInfo_GetInfo(info, 1, types, &inf);
+    ok(hr == S_OK, "got %08x\n", hr);
+    ok(inf->eInfoType == DCINFOTYPE_VERSION, "got %08x\n", inf->eInfoType);
+    ok(V_VT(&inf->vData) == VT_UI4, "got %08x\n", V_VT(&inf->vData));
+    ok(V_UI4(&inf->vData) == 0xffff, "got %08x\n", V_UI4(&inf->vData));
+
+    V_UI4(&inf->vData) = 0x12345678;
+    hr = IDCInfo_SetInfo(info, 1, inf);
+    ok(hr == S_OK, "got %08x\n", hr);
+    CoTaskMemFree(inf);
+
+    hr = IDCInfo_GetInfo(info, 1, types, &inf);
+    ok(hr == S_OK, "got %08x\n", hr);
+    ok(inf->eInfoType == DCINFOTYPE_VERSION, "got %08x\n", inf->eInfoType);
+    ok(V_VT(&inf->vData) == VT_UI4, "got %08x\n", V_VT(&inf->vData));
+    ok(V_UI4(&inf->vData) == 0x12345678, "got %08x\n", V_UI4(&inf->vData));
+
+    /* Try setting a version variant of something other than VT_UI4 */
+    V_VT(&inf->vData) = VT_I4;
+    V_I4(&inf->vData) = 0x200;
+    hr = IDCInfo_SetInfo(info, 1, inf);
+    ok(hr == DB_S_ERRORSOCCURRED, "got %08x\n", hr);
+    CoTaskMemFree(inf);
+
+    hr = IDCInfo_GetInfo(info, 1, types, &inf);
+    ok(hr == S_OK, "got %08x\n", hr);
+    ok(inf->eInfoType == DCINFOTYPE_VERSION, "got %08x\n", inf->eInfoType);
+    ok(V_VT(&inf->vData) == VT_UI4, "got %08x\n", V_VT(&inf->vData));
+    ok(V_UI4(&inf->vData) == 0x12345678, "got %08x\n", V_UI4(&inf->vData));
+    CoTaskMemFree(inf);
+
+    /* More than one type */
+    types[1] = 2;
+    hr = IDCInfo_GetInfo(info, 2, types, &inf);
+    ok(hr == S_OK, "got %08x\n", hr);
+    ok(inf[0].eInfoType == DCINFOTYPE_VERSION, "got %08x\n", inf[0].eInfoType);
+    ok(V_VT(&inf[0].vData) == VT_UI4, "got %08x\n", V_VT(&inf[0].vData));
+    ok(V_UI4(&inf[0].vData) == 0x12345678, "got %08x\n", V_UI4(&inf[0].vData));
+    ok(inf[1].eInfoType == 2, "got %08x\n", inf[1].eInfoType);
+    ok(V_VT(&inf[1].vData) == VT_EMPTY, "got %08x\n", V_VT(&inf[1].vData));
+
+    hr = IDCInfo_SetInfo(info, 2, inf);
+    ok(hr == S_OK, "got %08x\n", hr);
+    CoTaskMemFree(inf);
+
+
+    IDCInfo_Release(info);
+}
+
+START_TEST(convert)
+{
+    OleInitialize(NULL);
+    test_dcinfo();
+    OleUninitialize();
+}
diff --git a/dlls/oledb32/tests/convert.idl b/dlls/oledb32/tests/convert.idl
new file mode 100644
index 0000000..081be3d
--- /dev/null
+++ b/dlls/oledb32/tests/convert.idl
@@ -0,0 +1 @@
+#include "msdadc.idl"




More information about the wine-cvs mailing list