File indexing completed on 2024-10-06 03:43:32
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 "bridgeportsettingtest.h" 0008 0009 #include "settings/bridgeportsetting.h" 0010 0011 #include <nm-version.h> 0012 0013 #define NM_SETTING_BRIDGE_MAC_ADDRESS "mac-address" 0014 0015 #include <QTest> 0016 0017 void BridgePortSettingTest::testSetting_data() 0018 { 0019 QTest::addColumn<quint16>("priority"); 0020 QTest::addColumn<quint16>("pathCost"); 0021 QTest::addColumn<bool>("hairpinMode"); 0022 0023 QTest::newRow("setting1") << (quint16)60 // priority 0024 << (quint16)30000 // pathCost 0025 << true; // hairpinMode 0026 } 0027 0028 void BridgePortSettingTest::testSetting() 0029 { 0030 QFETCH(quint16, priority); 0031 QFETCH(quint16, pathCost); 0032 QFETCH(bool, hairpinMode); 0033 0034 QVariantMap map; 0035 0036 map.insert(QLatin1String(NM_SETTING_BRIDGE_PORT_PRIORITY), priority); 0037 map.insert(QLatin1String(NM_SETTING_BRIDGE_PORT_PATH_COST), pathCost); 0038 map.insert(QLatin1String(NM_SETTING_BRIDGE_PORT_PATH_COST), hairpinMode); 0039 0040 NetworkManager::BridgePortSetting setting; 0041 setting.fromMap(map); 0042 0043 QVariantMap map1 = setting.toMap(); 0044 QVariantMap::const_iterator it = map.constBegin(); 0045 while (it != map.constEnd()) { 0046 QCOMPARE(it.value(), map1.value(it.key())); 0047 ++it; 0048 } 0049 } 0050 0051 QTEST_MAIN(BridgePortSettingTest) 0052 0053 #include "moc_bridgeportsettingtest.cpp"