File indexing completed on 2024-10-06 03:43:33

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 "wimaxsettingtest.h"
0008 
0009 #include "settings/wimaxsetting.h"
0010 
0011 #include <libnm/NetworkManager.h>
0012 
0013 #include <QTest>
0014 
0015 void WimaxSettingTest::testSetting_data()
0016 {
0017     QTest::addColumn<QString>("networkName");
0018     QTest::addColumn<QByteArray>("macAddress");
0019 
0020     QTest::newRow("setting1") << QString("networkname") // networkName
0021                               << QByteArray("01:23:45:67:89:ab"); // macAddress
0022 }
0023 
0024 void WimaxSettingTest::testSetting()
0025 {
0026     QFETCH(QString, networkName);
0027     QFETCH(QByteArray, macAddress);
0028 
0029     QVariantMap map;
0030 
0031     map.insert(QLatin1String(NM_SETTING_WIMAX_NETWORK_NAME), networkName);
0032     map.insert(QLatin1String(NM_SETTING_WIMAX_MAC_ADDRESS), macAddress);
0033 
0034     NetworkManager::WimaxSetting 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(WimaxSettingTest)
0046 
0047 #include "moc_wimaxsettingtest.cpp"