Fix tests build

Daemon::requestPairing changed into ::askPairingConfirmation.
This commit is contained in:
Aleix Pol 2015-12-06 00:08:02 +01:00
parent 03926cc3bf
commit a45e48ca7a
4 changed files with 62 additions and 66 deletions

View file

@ -29,12 +29,13 @@ set(testsslsocketlinereader_sources
ecm_add_test(testsslsocketlinereader.cpp ${testsslsocketlinereader_sources} TEST_NAME testsslsocketlinereader LINK_LIBRARIES ${kdeconnect_libraries}) ecm_add_test(testsslsocketlinereader.cpp ${testsslsocketlinereader_sources} TEST_NAME testsslsocketlinereader LINK_LIBRARIES ${kdeconnect_libraries})
set(kdeconnectconfigtest_sources set(kdeconnectconfigtest_sources
../core/backends/devicelink.cpp
../core/backends/pairinghandler.cpp ../core/backends/pairinghandler.cpp
../core/dbushelper.cpp ../core/dbushelper.cpp
../core/device.cpp ../core/device.cpp
../core/pluginloader.cpp ../core/pluginloader.cpp
) )
ecm_add_test(kdeconnectconfigtest.cpp ${kdeconnectconfigtest_sources} TEST_NAME kdeconnectconfgtest LINK_LIBRARIES ${kdeconnect_libraries}) ecm_add_test(kdeconnectconfigtest.cpp ${kdeconnectconfigtest_sources} TEST_NAME kdeconnectconfigtest LINK_LIBRARIES ${kdeconnect_libraries})
set(lanlinkprovidertest_sources set(lanlinkprovidertest_sources
../core/backends/devicelink.cpp ../core/backends/devicelink.cpp
@ -54,4 +55,4 @@ ecm_add_test(lanlinkprovidertest.cpp ${lanlinkprovidertest_sources} TEST_NAME
ecm_add_test(devicetest.cpp ${lanlinkprovidertest_sources} TEST_NAME devicetest LINK_LIBRARIES ${kdeconnect_libraries}) ecm_add_test(devicetest.cpp ${lanlinkprovidertest_sources} TEST_NAME devicetest LINK_LIBRARIES ${kdeconnect_libraries})
ecm_add_test(downloadjobtest.cpp ../core/backends/lan/downloadjob.cpp TEST_NAME downloadjobtest LINK_LIBRARIES ${kdeconnect_libraries}) ecm_add_test(downloadjobtest.cpp ../core/backends/lan/downloadjob.cpp TEST_NAME downloadjobtest LINK_LIBRARIES ${kdeconnect_libraries})

View file

@ -33,38 +33,7 @@
#include "core/kdeconnectplugin.h" #include "core/kdeconnectplugin.h"
#include <backends/pairinghandler.h> #include <backends/pairinghandler.h>
#include "kdeconnect-version.h" #include "kdeconnect-version.h"
#include "testdaemon.h"
class TestDaemon : public Daemon
{
Q_OBJECT
public:
TestDaemon(QObject* parent = Q_NULLPTR)
: Daemon(parent, true)
, m_nam(Q_NULLPTR)
{
}
void requestPairing(PairingHandler* d) Q_DECL_OVERRIDE
{
d->acceptPairing();
}
void reportError(const QString & title, const QString & description) Q_DECL_OVERRIDE
{
qWarning() << "error:" << title << description;
}
QNetworkAccessManager* networkAccessManager() Q_DECL_OVERRIDE
{
if (!m_nam) {
m_nam = new KIO::AccessManager(this);
}
return m_nam;
}
private:
QNetworkAccessManager* m_nam;
};
class PluginLoadTest : public QObject class PluginLoadTest : public QObject
{ {

View file

@ -33,38 +33,7 @@
#include "core/kdeconnectplugin.h" #include "core/kdeconnectplugin.h"
#include <backends/pairinghandler.h> #include <backends/pairinghandler.h>
#include "kdeconnect-version.h" #include "kdeconnect-version.h"
#include "testdaemon.h"
class TestDaemon : public Daemon
{
Q_OBJECT
public:
TestDaemon(QObject* parent = Q_NULLPTR)
: Daemon(parent, true)
, m_nam(Q_NULLPTR)
{
}
void requestPairing(PairingHandler* d) Q_DECL_OVERRIDE
{
d->acceptPairing();
}
void reportError(const QString & title, const QString & description) Q_DECL_OVERRIDE
{
qWarning() << "error:" << title << description;
}
QNetworkAccessManager* networkAccessManager() Q_DECL_OVERRIDE
{
if (!m_nam) {
m_nam = new KIO::AccessManager(this);
}
return m_nam;
}
private:
QNetworkAccessManager* m_nam;
};
class TestSendFile : public QObject class TestSendFile : public QObject
{ {

57
tests/testdaemon.h Normal file
View file

@ -0,0 +1,57 @@
/**
* Copyright 2015 Aleix Pol Gonzalez <aleixpol@kde.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TESTDAEMON_H
#define TESTDAEMON_H
#include <core/daemon.h>
#include <core/backends/pairinghandler.h>
class TestDaemon : public Daemon
{
public:
TestDaemon(QObject* parent = Q_NULLPTR)
: Daemon(parent, true)
, m_nam(Q_NULLPTR)
{
}
void reportError(const QString & title, const QString & description) Q_DECL_OVERRIDE
{
qWarning() << "error:" << title << description;
}
void askPairingConfirmation(PairingHandler * d) override {
d->acceptPairing();
}
QNetworkAccessManager* networkAccessManager() Q_DECL_OVERRIDE
{
if (!m_nam) {
m_nam = new KIO::AccessManager(this);
}
return m_nam;
}
private:
QNetworkAccessManager* m_nam;
};
#endif