##// END OF EJS Templates
Added static plugin support...
Added static plugin support In case of fully static exe even plugins must be static to allow single file executable. Small fix, when using resources in app from library they must be initialized with Q_INIT_RESOURCE. Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>

File last commit:

r709:8d80a1dd4059
r1156:247dc18789c6
Show More
TestStringUtils.cpp
50 lines | 1.7 KiB | text/x-c | CppLexer
#include <Common/StringUtils.h>
#include <QObject>
#include <QtTest>
class TestStringUtils : public QObject {
Q_OBJECT
private slots:
void testUniqueName_data();
void testUniqueName();
};
void TestStringUtils::testUniqueName_data()
{
// ////////////// //
// Test structure //
// ////////////// //
QTest::addColumn<QString>("defaultName");
QTest::addColumn<std::vector<QString> >("forbiddenNames");
QTest::addColumn<QString>("expectedName");
// ////////// //
// Test cases //
// ////////// //
QTest::newRow("uniqueName") << "FGM" << std::vector<QString>{"FGM2"} << "FGM";
QTest::newRow("uniqueName2") << "FGM2" << std::vector<QString>{"FGM", "FGM1", "FGM2"} << "FGM3";
QTest::newRow("uniqueName3") << "FGM1" << std::vector<QString>{"FGM1"} << "FGM";
QTest::newRow("uniqueName4") << "FGM" << std::vector<QString>{"FGM"} << "FGM1";
QTest::newRow("uniqueName5") << "FGM" << std::vector<QString>{"FGM", "FGM1", "FGM3"} << "FGM2";
QTest::newRow("uniqueName6") << "FGM" << std::vector<QString>{"A", "B", "C"} << "FGM";
QTest::newRow("uniqueName7") << "FGM" << std::vector<QString>{"fGm", "FGm1", "Fgm2"} << "FGM3";
QTest::newRow("uniqueName8") << "" << std::vector<QString>{"A", "B", "C"} << "1";
QTest::newRow("uniqueName9") << "24" << std::vector<QString>{"A", "B", "C"} << "1";
}
void TestStringUtils::testUniqueName()
{
QFETCH(QString, defaultName);
QFETCH(std::vector<QString>, forbiddenNames);
QFETCH(QString, expectedName);
auto result = StringUtils::uniqueName(defaultName, forbiddenNames);
QCOMPARE(result, expectedName);
}
QTEST_MAIN(TestStringUtils)
#include "TestStringUtils.moc"