Add basic test for url interceptor
This commit is contained in:
parent
48d9bcb9f5
commit
9f85a7dc11
@ -67,3 +67,4 @@ install(FILES
|
||||
|
||||
install(EXPORT PlasmaQuickTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE PlasmaQuickTargets.cmake NAMESPACE KF5:: )
|
||||
|
||||
add_subdirectory(autotests)
|
||||
|
32
src/plasmaquick/autotests/CMakeLists.txt
Normal file
32
src/plasmaquick/autotests/CMakeLists.txt
Normal 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
|
||||
)
|
||||
|
||||
|
40
src/plasmaquick/autotests/packageurlinterceptortest.cpp
Normal file
40
src/plasmaquick/autotests/packageurlinterceptortest.cpp
Normal 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"
|
||||
|
35
src/plasmaquick/autotests/packageurlinterceptortest.h
Normal file
35
src/plasmaquick/autotests/packageurlinterceptortest.h
Normal 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
|
@ -0,0 +1,2 @@
|
||||
#include "../../plasmaquick/packageurlinterceptor.h"
|
||||
|
Loading…
Reference in New Issue
Block a user