Add basic test for url interceptor

This commit is contained in:
Sebastian Kügler 2013-10-15 02:37:06 +02:00
parent 48d9bcb9f5
commit 9f85a7dc11
5 changed files with 110 additions and 0 deletions

View File

@ -67,3 +67,4 @@ install(FILES
install(EXPORT PlasmaQuickTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE PlasmaQuickTargets.cmake NAMESPACE KF5:: )
add_subdirectory(autotests)

View File

@ -0,0 +1,32 @@
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
include(ECMMarkAsTest)
find_package(KCoreAddons REQUIRED)
# add_definitions( -DKDESRCDIR=${CMAKE_CURRENT_SOURCE_DIR} )
MACRO(PLASMA_UNIT_TESTS)
FOREACH(_testname ${ARGN})
add_executable(${_testname} ${_testname}.cpp)
target_link_libraries(${_testname} ${QT_QTTEST_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY}
plasma KF5::KArchive KF5::KCoreAddons
KF5::KConfigGui
KF5::KI18n
KF5::KIOCore
KF5::KService
PlasmaQuick
)
if(QT_QTOPENGL_FOUND)
target_link_libraries(${_testname} ${QT_QTOPENGL_LIBRARY})
endif(QT_QTOPENGL_FOUND)
add_test(plasma-${_testname} ${_testname})
ecm_mark_as_test(${_testname})
ENDFOREACH(_testname)
ENDMACRO(PLASMA_UNIT_TESTS)
PLASMA_UNIT_TESTS(
packageurlinterceptortest
)

View File

@ -0,0 +1,40 @@
/******************************************************************************
* Copyright 2013 Sebastian Kügler <sebas@kde.org> *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library 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 *
* Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public License *
* along with this library; see the file COPYING.LIB. If not, write to *
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301, USA. *
*******************************************************************************/
#include "packageurlinterceptortest.h"
#include <packageurlinterceptor.h>
#include <QQmlNetworkAccessManagerFactory>
#include <qtest.h>
#include <QDebug>
QTEST_MAIN(PackageUrlInterceptorTest)
void PackageUrlInterceptorTest::loadAccessManager()
{
Plasma::Package pkg = Plasma::Package();
QQmlNetworkAccessManagerFactory* pui = PackageUrlInterceptor::createPackageAccessManagerFactory(pkg);
QVERIFY(pui != 0);
delete pui;
}
#include "moc_packageurlinterceptortest.cpp"

View File

@ -0,0 +1,35 @@
/******************************************************************************
* Copyright 2013 Sebastian Kügler <sebas@kde.org> *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library 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 *
* Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public License *
* along with this library; see the file COPYING.LIB. If not, write to *
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301, USA. *
*******************************************************************************/
#ifndef PACKAGEURLINTERCEPTORTEST_H
#define PACKAGEURLINTERCEPTORTEST_H
#include <QObject>
class PackageUrlInterceptorTest : public QObject
{
Q_OBJECT
public:
PackageUrlInterceptorTest() {}
private Q_SLOTS:
void loadAccessManager();
};
#endif

View File

@ -0,0 +1,2 @@
#include "../../plasmaquick/packageurlinterceptor.h"