summaryrefslogtreecommitdiff
path: root/libs/pbd/test
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-07-11 10:59:30 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2013-07-11 10:59:30 -0400
commitbceab192013e3e49b18b631598ebf9353f7db716 (patch)
tree7ab6449d287cbe6c776f64766f1dae5e3234449c /libs/pbd/test
parenta2f5a8d9c08c8779b0b7d193a74b233cd6f130e2 (diff)
Use test_search_path to find test data in xpath test
Diffstat (limited to 'libs/pbd/test')
-rw-r--r--libs/pbd/test/xpath.cc22
1 files changed, 17 insertions, 5 deletions
diff --git a/libs/pbd/test/xpath.cc b/libs/pbd/test/xpath.cc
index f0e976eabd..8b80eec2c6 100644
--- a/libs/pbd/test/xpath.cc
+++ b/libs/pbd/test/xpath.cc
@@ -3,18 +3,24 @@
#include "xpath.h"
#include "pbd/xml++.h"
+#include "pbd/file_utils.h"
+
+#include "test_common.h"
CPPUNIT_TEST_SUITE_REGISTRATION (XPathTest);
using namespace std;
-
-static string const prefix = "../libs/pbd/test/";
+using namespace PBD;
void
XPathTest::testMisc ()
{
// cout << "Test 1: RosegardenPatchFile.xml: Find all banks in the file" << endl;
- XMLTree doc(prefix + "RosegardenPatchFile.xml");
+
+ std::string testdata_path;
+ CPPUNIT_ASSERT (find_file_in_search_path (test_search_path (), "RosegardenPatchFile.xml", testdata_path));
+
+ XMLTree doc(testdata_path);
// "//bank" gives as last element an empty element libxml bug????
boost::shared_ptr<XMLSharedNodeList> result = doc.find("//bank[@name]");
@@ -44,7 +50,10 @@ XPathTest::testMisc ()
// cout << endl << endl << "Test 3: TestSession.ardour: find all Sources where captured-for contains the string 'Guitar'" << endl;
// We have to allocate a new document here, or we get segfaults
- XMLTree doc2(prefix + "TestSession.ardour");
+ std::string testsession_path;
+ CPPUNIT_ASSERT (find_file_in_search_path (test_search_path (), "TestSession.ardour", testsession_path));
+
+ XMLTree doc2(testsession_path);
result = doc2.find("/Session/Sources/Source[contains(@captured-for, 'Guitar')]");
assert(result->size() == 16);
@@ -67,8 +76,11 @@ XPathTest::testMisc ()
// cout << endl << endl << "Test 5: ProtoolsPatchFile.midnam: Get Banks and Patches for 'Name Set 1'" << endl;
+ std::string testmidnam_path;
+ CPPUNIT_ASSERT (find_file_in_search_path (test_search_path (), "ProtoolsPatchFile.midnam", testmidnam_path));
+
// We have to allocate a new document here, or we get segfaults
- XMLTree doc3(prefix + "ProtoolsPatchFile.midnam");
+ XMLTree doc3(testmidnam_path);
result = doc3.find("/MIDINameDocument/MasterDeviceNames/ChannelNameSet[@Name='Name Set 1']/PatchBank");
assert(result->size() == 16);