1515
1616#include < iostream>
1717
18- namespace otime = opentime::OPENTIME_VERSION_NS;
19- namespace otio = opentimelineio::OPENTIMELINEIO_VERSION_NS;
18+ using namespace OTIO_NS ;
2019
2120int
2221main (int argc, char ** argv)
2322{
2423 Tests tests;
2524
2625 tests.add_test (" test_cons" , [] {
27- std::string name = " test" ;
28- otime::RationalTime rt (5 , 24 );
29- otime::TimeRange tr (rt, rt);
30-
31- otio::SerializableObject::Retainer<otio::ExternalReference> mr (
32- new otio::ExternalReference);
33- mr->set_available_range (
34- otime::TimeRange (rt, otime::RationalTime (10 , 24 )));
26+ std::string name = " test" ;
27+ RationalTime rt (5 , 24 );
28+ TimeRange tr (rt, rt);
29+
30+ SerializableObject::Retainer<ExternalReference> mr (
31+ new ExternalReference);
32+ mr->set_available_range (TimeRange (rt, RationalTime (10 , 24 )));
3533 mr->set_target_url (" /var/tmp/test.mov" );
3634
37- otio:: SerializableObject::Retainer<otio:: Clip> cl (new otio:: Clip);
35+ SerializableObject::Retainer<Clip> cl (new Clip);
3836 cl->set_name (name);
3937 cl->set_media_reference (mr);
4038 cl->set_source_range (tr);
4139 assertEqual (cl->name (), name);
4240 assertEqual (cl->source_range ().value (), tr);
4341
4442 std::string encoded = cl->to_json_string ();
45- otio:: SerializableObject::Retainer<otio:: SerializableObject> decoded (
46- otio:: SerializableObject::from_json_string (encoded));
43+ SerializableObject::Retainer<SerializableObject> decoded (
44+ SerializableObject::from_json_string (encoded));
4745 assertTrue (cl->is_equivalent_to (*decoded));
4846 });
4947
5048 tests.add_test (" test_ranges" , [] {
51- otime:: TimeRange tr (
49+ TimeRange tr (
5250 // 1 hour in at 24 fps
53- otime:: RationalTime (86400 , 24 ),
54- otime:: RationalTime (200 , 24 ));
51+ RationalTime (86400 , 24 ),
52+ RationalTime (200 , 24 ));
5553
56- otio::SerializableObject::Retainer<otio::Clip> cl (
57- new otio::Clip (" test_clip" ));
58- otio::SerializableObject::Retainer<otio::ExternalReference> mr (
59- new otio::ExternalReference);
54+ SerializableObject::Retainer<Clip> cl (new Clip (" test_clip" ));
55+ SerializableObject::Retainer<ExternalReference> mr (
56+ new ExternalReference);
6057 mr->set_target_url (" /var/tmp/test.mov" );
6158 mr->set_available_range (tr);
6259 cl->set_media_reference (mr);
@@ -65,20 +62,19 @@ main(int argc, char** argv)
6562 assertEqual (cl->trimmed_range (), tr);
6663 assertEqual (cl->available_range (), tr);
6764
68- cl->set_source_range (otime:: TimeRange (
65+ cl->set_source_range (TimeRange (
6966 // 1 hour + 100 frames
70- otime:: RationalTime (86500 , 24 ),
71- otime:: RationalTime (50 , 24 )));
67+ RationalTime (86500 , 24 ),
68+ RationalTime (50 , 24 )));
7269 assertNotEqual (cl->duration (), tr.duration ());
7370 assertNotEqual (cl->trimmed_range (), tr);
7471 assertEqual (cl->duration (), cl->source_range ()->duration ());
7572 assertEqual (cl->trimmed_range (), cl->source_range ().value ());
7673 });
7774
7875 tests.add_test (" test_clip_v1_to_v2_null" , [] {
79- using namespace otio ;
8076
81- otio ::ErrorStatus status;
77+ OTIO_NS ::ErrorStatus status;
8278 SerializableObject::Retainer<> so =
8379 SerializableObject::from_json_string (
8480 R"(
@@ -99,9 +95,8 @@ main(int argc, char** argv)
9995 });
10096
10197 tests.add_test (" test_clip_v1_to_v2" , [] {
102- using namespace otio ;
10398
104- otio ::ErrorStatus status;
99+ OTIO_NS ::ErrorStatus status;
105100 SerializableObject::Retainer<> so =
106101 SerializableObject::from_json_string (
107102 R"(
@@ -151,7 +146,6 @@ main(int argc, char** argv)
151146 });
152147
153148 tests.add_test (" test_clip_media_representation" , [] {
154- using namespace otio ;
155149
156150 static constexpr auto time_scalar = 1.5 ;
157151
@@ -173,7 +167,7 @@ main(int argc, char** argv)
173167 static constexpr auto proxy_quality = " proxy_quality" ;
174168
175169 SerializableObject::Retainer<MediaReference> media (
176- new otio:: ExternalReference ());
170+ new ExternalReference ());
177171
178172 SerializableObject::Retainer<Clip> clip (new Clip (
179173 " unit_clip" ,
@@ -189,11 +183,11 @@ main(int argc, char** argv)
189183 assertEqual (clip->active_media_reference_key ().c_str (), high_quality);
190184
191185 SerializableObject::Retainer<MediaReference> ref1 (
192- new otio:: ExternalReference ());
186+ new ExternalReference ());
193187 SerializableObject::Retainer<MediaReference> ref2 (
194- new otio:: ExternalReference ());
188+ new ExternalReference ());
195189 SerializableObject::Retainer<MediaReference> ref3 (
196- new otio:: ExternalReference ());
190+ new ExternalReference ());
197191
198192 clip->set_media_references (
199193 { { Clip::default_media_key, ref1 },
@@ -211,36 +205,36 @@ main(int argc, char** argv)
211205
212206 // setting the active reference to a key that does not exist
213207 // should return an error
214- otio ::ErrorStatus error;
208+ OTIO_NS ::ErrorStatus error;
215209 clip->set_active_media_reference_key (" cloud" , &error);
216- assertTrue (otio:: is_error (error));
210+ assertTrue (is_error (error));
217211 assertEqual (
218212 error.outcome ,
219- otio ::ErrorStatus::MEDIA_REFERENCES_DO_NOT_CONTAIN_ACTIVE_KEY);
213+ OTIO_NS ::ErrorStatus::MEDIA_REFERENCES_DO_NOT_CONTAIN_ACTIVE_KEY);
220214 assertEqual (clip->media_reference (), ref1.value );
221215
222216 // setting the references that doesn't have the active key should
223217 // also generate an error
224218 SerializableObject::Retainer<MediaReference> ref4 (
225- new otio:: ExternalReference ());
219+ new ExternalReference ());
226220
227- otio ::ErrorStatus error2;
221+ OTIO_NS ::ErrorStatus error2;
228222 clip->set_media_references (
229223 { { " cloud" , ref4 } }, high_quality, &error2);
230- assertTrue (otio:: is_error (error2));
224+ assertTrue (is_error (error2));
231225 assertEqual (
232226 error2.outcome ,
233- otio ::ErrorStatus::MEDIA_REFERENCES_DO_NOT_CONTAIN_ACTIVE_KEY);
227+ OTIO_NS ::ErrorStatus::MEDIA_REFERENCES_DO_NOT_CONTAIN_ACTIVE_KEY);
234228
235229 assertEqual (clip->media_reference (), ref1.value );
236230
237231 // setting an empty should also generate an error
238- otio ::ErrorStatus error3;
232+ OTIO_NS ::ErrorStatus error3;
239233 clip->set_media_references ({ { " " , ref4 } }, " " , &error3);
240- assertTrue (otio:: is_error (error3));
234+ assertTrue (is_error (error3));
241235 assertEqual (
242236 error3.outcome ,
243- otio ::ErrorStatus::MEDIA_REFERENCES_CONTAIN_EMPTY_KEY);
237+ OTIO_NS ::ErrorStatus::MEDIA_REFERENCES_CONTAIN_EMPTY_KEY);
244238
245239 // setting the references and the active key at the same time
246240 // should work
@@ -263,21 +257,19 @@ main(int argc, char** argv)
263257 // test to ensure null error_status pointers are correctly handled
264258 tests.add_test (" test_error_ptr_null" , [] {
265259
266- using namespace otio ;
267-
268260 // tests for no image bounds on media reference on clip
269261 SerializableObject::Retainer<Clip> clip (new Clip);
270262
271263 // check that there is an error, and that it's the correct error
272- otio ::ErrorStatus mr_bounds_error;
264+ OTIO_NS ::ErrorStatus mr_bounds_error;
273265 clip->available_image_bounds (&mr_bounds_error);
274- assertTrue (otio:: is_error (mr_bounds_error));
266+ assertTrue (is_error (mr_bounds_error));
275267 assertEqual (
276268 mr_bounds_error.outcome ,
277- otio ::ErrorStatus::CANNOT_COMPUTE_BOUNDS);
269+ OTIO_NS ::ErrorStatus::CANNOT_COMPUTE_BOUNDS);
278270
279271 // check that if null ptr, nothing happens
280- otio ::ErrorStatus* null_test = nullptr ;
272+ OTIO_NS ::ErrorStatus* null_test = nullptr ;
281273
282274 assertEqual (
283275 clip->available_image_bounds (null_test), std::optional<IMATH_NAMESPACE::Box2d>()
@@ -287,7 +279,6 @@ main(int argc, char** argv)
287279 // test to ensure null error_status pointers are correctly handled
288280 // when there's no media reference
289281 tests.add_test (" test_error_ptr_null_no_media" , [] {
290- using namespace otio ;
291282
292283 SerializableObject::Retainer<Clip> clip (new Clip);
293284
@@ -296,17 +287,17 @@ main(int argc, char** argv)
296287 empty_mrs[" empty" ] = nullptr ;
297288 clip->set_media_references (empty_mrs, " empty" );
298289
299- otio ::ErrorStatus bounds_error_no_mr;
290+ OTIO_NS ::ErrorStatus bounds_error_no_mr;
300291 clip->available_image_bounds (&bounds_error_no_mr);
301- assertTrue (otio:: is_error (bounds_error_no_mr));
292+ assertTrue (is_error (bounds_error_no_mr));
302293
303294 assertEqual (
304295 bounds_error_no_mr.outcome ,
305- otio ::ErrorStatus::CANNOT_COMPUTE_BOUNDS);
296+ OTIO_NS ::ErrorStatus::CANNOT_COMPUTE_BOUNDS);
306297
307298 // std::cout<< "bounds error details: " << bounds_error_no_mr.details << std::endl;
308299
309- otio ::ErrorStatus* null_test_no_mr = nullptr ;
300+ OTIO_NS ::ErrorStatus* null_test_no_mr = nullptr ;
310301
311302 assertEqual (
312303 clip->available_image_bounds (null_test_no_mr), std::optional<IMATH_NAMESPACE::Box2d>()
0 commit comments