2014-03-29 20:16:54 +00:00
|
|
|
#include <QTest>
|
|
|
|
#include "TestUtil.h"
|
|
|
|
|
2014-07-01 00:48:09 +01:00
|
|
|
#include "logic/settings/INIFile.h"
|
2014-03-29 20:16:54 +00:00
|
|
|
|
|
|
|
class IniFileTest : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
private
|
|
|
|
slots:
|
|
|
|
void initTestCase()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
void cleanupTestCase()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void test_PathCombine1_data()
|
|
|
|
{
|
|
|
|
QTest::addColumn<QString>("through");
|
|
|
|
|
|
|
|
QTest::newRow("unix path") << "/abc/def/ghi/jkl";
|
|
|
|
QTest::newRow("windows path") << "C:\\Program files\\terrible\\name\\of something\\";
|
|
|
|
QTest::newRow("Plain text") << "Lorem ipsum dolor sit amet.";
|
|
|
|
QTest::newRow("Escape sequences") << "Lorem\n\t\n\\n\\tAAZ\nipsum dolor\n\nsit amet.";
|
|
|
|
QTest::newRow("Escape sequences 2") << "\"\n\n\"";
|
|
|
|
}
|
|
|
|
void test_PathCombine1()
|
|
|
|
{
|
|
|
|
QFETCH(QString, through);
|
|
|
|
|
|
|
|
QString there = INIFile::escape(through);
|
|
|
|
QString back = INIFile::unescape(there);
|
2015-01-31 18:21:47 +00:00
|
|
|
|
2014-03-29 20:16:54 +00:00
|
|
|
QCOMPARE(back, through);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-01-31 18:21:47 +00:00
|
|
|
QTEST_GUILESS_MAIN(IniFileTest)
|
2014-03-29 20:16:54 +00:00
|
|
|
|
|
|
|
#include "tst_inifile.moc"
|