Commit d18b956a authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use specific export symbol when we build test

=> avoid to export some class when we build in release mode
parent ab111e47
......@@ -127,6 +127,11 @@ endif ()
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
if(BUILD_TESTING)
add_definitions(-DBUILD_TESTING)
endif(BUILD_TESTING)
add_subdirectory(mimetreeparser)
if (NOT ${MIMETREEPARSER_ONLY_BUILD})
add_subdirectory(messageviewer)
......
/* This file is part of the KDE project
Copyright (C) 2017 Laurent Montel <montel@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 TEMPLATEPARSERPRIVATE_EXPORT_H
#define TEMPLATEPARSERPRIVATE_EXPORT_H
#include "templateparser_export.h"
/* Classes which are exported only for unit tests */
#ifdef BUILD_TESTING
# ifndef TEMPLATEPARSER_TESTS_EXPORT
# define TEMPLATEPARSER_TESTS_EXPORT TEMPLATEPARSER_EXPORT
# endif
#else /* not compiling tests */
# define TEMPLATEPARSER_TESTS_EXPORT
#endif
#endif
......@@ -15,7 +15,7 @@ ecm_add_test(zoomactionmenutest.cpp
)
ecm_add_test(webengineprintmessageboxtest.cpp ${testwebengineviewer_webengine_SRCS} ../webengineprintmessagebox.cpp ../webengineexporthtmlpagejob.cpp
ecm_add_test(webengineprintmessageboxtest.cpp ${testwebengineviewer_webengine_SRCS} ../webengineexporthtmlpagejob.cpp
TEST_NAME webengineprintmessageboxtest
NAME_PREFIX "webengineviewer-"
LINK_LIBRARIES Qt5::Test KF5::WebEngineViewer KF5::I18n
......
......@@ -28,62 +28,62 @@ ecm_add_test(searchfullhashjobtest.cpp ../checkphishingurlutil.cpp ../updatedata
LINK_LIBRARIES Qt5::Test KF5::WebEngineViewer
)
ecm_add_test(localdatabasefiletest.cpp ../localdatabasefile.cpp ${testwebengineviewer_webengine_common_SRCS}
ecm_add_test(localdatabasefiletest.cpp ${testwebengineviewer_webengine_common_SRCS}
TEST_NAME localdatabasefiletest
NAME_PREFIX "webengineview-"
LINK_LIBRARIES Qt5::Test KF5::WebEngineViewer
)
ecm_add_test(createdatabasefilejobtest.cpp ../createdatabasefilejob.cpp ${testwebengineviewer_webengine_common_SRCS}
ecm_add_test(createdatabasefilejobtest.cpp ${testwebengineviewer_webengine_common_SRCS}
TEST_NAME createdatabasefilejobtest
NAME_PREFIX "webengineview-"
LINK_LIBRARIES Qt5::Test KF5::WebEngineViewer
)
ecm_add_test(verifydatabaseupdatetest.cpp ../createdatabasefilejob.cpp ${testwebengineviewer_webengine_common_SRCS}
ecm_add_test(verifydatabaseupdatetest.cpp ${testwebengineviewer_webengine_common_SRCS}
TEST_NAME verifydatabaseupdatetest
NAME_PREFIX "webengineview-"
LINK_LIBRARIES Qt5::Test KF5::WebEngineViewer
)
ecm_add_test(urlhashingtest.cpp ../urlhashing.cpp ${testwebengineviewer_webengine_common_SRCS}
ecm_add_test(urlhashingtest.cpp ${testwebengineviewer_webengine_common_SRCS}
TEST_NAME urlhashingtest
NAME_PREFIX "webengineview-"
LINK_LIBRARIES Qt5::Test KF5::WebEngineViewer
)
ecm_add_test(riceencodingdecodertest.cpp ../riceencodingdecoder.cpp ${testwebengineviewer_webengine_common_SRCS}
ecm_add_test(riceencodingdecodertest.cpp ${testwebengineviewer_webengine_common_SRCS}
TEST_NAME riceencodingdecodertest
NAME_PREFIX "webengineview-"
LINK_LIBRARIES Qt5::Test KF5::WebEngineViewer
)
ecm_add_test(hashcachemanagertest.cpp ../hashcachemanager.cpp ../checkphishingurlutil.cpp ${testwebengineviewer_webengine_common_SRCS}
ecm_add_test(hashcachemanagertest.cpp ${testwebengineviewer_webengine_common_SRCS}
TEST_NAME hashcachemanagertest
NAME_PREFIX "webengineview-"
LINK_LIBRARIES Qt5::Test KF5::ConfigCore
LINK_LIBRARIES Qt5::Test KF5::ConfigCore KF5::WebEngineViewer
)
ecm_add_test(checkphishingurlutiltest.cpp ../checkphishingurlutil.cpp ${testwebengineviewer_webengine_common_SRCS}
ecm_add_test(checkphishingurlutiltest.cpp ${testwebengineviewer_webengine_common_SRCS}
TEST_NAME checkphishingurlutiltest
NAME_PREFIX "webengineview-"
LINK_LIBRARIES Qt5::Test
LINK_LIBRARIES Qt5::Test KF5::WebEngineViewer
)
ecm_add_test(checkphishingurlcachetest.cpp ../checkphishingurlcache.cpp ../checkphishingurlutil.cpp ${testwebengineviewer_webengine_common_SRCS}
ecm_add_test(checkphishingurlcachetest.cpp ${testwebengineviewer_webengine_common_SRCS}
TEST_NAME checkphishingurlcachetest
NAME_PREFIX "webengineview-"
LINK_LIBRARIES Qt5::Test KF5::ConfigCore
LINK_LIBRARIES Qt5::Test KF5::ConfigCore KF5::WebEngineViewer
)
ecm_add_test(backoffmodemanagertest.cpp ../backoffmodemanager.cpp ../checkphishingurlutil.cpp ${testwebengineviewer_webengine_common_SRCS}
ecm_add_test(backoffmodemanagertest.cpp ${testwebengineviewer_webengine_common_SRCS}
TEST_NAME backoffmodemanagertest
NAME_PREFIX "webengineview-"
LINK_LIBRARIES Qt5::Test KF5::ConfigCore
LINK_LIBRARIES Qt5::Test KF5::ConfigCore KF5::WebEngineViewer
)
ecm_add_test(downloadlocaldatabasethreadtest.cpp ../downloadlocaldatabasethread.cpp ../checkphishingurlutil.cpp ${testwebengineviewer_webengine_common_SRCS}
ecm_add_test(downloadlocaldatabasethreadtest.cpp ${testwebengineviewer_webengine_common_SRCS}
TEST_NAME downloadlocaldatabasethreadtest
NAME_PREFIX "webengineview-"
LINK_LIBRARIES Qt5::Test Qt5::Network KF5::WebEngineViewer
......
......@@ -22,7 +22,7 @@
#include <QString>
#include <QObject>
#include "webengineviewer_export.h"
#include "webengineviewer_private_export.h"
namespace WebEngineViewer
{
namespace CheckPhishingUrlUtil
......@@ -38,13 +38,13 @@ enum UrlStatus {
QString apiKey();
QString versionApps();
QString databaseFileName();
QString configFileName();
WEBENGINEVIEWER_EXPORT quint16 minorVersion();
WEBENGINEVIEWER_EXPORT quint16 majorVersion();
WEBENGINEVIEWER_EXPORT double convertToSecond(const QString &str);
WEBENGINEVIEWER_EXPORT uint refreshingCacheAfterThisTime(double seconds);
WEBENGINEVIEWER_EXPORT bool cachedValueStillValid(uint seconds);
WEBENGINEVIEWER_EXPORT int generateRandomSecondValue(int numberOfFailed);
WEBENGINEVIEWER_TESTS_EXPORT QString configFileName();
WEBENGINEVIEWER_TESTS_EXPORT quint16 minorVersion();
WEBENGINEVIEWER_TESTS_EXPORT quint16 majorVersion();
WEBENGINEVIEWER_TESTS_EXPORT double convertToSecond(const QString &str);
WEBENGINEVIEWER_TESTS_EXPORT uint refreshingCacheAfterThisTime(double seconds);
WEBENGINEVIEWER_TESTS_EXPORT bool cachedValueStillValid(uint seconds);
WEBENGINEVIEWER_TESTS_EXPORT int generateRandomSecondValue(int numberOfFailed);
}
}
Q_DECLARE_METATYPE(WebEngineViewer::CheckPhishingUrlUtil::UrlStatus)
......
......@@ -24,13 +24,13 @@
#include <QSslError>
#include <QNetworkReply>
#include "webengineviewer_export.h"
#include "webengineviewer_private_export.h"
namespace WebEngineViewer
{
struct UpdateDataBaseInfo;
class CreatePhishingUrlDataBaseJobPrivate;
/* https://developers.google.com/safe-browsing/v4/update-api */
class WEBENGINEVIEWER_EXPORT CreatePhishingUrlDataBaseJob : public QObject
class WEBENGINEVIEWER_TESTS_EXPORT CreatePhishingUrlDataBaseJob : public QObject
{
Q_OBJECT
public:
......
......@@ -21,11 +21,11 @@
#define DOWNLOADLOCALDATABASETHREAD_H
#include <QThread>
#include "webengineviewer_export.h"
#include "webengineviewer_private_export.h"
#include <WebEngineViewer/CreatePhishingUrlDataBaseJob>
namespace WebEngineViewer
{
class WEBENGINEVIEWER_EXPORT DownloadLocalDatabaseThread : public QThread
class WEBENGINEVIEWER_TESTS_EXPORT DownloadLocalDatabaseThread : public QThread
{
Q_OBJECT
public:
......
......@@ -20,7 +20,7 @@
#ifndef LOCALDATABASEFILE_H
#define LOCALDATABASEFILE_H
#include "webengineviewer_export.h"
#include "webengineviewer_private_export.h"
#include <QString>
#include <QDateTime>
......@@ -28,7 +28,7 @@ namespace WebEngineViewer
{
class LocalDataBaseFilePrivate;
class Addition;
class WEBENGINEVIEWER_EXPORT LocalDataBaseFile
class WEBENGINEVIEWER_TESTS_EXPORT LocalDataBaseFile
{
public:
/*
......
......@@ -20,7 +20,7 @@
#ifndef RICEENCODINGDECODER_H
#define RICEENCODINGDECODER_H
#include "webengineviewer_export.h"
#include "webengineviewer_private_export.h"
#include "updatedatabaseinfo.h"
namespace WebEngineViewer
{
......@@ -56,7 +56,7 @@ private:
};
class WEBENGINEVIEWER_EXPORT RiceEncodingDecoder
class WEBENGINEVIEWER_TESTS_EXPORT RiceEncodingDecoder
{
public:
RiceEncodingDecoder();
......
......@@ -20,14 +20,14 @@
#ifndef URLHASHING_H
#define URLHASHING_H
#include "webengineviewer_export.h"
#include "webengineviewer_private_export.h"
#include <QUrl>
#include <QString>
namespace WebEngineViewer
{
//https://developers.google.com/safe-browsing/v4/urls-hashing
class WEBENGINEVIEWER_EXPORT UrlHashing
class WEBENGINEVIEWER_TESTS_EXPORT UrlHashing
{
public:
UrlHashing(const QUrl &url);
......
......@@ -21,10 +21,10 @@
#define WEBENGINEPRINTMESSAGEBOX_H
#include <QDialog>
#include "webengineviewer_export.h"
#include "webengineviewer_private_export.h"
namespace WebEngineViewer
{
class WEBENGINEVIEWER_EXPORT WebEnginePrintMessageBox : public QDialog
class WEBENGINEVIEWER_TESTS_EXPORT WebEnginePrintMessageBox : public QDialog
{
Q_OBJECT
public:
......
/* This file is part of the KDE project
Copyright (C) 2007 David Faure <faure@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 WEBENGINEVIEWERPRIVATE_EXPORT_H
#define WEBENGINEVIEWERPRIVATE_EXPORT_H
#include "webengineviewer_export.h"
/* Classes which are exported only for unit tests */
#ifdef BUILD_TESTING
# ifndef WEBENGINEVIEWER_TESTS_EXPORT
# define WEBENGINEVIEWER_TESTS_EXPORT WEBENGINEVIEWER_EXPORT
# endif
#else /* not compiling tests */
# define WEBENGINEVIEWER_TESTS_EXPORT
#endif
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment