From: Vibhav Pant vibhavp@gmail.com
--- dlls/bluetoothapis/tests/sdp.c | 40 ++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 16 deletions(-)
diff --git a/dlls/bluetoothapis/tests/sdp.c b/dlls/bluetoothapis/tests/sdp.c index 4ac03defab3..c66f602e879 100644 --- a/dlls/bluetoothapis/tests/sdp.c +++ b/dlls/bluetoothapis/tests/sdp.c @@ -480,14 +480,14 @@ static void test_BluetoothSdpGetElementData_seq( void ) { SDP_ELEMENT_DATA container_elem = {0};
- winetest_push_context( "test_cases[%lld].sequence[%lld]", i, n ); + winetest_push_context( "test_cases[%d].sequence[%d]", (int)i, (int)n ); ret = BluetoothSdpGetContainerElementData( test_cases[i].data.data.sequence.value, test_cases[i].data.data.sequence.length, &handle, &container_elem ); if (ret == ERROR_NO_MORE_ITEMS) { - ok( n == test_cases[i].container_size, "Expected %lld elements, got %lld.\n", - test_cases[i].container_size, n ); + ok( n == test_cases[i].container_size, "Expected %d elements, got %d.\n", + (int)test_cases[i].container_size, (int)n ); winetest_pop_context(); break; } @@ -514,13 +514,20 @@ struct attr_callback_data SIZE_T i; };
+static BYTE sdp_record_bytes[] = { + 0x35, 0x48, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x01, 0x00, 0x00, 0x09, 0x00, 0x01, 0x35, 0x03, + 0x19, 0x12, 0x00, 0x09, 0x00, 0x05, 0x35, 0x03, 0x19, 0x10, 0x02, 0x09, 0x00, 0x09, 0x35, + 0x08, 0x35, 0x06, 0x19, 0x12, 0x00, 0x09, 0x01, 0x03, 0x09, 0x02, 0x00, 0x09, 0x01, 0x03, + 0x09, 0x02, 0x01, 0x09, 0x1d, 0x6b, 0x09, 0x02, 0x02, 0x09, 0x02, 0x46, 0x09, 0x02, 0x03, + 0x09, 0x05, 0x4d, 0x09, 0x02, 0x04, 0x28, 0x01, 0x09, 0x02, 0x05, 0x09, 0x00, 0x02 }; + static BOOL WINAPI enum_attr_callback( ULONG attr_id, BYTE *stream, ULONG stream_size, void *param ) { struct attr_callback_data *params = param; winetest_push_context( TEST_CASE_NAME( params->i + 1) ); if (params->i < params->attrs_n) - { - SDP_ELEMENT_DATA data = {0}; + { + SDP_ELEMENT_DATA data = {0}, data2 = {0}; DWORD result;
ok( attr_id == params->attrs_id[params->i], "Expected attribute id %lu, got %lu.\n", @@ -530,6 +537,14 @@ static BOOL WINAPI enum_attr_callback( ULONG attr_id, BYTE *stream, ULONG stream ok( !memcmp( ¶ms->attrs[params->i], &data, sizeof( data ) ), "Expected %s, got %s.\n", debugstr_SDP_ELEMENT_DATA( ¶ms->attrs[params->i] ), debugstr_SDP_ELEMENT_DATA( &data ) ); + + result = BluetoothSdpGetAttributeValue( sdp_record_bytes, ARRAY_SIZE( sdp_record_bytes ), + params->attrs_id[params->i], &data2 ); + ok( result == ERROR_SUCCESS, "BluetoothSdpGetAttributeValue failed: %ld.\n", result ); + ok( !memcmp( ¶ms->attrs[params->i], &data2, sizeof( data2 ) ), "Expected %s, got %s.\n", + debugstr_SDP_ELEMENT_DATA( ¶ms->attrs[params->i] ), + debugstr_SDP_ELEMENT_DATA( &data2 ) ); + params->i++; } winetest_pop_context(); @@ -538,18 +553,11 @@ static BOOL WINAPI enum_attr_callback( ULONG attr_id, BYTE *stream, ULONG stream
static void test_BluetoothSdpEnumAttributes( void ) { - static BYTE record_bytes[] = { - 0x35, 0x48, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x01, 0x00, 0x00, 0x09, 0x00, 0x01, 0x35, 0x03, - 0x19, 0x12, 0x00, 0x09, 0x00, 0x05, 0x35, 0x03, 0x19, 0x10, 0x02, 0x09, 0x00, 0x09, 0x35, - 0x08, 0x35, 0x06, 0x19, 0x12, 0x00, 0x09, 0x01, 0x03, 0x09, 0x02, 0x00, 0x09, 0x01, 0x03, - 0x09, 0x02, 0x01, 0x09, 0x1d, 0x6b, 0x09, 0x02, 0x02, 0x09, 0x02, 0x46, 0x09, 0x02, 0x03, - 0x09, 0x05, 0x4d, 0x09, 0x02, 0x04, 0x28, 0x01, 0x09, 0x02, 0x05, 0x09, 0x00, 0x02 }; - static SDP_ELEMENT_DATA attributes[] = { {SDP_TYPE_UINT, SDP_ST_UINT32, {.uint32 = 0x10000}}, - {SDP_TYPE_SEQUENCE, SDP_ST_NONE, {.sequence = {&record_bytes[13], 5}}}, - {SDP_TYPE_SEQUENCE, SDP_ST_NONE, {.sequence = {&record_bytes[21], 5}}}, - {SDP_TYPE_SEQUENCE, SDP_ST_NONE, {.sequence = {&record_bytes[29], 10}}}, + {SDP_TYPE_SEQUENCE, SDP_ST_NONE, {.sequence = {&sdp_record_bytes[13], 5}}}, + {SDP_TYPE_SEQUENCE, SDP_ST_NONE, {.sequence = {&sdp_record_bytes[21], 5}}}, + {SDP_TYPE_SEQUENCE, SDP_ST_NONE, {.sequence = {&sdp_record_bytes[29], 10}}}, {SDP_TYPE_UINT, SDP_ST_UINT16, {.uint16 = 0x0103}}, {SDP_TYPE_UINT, SDP_ST_UINT16, {.uint16 = 0x1d6b}}, {SDP_TYPE_UINT, SDP_ST_UINT16, {.uint16 = 0x0246}}, @@ -563,7 +571,7 @@ static void test_BluetoothSdpEnumAttributes( void ) BOOL ret;
SetLastError( 0xdeadbeef ); - ret = BluetoothSdpEnumAttributes( record_bytes, ARRAY_SIZE( record_bytes ), enum_attr_callback, + ret = BluetoothSdpEnumAttributes( sdp_record_bytes, ARRAY_SIZE( sdp_record_bytes ), enum_attr_callback, &data ); ok( ret, "BluetoothSdpEnumAttributes failed with %ld.\n", GetLastError() ); ok( data.i == data.attrs_n, "%d != %d\n", (int)data.i, (int)data.attrs_n );