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"));
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));
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"));
}