[Pkg-owncloud-commits] [owncloud-client] 60/484: ExcludedFiles: Add test

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Dec 16 00:37:13 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 225da688326b2c075db8c12b17e6cadf6ce935d2
Author: Christian Kamm <mail at ckamm.de>
Date:   Tue Oct 13 15:01:59 2015 +0200

    ExcludedFiles: Add test
---
 test/CMakeLists.txt          |  1 +
 test/owncloud_add_test.cmake |  1 +
 test/testexcludedfiles.h     | 50 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+)

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 19dc280..faab1f8 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -39,6 +39,7 @@ owncloud_add_test(XmlParse "")
 owncloud_add_test(FileSystem "")
 owncloud_add_test(TransChecksumValidator "")
 
+owncloud_add_test(ExcludedFiles "")
 
 SET(FolderMan_SRC ../src/gui/folderman.cpp)
 list(APPEND FolderMan_SRC ../src/gui/folder.cpp )
diff --git a/test/owncloud_add_test.cmake b/test/owncloud_add_test.cmake
index ad5ca3c..3129f4b 100644
--- a/test/owncloud_add_test.cmake
+++ b/test/owncloud_add_test.cmake
@@ -24,5 +24,6 @@ macro(owncloud_add_test test_class additional_cpp)
     )
 
     add_definitions(-DOWNCLOUD_TEST)
+    add_definitions(-DOWNCLOUD_BIN_PATH=${CMAKE_BINARY_DIR}/bin)
     add_test(NAME ${OWNCLOUD_TEST_CLASS}Test COMMAND ${OWNCLOUD_TEST_CLASS}Test)
 endmacro()
diff --git a/test/testexcludedfiles.h b/test/testexcludedfiles.h
new file mode 100644
index 0000000..659c659
--- /dev/null
+++ b/test/testexcludedfiles.h
@@ -0,0 +1,50 @@
+/*
+ *    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.
+ *
+ */
+
+#pragma once
+
+#include <QtTest>
+
+#include "excludedfiles.h"
+
+using namespace OCC;
+
+#define STR_(X) #X
+#define STR(X) STR_(X)
+#define BIN_PATH STR(OWNCLOUD_BIN_PATH)
+
+class TestExcludedFiles: public QObject
+{
+    Q_OBJECT
+
+private slots:
+    void testFun()
+    {
+        auto & excluded = ExcludedFiles::instance();
+        bool excludeHidden = true;
+        bool keepHidden = false;
+
+        QVERIFY(!excluded.isExcluded("/a/b", "b", keepHidden));
+        QVERIFY(!excluded.isExcluded("/a/b~", "b~", keepHidden));
+        QVERIFY(!excluded.isExcluded("/a/.b", ".b", keepHidden));
+        QVERIFY(excluded.isExcluded("/a/.b", ".b", excludeHidden));
+
+        QString path(BIN_PATH);
+        path.append("/sync-exclude.lst");
+        excluded.addExcludeFilePath(path);
+        excluded.reloadExcludes();
+
+        QVERIFY(!excluded.isExcluded("/a/b", "b", keepHidden));
+        QVERIFY(excluded.isExcluded("/a/b~", "b~", keepHidden));
+        QVERIFY(!excluded.isExcluded("/a/.b", ".b", keepHidden));
+        QVERIFY(excluded.isExcluded("/a/.Trashes", ".Trashes", keepHidden));
+        QVERIFY(excluded.isExcluded("/a/foo_conflict-bar", "foo_conflict-bar", keepHidden));
+        QVERIFY(excluded.isExcluded("/a/.b", ".b", excludeHidden));
+    }
+};
+
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list