summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/ratio.cc3
-rw-r--r--test/ratio_test.cc4
2 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/ratio.cc b/src/lib/ratio.cc
index aa222b116..5f1a3aa63 100644
--- a/src/lib/ratio.cc
+++ b/src/lib/ratio.cc
@@ -39,6 +39,9 @@ vector<Ratio> Ratio::_ratios;
void
Ratio::setup_ratios ()
{
+ /* This must only be called once as we rely on the addresses of objects in _ratios staying the same */
+ DCPOMATIC_ASSERT (_ratios.empty());
+
_ratios.push_back (Ratio(float(1290) / 1080, "119", _("1.19"), {}, "119"));
_ratios.push_back (Ratio(float(1440) / 1080, "133", _("1.33 (4:3)"), {}, "133"));
_ratios.push_back (Ratio(float(1485) / 1080, "138", _("1.38 (Academy)"), {}, "137"));
diff --git a/test/ratio_test.cc b/test/ratio_test.cc
index c922301c2..a21859049 100644
--- a/test/ratio_test.cc
+++ b/test/ratio_test.cc
@@ -34,8 +34,6 @@ using std::ostream;
BOOST_AUTO_TEST_CASE (ratio_test)
{
- Ratio::setup_ratios ();
-
Ratio const * r = Ratio::from_id ("119");
BOOST_CHECK (r);
BOOST_CHECK_EQUAL (fit_ratio_within (r->ratio(), dcp::Size (2048, 1080)), dcp::Size (1290, 1080));
@@ -72,8 +70,6 @@ BOOST_AUTO_TEST_CASE (ratio_test)
BOOST_AUTO_TEST_CASE (ratios_use_same_pointers_test)
{
- Ratio::setup_ratios ();
-
auto const test = Ratio::from_id ("119");
BOOST_CHECK_EQUAL (test, Ratio::from_id("119"));
}