Lumiera  0.pre.03
»edit your freedom«
stream-type-basics-test.cpp
Go to the documentation of this file.
1 /*
2  StreamTypeBasics(Test) - check the fundamentals of stream type information
3 
4  Copyright (C)
5  2008, 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/util.hpp"
21 
23 #include "teststreamtypes.hpp"
24 
25 using ::test::Test;
26 using util::isnil;
27 
28 
29 namespace steam {
30 namespace test_format {
31 
32  using control::STypeManager;
33  typedef StreamType const& SType;
34  typedef StreamType::ImplFacade const& ImplType;
35 
36 
37  /***************************************************************/
43  class StreamTypeBasics_test : public Test
44  {
45  virtual void
46  run (Arg)
47  {
48  ImplType iType = buildImplType ();
49  basicImplTypeProperties (iType);
50 
51  SType type = extend2fullType (iType);
52  basicStreamTypeProperties (type, iType);
53  }
54 
55  ImplType
56  buildImplType ()
57  {
58  STypeManager& typeManager = STypeManager::instance();
59 
60  gavl_video_format_t rawType = test_createRawType();
61  ImplType iTy (typeManager.getImpl (GAVL, rawType));
62 
63  UNIMPLEMENTED ("at least preliminary implementation of the MediaImplLib interface for lib GAVL");
64 
65  TODO ("how to do a simple consistency check on the returned ImplFacade? can we re-create the GAVL frame type?");
66  CHECK (GAVL==iTy.libraryID);
67  return iTy;
68  }
69 
70  void
71  basicImplTypeProperties (ImplType refType)
72  {
73  ImplType iTy2 = test_createImplType ();
74  CHECK (iTy2==refType);
75  CHECK (refType==iTy2);
76  TODO ("add equality comparable concept to the ImplType class");
77 
78  CHECK (StreamType::VIDEO==refType.getKind());
79  UNIMPLEMENTED ("get a lib descriptor");
80  UNIMPLEMENTED ("check the lib of the type");
81  UNIMPLEMENTED ("compare two types");
82  }
83 
84  SType
85  extend2fullType (ImplType iTy)
86  {
87  return STypeManager::instance().getType(iTy);
88  }
89 
90  void
91  basicStreamTypeProperties (SType type, ImplType iTy)
92  {
93  CHECK (type.implType);
94  CHECK (iTy==(*type.implType));
95  CHECK (&iTy==type.implType); // actually using the same object (in the registry)
96 
97  CHECK (!isnil (type.prototype.id));
98  CHECK (StreamType::VIDEO==type.prototype.kind);
99  CHECK (StreamType::VIDEO==type.implType->getKind());
100 
101  CHECK (type.implType->canConvert(iTy)); // of course... they are actually the same
102  CHECK (iTy.canConvert(type)); // because it's based on the same impl type
103 
104  CHECK (StreamType::RAW==type.intentionTag);
105  }
106  };
107 
108  LAUNCHER (StreamTypeBasics_test, "unit common");
109 
110 
111 }} // namespace steam::test_format
112 
ImplFacade const & getImpl(Symbol libID, StreamType::Prototype const &protoType)
build or retrieve an implementation (facade) utilizing a specific MediaImplLib and implementing the g...
Steam-Layer implementation namespace root.
Interface to the stream type system.
static lib::Depend< STypeManager > instance
access the system-wide stream type manager instance.
gavl_video_format_t test_createRawType()
Helper: create an raw GAVL type descriptor usable for generating a Lumiera StreamType.
Unit test helper to create fake streamtype information.
Simplistic test class runner.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
StreamType::ImplFacade const & test_createImplType()
Helper: create an implementation frame and build the corresponding streamtype.