2013-09-16 11:17:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
#ifdef BUILD_TESTS
|
|
|
|
|
|
|
|
#include "../config.hxx"
|
|
|
|
|
|
|
|
#include "../gui.hxx"
|
|
|
|
#include "../audiobuffer.hxx"
|
|
|
|
#include "../diskwriter.hxx"
|
|
|
|
|
|
|
|
#include "qunit.hxx"
|
|
|
|
|
|
|
|
extern Gui* gui;
|
2013-09-17 13:07:25 +02:00
|
|
|
extern bool testsPassed;
|
2013-09-16 11:17:27 +02:00
|
|
|
|
|
|
|
int DiskWriter::runTests()
|
|
|
|
{
|
2013-09-17 12:00:12 +02:00
|
|
|
QUnit::UnitTest qunit( QUnit::normal );
|
2013-09-16 11:17:27 +02:00
|
|
|
|
2013-09-17 13:07:25 +02:00
|
|
|
// set the session path to /tmp for test writing
|
|
|
|
|
2013-09-23 12:54:54 +02:00
|
|
|
string path = "/tmp";
|
|
|
|
string session = "testSession";
|
2013-09-17 13:07:25 +02:00
|
|
|
|
|
|
|
AudioBuffer ab(440);
|
2013-09-23 12:54:54 +02:00
|
|
|
gui->getDiskWriter()->initialize(path, session);
|
|
|
|
|
|
|
|
QUNIT_IS_TRUE( gui->getDiskWriter()->writeAudioBuffer(0, 0, &ab) == LUPPP_RETURN_OK );
|
|
|
|
QUNIT_IS_TRUE( gui->getDiskWriter()->writeSession() == LUPPP_RETURN_OK );
|
|
|
|
|
|
|
|
QUNIT_IS_TRUE( strcmp( gui->getDiskWriter()->getLastSavePath().c_str(), path.c_str() ) == 0 );
|
|
|
|
QUNIT_IS_TRUE( strcmp( gui->getDiskWriter()->getLastSaveName().c_str(), session.c_str() ) == 0 );
|
2013-09-16 11:17:27 +02:00
|
|
|
|
2013-09-17 13:07:25 +02:00
|
|
|
return qunit.errors();
|
2013-09-16 11:17:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|