forked from AcademySoftwareFoundation/OpenTimelineIO
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for SerializableCollection::children_if (AcademySoftwareFoundatio…
…n#1404) * Fix for children_if * Missing shallow_search parameter fixes * Refactor test_children_if tests * Lint fixes * Add Python tests Signed-off-by: Darby Johnston <[email protected]> Signed-off-by: Michele Spina <[email protected]>
- Loading branch information
1 parent
2a9aab8
commit 8dba0c2
Showing
14 changed files
with
496 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright Contributors to the OpenTimelineIO project | ||
|
||
#include "utils.h" | ||
|
||
#include <opentimelineio/clip.h> | ||
#include <opentimelineio/serializableCollection.h> | ||
#include <opentimelineio/timeline.h> | ||
#include <opentimelineio/track.h> | ||
|
||
#include <iostream> | ||
|
||
namespace otime = opentime::OPENTIME_VERSION; | ||
namespace otio = opentimelineio::OPENTIMELINEIO_VERSION; | ||
|
||
int | ||
main(int argc, char** argv) | ||
{ | ||
Tests tests; | ||
|
||
tests.add_test( | ||
"test_children_if", [] { | ||
using namespace otio; | ||
otio::SerializableObject::Retainer<otio::Clip> cl = | ||
new otio::Clip(); | ||
otio::SerializableObject::Retainer<otio::Track> tr = | ||
new otio::Track(); | ||
tr->append_child(cl); | ||
otio::SerializableObject::Retainer<otio::Timeline> tl = | ||
new otio::Timeline(); | ||
tl->tracks()->append_child(tr); | ||
otio::SerializableObject::Retainer<otio::SerializableCollection> | ||
sc = new otio::SerializableCollection(); | ||
sc->insert_child(0, tl); | ||
opentimelineio::v1_0::ErrorStatus err; | ||
auto result = sc->children_if<otio::Clip>(&err, {}, false); | ||
assertEqual(result.size(), 1); | ||
assertEqual(result[0].value, cl.value); | ||
}); | ||
tests.add_test( | ||
"test_children_if_search_range", [] { | ||
using namespace otio; | ||
const TimeRange range(RationalTime(0.0, 24.0), RationalTime(24.0, 24.0)); | ||
otio::SerializableObject::Retainer<otio::Clip> cl0 = | ||
new otio::Clip(); | ||
cl0->set_source_range(range); | ||
otio::SerializableObject::Retainer<otio::Clip> cl1 = | ||
new otio::Clip(); | ||
cl1->set_source_range(range); | ||
otio::SerializableObject::Retainer<otio::Clip> cl2 = | ||
new otio::Clip(); | ||
cl2->set_source_range(range); | ||
otio::SerializableObject::Retainer<otio::Track> tr = | ||
new otio::Track(); | ||
tr->append_child(cl0); | ||
tr->append_child(cl1); | ||
tr->append_child(cl2); | ||
otio::SerializableObject::Retainer<otio::Timeline> tl = | ||
new otio::Timeline(); | ||
tl->tracks()->append_child(tr); | ||
otio::SerializableObject::Retainer<otio::SerializableCollection> | ||
sc = new otio::SerializableCollection(); | ||
sc->insert_child(0, tl); | ||
opentimelineio::v1_0::ErrorStatus err; | ||
auto result = sc->children_if<otio::Clip>(&err, range); | ||
assertEqual(result.size(), 1); | ||
assertEqual(result[0].value, cl0.value); | ||
}); | ||
tests.add_test( | ||
"test_children_if_shallow_search", [] { | ||
using namespace otio; | ||
otio::SerializableObject::Retainer<otio::Clip> cl = | ||
new otio::Clip(); | ||
otio::SerializableObject::Retainer<otio::Track> tr = | ||
new otio::Track(); | ||
tr->append_child(cl); | ||
otio::SerializableObject::Retainer<otio::Timeline> tl = | ||
new otio::Timeline(); | ||
tl->tracks()->append_child(tr); | ||
otio::SerializableObject::Retainer<otio::SerializableCollection> | ||
sc = new otio::SerializableCollection(); | ||
sc->insert_child(0, tl); | ||
opentimelineio::v1_0::ErrorStatus err; | ||
auto result = sc->children_if<otio::Clip>(&err, nullopt, true); | ||
assertEqual(result.size(), 0); | ||
result = sc->children_if<otio::Clip>(&err, nullopt, false); | ||
assertEqual(result.size(), 1); | ||
assertEqual(result[0].value, cl.value); | ||
}); | ||
|
||
tests.run(argc, argv); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.