forked from elusive-ideas/fcpxml_reader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_tests.py
134 lines (103 loc) · 5.08 KB
/
run_tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import unittest
import fcpxml_reader
import os
class clip_name_logic(unittest.TestCase):
def test_clip_name_logic(self):
self.data_fldr = os.getcwd() + r'\data'
data = []
for current_fps in ['25fps', '30fps']:
for clip_type in ['cut', 'no cut']:
if clip_type == 'cut':
pass
'''
filename = '3_clip_100_50_50.fcpxml'
clip_path = os.path.join(self.data_fldr, current_fps,
clip_type, filename)
'''
else:
for current_speed in ['25', '50', '100', '150', '200']:
filename = '1_clip_{0}.fcpxml'.format(current_speed)
clip_path = os.path.join(self.data_fldr,
current_fps,
clip_type, filename)
base_filename = filename.rpartition('.')[0]
data.append([clip_path, 'name-'+base_filename])
for current in data:
wrapper = fcpxml_reader.fcpxml_wrapper(current[0])
self.assertEqual(wrapper.clips[0].name, current[1])
class seconds_to_frames_logic(unittest.TestCase):
def test_seconds_to_frames_logic(self):
# Seconds to frames at 30 fps
frames = fcpxml_reader.get_frames_from_time(4, 30)
self.assertEqual(frames, 120)
# Seconds to frames at 25 fps
frames = fcpxml_reader.get_frames_from_time(4, 25)
self.assertEqual(frames, 100)
class clip_cuts_logic(unittest.TestCase):
def test_clip_cuts_logic(self):
self.data_fldr = os.getcwd() + r'\data'
pass
class clip_percentage_logic(unittest.TestCase):
def test_clip_percentage_logic(self):
self.data_fldr = os.getcwd() + r'\data'
data = []
for current_fps in ['25fps', '30fps']:
for clip_type in ['cut', 'no cut']:
if clip_type == 'cut':
pass
'''
filename = '3_clip_100_50_50.fcpxml'
clip_path = os.path.join(self.data_fldr, current_fps,
clip_type, filename)
'''
else:
for current_speed in [25, 50, 100, 150, 200]:
filename = '1_clip_{0}.fcpxml'.format(current_speed)
clip_path = os.path.join(self.data_fldr, current_fps,
clip_type, filename)
data.append([clip_path, current_speed])
for current in data:
wrapper = fcpxml_reader.fcpxml_wrapper(current[0])
self.assertEqual(wrapper.clips[0].percentage, current[1])
class clip_number_logic(unittest.TestCase):
def test_clip_number_logic(self):
self.data_fldr = os.getcwd() + r'\data'
data = []
clip_count = None
for current_fps in ['25fps', '30fps']:
for clip_type in ['cut', 'no cut']:
if clip_type == 'cut':
filename = '3_clip_100_50_50.fcpxml'
clip_path = os.path.join(self.data_fldr, current_fps,
clip_type, filename)
clip_count = 3
else:
for current_speed in ['25', '50', '100', '150', '200']:
filename = '1_clip_{0}.fcpxml'.format(current_speed)
clip_path = os.path.join(self.data_fldr, current_fps,
clip_type, filename)
clip_count = 1
data.append([clip_path, clip_count])
for current in data:
wrapper = fcpxml_reader.fcpxml_wrapper(current[0])
self.assertEqual(wrapper.clip_count, current[1])
class framerate_logic(unittest.TestCase):
def test_framerate_logic(self):
self.data_fldr = os.getcwd() + r'\data'
data = [[self.data_fldr + r'\25fps\cut\3_clip_100_50_50.fcpxml', 25],
[self.data_fldr + r'\25fps\no cut\1_clip_25.fcpxml', 25],
[self.data_fldr + r'\25fps\no cut\1_clip_50.fcpxml', 25],
[self.data_fldr + r'\25fps\no cut\1_clip_100.fcpxml', 25],
[self.data_fldr + r'\25fps\no cut\1_clip_150.fcpxml', 25],
[self.data_fldr + r'\25fps\no cut\1_clip_200.fcpxml', 25],
[self.data_fldr + r'\30fps\cut\3_clip_100_50_50.fcpxml', 30],
[self.data_fldr + r'\30fps\no cut\1_clip_25.fcpxml', 30],
[self.data_fldr + r'\30fps\no cut\1_clip_50.fcpxml', 30],
[self.data_fldr + r'\30fps\no cut\1_clip_100.fcpxml', 30],
[self.data_fldr + r'\30fps\no cut\1_clip_150.fcpxml', 30],
[self.data_fldr + r'\30fps\no cut\1_clip_200.fcpxml', 30]]
for current in data:
wrapper = fcpxml_reader.fcpxml_wrapper(current[0])
self.assertEqual(wrapper.framerate, current[1])
if __name__ == '__main__':
unittest.main()