Fix up hints about long subtitle lines.
authorCarl Hetherington <cth@carlh.net>
Sat, 10 Apr 2021 13:27:41 +0000 (15:27 +0200)
committerCarl Hetherington <cth@carlh.net>
Sat, 10 Apr 2021 13:27:41 +0000 (15:27 +0200)
src/lib/hints.cc
test/data
test/hints_test.cc

index ea524df501f13a9576392eda508105a103a24c5e..e431cca7f51ef9dce2ddbb7a8f4d5c67347e9844 100644 (file)
@@ -417,6 +417,12 @@ Hints::thread ()
 
        _writer->write (player->get_subtitle_fonts());
 
+       if (_long_subtitle && !_very_long_subtitle) {
+               hint (_("At least one of your subtitle lines has more than 52 characters.  It is recommended to make each line 52 characters at most in length."));
+       } else if (_very_long_subtitle) {
+               hint (_("At least one of your subtitle lines has more than 79 characters.  You should make each line 79 characters at most in length."));
+       }
+
        bool ccap_xml_too_big = false;
        bool ccap_mxf_too_big = false;
        bool subs_mxf_too_big = false;
@@ -554,14 +560,12 @@ Hints::open_subtitle (PlayerText text, DCPTimePeriod period)
                longest_line = max (longest_line, i.text().length());
        }
 
-       if (longest_line > 52 && !_long_subtitle) {
+       if (longest_line > 52) {
                _long_subtitle = true;
-               hint (_("At least one of your subtitle lines has more than 52 characters.  It is recommended to make each line 52 characters at most in length."));
        }
 
-       if (longest_line > 79 && !_very_long_subtitle) {
+       if (longest_line > 79) {
                _very_long_subtitle = true;
-               hint (_("At least one of your subtitle lines has more than 79 characters.  You should make each line 79 characters at most in length."));
        }
 
        _last_subtitle = period;
index 0d909bc1f5faf91ded4acb6afbee99fd77cd4672..f67e614146c23e721421c2070460510f965a170c 160000 (submodule)
--- a/test/data
+++ b/test/data
@@ -1 +1 @@
-Subproject commit 0d909bc1f5faf91ded4acb6afbee99fd77cd4672
+Subproject commit f67e614146c23e721421c2070460510f965a170c
index 33486f0be25f42eb1fd52e500bae01cd6f557991..f929da9c46f993f64b1596c27ad1493a6de376cf 100644 (file)
@@ -149,7 +149,17 @@ BOOST_AUTO_TEST_CASE (hint_subtitle_too_long)
        check (
                TextType::OPEN_SUBTITLE,
                "hint_subtitle_too_long",
-               string("At least one of your subtitle lines has more than 52 characters.  It is advisable to make each line 52 characters at most in length.")
+               string("At least one of your subtitle lines has more than 52 characters.  It is recommended to make each line 52 characters at most in length.")
+             );
+}
+
+
+BOOST_AUTO_TEST_CASE (hint_subtitle_much_too_long)
+{
+       check (
+               TextType::OPEN_SUBTITLE,
+               "hint_subtitle_much_too_long",
+               string("At least one of your subtitle lines has more than 79 characters.  You should make each line 79 characters at most in length.")
              );
 }