Add TestUI class to properly handle EventLoop invalidation
This fixes the programming error: Session RT event... warnings while running ardour tests
This commit is contained in:
parent
964c04eec5
commit
2a04ff8641
66
libs/ardour/test/test_ui.cc
Normal file
66
libs/ardour/test/test_ui.cc
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
Copyright (C) 2015 Tim Mayberry
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "test_ui.h"
|
||||
|
||||
#include <glibmm/threads.h>
|
||||
|
||||
#include "pbd/error.h"
|
||||
|
||||
#include "ardour/session_event.h"
|
||||
#include "ardour/rc_configuration.h"
|
||||
|
||||
#include "pbd/abstract_ui.cc" // instantiate template
|
||||
|
||||
using namespace ARDOUR;
|
||||
|
||||
template class AbstractUI<TestUIRequest>;
|
||||
|
||||
TestUI::TestUI ()
|
||||
: AbstractUI<TestUIRequest> ("test_ui")
|
||||
{
|
||||
|
||||
pthread_set_name ("test_ui_thread");
|
||||
|
||||
run_loop_thread = Glib::Threads::Thread::self ();
|
||||
|
||||
set_event_loop_for_thread (this);
|
||||
|
||||
SessionEvent::create_per_thread_pool ("test", 512);
|
||||
|
||||
m_test_receiver.listen_to (PBD::error);
|
||||
m_test_receiver.listen_to (PBD::info);
|
||||
m_test_receiver.listen_to (PBD::fatal);
|
||||
m_test_receiver.listen_to (PBD::warning);
|
||||
|
||||
/* We can't use VSTs here as we have a stub instead of the
|
||||
required bits in gtk2_ardour.
|
||||
*/
|
||||
Config->set_use_lxvst (false);
|
||||
}
|
||||
|
||||
TestUI::~TestUI ()
|
||||
{
|
||||
m_test_receiver.hangup ();
|
||||
}
|
||||
|
||||
void
|
||||
TestUI::do_request (TestUIRequest* req)
|
||||
{
|
||||
|
||||
}
|
48
libs/ardour/test/test_ui.h
Normal file
48
libs/ardour/test/test_ui.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright (C) 2015 Tim Mayberry
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
//#ifndef ABSTRACT_UI_EXPORTS
|
||||
//#define ABSTRACT_UI_EXPORTS
|
||||
//#endif
|
||||
|
||||
#include "pbd/abstract_ui.h"
|
||||
|
||||
#include "test_receiver.h"
|
||||
|
||||
class TestUIRequest : public BaseUI::BaseRequestObject
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
class TestUI : public AbstractUI<TestUIRequest>
|
||||
{
|
||||
public: // ctors
|
||||
|
||||
TestUI ();
|
||||
|
||||
~TestUI ();
|
||||
|
||||
public: // AbstractUI Interface
|
||||
|
||||
virtual void do_request (TestUIRequest*);
|
||||
|
||||
private: // member data
|
||||
|
||||
TestReceiver m_test_receiver;
|
||||
|
||||
};
|
@ -29,7 +29,6 @@
|
||||
#include "ardour/audioengine.h"
|
||||
|
||||
#include "test_util.h"
|
||||
#include "test_receiver.h"
|
||||
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
@ -97,25 +96,6 @@ write_ref (XMLNode* node, string ref_file)
|
||||
return rv;
|
||||
}
|
||||
|
||||
TestReceiver test_receiver;
|
||||
|
||||
bool
|
||||
test_init ()
|
||||
{
|
||||
SessionEvent::create_per_thread_pool ("test", 512);
|
||||
|
||||
test_receiver.listen_to (error);
|
||||
test_receiver.listen_to (info);
|
||||
test_receiver.listen_to (fatal);
|
||||
test_receiver.listen_to (warning);
|
||||
|
||||
/* We can't use VSTs here as we have a stub instead of the
|
||||
required bits in gtk2_ardour.
|
||||
*/
|
||||
Config->set_use_lxvst (false);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
create_and_start_dummy_backend ()
|
||||
{
|
||||
|
@ -31,8 +31,6 @@ namespace ARDOUR {
|
||||
class Session;
|
||||
}
|
||||
|
||||
bool test_init ();
|
||||
|
||||
PBD::Searchpath test_search_path ();
|
||||
|
||||
std::string new_test_output_dir (std::string prefix = "");
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include "pbd/debug.h"
|
||||
#include "ardour/ardour.h"
|
||||
#include "test_util.h"
|
||||
#include "test_ui.h"
|
||||
|
||||
static const char* localedir = LOCALEDIR;
|
||||
|
||||
@ -51,7 +51,7 @@ main(int argc, char* argv[])
|
||||
|
||||
CPPUNIT_ASSERT (ARDOUR::init (false, true, localedir));
|
||||
|
||||
CPPUNIT_ASSERT (test_init ());
|
||||
TestUI* test_ui = new TestUI();
|
||||
|
||||
CppUnit::TestResult testresult;
|
||||
|
||||
@ -68,6 +68,8 @@ main(int argc, char* argv[])
|
||||
CppUnit::CompilerOutputter compileroutputter (&collectedresults, std::cerr);
|
||||
compileroutputter.write ();
|
||||
|
||||
delete test_ui;
|
||||
|
||||
ARDOUR::cleanup ();
|
||||
|
||||
return collectedresults.wasSuccessful () ? 0 : 1;
|
||||
|
@ -421,7 +421,7 @@ def build(bld):
|
||||
testcommon = bld(features = 'cxx')
|
||||
testcommon.includes = obj.includes + ['test', '../pbd', '..']
|
||||
testcommon.source = ['test/testrunner.cc', 'test/test_needing_session.cc',
|
||||
'test/dummy_lxvst.cc', 'test/audio_region_test.cc', 'test/test_util.cc']
|
||||
'test/dummy_lxvst.cc', 'test/audio_region_test.cc', 'test/test_util.cc', 'test/test_ui.cc']
|
||||
testcommon.uselib = ['CPPUNIT','SIGCPP','GLIBMM','GTHREAD',
|
||||
'SAMPLERATE','XML','LRDF','COREAUDIO','TAGLIB','VAMPSDK','VAMPHOSTSDK','RUBBERBAND']
|
||||
testcommon.use = ['libpbd','libmidipp','libevoral',
|
||||
|
Loading…
Reference in New Issue
Block a user