tests/CMakeLists.txt tests/kcalconversiontest.cpp tests/testutils.h

Till Adam adam at kolabsys.com
Sat Aug 4 21:30:01 CEST 2012


 tests/CMakeLists.txt         |    1 +
 tests/kcalconversiontest.cpp |    2 +-
 tests/testutils.h            |    5 ++---
 3 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit fafd4bd44d08d1fa582c38dcbebf80bee9fbe7d9
Author: Till Adam <till at kdab.com>
Date:   Sat Aug 4 21:29:54 2012 +0200

    Find the unit test files also from a builddir.

diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index db582cd..b093234 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,5 +1,6 @@
 
 include_directories(${CMAKE_CURRENT_BINARY_DIR})
+add_definitions(-DTEST_DATA_PATH="${CMAKE_CURRENT_SOURCE_DIR}")
 
 QT4_AUTOMOC(benchmark.cpp)
 add_executable(benchmarktest benchmark.cpp)
diff --git a/tests/kcalconversiontest.cpp b/tests/kcalconversiontest.cpp
index dceb24d..9db2a01 100644
--- a/tests/kcalconversiontest.cpp
+++ b/tests/kcalconversiontest.cpp
@@ -503,7 +503,7 @@ void KCalConversionTest::testContactConversion()
 
 // void KCalConversionTest::BenchmarkRoundtripKCAL()
 // {
-//     const Kolab::Event &event = Kolab::readEvent("../../tests/testfiles/icalEvent.xml", true);
+//     const Kolab::Event &event = Kolab::readEvent(TEST_DATA_PATH "/testfiles/icalEvent.xml", true);
 //     std::string result = Kolab::writeEvent(event);
 //     QBENCHMARK {
 //         Kolab::Conversion::toKCalCore(Kolab::readEvent(result, false));
diff --git a/tests/testutils.h b/tests/testutils.h
index a4e00f1..b6afcf5 100644
--- a/tests/testutils.h
+++ b/tests/testutils.h
@@ -18,8 +18,7 @@
 #ifndef TESTUTILS_H
 #define TESTUTILS_H
 
-
-#define TESTFILEDIR QString::fromLatin1("../../tests/testfiles/")
+#define TESTFILEDIR QString::fromLatin1(TEST_DATA_PATH "/testfiles/")
 #include <qtemporaryfile.h>
 #include <qprocess.h>
 #include <quuid.h>
@@ -190,4 +189,4 @@ Kolab::Event createEvent(const Kolab::cDateTime &start, const Kolab::cDateTime &
     event.setStart(start);
     event.setEnd(end);
     return event;
-}
\ No newline at end of file
+}





More information about the commits mailing list