mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 11:46:25 +01:00
Improve coverage of evoral tests
This commit is contained in:
parent
9dbc524060
commit
1438191938
2 changed files with 35 additions and 0 deletions
|
|
@ -39,9 +39,14 @@ SMFTest::takeFiveTest ()
|
||||||
TestSMF smf;
|
TestSMF smf;
|
||||||
string testdata_path;
|
string testdata_path;
|
||||||
CPPUNIT_ASSERT (find_file (test_search_path (), "TakeFive.mid", testdata_path));
|
CPPUNIT_ASSERT (find_file (test_search_path (), "TakeFive.mid", testdata_path));
|
||||||
|
CPPUNIT_ASSERT (SMF::test(testdata_path));
|
||||||
|
|
||||||
smf.open(testdata_path);
|
smf.open(testdata_path);
|
||||||
CPPUNIT_ASSERT(!smf.is_empty());
|
CPPUNIT_ASSERT(!smf.is_empty());
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT_EQUAL((uint16_t)1, smf.num_tracks());
|
||||||
|
CPPUNIT_ASSERT_EQUAL(0, smf.seek_to_track(1));
|
||||||
|
|
||||||
seq->start_write();
|
seq->start_write();
|
||||||
smf.seek_to_start();
|
smf.seek_to_start();
|
||||||
|
|
||||||
|
|
@ -68,3 +73,31 @@ SMFTest::takeFiveTest ()
|
||||||
Evoral::Beats::ticks_at_rate(time, smf.ppqn()));
|
Evoral::Beats::ticks_at_rate(time, smf.ppqn()));
|
||||||
CPPUNIT_ASSERT(!seq->empty());
|
CPPUNIT_ASSERT(!seq->empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SMFTest::writeTest ()
|
||||||
|
{
|
||||||
|
TestSMF smf;
|
||||||
|
string testdata_path;
|
||||||
|
CPPUNIT_ASSERT (find_file (test_search_path (), "TakeFive.mid", testdata_path));
|
||||||
|
|
||||||
|
smf.open(testdata_path);
|
||||||
|
CPPUNIT_ASSERT(!smf.is_empty());
|
||||||
|
|
||||||
|
TestSMF out;
|
||||||
|
const string output_dir_path = PBD::tmp_writable_directory (PACKAGE, "writeTest");
|
||||||
|
const string new_file_path = Glib::build_filename (output_dir_path, "TakeFiveCopy.mid");
|
||||||
|
CPPUNIT_ASSERT_EQUAL (0, out.create(new_file_path, 1, 1920));
|
||||||
|
out.begin_write();
|
||||||
|
|
||||||
|
uint32_t delta_t = 0;
|
||||||
|
uint32_t size = 0;
|
||||||
|
uint8_t* buf = NULL;
|
||||||
|
while (smf.read_event(&delta_t, &size, &buf) >= 0) {
|
||||||
|
out.append_event_delta(delta_t, size, buf, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
out.end_write(new_file_path);
|
||||||
|
|
||||||
|
// TODO: Check files are actually equivalent
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ class SMFTest : public CppUnit::TestFixture
|
||||||
CPPUNIT_TEST_SUITE(SMFTest);
|
CPPUNIT_TEST_SUITE(SMFTest);
|
||||||
CPPUNIT_TEST(createNewFileTest);
|
CPPUNIT_TEST(createNewFileTest);
|
||||||
CPPUNIT_TEST(takeFiveTest);
|
CPPUNIT_TEST(takeFiveTest);
|
||||||
|
CPPUNIT_TEST(writeTest);
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -73,6 +74,7 @@ public:
|
||||||
|
|
||||||
void createNewFileTest();
|
void createNewFileTest();
|
||||||
void takeFiveTest();
|
void takeFiveTest();
|
||||||
|
void writeTest();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DummyTypeMap* type_map;
|
DummyTypeMap* type_map;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue