Commit 03c4b80c authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Reduce duplicate code

parent 825ca351
......@@ -19,6 +19,8 @@
#include "resourceconvertertest.h"
#include <QDebug>
ResourceConverterTest::ResourceConverterTest()
{
}
......@@ -27,15 +29,20 @@ ResourceConverterTest::~ResourceConverterTest()
{
}
QString ResourceConverterTest::prefixStr() const
{
return QStringLiteral("foo/bla bla/bli");
}
QString ResourceConverterTest::convertToFullCollectionPath(const qlonglong collectionValue)
{
return QStringLiteral("foo/bla bla/bli%1").arg(collectionValue);
return prefixStr() + QString::number(collectionValue);
}
Akonadi::Collection::Id ResourceConverterTest::convertFolderPathToCollectionId(const QString &path)
{
QString str = path;
str.remove(QStringLiteral("foo/bla bla/bli"));
str.remove(prefixStr());
auto result = str.toLongLong();
//Make sure that we use another number.
if (result != -1) {
......
......@@ -36,6 +36,7 @@ public:
void setTestPath(const QString &testPath);
private:
Q_REQUIRED_RESULT QString prefixStr() const;
QString mTestPath;
};
......
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