@@ -103,6 +103,61 @@ def test_repr(self):
103
103
")"
104
104
)
105
105
106
+ def test_trim_child_range (self ):
107
+ for st in [
108
+ otio .schema .Track (name = "foo" ),
109
+ otio .schema .Stack (name = "foo" )
110
+ ]:
111
+ st .source_range = otio .opentime .TimeRange (
112
+ start_time = otio .opentime .RationalTime (value = 100 , rate = 24 ),
113
+ duration = otio .opentime .RationalTime (value = 50 , rate = 24 )
114
+ )
115
+ r = otio .opentime .TimeRange (
116
+ start_time = otio .opentime .RationalTime (value = 110 , rate = 24 ),
117
+ duration = otio .opentime .RationalTime (value = 30 , rate = 24 )
118
+ )
119
+ self .assertEqual (st .trim_child_range (r ), r )
120
+ r = otio .opentime .TimeRange (
121
+ start_time = otio .opentime .RationalTime (value = 0 , rate = 24 ),
122
+ duration = otio .opentime .RationalTime (value = 30 , rate = 24 )
123
+ )
124
+ self .assertEqual (st .trim_child_range (r ), None )
125
+ r = otio .opentime .TimeRange (
126
+ start_time = otio .opentime .RationalTime (value = 1000 , rate = 24 ),
127
+ duration = otio .opentime .RationalTime (value = 30 , rate = 24 )
128
+ )
129
+ self .assertEqual (st .trim_child_range (r ), None )
130
+ r = otio .opentime .TimeRange (
131
+ start_time = otio .opentime .RationalTime (value = 90 , rate = 24 ),
132
+ duration = otio .opentime .RationalTime (value = 30 , rate = 24 )
133
+ )
134
+ self .assertEqual (
135
+ st .trim_child_range (r ),
136
+ otio .opentime .TimeRange (
137
+ start_time = otio .opentime .RationalTime (value = 100 , rate = 24 ),
138
+ duration = otio .opentime .RationalTime (value = 20 , rate = 24 )
139
+ )
140
+ )
141
+ r = otio .opentime .TimeRange (
142
+ start_time = otio .opentime .RationalTime (value = 110 , rate = 24 ),
143
+ duration = otio .opentime .RationalTime (value = 50 , rate = 24 )
144
+ )
145
+ self .assertEqual (
146
+ st .trim_child_range (r ),
147
+ otio .opentime .TimeRange (
148
+ start_time = otio .opentime .RationalTime (value = 110 , rate = 24 ),
149
+ duration = otio .opentime .RationalTime (value = 40 , rate = 24 )
150
+ )
151
+ )
152
+ r = otio .opentime .TimeRange (
153
+ start_time = otio .opentime .RationalTime (value = 90 , rate = 24 ),
154
+ duration = otio .opentime .RationalTime (value = 1000 , rate = 24 )
155
+ )
156
+ self .assertEqual (
157
+ st .trim_child_range (r ),
158
+ st .source_range
159
+ )
160
+
106
161
def test_range_of_child (self ):
107
162
st = otio .schema .Stack (name = "foo" , children = [
108
163
otio .schema .Clip (
0 commit comments