diff options
author | Tim Mayberry <mojofunk@gmail.com> | 2014-06-25 13:51:58 +1000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-06-25 12:40:11 -0400 |
commit | 53c959ad8f75b4d5c394e091d94e22feb63cb23d (patch) | |
tree | f7b83d3363a8a0031f457359ec8b8130a785de3d /libs | |
parent | de4fc4843b7975eb1a44622845e0e2942cf1d119 (diff) |
Add a test for PBD::copy_file using test files with utf-8 encoded filenames
Diffstat (limited to 'libs')
-rw-r--r-- | libs/pbd/test/filesystem_test.cc | 35 | ||||
-rw-r--r-- | libs/pbd/test/filesystem_test.h | 6 | ||||
-rw-r--r-- | libs/pbd/test/i18n_test/ardour.tst | 2 | ||||
-rw-r--r-- | libs/pbd/test/i18n_test/žar.tst | 2 | ||||
-rw-r--r-- | libs/pbd/test/i18n_test/пыл.tst | 2 | ||||
-rw-r--r-- | libs/pbd/test/i18n_test/եռանդ.tst | 2 | ||||
-rw-r--r-- | libs/pbd/test/i18n_test/ব্যগ্রতা.tst | 2 | ||||
-rw-r--r-- | libs/pbd/test/i18n_test/ความกระตือรือร้น.tst | 2 | ||||
-rw-r--r-- | libs/pbd/test/i18n_test/情熱.tst | 2 | ||||
-rw-r--r-- | libs/pbd/test/i18n_test/热情.tst | 2 |
10 files changed, 52 insertions, 5 deletions
diff --git a/libs/pbd/test/filesystem_test.cc b/libs/pbd/test/filesystem_test.cc index 8a173858a0..8fe5afab21 100644 --- a/libs/pbd/test/filesystem_test.cc +++ b/libs/pbd/test/filesystem_test.cc @@ -10,6 +10,7 @@ #include "test_common.h" using namespace std; +using namespace PBD; CPPUNIT_TEST_SUITE_REGISTRATION (FilesystemTest); @@ -42,16 +43,44 @@ FilesystemTest::testPathIsWithin () } void -FilesystemTest::testCopyFile () +FilesystemTest::testCopyFileASCIIFilename () { - std::string testdata_path; + string testdata_path; CPPUNIT_ASSERT (find_file (test_search_path (), "RosegardenPatchFile.xml", testdata_path)); - std::string output_path = test_output_directory ("CopyFile"); + string output_path = test_output_directory ("CopyFile"); output_path = Glib::build_filename (output_path, "RosegardenPatchFile.xml"); + cerr << endl; cerr << "CopyFile test output path: " << output_path << endl; CPPUNIT_ASSERT (PBD::copy_file (testdata_path, output_path)); } + +void +FilesystemTest::testCopyFileUTF8Filename () +{ + vector<string> i18n_files; + + Searchpath i18n_path(test_search_path()); + i18n_path.add_subdirectory_to_paths("i18n_test"); + + PBD::find_files_matching_pattern (i18n_files, i18n_path, "*.tst"); + + cerr << endl; + cerr << "Copying " << i18n_files.size() << " test files from: " + << i18n_path.to_string () << endl; + + for (vector<string>::iterator i = i18n_files.begin(); i != i18n_files.end(); ++i) { + string input_path = *i; + string output_file = Glib::path_get_basename(*i); + string output_path = test_output_directory ("CopyFile"); + output_path = Glib::build_filename (output_path, output_file); + + cerr << "Copying test file: " << input_path + << " To " << output_path << endl; + + CPPUNIT_ASSERT (PBD::copy_file (input_path, output_path)); + } +} diff --git a/libs/pbd/test/filesystem_test.h b/libs/pbd/test/filesystem_test.h index f25d3abbc8..a8b3968f3a 100644 --- a/libs/pbd/test/filesystem_test.h +++ b/libs/pbd/test/filesystem_test.h @@ -5,12 +5,14 @@ class FilesystemTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE (FilesystemTest); CPPUNIT_TEST (testPathIsWithin); - CPPUNIT_TEST (testCopyFile); + CPPUNIT_TEST (testCopyFileASCIIFilename); + CPPUNIT_TEST (testCopyFileUTF8Filename); CPPUNIT_TEST_SUITE_END (); public: void testPathIsWithin (); - void testCopyFile (); + void testCopyFileASCIIFilename (); + void testCopyFileUTF8Filename (); }; diff --git a/libs/pbd/test/i18n_test/ardour.tst b/libs/pbd/test/i18n_test/ardour.tst new file mode 100644 index 0000000000..0c7afd2838 --- /dev/null +++ b/libs/pbd/test/i18n_test/ardour.tst @@ -0,0 +1,2 @@ +Ardour Test file +Language: English diff --git a/libs/pbd/test/i18n_test/žar.tst b/libs/pbd/test/i18n_test/žar.tst new file mode 100644 index 0000000000..5d65515a01 --- /dev/null +++ b/libs/pbd/test/i18n_test/žar.tst @@ -0,0 +1,2 @@ +Ardour Test file +Language: Croatian diff --git a/libs/pbd/test/i18n_test/пыл.tst b/libs/pbd/test/i18n_test/пыл.tst new file mode 100644 index 0000000000..fcc5b61f0c --- /dev/null +++ b/libs/pbd/test/i18n_test/пыл.tst @@ -0,0 +1,2 @@ +Ardour Test file +Language: Russian diff --git a/libs/pbd/test/i18n_test/եռանդ.tst b/libs/pbd/test/i18n_test/եռանդ.tst new file mode 100644 index 0000000000..09b97a757f --- /dev/null +++ b/libs/pbd/test/i18n_test/եռանդ.tst @@ -0,0 +1,2 @@ +Ardour Test file +Language: Armenian diff --git a/libs/pbd/test/i18n_test/ব্যগ্রতা.tst b/libs/pbd/test/i18n_test/ব্যগ্রতা.tst new file mode 100644 index 0000000000..86a4d2aae4 --- /dev/null +++ b/libs/pbd/test/i18n_test/ব্যগ্রতা.tst @@ -0,0 +1,2 @@ +Ardour Test file +Language: Bengali diff --git a/libs/pbd/test/i18n_test/ความกระตือรือร้น.tst b/libs/pbd/test/i18n_test/ความกระตือรือร้น.tst new file mode 100644 index 0000000000..7ee6e18ac8 --- /dev/null +++ b/libs/pbd/test/i18n_test/ความกระตือรือร้น.tst @@ -0,0 +1,2 @@ +Ardour Test file +Language: Thai diff --git a/libs/pbd/test/i18n_test/情熱.tst b/libs/pbd/test/i18n_test/情熱.tst new file mode 100644 index 0000000000..7d00918c94 --- /dev/null +++ b/libs/pbd/test/i18n_test/情熱.tst @@ -0,0 +1,2 @@ +Ardour Test file +Language: Japanese diff --git a/libs/pbd/test/i18n_test/热情.tst b/libs/pbd/test/i18n_test/热情.tst new file mode 100644 index 0000000000..571ba353df --- /dev/null +++ b/libs/pbd/test/i18n_test/热情.tst @@ -0,0 +1,2 @@ +Ardour Test file +Language: Chinese (Simplified) |