remove ControlOnly port flag, since it was essentially unusable
[ardour.git] / libs / ardour / test / test_util.cc
index cedb7fa84995d004a612b4c7889d31537c0e4083..9b33f2676256fb623a377fba81f1f8b744b02c07 100644 (file)
     with this program; if not, write to the Free Software Foundation, Inc.,
     675 Mass Ave, Cambridge, MA 02139, USA.
 */
-#include <fstream>
 #include <sstream>
 
 #include <glibmm/fileutils.h>
 #include <glibmm/miscutils.h>
 
 #include "pbd/xml++.h"
-#include "pbd/textreceiver.h"
 #include "pbd/file_utils.h"
 
 #include "ardour/session.h"
 #include "ardour/audioengine.h"
+#include "ardour/filesystem_paths.h"
 
 #include "test_util.h"
 
@@ -68,7 +67,7 @@ check_nodes (XMLNode const * p, XMLNode const * q, list<string> const & ignore_p
        CPPUNIT_ASSERT_EQUAL (qc.size(), pc.size());
        XMLNodeList::const_iterator k = pc.begin ();
        XMLNodeList::const_iterator l = qc.begin ();
-       
+
        while (k != pc.end ()) {
                check_nodes (*k, *l, ignore_properties);
                ++k;
@@ -97,61 +96,6 @@ write_ref (XMLNode* node, string ref_file)
        return rv;
 }
 
-class TestReceiver : public Receiver 
-{
-protected:
-       void receive (Transmitter::Channel chn, const char * str) {
-               const char *prefix = "";
-               
-               switch (chn) {
-               case Transmitter::Error:
-                       prefix = ": [ERROR]: ";
-                       break;
-               case Transmitter::Info:
-                       /* ignore */
-                       return;
-               case Transmitter::Warning:
-                       prefix = ": [WARNING]: ";
-                       break;
-               case Transmitter::Fatal:
-                       prefix = ": [FATAL]: ";
-                       break;
-               case Transmitter::Throw:
-                       /* this isn't supposed to happen */
-                       abort ();
-               }
-               
-               /* note: iostreams are already thread-safe: no external
-                  lock required.
-               */
-               
-               cout << prefix << str << endl;
-               
-               if (chn == Transmitter::Fatal) {
-                       exit (9);
-               }
-       }
-};
-
-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 ()
 {
@@ -159,7 +103,7 @@ create_and_start_dummy_backend ()
 
        CPPUNIT_ASSERT (AudioEngine::instance ());
        CPPUNIT_ASSERT (engine);
-       CPPUNIT_ASSERT (engine->set_backend ("Dummy", "", ""));
+       CPPUNIT_ASSERT (engine->set_backend ("None (Dummy)", "Unit-Test", ""));
 
        init_post_engine ();
 
@@ -189,11 +133,12 @@ PBD::Searchpath
 test_search_path ()
 {
 #ifdef PLATFORM_WINDOWS
-       std::string wsp(g_win32_get_package_installation_directory_of_module(NULL));
-       return Glib::build_filename (wsp, "ardour_testdata");
-#else
-       return Glib::getenv("ARDOUR_TEST_PATH");
+       if (!getenv("ARDOUR_TEST_PATH")) {
+               std::string wsp(windows_package_directory_path());
+               return Glib::build_filename (wsp, "ardour_testdata");
+       }
 #endif
+       return Glib::getenv("ARDOUR_TEST_PATH");
 }
 
 std::string
@@ -207,3 +152,17 @@ get_test_sample_rate ()
 {
        return 44100;
 }
+
+void
+get_utf8_test_strings (std::vector<std::string>& result)
+{
+       // These are all translations of "Ardour" from google translate
+       result.push_back ("Ardour"); // Reference
+       result.push_back ("\320\277\321\213\320\273"); // Russian
+       result.push_back ("\305\276ar"); // Croatian
+       result.push_back ("\340\270\204\340\270\247\340\270\262\340\270\241\340\270\201\340\270\243\340\270\260\340\270\225\340\270\267\340\270\255\340\270\243\340\270\267\340\270\255\340\270\243\340\271\211\340\270\231"); // Thai
+       result.push_back ("\325\245\325\274\325\241\325\266\325\244"); // Armenian
+       result.push_back ("\340\246\254\340\247\215\340\246\257\340\246\227\340\247\215\340\246\260\340\246\244\340\246\276"); // Bengali
+       result.push_back ("\346\203\205\347\206\261"); // Japanese
+       result.push_back ("\347\203\255\346\203\205"); // Chinese (Simplified)
+}