Lumiera  0.pre.03
»edityourfreedom«
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
format-support-test.cpp
Go to the documentation of this file.
1 /*
2  FormatSupport(Test) - verify the configuration to support a specific format
3 
4  Copyright (C) Lumiera.org
5  2011, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 * *****************************************************/
22 
28 #include "lib/test/run.hpp"
29 #include "lib/time/formats.hpp"
30 
31 
32 namespace lib {
33 namespace time {
34 namespace format{
35 namespace test {
36 
37 
38 
39  /****************************************************/
45  class FormatSupport_test : public Test
46  {
47  virtual void
48  run (Arg)
49  {
50  SupportStandardTimecode just_fine;
51  Supported just_smpte = Supported::formats< Types<Smpte> >();
52  Supported just_simple = Supported::formats< Types<Frames,Seconds> >();
53 
54  Supported& support1 (just_fine);
55  Supported& support2 (just_smpte);
56  Supported& support3 (just_simple);
57 
58  CHECK ( support1.check<Hms>());
59  CHECK ( support1.check<Smpte>());
60  CHECK ( support1.check<Frames>());
61  CHECK ( support1.check<Seconds>());
62 
63  CHECK (!support2.check<Hms>());
64  CHECK ( support2.check<Smpte>());
65  CHECK (!support2.check<Frames>());
66  CHECK (!support2.check<Seconds>());
67 
68  CHECK (!support3.check<Hms>());
69  CHECK (!support3.check<Smpte>());
70  CHECK ( support3.check<Frames>());
71  CHECK ( support3.check<Seconds>());
72 
73  // format support descriptors are assignable
74  just_smpte = just_simple;
75  CHECK (support2.check<Hms>() == support3.check<Hms>());
76  CHECK (support2.check<Smpte>() == support3.check<Smpte>());
77  CHECK (support2.check<Frames>() == support3.check<Frames>());
78  CHECK (support2.check<Seconds>() == support3.check<Seconds>());
79  }
80  };
81 
82 
84  LAUNCHER (FormatSupport_test, "unit common");
85 
86 
87 
88 }}}} // namespace lib::time::format::test
Frame count as timecode format.
Definition: formats.hpp:81
The informal hours-minutes-seconds-millisecond timecode.
Definition: formats.hpp:114
Definition: run.hpp:49
Widely used standard media timecode format.
Definition: formats.hpp:96
LAUNCHER(FormatSupport_test,"unit common")
Register this test class...
Implementation namespace for support and library code.
Descriptor to denote support for a specific (timecode) format.
Definition: formats.hpp:193
std::vector< string > & Arg
Definition: run.hpp:54
Simple test class runner.
predefined standard configuration: Descriptor for supporting all the classical timecode formats ...
Definition: formats.hpp:243
Simple timecode specification as fractional seconds.
Definition: formats.hpp:132
Definition of time code formats This header is part of the Lumiera time and timecode handling library...
bool check() const
check if a specific Format is supported
Definition: formats.hpp:233