From 3f74b78e4ee9f1d400ebbf2b9093a0f9c48c6307 Mon Sep 17 00:00:00 2001
From: Sebastian Kraft <mail@sebastiankraft.net>
Date: Sat, 9 Jan 2016 20:48:16 +0100
Subject: [PATCH] Use database in source directory while running tests. Fixes
 bug #46.

---
 tests/CMakeLists.txt    | 4 ++--
 tests/test_database.cpp | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index b79fda6..4056072 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,6 +1,6 @@
 ADD_EXECUTABLE(test_database test_database.cpp)
 TARGET_LINK_LIBRARIES(test_database lensfun ${COMMON_LIBS})
-ADD_TEST(Database test_database)
+ADD_TEST(NAME Database WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND test_database)
 
 ADD_EXECUTABLE(test_modifier test_modifier.cpp)
 TARGET_LINK_LIBRARIES(test_modifier lensfun ${COMMON_LIBS})
@@ -30,4 +30,4 @@ TARGET_LINK_LIBRARIES(test_modifier_coord_geometry lensfun ${COMMON_LIBS})
 ADD_TEST(Modifier_coord_geometry test_modifier_coord_geometry)
 
 FIND_PACKAGE(PythonInterp REQUIRED)
-ADD_TEST(NAME Database_integrity COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/check_database/check_database.py ../../data/db)
+ADD_TEST(NAME Database_integrity COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/check_database/check_database.py ${CMAKE_SOURCE_DIR}/data/db)
diff --git a/tests/test_database.cpp b/tests/test_database.cpp
index 45dc38f..49a2644 100644
--- a/tests/test_database.cpp
+++ b/tests/test_database.cpp
@@ -10,7 +10,7 @@ typedef struct {
 void db_setup(lfFixture *lfFix, gconstpointer data)
 {
     lfFix->db = lf_db_new ();
-    lfFix->db->Load();
+    lfFix->db->LoadDirectory("data/db");
 }
 
 
-- 
2.6.4

