Use test_search_path to find test data files for automation test
authorTim Mayberry <mojofunk@gmail.com>
Sat, 10 Aug 2013 06:09:28 +0000 (16:09 +1000)
committerTim Mayberry <mojofunk@gmail.com>
Fri, 11 Oct 2013 12:36:19 +0000 (22:36 +1000)
libs/ardour/test/automation_list_property_test.cc

index 90e2e229899a8a1be64e757a3fa518a72e6e6016..073fcf4b098f671ee636d6a55786daf19e7ddb7a 100644 (file)
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
+#include <glibmm/fileutils.h>
+#include <glibmm/miscutils.h>
+
 #include "pbd/properties.h"
 #include "pbd/stateful_diff_command.h"
 #include "ardour/automation_list.h"
 #include "automation_list_property_test.h"
 #include "test_util.h"
+#include "test_common.h"
 
 CPPUNIT_TEST_SUITE_REGISTRATION (AutomationListPropertyTest);
 
@@ -52,9 +56,15 @@ AutomationListPropertyTest::basicTest ()
        /* Now it has changed */
        CPPUNIT_ASSERT_EQUAL (true, property.changed());
 
+       std::string test_data_file1 = Glib::build_filename (test_search_path().front(), "automation_list_property_test1.ref");
+       CPPUNIT_ASSERT (Glib::file_test (test_data_file1, Glib::FILE_TEST_EXISTS));
+
        XMLNode* foo = new XMLNode ("test");
        property.get_changes_as_xml (foo);
-       check_xml (foo, "../libs/ardour/test/data/automation_list_property_test1.ref", ignore_properties);
+       check_xml (foo, test_data_file1, ignore_properties);
+
+       std::string test_data_file2 = Glib::build_filename (test_search_path().front(), "automation_list_property_test2.ref");
+       CPPUNIT_ASSERT (Glib::file_test (test_data_file2, Glib::FILE_TEST_EXISTS));
 
        /* Do some more */
        property.clear_changes ();
@@ -64,7 +74,7 @@ AutomationListPropertyTest::basicTest ()
        CPPUNIT_ASSERT_EQUAL (true, property.changed());
        foo = new XMLNode ("test");
        property.get_changes_as_xml (foo);
-       check_xml (foo, "../libs/ardour/test/data/automation_list_property_test2.ref", ignore_properties);
+       check_xml (foo, test_data_file2, ignore_properties);
 }
 
 /** Here's a StatefulDestructible class that has a AutomationListProperty */
@@ -119,11 +129,17 @@ AutomationListPropertyTest::undoTest ()
        sheila->_jim->add (7, 8);
        StatefulDiffCommand sdc (sheila);
 
+       std::string test_data_file3 = Glib::build_filename (test_search_path().front(), "automation_list_property_test3.ref");
+       CPPUNIT_ASSERT (Glib::file_test (test_data_file3, Glib::FILE_TEST_EXISTS));
+
        /* Undo */
        sdc.undo ();
-       check_xml (&sheila->get_state(), "../libs/ardour/test/data/automation_list_property_test3.ref", ignore_properties);
+       check_xml (&sheila->get_state(), test_data_file3, ignore_properties);
+
+       std::string test_data_file4 = Glib::build_filename (test_search_path().front(), "automation_list_property_test4.ref");
+       CPPUNIT_ASSERT (Glib::file_test (test_data_file4, Glib::FILE_TEST_EXISTS));
 
        /* Redo */
        sdc.redo ();
-       check_xml (&sheila->get_state(), "../libs/ardour/test/data/automation_list_property_test4.ref", ignore_properties);
+       check_xml (&sheila->get_state(), test_data_file4, ignore_properties);
 }