IDCInfo_Release(info);
}
+struct can_convert
+{
+ DBTYPE type;
+ DWORD can_convert_to;
+} simple_convert[] =
+{
+ {DBTYPE_EMPTY, 0x23bfd9ff},
+ {DBTYPE_NULL, 0x00001002},
+ {DBTYPE_I2, 0x3b9fd9ff},
+ {DBTYPE_I4, 0x3bdfd9ff},
+
+ {DBTYPE_R4, 0x3b9fd9ff},
+ {DBTYPE_R8, 0x3b9fd9ff},
+ {DBTYPE_CY, 0x039fd97f},
+ {DBTYPE_DATE, 0x399f99bf},
+
+ {DBTYPE_BSTR, 0x3bffd9ff},
+ {DBTYPE_IDISPATCH, 0x3bffffff},
+ {DBTYPE_ERROR, 0x01001500},
+ {DBTYPE_BOOL, 0x039fd9ff},
+
+ {DBTYPE_VARIANT, 0x3bffffff},
+ {DBTYPE_IUNKNOWN, 0x00003203},
+ {DBTYPE_DECIMAL, 0x3b9fd97f},
+ {DBTYPE_I1, 0x3b9fd9ff},
+
+ {DBTYPE_UI1, 0x3b9fd9ff},
+ {DBTYPE_UI2, 0x3b9fd9ff},
+ {DBTYPE_UI4, 0x3bdfd9ff},
+ {DBTYPE_I8, 0x03dfd97f},
+
+ {DBTYPE_UI8, 0x03dfd97f},
+ {DBTYPE_GUID, 0x01e01103},
+ {DBTYPE_BYTES, 0x01fc110b},
+ {DBTYPE_STR, 0x3bffd9ff},
+
+ {DBTYPE_WSTR, 0x3bffd9ff},
+ {DBTYPE_NUMERIC, 0x039fd97f},
+ {DBTYPE_UDT, 0x00000000},
+ {DBTYPE_DBDATE, 0x39801183},
+
+ {DBTYPE_DBTIME, 0x39801183},
+ {DBTYPE_DBTIMESTAMP, 0x39801183}
+};
+
+
+static void test_canconvert(void)
+{
+ IDataConvert *convert;
+ HRESULT hr;
+ int src_idx, dst_idx;
+
+ hr = CoCreateInstance(&CLSID_OLEDB_CONVERSIONLIBRARY, NULL, CLSCTX_INPROC_SERVER, &IID_IDataConvert, (void**)&convert);
+ if(FAILED(hr))
+ {
+ win_skip("Unable to load oledb conversion library\n");
+ return;
+ }
+
+ for(src_idx = 0; src_idx < sizeof(simple_convert) / sizeof(simple_convert[0]); src_idx++)
+ for(dst_idx = 0; dst_idx < sizeof(simple_convert) / sizeof(simple_convert[0]); dst_idx++)
+ {
+ BOOL expect;
+ hr = IDataConvert_CanConvert(convert, simple_convert[src_idx].type, simple_convert[dst_idx].type);
+ expect = (simple_convert[src_idx].can_convert_to >> dst_idx) & 1;
+todo_wine
+ ok((hr == S_OK && expect == TRUE) ||
+ (hr == S_FALSE && expect == FALSE),
+ "%04x -> %04x: got %08x expect conversion to be %spossible\n", simple_convert[src_idx].type,
+ simple_convert[dst_idx].type, hr, expect ? "" : "not ");
+ }
+
+ IDataConvert_Release(convert);
+}
+
START_TEST(convert)
{
OleInitialize(NULL);
test_dcinfo();
+ test_canconvert();
OleUninitialize();
}