summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-05-27 14:50:56 +0100
committerCarl Hetherington <cth@carlh.net>2014-05-27 14:50:56 +0100
commitf0de0c63504446714ab642f9db872bd31f9c070b (patch)
tree45ea6c4219a3a3dbd1dedde65f071ab092c5c290 /test
parent170aa07b0c45d031b89815a5d07c8eb7e9226bbe (diff)
Rename STL -> STLText
Diffstat (limited to 'test')
-rw-r--r--test/data/test_text.stl (renamed from test/data/test.stl)0
-rw-r--r--test/dcp_to_stl_text_test.cc (renamed from test/dcp_to_stl_test.cc)7
-rw-r--r--test/stl_text_reader_test.cc (renamed from test/stl_reader_test.cc)10
-rw-r--r--test/stl_text_writer_test.cc (renamed from test/stl_writer_test.cc)8
-rw-r--r--test/test.cc11
-rw-r--r--test/wscript6
6 files changed, 27 insertions, 15 deletions
diff --git a/test/data/test.stl b/test/data/test_text.stl
index abb755a..abb755a 100644
--- a/test/data/test.stl
+++ b/test/data/test_text.stl
diff --git a/test/dcp_to_stl_test.cc b/test/dcp_to_stl_text_test.cc
index 95a5842..b96fc6c 100644
--- a/test/dcp_to_stl_test.cc
+++ b/test/dcp_to_stl_text_test.cc
@@ -21,13 +21,13 @@
#include <boost/test/unit_test.hpp>
#include "test.h"
#include "dcp_reader.h"
-#include "stl_writer.h"
+#include "stl_text_writer.h"
using std::string;
using std::ifstream;
using std::ofstream;
-BOOST_AUTO_TEST_CASE (dcp_to_stl_test)
+BOOST_AUTO_TEST_CASE (dcp_to_stl_text_test)
{
if (private_test.empty ()) {
return;
@@ -38,7 +38,8 @@ BOOST_AUTO_TEST_CASE (dcp_to_stl_test)
sub::DCPReader r (f);
string const q = "build/test/fd586c30-6d38-48f2-8241-27359acf184c_sub.stl";
ofstream g (q.c_str ());
- sub::STLWriter w (r.subtitles (), 72 * 11, 24, g);
+ sub::STLTextWriter w (r.subtitles (), 72 * 11, 24, g);
string const c = private_test + "/fd586c30-6d38-48f2-8241-27359acf184c_sub.stl";
+ g.close ();
check_text (q, c);
}
diff --git a/test/stl_reader_test.cc b/test/stl_text_reader_test.cc
index 07e1616..fa9d448 100644
--- a/test/stl_reader_test.cc
+++ b/test/stl_text_reader_test.cc
@@ -19,17 +19,17 @@
#include <boost/test/unit_test.hpp>
#include <fstream>
-#include "stl_reader.h"
+#include "stl_text_reader.h"
#include "subtitle.h"
using std::list;
using std::ifstream;
-/* Test reading of an STL file */
-BOOST_AUTO_TEST_CASE (stl_reader_test)
+/* Test reading of a textual STL file */
+BOOST_AUTO_TEST_CASE (stl_text_reader_test)
{
- ifstream file ("test/data/test.stl");
- sub::STLReader reader (file);
+ ifstream file ("test/data/test_text.stl");
+ sub::STLTextReader reader (file);
list<sub::Subtitle> subs = reader.subtitles ();
list<sub::Subtitle>::iterator i = subs.begin ();
diff --git a/test/stl_writer_test.cc b/test/stl_text_writer_test.cc
index 8f16f1f..9e987a9 100644
--- a/test/stl_writer_test.cc
+++ b/test/stl_text_writer_test.cc
@@ -19,7 +19,7 @@
#include <boost/test/unit_test.hpp>
#include <fstream>
-#include "stl_writer.h"
+#include "stl_text_writer.h"
#include "subtitle.h"
#include "test.h"
@@ -44,8 +44,8 @@ make (string text, bool bold, bool italic, bool underline, int line, sub::FrameT
return s;
}
-/* Test writing of an STL file */
-BOOST_AUTO_TEST_CASE (stl_writer_test)
+/* Test writing of an textual STL file */
+BOOST_AUTO_TEST_CASE (stl_text_writer_test)
{
list<sub::Subtitle> subs;
subs.push_back (make (" This is a subtitle ", false, false, false, 0, sub::FrameTime (0, 0, 41, 9), sub::FrameTime (0, 0, 42, 21)));
@@ -59,7 +59,7 @@ BOOST_AUTO_TEST_CASE (stl_writer_test)
subs.push_back (make (".", false, false, false, 0, sub::FrameTime (0, 1, 1, 1), sub::FrameTime (0, 1, 2, 10)));
ofstream f ("build/test/test.stl");
- sub::STLWriter writer (subs, 24, 72 * 11, f);
+ sub::STLTextWriter writer (subs, 24, 72 * 11, f);
f.close ();
check_text ("test/ref/test.stl", "build/test/test.stl");
diff --git a/test/test.cc b/test/test.cc
index 423906b..feeba36 100644
--- a/test/test.cc
+++ b/test/test.cc
@@ -24,6 +24,7 @@
#include <string>
using std::string;
+using std::cerr;
using std::ifstream;
using std::getline;
@@ -46,6 +47,16 @@ BOOST_GLOBAL_FIXTURE (TestConfig);
void
check_text (string a, string b)
{
+ if (access (a.c_str(), F_OK) == -1) {
+ cerr << "File not found: " << a << "\n";
+ }
+
+ if (access (b.c_str(), F_OK) == -1) {
+ cerr << "File not found: " << b << "\n";
+ }
+
+ BOOST_CHECK_EQUAL (access (a.c_str(), F_OK), 0);
+
ifstream p (a.c_str ());
ifstream q (b.c_str ());
diff --git a/test/wscript b/test/wscript
index 765771e..c6abb1d 100644
--- a/test/wscript
+++ b/test/wscript
@@ -17,9 +17,9 @@ def build(bld):
obj.use = 'libsub'
obj.source = """
dcp_reader_test.cc
- dcp_to_stl_test.cc
- stl_reader_test.cc
- stl_writer_test.cc
+ dcp_to_stl_text_test.cc
+ stl_text_reader_test.cc
+ stl_text_writer_test.cc
time_test.cc
test.cc
"""