2014-08-27 11:15:31 +04:00
|
|
|
/*
|
|
|
|
* This software is in the public domain, furnished "as is", without technical
|
|
|
|
* support, and with no warranty, express or implied, as to its usefulness for
|
|
|
|
* any purpose.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <QtTest>
|
|
|
|
|
2017-08-16 09:36:52 +03:00
|
|
|
#include "common/utility.h"
|
2014-08-27 11:15:31 +04:00
|
|
|
#include "folder.h"
|
|
|
|
|
2014-11-10 00:36:49 +03:00
|
|
|
using namespace OCC;
|
2014-08-27 11:15:31 +04:00
|
|
|
|
|
|
|
class TestFolder: public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
private slots:
|
|
|
|
void testFolder()
|
|
|
|
{
|
|
|
|
QFETCH(QString, folder);
|
|
|
|
QFETCH(QString, expectedFolder);
|
|
|
|
Folder *f = new Folder("alias", folder, "http://foo.bar.net");
|
|
|
|
QCOMPARE(f->path(), expectedFolder);
|
|
|
|
delete f;
|
|
|
|
}
|
|
|
|
|
|
|
|
void testFolder_data()
|
|
|
|
{
|
|
|
|
QTest::addColumn<QString>("folder");
|
|
|
|
QTest::addColumn<QString>("expectedFolder");
|
|
|
|
|
|
|
|
QTest::newRow("unixcase") << "/foo/bar" << "/foo/bar";
|
|
|
|
QTest::newRow("doubleslash") << "/foo//bar" << "/foo/bar";
|
|
|
|
QTest::newRow("tripleslash") << "/foo///bar" << "/foo/bar";
|
|
|
|
QTest::newRow("mixedslash") << "/foo/\\bar" << "/foo/bar";
|
|
|
|
QTest::newRow("windowsfwslash") << "C:/foo/bar" << "C:/foo/bar";
|
|
|
|
QTest::newRow("windowsbwslash") << "C:\\foo" << "C:/foo";
|
|
|
|
QTest::newRow("windowsbwslash2") << "C:\\foo\\bar" << "C:/foo/bar";
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2016-05-11 02:17:16 +03:00
|
|
|
QTEST_APPLESS_MAIN(TestFolder)
|
2016-03-30 18:58:15 +03:00
|
|
|
#include "testfolder.moc"
|