diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-12-14 14:00:23 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-12-14 14:00:23 +0100 |
commit | 8f856f55732e6427e9b4994343b01f9ac0e0daee (patch) | |
tree | 09ca49c42d53ed4510d0aa7231bdb2cdad0be459 /tests/tst_userutils.cpp | |
parent | 4623aa44f58575b6d2ceb0b047945ffeb0081f65 (diff) | |
parent | 1167a66ac89d1510fbb522544e9733cc086f35eb (diff) | |
download | MultiMC-8f856f55732e6427e9b4994343b01f9ac0e0daee.tar MultiMC-8f856f55732e6427e9b4994343b01f9ac0e0daee.tar.gz MultiMC-8f856f55732e6427e9b4994343b01f9ac0e0daee.tar.lz MultiMC-8f856f55732e6427e9b4994343b01f9ac0e0daee.tar.xz MultiMC-8f856f55732e6427e9b4994343b01f9ac0e0daee.zip |
Merge branch 'testing' of https://github.com/02JanDal/MultiMC5 into develop
Conflicts:
MultiMC.cpp
Diffstat (limited to 'tests/tst_userutils.cpp')
-rw-r--r-- | tests/tst_userutils.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/tst_userutils.cpp b/tests/tst_userutils.cpp new file mode 100644 index 00000000..62bee985 --- /dev/null +++ b/tests/tst_userutils.cpp @@ -0,0 +1,66 @@ +#include <QTest> +#include <QStandardPaths> +#include "TestUtil.h" + +#include "depends/util/include/userutils.h" + +class UserUtilsTest : public QObject +{ + Q_OBJECT +private +slots: + void initTestCase() + { + + } + void cleanupTestCase() + { + + } + + void test_getDesktop() + { + QCOMPARE(Util::getDesktopDir(), QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)); + } + + void test_createShortcut_data() + { + QTest::addColumn<QString>("location"); + QTest::addColumn<QString>("dest"); + QTest::addColumn<QStringList>("args"); + QTest::addColumn<QString>("name"); + QTest::addColumn<QString>("iconLocation"); + QTest::addColumn<QByteArray>("result"); + + QTest::newRow("unix") << QDir::currentPath() + << "asdfDest" + << (QStringList() << "arg1" << "arg2") + << "asdf" + << QString() + #if defined(Q_OS_LINUX) + << MULTIMC_GET_TEST_FILE("data/tst_userutils-test_createShortcut-unix") + #elif defined(Q_OS_WIN) + << QString() + #endif + ; + } + + void test_createShortcut() + { + QFETCH(QString, location); + QFETCH(QString, dest); + QFETCH(QStringList, args); + QFETCH(QString, name); + QFETCH(QString, iconLocation); + QFETCH(QByteArray, result); + + QVERIFY(Util::createShortCut(location, dest, args, name, iconLocation)); + QCOMPARE(QString::fromLocal8Bit(TestsInternal::readFile(location + QDir::separator() + name + ".desktop")), QString::fromLocal8Bit(result)); + + //QDir().remove(location); + } +}; + +QTEST_GUILESS_MAIN_MULTIMC(UserUtilsTest) + +#include "tst_userutils.moc" |