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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
|
# -*- coding: utf-8 -*-
from lettuce import step
from lettuce import world
import datafiles
import devices
data = datafiles.TestData()
DEFAULT_DEVICE = "iPad"
def test_data(many=False, new=False):
UNITTESTFILES = ['mp4-0.mp4', 'webm-0.webm', 'drm.m4v']
SIKTESTFILES = ['baby_block.m4v', 'story_styff.mov']
if new:
TESTFILES = SIKTESTFILES
else:
TESTFILES = UNITTESTFILES
DATADIR = data.testfile_attr(TESTFILES[0], 'testdir')
if not many:
TESTFILES = TESTFILES[:1]
print TESTFILES
return DATADIR, TESTFILES
def device_group(option):
menu_group = devices.dev_attr(option, 'group')
return menu_group
def device_output(option):
dev_output_format = devices.dev_attr(option, 'container')
return device_output_format
@step('I browse for (?:a|several)( new)? file(s)?')
def browse_for_files(step, new, several): # file or files determines 1 or many
datadir, testfiles = test_data(several, new)
print testfiles
world.lvc.browse_for_files(datadir, testfiles)
@step('The( new)? file(s)? (?:is|are) added to the list')
def files_added_to_the_list(step, new, several):
_, testfiles = test_data(several, new)
for t in testfiles:
assert world.lvc.verify_file_in_list(t)
@step('I browse to a directory of files')
def add_a_directory(step):
datadir, _ = test_data(many=True)
world.lvc.add_directory_of_files(datadir)
@step(u'When I drag (?:a|several)( new)? file(s)? to the drop zone')
def drag_to_the_drop_zone(step, new, several):
datadir, testfiles = test_data(several, new)
world.lvc.drag_and_drop_files(datadir, testfiles)
@step('Given I have files in the list')
def given_i_have_some_files(step):
step.given('I browse for several files')
@step('I start conversion')
def start_conversion(step):
world.lvc.start_conversions()
@step('I remove "([^"]*)" from the list')
def when_i_remove_it_from_the_list(step, items):
if items == "it":
_, testfile = test_data()
elif items == "them":
_, testfile = test_data(True, False)
else:
testfile = items.split(', ')
world.lvc.remove_files(testfile)
@step('"([^"]*)" is not in the list')
def not_in_the_list(step, items):
if items == "it":
_, testfile = test_data()
assert False, world.lvc.verify_file_in_list(testfile)
@step('I remove each of them from the list')
def i_remove_each_of_them_from_the_list(step):
assert False, 'This step must be implemented'
@step(u'Then the list of files is empty')
def then_the_list_of_files_is_empty(step):
assert False, 'This step must be implemented'
@step('I have converted (?:a|some) file(s)?')
def have_converted_file(step, amount):
if amount is None:
browse_file = ('I browse for a file') # file or files determines
else:
browse_file = ('I browse for some files')
step.given(browse_file)
step.given('I choose the "test_default" device option')
step.given('I start conversion')
@step('I clear finished conversions')
def clear_finished_conversions(step, testfiles):
world.lvc.clear_finished_files()
@step('I (?:convert|have converted) "(.*?)" to "(.*?)"')
def convert_file_to_format(step, filename, device):
datadir = data.testfile_attr(filename, 'testdir')
world.lvc.browse_for_files(datadir, [filename])
world.lvc.choose_device_conversion(device)
world.lvc.start_conversions()
@step('the "(.*?)" (?:is|are) removed')
def file_is_removed(step, testfile):
if testfile == "file":
_, testfile = test_data()
assert world.lvc.verify_file_not_in_list(testfile)
@step('And I have some conversions in progress')
def and_i_have_some_conversions_in_progress(step):
assert False, 'This step must be implemented'
@step('the completed files are removed')
def completed_files_are_removed(step):
assert world.lvc.verify_completed_removed()
@step('the in-progress conversions remain')
def and_the_in_progress_conversions_remain(step):
assert world.lvc.verify_in_progress()
@step('"(.*?)" is a failed conversion')
def have_failed_conversion(step, item):
assert verify_failed(self, item)
@step('the failed conversions are removed')
def failed_conversions_removed(step):
assert world.lvc.verify_failed_removed()
@step('I choose the custom size option')
def change_custom_size(step):
world.lvc.choose_custom_size('on', '150', '175')
assert world.lvc.verify_test_img('_custom_size_test')
@step('I choose the aspect ratio')
def when_i_choose_the_aspect_ratio(step):
assert False, 'This step must be implemented'
@step('I choose the "([^"]*)" (?:device|format) option')
def choose_conversion_format(step, device):
if device == 'test_default':
device = DEFAULT_DEVICE
world.lvc.choose_device_conversion(device)
@step('I open the custom pulldown')
def open_custom_pulldown(step):
world.lvc.open_custom_menu()
@step('I verify "([^"]*)" and "([^"]*)" size setting entry')
def verify_the_size_value(step, width, height):
assert False, 'This step must be implemented'
@step('I verify the "([^"]*)" (?:device|format)( not)? selected')
def verify_format_selection_for_device(self, device, removed):
if removed:
assert False, world.lvc.verify_device_format_selected(device)
else:
assert world.lvc.verify_device_format_selected(device)
@step('the menu is reset')
def menu_is_reset(step):
assert False, 'This step must be implemented'
@step(u'Then there should be some smart way to make sure that the size and aspect ratio values are not conflicting')
def then_there_should_be_some_smart_way_to_make_sure_that_the_size_and_aspect_ratio_values_are_not_conflicting(step):
assert False, 'This step must be implemented'
@step(u'And therefore if you have a size selected, and then select an aspect ratio, a valid size should be calculated based on the chosen width and the size value should be updated.')
def and_therefore_if_you_have_a_size_selected_and_then_select_an_aspect_ratio_a_valid_size_should_be_calculated_based_on_the_chosen_width_and_the_size_value_should_be_updated(step):
assert False, 'This step must be implemented'
@step(u'When I restart lvc')
def when_i_restart_lvc(step):
assert False, 'This step must be implemented'
@step('I have Send to iTunes checked')
def and_i_have_send_to_itunes_checked(step):
assert False, 'This step must be implemented'
@step('the file is added to my iTunes library')
def file_added_to_itunes(step):
assert False, 'This step must be implemented'
@step(u'And I have the (default)? output directory specified')
def and_i_have_the_output_directory_specified(step, default):
assert False, 'This step must be implemented'
@step('the output file is in the (specified|default) directory')
def output_file_specified_directory(step):
assert False, 'This step must be implemented'
@step(u'Then is named with the file name (or even better item title) as the base')
def then_is_named_with_the_file_name_or_even_better_item_title_as_the_base(step):
assert False, 'This step must be implemented'
@step(u'And the output container is the extension')
def and_the_output_container_is_the_extension(step):
assert False, 'This step must be implemented'
@step(u'Then the output file is resized correctly')
def then_the_output_file_is_resized_correctly(step):
assert False, 'This step must be implemented'
@step(u'When I view the ffmpeg output')
def when_i_view_the_ffmpeg_output(step):
assert False, 'This step must be implemented'
@step('the ffmpeg output is displayed in a text window')
def then_the_ffmpeg_output_is_displayed_in_a_text_window(step):
assert False, 'This step must be implemented'
|