File indexing completed on 2024-11-03 03:44:51
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 "olpcmeshsettingtest.h" 0008 0009 #include "settings/olpcmeshsetting.h" 0010 0011 #include <libnm/NetworkManager.h> 0012 0013 #include <QTest> 0014 0015 void OlpcMeshSettingTest::testSetting_data() 0016 { 0017 QTest::addColumn<QByteArray>("ssid"); 0018 QTest::addColumn<quint32>("channel"); 0019 QTest::addColumn<QByteArray>("dhcpAnycastAddress"); 0020 0021 QTest::newRow("setting1") << QByteArray("ssid") // ssid 0022 << (quint32)1 // channel 0023 << QByteArray("00:A0:C9:14:C8:29"); // dhcpAnycastAddress 0024 } 0025 0026 void OlpcMeshSettingTest::testSetting() 0027 { 0028 QFETCH(QByteArray, ssid); 0029 QFETCH(quint32, channel); 0030 QFETCH(QByteArray, dhcpAnycastAddress); 0031 0032 QVariantMap map; 0033 0034 map.insert(QLatin1String(NM_SETTING_OLPC_MESH_SSID), ssid); 0035 map.insert(QLatin1String(NM_SETTING_OLPC_MESH_CHANNEL), channel); 0036 map.insert(QLatin1String(NM_SETTING_OLPC_MESH_DHCP_ANYCAST_ADDRESS), dhcpAnycastAddress); 0037 0038 NetworkManager::OlpcMeshSetting setting; 0039 setting.fromMap(map); 0040 0041 QVariantMap map1 = setting.toMap(); 0042 QVariantMap::const_iterator it = map.constBegin(); 0043 while (it != map.constEnd()) { 0044 QCOMPARE(it.value(), map1.value(it.key())); 0045 ++it; 0046 } 0047 } 0048 0049 QTEST_MAIN(OlpcMeshSettingTest) 0050 0051 #include "moc_olpcmeshsettingtest.cpp"