summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/subtitle_font_id_change_test.cc31
-rw-r--r--test/test.cc24
-rw-r--r--test/test.h14
3 files changed, 38 insertions, 31 deletions
diff --git a/test/subtitle_font_id_change_test.cc b/test/subtitle_font_id_change_test.cc
index f32541980..878dc6506 100644
--- a/test/subtitle_font_id_change_test.cc
+++ b/test/subtitle_font_id_change_test.cc
@@ -38,37 +38,6 @@
using std::string;
-class Editor
-{
-public:
- Editor (boost::filesystem::path path)
- : _path(path)
- , _content(dcp::file_to_string(path))
- {
-
- }
-
- ~Editor ()
- {
- auto f = fopen(_path.string().c_str(), "w");
- BOOST_REQUIRE(f);
- fwrite(_content.c_str(), _content.length(), 1, f);
- fclose(f);
- }
-
- void replace (string a, string b)
- {
- auto old_content = _content;
- boost::algorithm::replace_all (_content, a, b);
- BOOST_REQUIRE (_content != old_content);
- }
-
-private:
- boost::filesystem::path _path;
- std::string _content;
-};
-
-
BOOST_AUTO_TEST_CASE(subtitle_font_id_change_test1)
{
auto film = new_test_film2("subtitle_font_id_change_test1");
diff --git a/test/test.cc b/test/test.cc
index f1fd40fb7..02b567237 100644
--- a/test/test.cc
+++ b/test/test.cc
@@ -980,3 +980,27 @@ find_file (boost::filesystem::path dir, string filename_part)
BOOST_REQUIRE (found);
return *found;
}
+
+
+Editor::Editor(boost::filesystem::path path)
+ : _path(path)
+ , _content(dcp::file_to_string(path))
+{
+
+}
+
+Editor::~Editor()
+{
+ auto f = fopen(_path.string().c_str(), "w");
+ BOOST_REQUIRE(f);
+ fwrite(_content.c_str(), _content.length(), 1, f);
+ fclose(f);
+}
+
+void
+Editor::replace(string a, string b)
+{
+ auto old_content = _content;
+ boost::algorithm::replace_all(_content, a, b);
+ BOOST_REQUIRE(_content != old_content);
+}
diff --git a/test/test.h b/test/test.h
index 10113b662..8bcef0604 100644
--- a/test/test.h
+++ b/test/test.h
@@ -97,6 +97,20 @@ public:
};
+class Editor
+{
+public:
+ Editor(boost::filesystem::path path);
+ ~Editor();
+
+ void replace(std::string a, std::string b);
+
+private:
+ boost::filesystem::path _path;
+ std::string _content;
+};
+
+
namespace dcp {
std::ostream& operator<< (std::ostream& s, dcp::Size i);