Commit 01f00099 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Remove unused methods

parent 66e686e7
......@@ -90,7 +90,6 @@ set(libpimcommon_customtools_SRCS
set(libpimcommon_util_SRCS
util/pimutil.cpp
util/networkutil.cpp
)
set(libpimcommon_migrate_SRCS
......@@ -198,7 +197,6 @@ if (BUILD_TESTING)
add_subdirectory(autocorrection/autotests)
add_subdirectory(widgets/autotests)
add_subdirectory(migration/autotests)
add_subdirectory(util/autotests)
add_subdirectory(shareserviceurl/autotests)
add_subdirectory(translator/tests)
add_subdirectory(widgets/tests)
......@@ -234,7 +232,6 @@ ecm_generate_headers(PimCommon_CamelCasenetworkmanager_HEADERS
ecm_generate_headers(PimCommon_CamelCase_HEADERS
HEADER_NAMES
PimUtil
NetworkUtil
REQUIRED_HEADERS PimCommon_HEADERS
PREFIX PimCommon
RELATIVE util
......
macro(add_pimcommon_util_unittest _name)
ecm_add_test(${ARGN}
TEST_NAME ${_name}
NAME_PREFIX "pimcommon-util-"
LINK_LIBRARIES Qt5::Test Qt5::Gui KF5::PimCommon
GUI
)
endmacro()
add_pimcommon_util_unittest(networkutiltest networkutiltest.cpp)
/*
Copyright (c) 2015-2019 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
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, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "networkutiltest.h"
#include <QTest>
#include "../networkutil.h"
NetworkUtilTest::NetworkUtilTest(QObject *parent)
: QObject(parent)
{
}
NetworkUtilTest::~NetworkUtilTest()
{
}
void NetworkUtilTest::shouldHaveDefaultValue()
{
PimCommon::NetworkUtil util;
QVERIFY(!util.lowBandwidth());
}
void NetworkUtilTest::shouldApplyChanges()
{
PimCommon::NetworkUtil util;
bool lowBandwith = false;
util.setLowBandwidth(lowBandwith);
QCOMPARE(util.lowBandwidth(), lowBandwith);
lowBandwith = true;
util.setLowBandwidth(lowBandwith);
QCOMPARE(util.lowBandwidth(), lowBandwith);
}
QTEST_MAIN(NetworkUtilTest)
/*
Copyright (c) 2015-2019 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
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, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef NETWORKUTILTEST_H
#define NETWORKUTILTEST_H
#include <QObject>
class NetworkUtilTest : public QObject
{
Q_OBJECT
public:
explicit NetworkUtilTest(QObject *parent = nullptr);
~NetworkUtilTest();
private Q_SLOTS:
void shouldHaveDefaultValue();
void shouldApplyChanges();
};
#endif // NETWORKUTILTEST_H
/*
Copyright (c) 2015-2019 Montel Laurent <montel@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) any later version.
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, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "networkutil.h"
#include <qglobal.h>
using namespace PimCommon;
Q_GLOBAL_STATIC(NetworkUtil, s_networkUtil)
NetworkUtil *NetworkUtil::self()
{
return s_networkUtil;
}
NetworkUtil::NetworkUtil()
: mLowBandwidth(false)
{
}
bool NetworkUtil::lowBandwidth() const
{
return mLowBandwidth;
}
void NetworkUtil::setLowBandwidth(bool lowBandwidh)
{
mLowBandwidth = lowBandwidh;
}
/*
Copyright (c) 2015-2019 Montel Laurent <montel@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) any later version.
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, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef NETWORKUTIL_H
#define NETWORKUTIL_H
#include "pimcommon_export.h"
namespace PimCommon {
/**
* @brief The NetworkUtil class
* @author Laurent Montel <montel@kde.org>
*/
class PIMCOMMON_EXPORT NetworkUtil
{
public:
static NetworkUtil *self();
NetworkUtil();
bool lowBandwidth() const;
void setLowBandwidth(bool lowBandwidth);
private:
bool mLowBandwidth;
};
}
#endif // NETWORKUTIL_H
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