1 /* OLE DB Conversion library tests
3 * Copyright 2009 Huw Davies
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #define NONAMELESSUNION
24 #define NONAMELESSSTRUCT
36 #include "wine/test.h"
38 static void test_dcinfo(void)
45 hr = CoCreateInstance(&CLSID_OLEDB_CONVERSIONLIBRARY, NULL, CLSCTX_INPROC_SERVER, &IID_IDCInfo, (void**)&info);
48 win_skip("Unable to load oledb conversion library\n");
52 types[0] = DCINFOTYPE_VERSION;
53 hr = IDCInfo_GetInfo(info, 1, types, &inf);
54 ok(hr == S_OK, "got %08x\n", hr);
56 ok(inf->eInfoType == DCINFOTYPE_VERSION, "got %08x\n", inf->eInfoType);
57 ok(V_VT(&inf->vData) == VT_UI4, "got %08x\n", V_VT(&inf->vData));
58 ok(V_UI4(&inf->vData) == 0x110, "got %08x\n", V_UI4(&inf->vData));
60 V_UI4(&inf->vData) = 0x200;
61 hr = IDCInfo_SetInfo(info, 1, inf);
62 ok(hr == S_OK, "got %08x\n", hr);
65 hr = IDCInfo_GetInfo(info, 1, types, &inf);
66 ok(hr == S_OK, "got %08x\n", hr);
67 ok(inf->eInfoType == DCINFOTYPE_VERSION, "got %08x\n", inf->eInfoType);
68 ok(V_VT(&inf->vData) == VT_UI4, "got %08x\n", V_VT(&inf->vData));
69 ok(V_UI4(&inf->vData) == 0x200, "got %08x\n", V_UI4(&inf->vData));
71 V_UI4(&inf->vData) = 0x100;
72 hr = IDCInfo_SetInfo(info, 1, inf);
73 ok(hr == S_OK, "got %08x\n", hr);
76 hr = IDCInfo_GetInfo(info, 1, types, &inf);
77 ok(hr == S_OK, "got %08x\n", hr);
78 ok(inf->eInfoType == DCINFOTYPE_VERSION, "got %08x\n", inf->eInfoType);
79 ok(V_VT(&inf->vData) == VT_UI4, "got %08x\n", V_VT(&inf->vData));
80 ok(V_UI4(&inf->vData) == 0x100, "got %08x\n", V_UI4(&inf->vData));
82 V_UI4(&inf->vData) = 0x500;
83 hr = IDCInfo_SetInfo(info, 1, inf);
84 ok(hr == S_OK, "got %08x\n", hr);
87 hr = IDCInfo_GetInfo(info, 1, types, &inf);
88 ok(hr == S_OK, "got %08x\n", hr);
89 ok(inf->eInfoType == DCINFOTYPE_VERSION, "got %08x\n", inf->eInfoType);
90 ok(V_VT(&inf->vData) == VT_UI4, "got %08x\n", V_VT(&inf->vData));
91 ok(V_UI4(&inf->vData) == 0x500, "got %08x\n", V_UI4(&inf->vData));
93 V_UI4(&inf->vData) = 0xffff;
94 hr = IDCInfo_SetInfo(info, 1, inf);
95 ok(hr == S_OK, "got %08x\n", hr);
98 hr = IDCInfo_GetInfo(info, 1, types, &inf);
99 ok(hr == S_OK, "got %08x\n", hr);
100 ok(inf->eInfoType == DCINFOTYPE_VERSION, "got %08x\n", inf->eInfoType);
101 ok(V_VT(&inf->vData) == VT_UI4, "got %08x\n", V_VT(&inf->vData));
102 ok(V_UI4(&inf->vData) == 0xffff, "got %08x\n", V_UI4(&inf->vData));
104 V_UI4(&inf->vData) = 0x12345678;
105 hr = IDCInfo_SetInfo(info, 1, inf);
106 ok(hr == S_OK, "got %08x\n", hr);
109 hr = IDCInfo_GetInfo(info, 1, types, &inf);
110 ok(hr == S_OK, "got %08x\n", hr);
111 ok(inf->eInfoType == DCINFOTYPE_VERSION, "got %08x\n", inf->eInfoType);
112 ok(V_VT(&inf->vData) == VT_UI4, "got %08x\n", V_VT(&inf->vData));
113 ok(V_UI4(&inf->vData) == 0x12345678, "got %08x\n", V_UI4(&inf->vData));
115 /* Try setting a version variant of something other than VT_UI4 */
116 V_VT(&inf->vData) = VT_I4;
117 V_I4(&inf->vData) = 0x200;
118 hr = IDCInfo_SetInfo(info, 1, inf);
119 ok(hr == DB_S_ERRORSOCCURRED, "got %08x\n", hr);
122 hr = IDCInfo_GetInfo(info, 1, types, &inf);
123 ok(hr == S_OK, "got %08x\n", hr);
124 ok(inf->eInfoType == DCINFOTYPE_VERSION, "got %08x\n", inf->eInfoType);
125 ok(V_VT(&inf->vData) == VT_UI4, "got %08x\n", V_VT(&inf->vData));
126 ok(V_UI4(&inf->vData) == 0x12345678, "got %08x\n", V_UI4(&inf->vData));
129 /* More than one type */
131 hr = IDCInfo_GetInfo(info, 2, types, &inf);
132 ok(hr == S_OK, "got %08x\n", hr);
133 ok(inf[0].eInfoType == DCINFOTYPE_VERSION, "got %08x\n", inf[0].eInfoType);
134 ok(V_VT(&inf[0].vData) == VT_UI4, "got %08x\n", V_VT(&inf[0].vData));
135 ok(V_UI4(&inf[0].vData) == 0x12345678, "got %08x\n", V_UI4(&inf[0].vData));
136 ok(inf[1].eInfoType == 2, "got %08x\n", inf[1].eInfoType);
137 ok(V_VT(&inf[1].vData) == VT_EMPTY, "got %08x\n", V_VT(&inf[1].vData));
139 hr = IDCInfo_SetInfo(info, 2, inf);
140 ok(hr == S_OK, "got %08x\n", hr);
144 IDCInfo_Release(info);