Split CPL up into its own files.
[libdcp.git] / src / test_mode.cc
1 /*
2     Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 /** @file  src/test_mode.cc
21  *  @brief A method to enable test mode for libdcp.
22  */
23
24 #include "KM_prng.h"
25 #include "test_mode.h"
26 #include "metadata.h"
27
28 /** Calling this will seed the random number generator used to
29  *  generate UUIDs with a known value, and set the DCP issue
30  *  date to 1st January 2012 at midnight.  This means that
31  *  two runs of libdcp with the same inputs will produce
32  *  the same output.
33  */
34
35 void
36 libdcp::enable_test_mode ()
37 {
38         Kumu::libdcp_test = true;
39         Metadata::instance()->issue_date = "2012-01-01T00:00:00+00:00";
40
41         /* Remove version strings */
42         Metadata::instance()->issuer = "libdcp-test";
43         Metadata::instance()->creator = "libdcp-test";
44         Metadata::instance()->product_version = "test";
45 }