13
0

Use PBD::tmp_writable_directory to write evoral test file into

no need to remove directory as it is temporary
This commit is contained in:
Tim Mayberry 2014-11-29 16:11:22 +07:00
parent 929fc3d235
commit f6e15a3b6b
2 changed files with 10 additions and 6 deletions

View File

@ -1,8 +1,9 @@
#include "SMFTest.hpp"
#ifdef WIN32
#include <io.h> // for R_OK
#endif
#include <glibmm/fileutils.h>
#include <glibmm/miscutils.h>
#include "pbd/file_utils.h"
using namespace std;
@ -12,10 +13,12 @@ void
SMFTest::createNewFileTest ()
{
TestSMF smf;
smf.create("NewFile.mid");
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(access("NewFile.mid", R_OK) == 0);
unlink(smf.path().c_str());
CPPUNIT_ASSERT(Glib::file_test (new_file_path, Glib::FILE_TEST_IS_REGULAR));
}
void

View File

@ -145,6 +145,7 @@ def build(bld):
obj.target = 'run-tests'
obj.name = 'libevoral-tests'
obj.install_path = ''
obj.defines = ['PACKAGE="libevoraltest"']
if bld.env['TEST_COVERAGE']:
obj.linkflags = '-lgcov'
obj.cflags = [ '-fprofile-arcs', '-ftest-coverage' ]