#include "SMFTest.h" #include #include #include "pbd/file_utils.h" using namespace std; CPPUNIT_TEST_SUITE_REGISTRATION( SMFTest ); void SMFTest::createNewFileTest () { TestSMF smf; string output_dir_path = PBD::tmp_writable_directory (PACKAGE, "createNewFileTest"); string new_file_path = Glib::build_filename (output_dir_path, "NewFile.mid"); smf.create(new_file_path); smf.close(); CPPUNIT_ASSERT(Glib::file_test (new_file_path, Glib::FILE_TEST_IS_REGULAR)); } PBD::Searchpath test_search_path () { #ifdef PLATFORM_WINDOWS if (!getenv("EVORAL_TEST_PATH")) { string wsp(g_win32_get_package_installation_directory_of_module(NULL)); return Glib::build_filename (wsp, "evoral_testdata"); } #endif return Glib::getenv("EVORAL_TEST_PATH"); } void SMFTest::takeFiveTest () { TestSMF smf; string testdata_path; CPPUNIT_ASSERT (find_file (test_search_path (), "TakeFive.mid", testdata_path)); CPPUNIT_ASSERT (SMF::test(testdata_path)); smf.open(testdata_path); 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(); smf.seek_to_start(); uint64_t time = 0; /* in SMF ticks */ Evoral::Event