File indexing completed on 2024-10-06 09:44:08
0001 /* 0002 SPDX-FileCopyrightText: 2012-2013 Jan Grulich <jgrulich@redhat.com> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #include "bluetoothsettingtest.h" 0008 0009 #include "settings/bluetoothsetting.h" 0010 0011 #include <libnm/NetworkManager.h> 0012 0013 #include <QTest> 0014 0015 void BluetoothSettingTest::testSetting_data() 0016 { 0017 QTest::addColumn<QByteArray>("address"); 0018 QTest::addColumn<QString>("type"); 0019 0020 QTest::newRow("setting1") << QByteArray("00:02:72:00:d4:1a") // address 0021 << QString("panu"); // type 0022 } 0023 0024 void BluetoothSettingTest::testSetting() 0025 { 0026 QFETCH(QByteArray, address); 0027 QFETCH(QString, type); 0028 0029 QVariantMap map; 0030 0031 map.insert(QLatin1String(NM_SETTING_BLUETOOTH_BDADDR), address); 0032 map.insert(QLatin1String(NM_SETTING_BLUETOOTH_TYPE), type); 0033 0034 NetworkManager::BluetoothSetting setting; 0035 setting.fromMap(map); 0036 0037 QVariantMap map1 = setting.toMap(); 0038 QVariantMap::const_iterator it = map.constBegin(); 0039 while (it != map.constEnd()) { 0040 QCOMPARE(it.value(), map1.value(it.key())); 0041 ++it; 0042 } 0043 } 0044 0045 QTEST_MAIN(BluetoothSettingTest) 0046 0047 #include "moc_bluetoothsettingtest.cpp"