This commit is contained in:
Daniel Molkentin 2014-08-27 09:15:31 +02:00
Родитель e442ba863a
Коммит 2c6324e3e5
3 изменённых файлов: 57 добавлений и 5 удалений

Просмотреть файл

@ -8,16 +8,16 @@ owncloud_add_test(OwncloudPropagator "")
owncloud_add_test(Utility "") owncloud_add_test(Utility "")
owncloud_add_test(Updater "") owncloud_add_test(Updater "")
SET(FolderWatcher_SRC ../src/mirall/folderwatcher.cpp) SET(FolderWatcher_SRC ../src/gui/folderwatcher.cpp)
IF( NOT WIN32 AND NOT APPLE ) 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() ENDIF()
IF( WIN32 ) IF( WIN32 )
list(APPEND FolderWatcher_SRC ../src/mirall/folderwatcher_win.cpp) list(APPEND FolderWatcher_SRC ../src/gui/folderwatcher_win.cpp)
ENDIF() ENDIF()
IF( APPLE ) IF( APPLE )
list(APPEND FolderWatcher_SRC ../src/mirall/folderwatcher_mac.cpp) list(APPEND FolderWatcher_SRC ../src/gui/folderwatcher_mac.cpp)
ENDIF() ENDIF()
owncloud_add_test(FolderWatcher "${FolderWatcher_SRC}") owncloud_add_test(FolderWatcher "${FolderWatcher_SRC}")

Просмотреть файл

@ -1,5 +1,10 @@
macro(owncloud_add_test test_class additional_cpp) 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(OWNCLOUD_TEST_CLASS ${test_class})
set(CMAKE_AUTOMOC TRUE) set(CMAKE_AUTOMOC TRUE)

47
test/testfolder.h Normal file
Просмотреть файл

@ -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 <QtTest>
#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<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";
}
};
#endif