From fb68974dcd6056552a88cc2dc43026655f44e93b Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Mon, 21 Sep 2009 13:38:15 +0100 Subject: [PATCH] oledb32/tests: Add CanConvert tests for DBTYPE_BYREF, DBTYPE_ARRAY and DBTYPE_VECTOR. --- dlls/oledb32/tests/convert.c | 113 ++++++++++++++++++++++++++++++++++- 1 file changed, 111 insertions(+), 2 deletions(-) diff --git a/dlls/oledb32/tests/convert.c b/dlls/oledb32/tests/convert.c index 8ff1609fcb..2cfbdc3c7a 100644 --- a/dlls/oledb32/tests/convert.c +++ b/dlls/oledb32/tests/convert.c @@ -190,6 +190,11 @@ struct can_convert }; +static inline BOOL array_type(DBTYPE type) +{ + return (type >= DBTYPE_I2 && type <= DBTYPE_UI4); +} + static void test_canconvert(void) { IDataConvert *convert; @@ -226,14 +231,118 @@ static void test_canconvert(void) 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; + BOOL expect, simple_expect; + simple_expect = (simple_convert[src_idx].can_convert_to >> dst_idx) & 1; + 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; + expect = simple_expect; 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 "); + + /* src DBTYPE_BYREF */ + hr = IDataConvert_CanConvert(convert, simple_convert[src_idx].type | DBTYPE_BYREF, simple_convert[dst_idx].type); + expect = simple_expect; +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 | DBTYPE_BYREF, + simple_convert[dst_idx].type, hr, expect ? "" : "not "); + + /* dst DBTYPE_BYREF */ + hr = IDataConvert_CanConvert(convert, simple_convert[src_idx].type, simple_convert[dst_idx].type | DBTYPE_BYREF); + expect = FALSE; + if(simple_expect && + (simple_convert[dst_idx].type == DBTYPE_BYTES || + simple_convert[dst_idx].type == DBTYPE_STR || + simple_convert[dst_idx].type == DBTYPE_WSTR)) + expect = TRUE; +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 | DBTYPE_BYREF, hr, expect ? "" : "not "); + + /* src & dst DBTYPE_BYREF */ + hr = IDataConvert_CanConvert(convert, simple_convert[src_idx].type | DBTYPE_BYREF, simple_convert[dst_idx].type | DBTYPE_BYREF); + expect = FALSE; + if(simple_expect && + (simple_convert[dst_idx].type == DBTYPE_BYTES || + simple_convert[dst_idx].type == DBTYPE_STR || + simple_convert[dst_idx].type == DBTYPE_WSTR)) + expect = TRUE; +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 | DBTYPE_BYREF, + simple_convert[dst_idx].type | DBTYPE_BYREF, hr, expect ? "" : "not "); + + /* src DBTYPE_ARRAY */ + hr = IDataConvert_CanConvert(convert, simple_convert[src_idx].type | DBTYPE_ARRAY, simple_convert[dst_idx].type); + expect = FALSE; + if(array_type(simple_convert[src_idx].type) && simple_convert[dst_idx].type == DBTYPE_VARIANT) + expect = TRUE; +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 | DBTYPE_ARRAY, + simple_convert[dst_idx].type, hr, expect ? "" : "not "); + + /* dst DBTYPE_ARRAY */ + hr = IDataConvert_CanConvert(convert, simple_convert[src_idx].type, simple_convert[dst_idx].type | DBTYPE_ARRAY); + expect = FALSE; + if(array_type(simple_convert[dst_idx].type) && + (simple_convert[src_idx].type == DBTYPE_IDISPATCH || + simple_convert[src_idx].type == DBTYPE_VARIANT)) + expect = TRUE; +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 | DBTYPE_ARRAY, hr, expect ? "" : "not "); + + /* src & dst DBTYPE_ARRAY */ + hr = IDataConvert_CanConvert(convert, simple_convert[src_idx].type | DBTYPE_ARRAY, simple_convert[dst_idx].type | DBTYPE_ARRAY); + expect = FALSE; + if(array_type(simple_convert[src_idx].type) && + simple_convert[src_idx].type == simple_convert[dst_idx].type) + expect = TRUE; +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 | DBTYPE_ARRAY, + simple_convert[dst_idx].type | DBTYPE_ARRAY, hr, expect ? "" : "not "); + + /* src DBTYPE_VECTOR */ + hr = IDataConvert_CanConvert(convert, simple_convert[src_idx].type | DBTYPE_VECTOR, simple_convert[dst_idx].type); + expect = FALSE; +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 | DBTYPE_VECTOR, + simple_convert[dst_idx].type, hr, expect ? "" : "not "); + + /* dst DBTYPE_VECTOR */ + hr = IDataConvert_CanConvert(convert, simple_convert[src_idx].type, simple_convert[dst_idx].type | DBTYPE_VECTOR); + expect = FALSE; +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 | DBTYPE_VECTOR, hr, expect ? "" : "not "); + + /* src & dst DBTYPE_VECTOR */ + hr = IDataConvert_CanConvert(convert, simple_convert[src_idx].type | DBTYPE_VECTOR, simple_convert[dst_idx].type | DBTYPE_VECTOR); + expect = FALSE; +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 | DBTYPE_VECTOR, + simple_convert[dst_idx].type | DBTYPE_VECTOR, hr, expect ? "" : "not "); + + } IDataConvert_Release(convert); -- 2.32.0.93.g670b81a890