end work on interfaces

This commit is contained in:
arcan1s
2015-03-14 06:42:06 +03:00
parent ef2694d7a7
commit f80d6aae6b
38 changed files with 676 additions and 569 deletions

View File

@ -11,23 +11,24 @@ set (TARGETS "")
# set files
# netctl
set (NETCTL_HEADERS testnetctl.h)
set (NETCTL_SOURCES testnetctl.cpp)
set (NETCTL_SOURCES testnetctl.cpp ${PROJECT_TRDPARTY_DIR}/listmap/listmap.cpp)
# netctl-auto
set (NETCTLAUTO_HEADERS testnetctlauto.h)
set (NETCTLAUTO_SOURCES testnetctlauto.cpp)
set (NETCTLAUTO_SOURCES testnetctlauto.cpp ${PROJECT_TRDPARTY_DIR}/listmap/listmap.cpp)
# netctl profile
set (PROFILE_HEADERS testnetctlprofile.h)
set (PROFILE_SOURCES testnetctlprofile.cpp)
set (PROFILE_SOURCES testnetctlprofile.cpp ${PROJECT_TRDPARTY_DIR}/listmap/listmap.cpp)
# wpa_supplicant
set (WPASUP_HEADERS testwpasup.h)
set (WPASUP_SOURCES testwpasup.cpp)
set (WPASUP_SOURCES testwpasup.cpp ${PROJECT_TRDPARTY_DIR}/listmap/listmap.cpp)
# include_path
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../${PROJECT_LIBRARY}/include/
${CMAKE_CURRENT_BINARY_DIR}/../
${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR})
${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_TRDPARTY_DIR})
link_directories (${PROJECT_LIBRARY}/src/lib)
if (USE_QT5)

View File

@ -22,6 +22,7 @@
#include <QDBusMessage>
#include <QtTest>
#include <listmap/listmap.h>
#include <netctlgui/netctlgui.h>
#include "version.h"
@ -119,12 +120,9 @@ void TestNetctl::test_getRecommendedConfiguration()
original.append(QString("SUDO_PATH==/usr/bin/sudo"));
original.append(QString("SYSTEMCTL_PATH==/usr/bin/systemctl"));
QMap<QString, QString> resultMap = Netctl::getRecommendedConfiguration();
QStringList result;
for (int i=0; i<resultMap.keys().count(); i++)
result.append(QString("%1==%2").arg(resultMap.keys()[i]).arg(resultMap[resultMap.keys()[i]]));
QWARN("This test may fail on other configuration");
QCOMPARE(result, original);
QCOMPARE(mapToList(resultMap), original);
}

View File

@ -22,6 +22,7 @@
#include <QDBusMessage>
#include <QtTest>
#include <listmap/listmap.h>
#include <netctlgui/netctlgui.h>
#include "version.h"
@ -107,12 +108,9 @@ void TestNetctlProfile::test_getRecommendedConfiguration()
original.append(QString("PROFILE_DIR==/etc/netctl"));
original.append(QString("SUDO_PATH==/usr/bin/sudo"));
QMap<QString, QString> resultMap = NetctlProfile::getRecommendedConfiguration();
QStringList result;
for (int i=0; i<resultMap.keys().count(); i++)
result.append(QString("%1==%2").arg(resultMap.keys()[i]).arg(resultMap[resultMap.keys()[i]]));
QWARN("This test may fail on other configuration");
QCOMPARE(result, original);
QCOMPARE(mapToList(resultMap), original);
}
@ -234,10 +232,7 @@ void TestNetctlProfile::test_createProfile()
if (helper) {
QList<QVariant> args;
args.append(QString("netctlgui-test-full"));
QStringList profileSettingsList;
for (int i=0; i<profileSettings.keys().count(); i++)
profileSettingsList.append(QString("%1==%2").arg(profileSettings.keys()[i]).arg(profileSettings[profileSettings.keys()[i]]));
args.append(profileSettingsList);
args.append(mapToList(profileSettings));
QVERIFY(sendDBusRequest(QString("/ctrl"), QString("Create"), args)[0].toBool());
}
delete netctl;
@ -298,13 +293,11 @@ phase2=\"auth=PAP\"\
dbus = sendDBusRequest(QString("/netctl"), QString("Profile"), args)[0].toStringList();
}
QMap<QString, QString> resultMap = netctl->getSettingsFromProfile(QString("netctlgui-test-full"));
for (int i=0; i<resultMap.keys().count(); i++)
result.append(QString("%1==%2").arg(resultMap.keys()[i]).arg(resultMap[resultMap.keys()[i]]));
netctl->removeProfile(QString("netctlgui-test-full"));
delete netctl;
QCOMPARE(result, original);
if (helper) QCOMPARE(dbus, result);
QCOMPARE(mapToList(resultMap), original);
if (helper) QCOMPARE(dbus, mapToList(resultMap));
}

View File

@ -22,6 +22,7 @@
#include <QDBusMessage>
#include <QtTest>
#include <listmap/listmap.h>
#include <netctlgui/netctlgui.h>
#include "version.h"
@ -83,12 +84,9 @@ void TestWpaSup::test_getRecommendedConfiguration()
original.append(QString("WPASUP_PATH==/usr/bin/wpa_supplicant"));
original.append(QString("WPA_DRIVERS==nl80211,wext"));
QMap<QString, QString> resultMap = WpaSup::getRecommendedConfiguration();
QStringList result;
for (int i=0; i<resultMap.keys().count(); i++)
result.append(QString("%1==%2").arg(resultMap.keys()[i]).arg(resultMap[resultMap.keys()[i]]));
QWARN("This test may fail on other configuration");
QCOMPARE(result, original);
QCOMPARE(mapToList(resultMap), original);
}