Support Dolby-style WAV back surround names when guessing mappings (#2427).
[dcpomatic.git] / test / audio_mapping_test.cc
index 1e56df38777460703eae238ff6e478f91db43ecf..37f3d24764abed4c5cc34cc9fcdf516a56ead952 100644 (file)
@@ -27,7 +27,8 @@
 
 #include <boost/test/unit_test.hpp>
 #include "lib/audio_mapping.h"
-#include "lib/util.h"
+#include "lib/constants.h"
+#include "lib/compose.hpp"
 
 
 using std::list;
@@ -71,7 +72,7 @@ guess_check (boost::filesystem::path filename, int output_channel)
        AudioMapping m (1, 8);
        m.make_default (0, filename);
        for (int i = 0; i < 8; ++i) {
-               BOOST_TEST_INFO (filename);
+               BOOST_TEST_INFO (String::compose("%1 channel %2", filename, i));
                BOOST_CHECK_CLOSE (m.get(0, i), i == output_channel ? 1 : 0, 0.01);
        }
 }
@@ -93,6 +94,13 @@ BOOST_AUTO_TEST_CASE (audio_mapping_guess_test)
        guess_check ("ptish_Rsr_abc.wav", 7);
        guess_check ("more_Lss_s.wav", 4);
        guess_check ("other_Rss.aiff", 5);
+
+       /* Only the filename should be taken into account */
+       guess_check ("-Lfe-/foo_L.wav", 0);
+
+       /* Dolby-style */
+       guess_check ("jake-Lrs-good.wav", 6);
+       guess_check ("elwood-Rrs-good.wav", 7);
 }