diff options
author | Tim Mayberry <mojofunk@gmail.com> | 2016-09-19 10:10:23 +1000 |
---|---|---|
committer | Tim Mayberry <mojofunk@gmail.com> | 2016-09-19 14:47:52 +1000 |
commit | 75ade6b2df3926b965f5af6ec6d7ed8659167b73 (patch) | |
tree | bebac522062cb1c6b2a3782f4388d26e77402671 /libs/ardour | |
parent | 1a0ac520219ad2904914d710ebee873a01edf872 (diff) |
Add test to create new Sessions with localized names and reopen them
This test is successful on Linux but fails on Windows currently because of the
incorrect realpath implementation for windows in pbd/path_expand.cc
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/test/session_test.cc | 71 | ||||
-rw-r--r-- | libs/ardour/test/session_test.h | 2 |
2 files changed, 73 insertions, 0 deletions
diff --git a/libs/ardour/test/session_test.cc b/libs/ardour/test/session_test.cc index b9372aa5a5..d64fe77f7f 100644 --- a/libs/ardour/test/session_test.cc +++ b/libs/ardour/test/session_test.cc @@ -85,3 +85,74 @@ SessionTest::new_session_from_template () delete template_session; stop_and_destroy_backend (); } + +void +SessionTest::open_session_utf8_path () +{ + std::vector<std::string> utf8_strings; + + get_utf8_test_strings (utf8_strings); + + CPPUNIT_ASSERT (!utf8_strings.empty()); + + const string test_dir = new_test_output_dir ("open_session_utf8_path"); + + for (std::vector<std::string>::const_iterator i = utf8_strings.begin (); i != utf8_strings.end (); + ++i) { + + const string session_name (*i); + std::string new_session_dir = Glib::build_filename (test_dir, session_name); + bool new_session_failed = false; + + CPPUNIT_ASSERT (!Glib::file_test (new_session_dir, Glib::FILE_TEST_EXISTS)); + + create_and_start_dummy_backend (); + + ARDOUR::Session* session = 0; + + try { + session = new Session (*AudioEngine::instance(), new_session_dir, session_name); + + CPPUNIT_ASSERT (session); + + session->save_state (""); + + } catch(...) { + new_session_failed = true; + + std::cerr << "Failed to create new session using name : " << *i << std::endl; + } + + delete session; + session = 0; + stop_and_destroy_backend (); + + CPPUNIT_ASSERT (!new_session_failed); + + if (new_session_failed) break; + + create_and_start_dummy_backend (); + + bool open_session_failed = false; + + try { + // reopen same session to check that it opens without error + session = new Session (*AudioEngine::instance (), new_session_dir, session_name); + + CPPUNIT_ASSERT (session); + } catch (...) { + open_session_failed = true; + + std::cerr << "Failed to open session using name : " << *i << std::endl; + } + + delete session; + session = 0; + stop_and_destroy_backend (); + + CPPUNIT_ASSERT (!open_session_failed); + + if (open_session_failed) break; + } + +} diff --git a/libs/ardour/test/session_test.h b/libs/ardour/test/session_test.h index 9aba3d9847..37228bac15 100644 --- a/libs/ardour/test/session_test.h +++ b/libs/ardour/test/session_test.h @@ -7,10 +7,12 @@ class SessionTest : public CppUnit::TestFixture CPPUNIT_TEST_SUITE (SessionTest); CPPUNIT_TEST (new_session); CPPUNIT_TEST (new_session_from_template); + CPPUNIT_TEST (open_session_utf8_path); CPPUNIT_TEST_SUITE_END (); public: void new_session (); void new_session_from_template (); + void open_session_utf8_path (); }; |