oledb32/tests: Add some tests for IDCInfo.

This commit is contained in:
Huw Davies 2009-09-09 17:18:37 +01:00 committed by Alexandre Julliard
parent 93fa219bbf
commit 678f98ea88
6 changed files with 180 additions and 0 deletions

2
.gitignore vendored
View File

@ -82,6 +82,8 @@ dlls/oleaut32/tests/tmarshal.tlb
dlls/oleaut32/tests/tmarshal_i.c dlls/oleaut32/tests/tmarshal_i.c
dlls/oledb32/convert.h dlls/oledb32/convert.h
dlls/oledb32/convert_i.c 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.h
dlls/qmgr/qmgr_local_i.c dlls/qmgr/qmgr_local_i.c
dlls/qmgrprxy/qmgrprxy.h dlls/qmgrprxy/qmgrprxy.h

9
configure vendored
View File

@ -15992,6 +15992,14 @@ ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS
dlls/oledb32/Makefile: dlls/oledb32/Makefile.in dlls/Makedll.rules" dlls/oledb32/Makefile: dlls/oledb32/Makefile.in dlls/Makedll.rules"
ac_config_files="$ac_config_files dlls/oledb32/Makefile" 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 \\ ALL_MAKEFILES="$ALL_MAKEFILES \\
dlls/oledlg/Makefile" dlls/oledlg/Makefile"
test "x$enable_oledlg" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ test "x$enable_oledlg" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\
@ -18929,6 +18937,7 @@ do
"dlls/olecli.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/olecli.dll16/Makefile" ;; "dlls/olecli.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/olecli.dll16/Makefile" ;;
"dlls/olecli32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/olecli32/Makefile" ;; "dlls/olecli32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/olecli32/Makefile" ;;
"dlls/oledb32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/oledb32/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/oledlg/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/oledlg/Makefile" ;;
"dlls/olepro32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/olepro32/Makefile" ;; "dlls/olepro32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/olepro32/Makefile" ;;
"dlls/olesvr.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/olesvr.dll16/Makefile" ;; "dlls/olesvr.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/olesvr.dll16/Makefile" ;;

View File

@ -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/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/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/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/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/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]) WINE_CONFIG_MAKEFILE([dlls/olesvr.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16])

View File

@ -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
@MAKE_TEST_RULES@
@DEPENDENCIES@ # everything below this line is overwritten by make depend

View File

@ -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();
}

View File

@ -0,0 +1 @@
#include "msdadc.idl"