diff options
author | Jesús Eduardo <heckyel@hyperbola.info> | 2018-01-18 16:34:59 -0500 |
---|---|---|
committer | Jesús Eduardo <heckyel@hyperbola.info> | 2018-01-18 16:34:59 -0500 |
commit | dff70111ab49ac6eec20346661ddc52b98f45853 (patch) | |
tree | e908c45a6dad15c4e12a2f7f9ac63117968c090b | |
parent | 6af6352e7b5e1d72adbe6d24aa6f0c455535d757 (diff) | |
download | librevideoconverter-dff70111ab49ac6eec20346661ddc52b98f45853.tar.lz librevideoconverter-dff70111ab49ac6eec20346661ddc52b98f45853.tar.xz librevideoconverter-dff70111ab49ac6eec20346661ddc52b98f45853.zip |
pep8 en test/uitests.sikuli/lvcgui.py
-rw-r--r-- | test/uitests.sikuli/lvcgui.py | 72 |
1 files changed, 34 insertions, 38 deletions
diff --git a/test/uitests.sikuli/lvcgui.py b/test/uitests.sikuli/lvcgui.py index 28e01d6..4d9d65a 100644 --- a/test/uitests.sikuli/lvcgui.py +++ b/test/uitests.sikuli/lvcgui.py @@ -4,23 +4,21 @@ import config class MVCGui(object): + # ** APP UI IMAGES ** -# ** APP UI IMAGES ** - -# ADD FILES + # ADD FILES _INITIAL_DROP_ZONE = 'fresh_start_dropzone.png' _CHOOSE_FILES = 'choose_a_file.png' _DROP_ZONE = 'file_drop_zone.png' _CONVERSIONS_FINISHED = 'conversions_finished.png' - -# BIG BOTTOM BUTTONS + # BIG BOTTOM BUTTONS _START_CONVERSION = 'convert_now.png' _STOP_CONVERSION = 'stop_all.png' _RESET = 'clear_and_start_over.png' -# INDIVIDUAL FILE OPTIONS - #processing + # INDIVIDUAL FILE OPTIONS + # processing _IN_PROGRESS = 'progress_bar.png' _DELETE_FILE = 'delete_icon.png' _CLEAR_FINISHED = 'clear_finished.png' @@ -32,14 +30,14 @@ class MVCGui(object): _ERROR = 'error_icon.png' _SHOW_FILE = 'show_file.png' -# CONVERSION OPTIONS SECTION + # CONVERSION OPTIONS SECTION _SEND_ITUNES = 'send_to_itunes.png' _APPLE_MENU = 'apple_dropdown.png' _ANDROID_MENU = 'android_dropdown.png' _OTHER_MENU = 'other_dropdown.png' _CUSTOM_MENU = 'custom_menu.png' -# CUSTOM MENU OPTIONS + # CUSTOM MENU OPTIONS _PREFS_CHECKBOX_CHECKED = 'checkbox_checked.png' _PREFS_CHECKBOX_UNCHECKED = 'checkbox_unchecked.png' _SAVE_TO_OPTION = 'save_to_pulldown.png' @@ -55,14 +53,14 @@ class MVCGui(object): _ASPECT_32 = '32_aspect.png' _ASPECT_169 = '169_aspect.png' -# SELECTED CONVERSION OPTION + # SELECTED CONVERSION OPTION _APPLE_SELECTED = 'apple_selected.png' _ANDROID_SELECTED = 'android_selected.png' -# SYSTEM UI + # SYSTEM UI _SYS_TEXT_ENTRY_BUTTON = 'type_a_filename.png' -# TEST IMAGES for VERIFICATION + # TEST IMAGES for VERIFICATION _custom_size_test = '150x175size.png' def __init__(self): @@ -71,7 +69,8 @@ class MVCGui(object): ''' config.set_image_dirs() self.os_name = config.get_os_name() -# CMD or CTRL Key + + # CMD or CTRL Key if self.os_name == 'osx': self.CMDCTRL = Key.CMD else: @@ -94,15 +93,15 @@ class MVCGui(object): def type_a_path(self, dirname): if config.get_os_name() == "win": - if not exists("Location",5): + if not exists("Location", 5): click(self.SYS_TEXT_ENTRY_BUTTON) time.sleep(2) - type(dirname +"\n") + type(dirname + "\n") type(Key.ENTER) def browse_for_files(self, dirname, testdata): click(Pattern(self._CHOOSE_FILES)) - time.sleep(2) #osx freaks out if you start typing too fast + time.sleep(2) # osx freaks out if you start typing too fast self.type_a_path(dirname) keyDown(self.CMDCTRL) for f in testdata: @@ -116,18 +115,17 @@ class MVCGui(object): def drag_and_drop_files(self, dirname, testdata): click(self._CHOOSE_FILES) - y = getLastMatch() # y is drop destination + y = getLastMatch() # y is drop destination type(dirname) type(Key.ENTER) keyDown(self.CMDCTRL) for f in testdata: find(f) - x = getLastMatch() # the drag start is the last file we find and select + x = getLastMatch() # the drag start's last file we find and select click(getLastMatch()) dragDrop(x, y) keyUp(self.CMDCTRL) - type(Key.ESC) #close the file browser dialog - + type(Key.ESC) # close the file browser dialog def remove_files(self, *items): for item in items: @@ -166,14 +164,13 @@ class MVCGui(object): r.click(self._SHOW_FILE) # FIXME Verify the file is there and close the window - def choose_device_conversion(self, device): device_group = devices.dev_attr(device, 'group') - menu_img = getattr(self, "".join(["_",device_group.upper(),"_","MENU"])) + menu_img = getattr(self, "".join(["_", device_group.upper(), + "_", "MENU"])) click(menu_img) click(device) - def open_custom_menu(self): if not exists(self._OUTPUT_DIRECTORY): click(self._CUSTOM_MENU) @@ -195,11 +192,12 @@ class MVCGui(object): valid_settings = ['on', 'off'] if setting not in valid_settings: print("valid setting value not proviced, must be 'on' or 'off'") - #CHECK THE BOX - pref_image = getattr(self, "".join(["_",option])) + # CHECK THE BOX + pref_image = getattr(self, "".join(["_", option])) find(pref_image) reg = Region(getLastMatch()) - box = Region(reg.getX()-15, sr_loc.getY()-10, pref_reg.getW(), 30) #location of associated checkbox + box = Region(reg.getX()-15, sr_loc.getY()-10, pref_reg.getW(), 30) + # location of associated checkbox if setting == "off": if box.exists(self._PREFS_CHECKBOX_CHECKED): click(box.getLastMatch()) @@ -224,7 +222,7 @@ class MVCGui(object): def choose_aspect_ratio(self, setting, ratio=None): self.open_custom_menu(self) - if ratio == None: + if ratio is None: setting = 'off' self.set_pref_checkbox(self._ASPECT, setting) if setting == 'on': @@ -241,7 +239,6 @@ class MVCGui(object): def choose_itunes(self, setting): self.set_pref_checkbox(self._SEND_ITUNES, setting) - def remove_queued_conversions(self): while exists(self._QUEUED): qreg = Region(getLastMatch()) @@ -254,22 +251,21 @@ class MVCGui(object): if exists(device): return True else: - if exists(device) and exists("MP4"): #all devices are mp4 by default + if exists(device) and exists("MP4"): + # all devices are mp4 by default return True - def verify_size(self, item, width, height): self.show_ffmpeg_output(item) expected_size_parameter = "-s "+width+"x"+height type(self.CMDCTRL, 'f') type('-s '+width+'x'+'height') - type(self.CMDCTRL, 'c') #copy the ffmpeg size command to the clipboard + type(self.CMDCTRL, 'c') + # copy the ffmpeg size command to the clipboard size_param = Env.getClipboard() if size_param == expected_size_parameter: return True - - def verify_device_size_default(self, width, height): self.open_custom_menu() self.set_pref_checkbox(self._CUSTOM_SIZE, setting) @@ -282,7 +278,6 @@ class MVCGui(object): if displayed_height == height and displayed_width == width: return True - def verify_converting(self, item): r = self.item_region(item) if r.exists(self._IN_PROGRESS): @@ -341,9 +336,11 @@ class MVCGui(object): def verify_in_progress(self, item=None): if item: r = self.item_region(item) - if r.exists(self._IN_PROGRESS): return True + if r.exists(self._IN_PROGRESS): + return True else: - if exists(self._IN_PROGRESS): return True + if exists(self._IN_PROGRESS): + return True def verify_itunes(self, item): pass @@ -353,12 +350,11 @@ class MVCGui(object): r.click(self._SHOW_FILE) type(Key.ESC) - #FIXME need to get what the output name is going to be. + # FIXME need to get what the output name is going to be. output_file = os.path.join(directory, item) if os.path.isfile(output_file): return True - def show_ffmpeg_output(self, item): r = self.item_region(item) self.verify_completed(item, 30) |