From: Vibhav Pant vibhavp@gmail.com
--- dlls/bluetoothapis/tests/Makefile.in | 1 + dlls/bluetoothapis/tests/radio.c | 71 ++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 dlls/bluetoothapis/tests/radio.c
diff --git a/dlls/bluetoothapis/tests/Makefile.in b/dlls/bluetoothapis/tests/Makefile.in index c2e8bc0377a..c7d6567f578 100644 --- a/dlls/bluetoothapis/tests/Makefile.in +++ b/dlls/bluetoothapis/tests/Makefile.in @@ -2,4 +2,5 @@ TESTDLL = bluetoothapis.dll IMPORTS = bluetoothapis
SOURCES = \ + radio.c \ sdp.c diff --git a/dlls/bluetoothapis/tests/radio.c b/dlls/bluetoothapis/tests/radio.c new file mode 100644 index 00000000000..5f83c9d54e4 --- /dev/null +++ b/dlls/bluetoothapis/tests/radio.c @@ -0,0 +1,71 @@ +/* + * Tests for Bluetooth radio methods + * + * Copyright 2024 Vibhav Pant + * + * 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> + +#include <windef.h> +#include <winbase.h> + +#include <bthsdpdef.h> +#include <bluetoothapis.h> + +#include <wine/test.h> + +void test_BluetoothFindFirstRadio( void ) +{ + HANDLE radio, dummy = (HANDLE)0xdeadbeef; + BLUETOOTH_FIND_RADIO_PARAMS find_params; + HBLUETOOTH_RADIO_FIND find; + DWORD err, exp; + + radio = dummy; + SetLastError( 0xdeadbeef ); + find = BluetoothFindFirstRadio( NULL, &radio ); + ok ( !find, "Expected %p to be NULL\n", find ); + err = GetLastError(); + todo_wine ok( err == ERROR_INVALID_PARAMETER, "%lu != %d\n", err, ERROR_INVALID_PARAMETER ); + todo_wine ok( radio == dummy, "%p != %p\n", radio, dummy ); + + radio = dummy; + find_params.dwSize = 0; + SetLastError( 0xdeadbeef ); + find = BluetoothFindFirstRadio( &find_params, &radio ); + ok ( !find, "Expected %p to be NULL\n", find ); + err = GetLastError(); + todo_wine ok( err == ERROR_REVISION_MISMATCH, "%lu != %d\n", err, ERROR_REVISION_MISMATCH ); + todo_wine ok( radio == dummy, "%p != %p\n", radio, dummy ); + + find_params.dwSize = sizeof( find_params ); + SetLastError( 0xdeadbeef ); + find = BluetoothFindFirstRadio( &find_params, &radio ); + err = GetLastError(); + exp = find ? ERROR_SUCCESS : ERROR_NO_MORE_ITEMS; + todo_wine ok( err == exp, "%lu != %lu\n", err, exp ); + if (find) + { + CloseHandle( radio ); + todo_wine ok( BluetoothFindRadioClose( find ), "BluetoothFindRadioClose failed: %lu\n", GetLastError() ); + } +} + +START_TEST( radio ) +{ + test_BluetoothFindFirstRadio(); +}