From 2c6324e3e5096af5199bd11e533921d106802ae6 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Wed, 27 Aug 2014 09:15:31 +0200 Subject: [PATCH] Fix tests --- test/CMakeLists.txt | 8 +++--- test/owncloud_add_test.cmake | 7 +++++- test/testfolder.h | 47 ++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 test/testfolder.h diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 37ac1e83b..597fb2e31 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -8,16 +8,16 @@ owncloud_add_test(OwncloudPropagator "") owncloud_add_test(Utility "") owncloud_add_test(Updater "") -SET(FolderWatcher_SRC ../src/mirall/folderwatcher.cpp) +SET(FolderWatcher_SRC ../src/gui/folderwatcher.cpp) IF( NOT WIN32 AND NOT APPLE ) -list(APPEND FolderWatcher_SRC ../src/mirall/folderwatcher_linux.cpp) +list(APPEND FolderWatcher_SRC ../src/gui/folderwatcher_linux.cpp) ENDIF() IF( WIN32 ) -list(APPEND FolderWatcher_SRC ../src/mirall/folderwatcher_win.cpp) +list(APPEND FolderWatcher_SRC ../src/gui/folderwatcher_win.cpp) ENDIF() IF( APPLE ) -list(APPEND FolderWatcher_SRC ../src/mirall/folderwatcher_mac.cpp) +list(APPEND FolderWatcher_SRC ../src/gui/folderwatcher_mac.cpp) ENDIF() owncloud_add_test(FolderWatcher "${FolderWatcher_SRC}") diff --git a/test/owncloud_add_test.cmake b/test/owncloud_add_test.cmake index 698e9dc8b..14ee6285d 100644 --- a/test/owncloud_add_test.cmake +++ b/test/owncloud_add_test.cmake @@ -1,5 +1,10 @@ macro(owncloud_add_test test_class additional_cpp) - include_directories(${QT_INCLUDES} "${PROJECT_SOURCE_DIR}/src" ${CMAKE_CURRENT_BINARY_DIR}) + include_directories(${QT_INCLUDES} + "${PROJECT_SOURCE_DIR}/src/gui" + "${PROJECT_SOURCE_DIR}/src/libsync" + "${CMAKE_BINARY_DIR}/src/libsync" + "${CMAKE_CURRENT_BINARY_DIR}" + ) set(OWNCLOUD_TEST_CLASS ${test_class}) set(CMAKE_AUTOMOC TRUE) diff --git a/test/testfolder.h b/test/testfolder.h new file mode 100644 index 000000000..9f3f8f8d5 --- /dev/null +++ b/test/testfolder.h @@ -0,0 +1,47 @@ +/* + * 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. + * + */ + +#ifndef MIRALL_TESTFOLDER_H +#define MIRALL_TESTFOLDER_H + +#include + +#include "utility.h" +#include "folder.h" + +using namespace Mirall; + +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("folder"); + QTest::addColumn("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"; + } + +}; + +#endif