summaryrefslogtreecommitdiff
path: root/libs/evoral/test
diff options
context:
space:
mode:
authorHans Baier <hansfbaier@googlemail.com>2009-02-12 23:28:51 +0000
committerHans Baier <hansfbaier@googlemail.com>2009-02-12 23:28:51 +0000
commite7c7c33563101ed3e928380aef790248092a7abe (patch)
tree4c9a8d43679002bbd786a0c1c36053d5a9a47c5b /libs/evoral/test
parent9d33176b4950e981f83ffb186f2ff91c5d05ced2 (diff)
* Evoral: SMFTest: added createNewFileTest (passes)
git-svn-id: svn://localhost/ardour2/branches/3.0@4540 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/evoral/test')
-rw-r--r--libs/evoral/test/SMFTest.cpp10
-rw-r--r--libs/evoral/test/SMFTest.hpp14
2 files changed, 24 insertions, 0 deletions
diff --git a/libs/evoral/test/SMFTest.cpp b/libs/evoral/test/SMFTest.cpp
index fcfa6ef1dd..f401ea1abd 100644
--- a/libs/evoral/test/SMFTest.cpp
+++ b/libs/evoral/test/SMFTest.cpp
@@ -5,6 +5,16 @@ using namespace std;
CPPUNIT_TEST_SUITE_REGISTRATION( SMFTest );
void
+SMFTest::createNewFileTest ()
+{
+ TestSMF<Time> smf;
+ smf.open("NewFile.mid");
+ smf.close();
+ CPPUNIT_ASSERT(access(smf.path().c_str(), R_OK) == 0);
+ unlink(smf.path().c_str());
+}
+
+void
SMFTest::takeFiveTest ()
{
TestSMF<Time> smf;
diff --git a/libs/evoral/test/SMFTest.hpp b/libs/evoral/test/SMFTest.hpp
index 9787af8fc1..e4d390a07f 100644
--- a/libs/evoral/test/SMFTest.hpp
+++ b/libs/evoral/test/SMFTest.hpp
@@ -14,18 +14,31 @@ using namespace Evoral;
template<typename Time>
class TestSMF : public LibSMF<Time> {
public:
+ std::string path() const { return _path; }
+
int open(const std::string& path) THROW_FILE_ERROR {
+ _path = path;
return LibSMF<Time>::open(path);
}
+ void close() THROW_FILE_ERROR {
+ return LibSMF<Time>::close();
+ }
+
int read_event(uint32_t* delta_t, uint32_t* size, uint8_t** buf) const {
return LibSMF<Time>::read_event(delta_t, size, buf);
}
+
+private:
+
+ std::string _path;
+
};
class SMFTest : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE (SMFTest);
+ CPPUNIT_TEST (createNewFileTest);
CPPUNIT_TEST (takeFiveTest);
CPPUNIT_TEST_SUITE_END ();
@@ -45,6 +58,7 @@ class SMFTest : public CppUnit::TestFixture
delete type_map;
}
+ void createNewFileTest(void);
void takeFiveTest (void);
private: