Add a test for PBD::copy_file using test files with utf-8 encoded filenames
This commit is contained in:
parent
de4fc4843b
commit
53c959ad8f
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 ();
|
||||
|
||||
};
|
||||
|
||||
|
|
2
libs/pbd/test/i18n_test/ardour.tst
Normal file
2
libs/pbd/test/i18n_test/ardour.tst
Normal file
|
@ -0,0 +1,2 @@
|
|||
Ardour Test file
|
||||
Language: English
|
2
libs/pbd/test/i18n_test/žar.tst
Normal file
2
libs/pbd/test/i18n_test/žar.tst
Normal file
|
@ -0,0 +1,2 @@
|
|||
Ardour Test file
|
||||
Language: Croatian
|
2
libs/pbd/test/i18n_test/пыл.tst
Normal file
2
libs/pbd/test/i18n_test/пыл.tst
Normal file
|
@ -0,0 +1,2 @@
|
|||
Ardour Test file
|
||||
Language: Russian
|
2
libs/pbd/test/i18n_test/եռանդ.tst
Normal file
2
libs/pbd/test/i18n_test/եռանդ.tst
Normal file
|
@ -0,0 +1,2 @@
|
|||
Ardour Test file
|
||||
Language: Armenian
|
2
libs/pbd/test/i18n_test/ব্যগ্রতা.tst
Normal file
2
libs/pbd/test/i18n_test/ব্যগ্রতা.tst
Normal file
|
@ -0,0 +1,2 @@
|
|||
Ardour Test file
|
||||
Language: Bengali
|
2
libs/pbd/test/i18n_test/ความกระตือรือร้น.tst
Normal file
2
libs/pbd/test/i18n_test/ความกระตือรือร้น.tst
Normal file
|
@ -0,0 +1,2 @@
|
|||
Ardour Test file
|
||||
Language: Thai
|
2
libs/pbd/test/i18n_test/情熱.tst
Normal file
2
libs/pbd/test/i18n_test/情熱.tst
Normal file
|
@ -0,0 +1,2 @@
|
|||
Ardour Test file
|
||||
Language: Japanese
|
2
libs/pbd/test/i18n_test/热情.tst
Normal file
2
libs/pbd/test/i18n_test/热情.tst
Normal file
|
@ -0,0 +1,2 @@
|
|||
Ardour Test file
|
||||
Language: Chinese (Simplified)
|
Loading…
Reference in New Issue
Block a user