2015-10-13 16:01:59 +03: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-11-29 14:04:01 +03:00
|
|
|
#include "csync_exclude.h"
|
2015-10-13 16:01:59 +03:00
|
|
|
|
|
|
|
using namespace OCC;
|
|
|
|
|
2017-12-15 15:00:50 +03:00
|
|
|
#define EXCLUDE_LIST_FILE SOURCEDIR "/../../sync-exclude.lst"
|
2015-10-13 16:01:59 +03:00
|
|
|
|
|
|
|
class TestExcludedFiles: public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void testFun()
|
|
|
|
{
|
2017-11-29 14:04:01 +03:00
|
|
|
ExcludedFiles excluded;
|
2015-10-13 16:01:59 +03:00
|
|
|
bool excludeHidden = true;
|
|
|
|
bool keepHidden = false;
|
|
|
|
|
2016-05-10 17:46:08 +03:00
|
|
|
QVERIFY(!excluded.isExcluded("/a/b", "/a", keepHidden));
|
|
|
|
QVERIFY(!excluded.isExcluded("/a/b~", "/a", keepHidden));
|
|
|
|
QVERIFY(!excluded.isExcluded("/a/.b", "/a", keepHidden));
|
|
|
|
QVERIFY(excluded.isExcluded("/a/.b", "/a", excludeHidden));
|
2015-10-13 16:01:59 +03:00
|
|
|
|
2017-02-09 19:53:02 +03:00
|
|
|
excluded.addExcludeFilePath(EXCLUDE_LIST_FILE);
|
2017-11-29 14:04:01 +03:00
|
|
|
excluded.reloadExcludeFiles();
|
2015-10-13 16:01:59 +03:00
|
|
|
|
2016-05-10 17:46:08 +03:00
|
|
|
QVERIFY(!excluded.isExcluded("/a/b", "/a", keepHidden));
|
|
|
|
QVERIFY(excluded.isExcluded("/a/b~", "/a", keepHidden));
|
|
|
|
QVERIFY(!excluded.isExcluded("/a/.b", "/a", keepHidden));
|
|
|
|
QVERIFY(excluded.isExcluded("/a/.Trashes", "/a", keepHidden));
|
|
|
|
QVERIFY(excluded.isExcluded("/a/foo_conflict-bar", "/a", keepHidden));
|
2018-03-28 15:37:21 +03:00
|
|
|
QVERIFY(excluded.isExcluded("/a/foo (conflicted copy bar)", "/a", keepHidden));
|
2016-05-10 17:46:08 +03:00
|
|
|
QVERIFY(excluded.isExcluded("/a/.b", "/a", excludeHidden));
|
2019-05-03 13:10:15 +03:00
|
|
|
|
|
|
|
QVERIFY(excluded.isExcluded("/a/#b#", "/a", keepHidden));
|
2015-10-13 16:01:59 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-05-11 02:17:16 +03:00
|
|
|
QTEST_APPLESS_MAIN(TestExcludedFiles)
|
2016-03-30 18:58:15 +03:00
|
|
|
#include "testexcludedfiles.moc"
|