Lumiera  0.pre.03
»edit your freedom«
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)
5  2011, Hermann Vosseler <Ichthyostega@web.de>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 * *****************************************************************/
13 
19 #include "lib/test/run.hpp"
20 #include "lib/time/formats.hpp"
21 
22 
23 namespace lib {
24 namespace time {
25 namespace format{
26 namespace test {
27 
28 
29 
30  /****************************************************/
36  class FormatSupport_test : public Test
37  {
38  virtual void
39  run (Arg)
40  {
41  SupportStandardTimecode just_fine;
42  Supported just_smpte = Supported::formats< Types<Smpte> >();
43  Supported just_simple = Supported::formats< Types<Frames,Seconds> >();
44 
45  Supported& support1 (just_fine);
46  Supported& support2 (just_smpte);
47  Supported& support3 (just_simple);
48 
49  CHECK ( support1.check<Hms>());
50  CHECK ( support1.check<Smpte>());
51  CHECK ( support1.check<Frames>());
52  CHECK ( support1.check<Seconds>());
53 
54  CHECK (!support2.check<Hms>());
55  CHECK ( support2.check<Smpte>());
56  CHECK (!support2.check<Frames>());
57  CHECK (!support2.check<Seconds>());
58 
59  CHECK (!support3.check<Hms>());
60  CHECK (!support3.check<Smpte>());
61  CHECK ( support3.check<Frames>());
62  CHECK ( support3.check<Seconds>());
63 
64  // format support descriptors are assignable
65  just_smpte = just_simple;
66  CHECK (support2.check<Hms>() == support3.check<Hms>());
67  CHECK (support2.check<Smpte>() == support3.check<Smpte>());
68  CHECK (support2.check<Frames>() == support3.check<Frames>());
69  CHECK (support2.check<Seconds>() == support3.check<Seconds>());
70  }
71  };
72 
73 
75  LAUNCHER (FormatSupport_test, "unit common");
76 
77 
78 
79 }}}} // namespace lib::time::format::test
Frame count as timecode format.
Definition: formats.hpp:75
The informal hours-minutes-seconds-millisecond timecode.
Definition: formats.hpp:108
Definition: run.hpp:40
bool check() const
check if a specific Format is supported
Definition: formats.hpp:227
Widely used standard media timecode format.
Definition: formats.hpp:90
Implementation namespace for support and library code.
Descriptor to denote support for a specific (timecode) format.
Definition: formats.hpp:187
Simplistic test class runner.
predefined standard configuration: Descriptor for supporting all the classical timecode formats ...
Definition: formats.hpp:237
Simple timecode specification as fractional seconds.
Definition: formats.hpp:126
Definition of time code formats This header is part of the Lumiera time and timecode handling library...