зеркало из https://github.com/nextcloud/desktop.git
Fix tests
This commit is contained in:
Родитель
e442ba863a
Коммит
2c6324e3e5
|
@ -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}")
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
Загрузка…
Ссылка в новой задаче