|
13 | 13 | EXAMPLE_PATH = os.path.join(SAMPLE_DATA_DIR, "sample.ale") |
14 | 14 | EXAMPLE2_PATH = os.path.join(SAMPLE_DATA_DIR, "sample2.ale") |
15 | 15 | EXAMPLE_CDL_PATH = os.path.join(SAMPLE_DATA_DIR, "sample_cdl.ale") |
16 | | -EXAMPLE_NO_SECTION_NEWLINE_PATH = os.path.join( |
17 | | - SAMPLE_DATA_DIR, "sample_no_blank_lines_between_sections.ale" |
18 | | -) |
19 | 16 | EXAMPLEUHD_PATH = os.path.join(SAMPLE_DATA_DIR, "sampleUHD.ale") |
20 | | - |
| 17 | +EXAMPLE_BLANK_PATH = os.path.join(SAMPLE_DATA_DIR, "sample_blanks.ale") |
| 18 | +EXAMPLE_NO_BLANKS = os.path.join(SAMPLE_DATA_DIR, "sample_no_blanks.ale") |
21 | 19 |
|
22 | 20 | class ALEAdapterTest(unittest.TestCase): |
23 | 21 |
|
@@ -174,9 +172,41 @@ def test_ale_uhd(self): |
174 | 172 | ) |
175 | 173 | self.assertEqual(frmt, "CUSTOM") |
176 | 174 |
|
177 | | - def test_ale_no_newline_between_sections(self): |
178 | | - ale_path = EXAMPLE_NO_SECTION_NEWLINE_PATH |
| 175 | + def test_ale_read_blank_lines(self): |
| 176 | + ale_path = EXAMPLE_BLANK_PATH |
179 | 177 | collection = otio.adapters.read_from_file(ale_path) |
| 178 | + self.assertTrue(collection is not None) |
| 179 | + self.assertEqual(type(collection), otio.schema.SerializableCollection) |
| 180 | + self.assertEqual(len(collection), 1) |
| 181 | + # The ALE header information is the original FPS stored in the file, |
| 182 | + # and not the nearest SMPTE timecode rate |
| 183 | + fps = float(collection.metadata.get("ALE").get("header").get("FPS")) |
| 184 | + self.assertEqual(fps, 25) |
| 185 | + self.assertEqual([c.name for c in collection], [ |
| 186 | + "A020C003_150905_E2XZ.mov" |
| 187 | + ]) |
| 188 | + self.assertEqual(collection[0].source_range, otio.opentime.TimeRange( |
| 189 | + otio.opentime.from_timecode("05:42:12:20", fps), |
| 190 | + otio.opentime.from_timecode("00:00:17:17", fps) |
| 191 | + )) |
| 192 | + |
| 193 | + # Slope, offset, and power values are of type _otio.AnyVector |
| 194 | + # So we have to convert them to lists otherwise |
| 195 | + # the comparison between those two types would fail |
| 196 | + |
| 197 | + self.assertEqual( |
| 198 | + list(collection[0].metadata['cdl']['asc_sop']['slope']), |
| 199 | + [1.1822, 1.2183, 1.2284]) |
| 200 | + self.assertEqual( |
| 201 | + list(collection[0].metadata['cdl']['asc_sop']['offset']), |
| 202 | + [-0.2429, -0.2823, -0.2849]) |
| 203 | + self.assertEqual( |
| 204 | + list(collection[0].metadata['cdl']['asc_sop']['power']), |
| 205 | + [0.7283, 0.7096, 0.7054]) |
| 206 | + self.assertEqual(collection[0].metadata['cdl']['asc_sat'], 1.0680) |
| 207 | + |
| 208 | + def test_ale_no_newline_between_sections(self): |
| 209 | + collection = otio.adapters.read_from_file(EXAMPLE_NO_BLANKS) |
180 | 210 | assert len(collection) == 6 |
181 | 211 |
|
182 | 212 | # Spot-check one of the clips |
|
0 commit comments