aboutsummaryrefslogtreecommitdiffstats
path: root/test/uitests.sikuli
diff options
context:
space:
mode:
Diffstat (limited to 'test/uitests.sikuli')
-rw-r--r--test/uitests.sikuli/config.py16
-rw-r--r--test/uitests.sikuli/datafiles.py135
-rw-r--r--test/uitests.sikuli/lvc_steps.py6
-rw-r--r--test/uitests.sikuli/lvcgui.py32
-rw-r--r--test/uitests.sikuli/readme.md2
-rw-r--r--test/uitests.sikuli/test_android_conversions.py6
-rw-r--r--test/uitests.sikuli/test_apple_conversions.py6
-rw-r--r--test/uitests.sikuli/test_choose_files.py1
-rw-r--r--test/uitests.sikuli/test_clear_finished_conversions.py1
-rw-r--r--test/uitests.sikuli/test_conversions.py40
-rw-r--r--test/uitests.sikuli/test_output_settings.py4
-rw-r--r--test/uitests.sikuli/test_remove_files.py7
-rw-r--r--test/uitests.sikuli/uitests.py2
13 files changed, 134 insertions, 124 deletions
diff --git a/test/uitests.sikuli/config.py b/test/uitests.sikuli/config.py
index 27e7a74..ab89dc8 100644
--- a/test/uitests.sikuli/config.py
+++ b/test/uitests.sikuli/config.py
@@ -1,4 +1,4 @@
-# config.py
+#config.py
import os
import time
from sikuli.Sikuli import *
@@ -8,8 +8,9 @@ def set_image_dirs():
"""Set the Sikuli image path for the os specific
image directory and the main Image dir.
"""
- os_imgs = os.path.join(os.path.dirname(os.path.abspath(__file__)),
- "Images_"+get_os_name())
+ os_imgs = os.path.join(
+ os.path.dirname(
+ os.path.abspath(__file__)), "Images_"+get_os_name())
imgs = os.path.join(os.path.dirname(os.path.abspath(__file__)), "Images")
dir_list = [imgs, os_imgs]
@@ -41,10 +42,11 @@ def launch_cmd():
if get_os_name() == "osx":
launch_cmd = "/Applications/Libre Video Converter.app"
elif get_os_name() == "win":
- launch_cmd = os.path.join(os.getenv("PROGRAMFILES"),
- "Participatory Culture Foundation",
- "Libre Video Converter",
- "LibreConverter.exe")
+ launch_cmd = os.path.join(
+ os.getenv("PROGRAMFILES"),
+ "Participatory Culture Foundation",
+ "Libre Video Converter",
+ "LibreVideoConverter.exe")
else:
print(get_os_name())
print(launch_cmd)
diff --git a/test/uitests.sikuli/datafiles.py b/test/uitests.sikuli/datafiles.py
index 5d11ed0..d1191ca 100644
--- a/test/uitests.sikuli/datafiles.py
+++ b/test/uitests.sikuli/datafiles.py
@@ -1,21 +1,20 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
# Default Device Conversion Parameters
-
import os
class TestData(object):
-
- _UNITTESTFILES = \
- os.path.abspath(os.path.join(os.path.dirname(
- os.path.abspath(__file__)), '..', '..', '..', 'testdata'))
- _SIKTESTFILES = \
- os.path.abspath(os.path.join(os.path.dirname(
- os.path.abspath(__file__)), 'testdata'))
+ _UNITTESTFILES = os.path.abspath(
+ os.path.join(
+ os.path.dirname(
+ os.path.abspath(
+ __file__)), "..", "..", "..", 'testdata'))
+ _SIKTESTFILES = os.path.abspath(
+ os.path.join(
+ os.path.dirname(
+ os.path.abspath(__file__)), 'testdata'))
_FILES = {
- 'mp3-0.mp3': {
+ 'mp3-0.mp3': {
'testdir': _UNITTESTFILES,
'container': 'mp3',
'audio_codec': 'mp3',
@@ -24,9 +23,10 @@ class TestData(object):
'album': 'Increase The Dosage',
'track': '1',
'genre': 'Blues',
- 'duration': 1.07,
- },
- 'mp3-1.mp3': {
+ 'duration': 1.07
+ },
+ 'mp3-1.mp3':
+ {
'testdir': _UNITTESTFILES,
'container': 'mp3',
'audio_codec': 'mp3',
@@ -34,67 +34,72 @@ class TestData(object):
'artist': 'Ckz',
'album': 'The Heart EP',
'track': '2/5',
- 'duration': 1.07,
- },
- 'mp3-2.mp3': {
+ 'duration': 1.07
+ },
+ 'mp3-2.mp3':
+ {
'testdir': _UNITTESTFILES,
'container': 'mp3',
'audio_codec': 'mp3',
'artist': 'This American Life',
'genre': 'Podcast',
'title': '#426: Tough Room 2011',
- 'duration': 1.09,
- },
- 'theora_with_ogg_extension.ogg': {
+ 'duration': 1.09
+ },
+ 'theora_with_ogg_extension.ogg':
+ {
'testdir': _UNITTESTFILES,
'container': 'ogg',
'video_codec': 'theora',
'width': 320,
'height': 240,
- 'duration': 0.1,
- },
- 'webm-0.webm': {
+ 'duration': 0.1
+ },
+ 'webm-0.webm':
+ {
'testdir': _UNITTESTFILES,
'container': ['matroska', 'webm'],
'video_codec': 'vp8',
'width': 1920,
'height': 912,
- 'duration': 0.43,
- },
- 'mp4-0.mp4': {
+ 'duration': 0.43
+ },
+ 'mp4-0.mp4':
+ {
'testdir': _UNITTESTFILES,
- 'container': [
- 'mov',
- 'mp4',
- 'm4a',
- '3gp',
- '3g2',
- 'mj2',
- 'isom',
- 'mp41',
- ],
+ 'container': ['mov',
+ 'mp4',
+ 'm4a',
+ '3gp',
+ '3g2',
+ 'mj2',
+ 'isom',
+ 'mp41'],
'video_codec': 'h264',
'audio_codec': 'aac',
'width': 640,
'height': 480,
'title': 'Africa: Cash for Climate Change?',
- 'duration': 312.37,
- },
- 'nuls.mp3': {'testdir': _UNITTESTFILES, 'container': 'mp3',
- 'title': 'Invisible'},
- 'drm.m4v': {
+ 'duration': 312.37
+ },
+ 'nuls.mp3':
+ {
'testdir': _UNITTESTFILES,
- 'container': [
- 'mov',
- 'mp4',
- 'm4a',
- '3gp',
- '3g2',
- 'mj2',
- 'M4V',
- 'mp42',
- 'isom',
- ],
+ 'container': 'mp3',
+ 'title': 'Invisible'
+ },
+ 'drm.m4v':
+ {
+ 'testdir': _UNITTESTFILES,
+ 'container': ['mov',
+ 'mp4',
+ 'm4a',
+ '3gp',
+ '3g2',
+ 'mj2',
+ 'M4V',
+ 'mp42',
+ 'isom'],
'video_codec': 'none',
'audio_codec': 'aac',
'has_drm': ['audio', 'video'],
@@ -105,33 +110,38 @@ class TestData(object):
'album': 'The Most Extreme',
'track': '10',
'genre': 'Nonfiction',
- 'duration': 2668.8,
- },
- 'baby_block.m4v': {
+ 'duration': 2668.8
+ },
+ 'baby_block.m4v':
+ {
'testdir': _SIKTESTFILES,
'container': 'm4v',
'video_codec': 'h264',
'audio_codec': 'aac',
'width': 960,
'height': 540,
- },
- 'fake_video.mp4': {
+ },
+ # this is a fake mp4 file it is a pdf file renamed to an mp4
+ # extension and should fail conversion
+ 'fake_video.mp4':
+ {
'testdir': _SIKTESTFILES,
'container': 'mp4',
'video_codec': None,
'audio_codec': None,
'width': None,
'height': None,
- },
- 'story_stuff.mov': {
+ },
+ 'story_stuff.mov':
+ {
'testdir': _SIKTESTFILES,
'container': 'mov',
'video_codec': 'h264',
'audio_codec': 'mp3',
'width': 320,
'height': 180,
- },
}
+ }
def testfile_attr(self, testfile, default):
try:
@@ -141,7 +151,7 @@ class TestData(object):
def directory_list(self, testdir):
files_list = []
- for (k, v) in self._FILES.iteritems():
+ for k, v in self._FILES.iteritems():
if v.has_key('testdir') and testdir in v['testdir']:
files_list.append(k)
return files_list
@@ -153,7 +163,6 @@ class TestData(object):
but, if I need extra files, getting them from
the sikuli test files dir.
"""
-
DEFAULT_UNITTESTFILES = ['mp4-0.mp4', 'webm-0.webm']
DEFAULT_SIKTESTFILES = ['baby_block.m4v', 'story_styff.mov']
if new:
@@ -167,4 +176,4 @@ class TestData(object):
TESTFILES = TESTFILES[:1]
print(TESTFILES)
- return (DATADIR, TESTFILES)
+ return DATADIR, TESTFILES
diff --git a/test/uitests.sikuli/lvc_steps.py b/test/uitests.sikuli/lvc_steps.py
index 5723b6a..2d8be58 100644
--- a/test/uitests.sikuli/lvc_steps.py
+++ b/test/uitests.sikuli/lvc_steps.py
@@ -36,7 +36,8 @@ def device_output(option):
@step('I browse for (?:a|several)( new)? file(s)?')
-def browse_for_files(step, new, several): # file or files determines 1 or many
+# file or files determines 1 or many
+def browse_for_files(step, new, several):
datadir, testfiles = test_data(several, new)
print(testfiles)
world.lvc.browse_for_files(datadir, testfiles)
@@ -102,7 +103,8 @@ def then_the_list_of_files_is_empty(step):
@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
+ # file or files determines 1 or many
+ browse_file = ('I browse for a file')
else:
browse_file = ('I browse for some files')
step.given(browse_file)
diff --git a/test/uitests.sikuli/lvcgui.py b/test/uitests.sikuli/lvcgui.py
index 4d9d65a..daa572c 100644
--- a/test/uitests.sikuli/lvcgui.py
+++ b/test/uitests.sikuli/lvcgui.py
@@ -1,9 +1,11 @@
from sikuli.Sikuli import *
import devices
import config
+import time
class MVCGui(object):
+
# ** APP UI IMAGES **
# ADD FILES
@@ -69,7 +71,6 @@ class MVCGui(object):
'''
config.set_image_dirs()
self.os_name = config.get_os_name()
-
# CMD or CTRL Key
if self.os_name == 'osx':
self.CMDCTRL = Key.CMD
@@ -101,7 +102,8 @@ class MVCGui(object):
def browse_for_files(self, dirname, testdata):
click(Pattern(self._CHOOSE_FILES))
- time.sleep(2) # osx freaks out if you start typing too fast
+ # osx freaks out if you start typing too fast
+ time.sleep(2)
self.type_a_path(dirname)
keyDown(self.CMDCTRL)
for f in testdata:
@@ -115,17 +117,20 @@ class MVCGui(object):
def drag_and_drop_files(self, dirname, testdata):
click(self._CHOOSE_FILES)
- y = getLastMatch() # y is drop destination
+ # y is drop destination
+ y = getLastMatch()
type(dirname)
type(Key.ENTER)
keyDown(self.CMDCTRL)
for f in testdata:
find(f)
- x = getLastMatch() # the drag start's last file we find and select
+ # the drag start is the last file we find and select
+ x = getLastMatch()
click(getLastMatch())
dragDrop(x, y)
keyUp(self.CMDCTRL)
- type(Key.ESC) # close the file browser dialog
+ # close the file browser dialog
+ type(Key.ESC)
def remove_files(self, *items):
for item in items:
@@ -166,8 +171,7 @@ class MVCGui(object):
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)
@@ -193,11 +197,11 @@ class MVCGui(object):
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]))
+ 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)
if setting == "off":
if box.exists(self._PREFS_CHECKBOX_CHECKED):
click(box.getLastMatch())
@@ -251,8 +255,8 @@ class MVCGui(object):
if exists(device):
return True
else:
+ # 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):
@@ -260,8 +264,8 @@ class MVCGui(object):
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')
size_param = Env.getClipboard()
if size_param == expected_size_parameter:
return True
@@ -336,11 +340,9 @@ 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
diff --git a/test/uitests.sikuli/readme.md b/test/uitests.sikuli/readme.md
index 99e0424..cf5edc0 100644
--- a/test/uitests.sikuli/readme.md
+++ b/test/uitests.sikuli/readme.md
@@ -1,8 +1,6 @@
Libre Video Converter
======================
-<img src="http://cl.ly/ECBE/o"/></img>
-
LVC has a complete UI overhaul designed to maintain the simplicity of previous versions but also provide
users with batch processing options and give users greater control over their converted files.
diff --git a/test/uitests.sikuli/test_android_conversions.py b/test/uitests.sikuli/test_android_conversions.py
index b904374..3ecde7f 100644
--- a/test/uitests.sikuli/test_android_conversions.py
+++ b/test/uitests.sikuli/test_android_conversions.py
@@ -2,7 +2,6 @@
import devices
from sikuli.Sikuli import *
-import devices
import config
from lvcgui import MVCGui
import datafiles
@@ -19,7 +18,6 @@ def test_android_conversions():
def test_android_size_output_default():
"""Scenario: the output format and size are defaults when device selected.
-
"""
device_list = devices.devices('Android')
datadir, testfiles = data.test_data(many=True, new=True)
@@ -34,8 +32,8 @@ def test_android_size_output_default():
def device_defaults(device_output, lvc):
print(device_output)
lvc.choose_device_conversion(device_output)
- width = device.device_attr(device_output, 'width')
- height = device.device_attr(device_output, 'height')
+ width = devices.device_attr(device_output, 'width')
+ height = devices.device_attr(device_output, 'height')
default_format = 'MP4'
assert lvc.verify_device_format_selected(device_output)
assert lvc.verify_device_size_default(str(width), str(height))
diff --git a/test/uitests.sikuli/test_apple_conversions.py b/test/uitests.sikuli/test_apple_conversions.py
index 7b9bc3a..605cf2d 100644
--- a/test/uitests.sikuli/test_apple_conversions.py
+++ b/test/uitests.sikuli/test_apple_conversions.py
@@ -2,7 +2,6 @@
import devices
from sikuli.Sikuli import *
-import devices
import config
from lvcgui import MVCGui
import datafiles
@@ -12,6 +11,7 @@ data = datafiles.TestData()
def test_apple_conversions():
"""Scenario: test each android conversion option.
+
"""
device_list = devices.devices('Apple')
for x in device_list:
@@ -35,8 +35,8 @@ def test_apple_size_output_default():
def device_defaults(device_output, lvc):
print(device_output)
lvc.choose_device_conversion(device_output)
- width = device.device_attr(device_output, 'width')
- height = device.device_attr(device_output, 'height')
+ width = devices.device_attr(device_output, 'width')
+ height = devices.device_attr(device_output, 'height')
default_format = 'MP4'
assert lvc.verify_device_format_selected(device_output)
assert lvc.verify_device_size_default(str(width), str(height))
diff --git a/test/uitests.sikuli/test_choose_files.py b/test/uitests.sikuli/test_choose_files.py
index 1a93da0..7ef3d92 100644
--- a/test/uitests.sikuli/test_choose_files.py
+++ b/test/uitests.sikuli/test_choose_files.py
@@ -14,7 +14,6 @@ class Test_Choose_Files(unittest.TestCase):
"""Add files to the conversion list either via browse or drag-n-drop.
"""
-
def setUp(self):
"""
setup app for tests
diff --git a/test/uitests.sikuli/test_clear_finished_conversions.py b/test/uitests.sikuli/test_clear_finished_conversions.py
index 3962deb..90b9ef1 100644
--- a/test/uitests.sikuli/test_clear_finished_conversions.py
+++ b/test/uitests.sikuli/test_clear_finished_conversions.py
@@ -22,7 +22,6 @@ class Test_Clear_Finished_Conversions(unittest.TestCase):
def setUp(self):
"""
Each tests assumes that I there are files that have been converted.
-
"""
self.lvc = MVCGui()
self.lvc.lvc_focus()
diff --git a/test/uitests.sikuli/test_conversions.py b/test/uitests.sikuli/test_conversions.py
index 449c6d5..d305460 100644
--- a/test/uitests.sikuli/test_conversions.py
+++ b/test/uitests.sikuli/test_conversions.py
@@ -5,6 +5,7 @@ import os
import tempfile
import shutil
import unittest
+import lvc
from lvcgui import MVCGui
import datafiles
import devices
@@ -20,8 +21,8 @@ class Test_Conversions(unittest.TestCase):
def setUp(self):
"""
- Each tests assumes that I there are files in the
- list ready to be converted to some format.
+ Each tests assumes that I there are files in the list ready
+ to be converted to some format.
"""
self.lvc = MVCGui()
@@ -54,7 +55,6 @@ class Test_Conversions(unittest.TestCase):
When I convert a file
Then the output file is in the specified directory
"""
-
custom_output_dir = os.path.join(os.getenv("HOME"), "Desktop")
item = "mp4-0.mp4"
lvc.lvcGui()
@@ -86,7 +86,7 @@ class Test_Conversions(unittest.TestCase):
When I convert a file
Then it is named with the file name (or even better item title)
- as the base and the output container is the extension
+ As the base and the output container is the extension
"""
self.fail('I do not know the planned naming convention yet')
@@ -95,38 +95,39 @@ class Test_Conversions(unittest.TestCase):
When I convert a file
Then it is named with the file name (or even better item title)
- as the base and the output container is the extension
+ As the base and the output container is the extension
"""
self.fail('I do not know the planned naminig convention yet')
def test_output_video_no_upsize(self):
datadir, testfile = data.test_data()
- item = testfile[0]
# mp4-0.mp4 is smaller than the Apple Universal Setting
+ item = testfile[0]
lvc.lvcGui()
lvc.choose_device_conversion("Apple Universal")
lvc.choose_dont_upsize('on')
lvc.start_conversion()
- assert lvc.verify_size(os.path.join(datadir, item), width, height)
+ assert lvc.verify_size(os.path.join(
+ datadir, item), width, height)
"""Scenario: Output file video size.
When I convert a file to "format"
And Don't Upsize is selected
- Then the output file dimensions are not changed if the
- input file is smaller than the device
+ Then the output file dimensions are not changed if the input file
+ is smaller than the device
"""
- # This test is best covered more completely in unittests to verify
- # that we resize according to device sizes
- item = "mp4-0.mp4"
+ # This test is best covered more completely in unittests
+ # to verify that we resize according to device sizes
# mp4-0.mp4 is smaller than the Apple Universal Setting
+ item = "mp4-0.mp4"
lvc.lvcGui()
lvc.choose_device_conversion("Apple Universal")
lvc.choose_dont_upsize('on')
lvc.start_conversion()
- assert lvc.verify_size(os.path.join(self.output_dir, item),
- width, height)
+ assert lvc.verify_size(os.path.join(
+ self.output_dir, item), width, height)
def test_output_video_upsize(self):
"""Scenario: Output file video size.
@@ -135,17 +136,18 @@ class Test_Conversions(unittest.TestCase):
And Don't Upsize is NOT selected
The the output file dimensions are changed to match the device spec.
"""
- # This test is best covered more completely in unittests to verify
- # that we resize according to device sizes
- item = "mp4-0.mp4"
+ # This test is best covered more completely in unittests
+ # to verify that we resize according to device sizes
+
# mp4-0.mp4 is smaller than the Apple Universal Setting
+ item = "mp4-0.mp4"
lvc.lvcGui()
lvc.choose_device_conversion("Apple Universal")
lvc.choose_dont_upsize('off')
lvc.start_conversion()
- assert lvc.verify_size(os.path.join(self.output_dir, item),
- width, height)
+ assert lvc.verify_size(os.path.join(
+ self.output_dir, item), width, height)
def test_completed_conversions_display(self):
"""Scenario: File displays as completed.
diff --git a/test/uitests.sikuli/test_output_settings.py b/test/uitests.sikuli/test_output_settings.py
index b44e5a0..97c711a 100644
--- a/test/uitests.sikuli/test_output_settings.py
+++ b/test/uitests.sikuli/test_output_settings.py
@@ -18,8 +18,8 @@ class Test_Custom_Settings(unittest.TestCase):
"""
def setUp(self):
"""
- Each tests assumes that I there are files in the
- list ready to be converted to some format.
+ Each tests assumes that I there are files in the list ready to be
+ converted to some format.
"""
self.lvc = MVCGui()
diff --git a/test/uitests.sikuli/test_remove_files.py b/test/uitests.sikuli/test_remove_files.py
index e3e4a06..eefd383 100644
--- a/test/uitests.sikuli/test_remove_files.py
+++ b/test/uitests.sikuli/test_remove_files.py
@@ -3,6 +3,7 @@ import os
import tempfile
import shutil
import unittest
+import lvc
from lvcgui import MVCGui
import datafiles
import devices
@@ -14,7 +15,6 @@ class Test_Remove_Files(unittest.TestCase):
"""Remove files from the conversion list
"""
-
def setUp(self):
"""
setup app for tests
@@ -33,7 +33,6 @@ class Test_Remove_Files(unittest.TestCase):
When I remove it from the list
Then it is not in the list
"""
-
lvc.lvcGui()
_, testfiles = data.test_data(many=False)
item = testfiles[0]
@@ -73,8 +72,8 @@ class Test_Remove_Files(unittest.TestCase):
assert lvc.verify_completed(item, 160)
def test_remove_last_queued_file_with_in_progress_conversions(self):
- """Scenario: Remove the last queued file from the
- list with conversions in progress.
+ """Scenario: Remove the last queued file from the list with
+ conversions in progress.
Given I have lots of files files in the list
And I start conversion
diff --git a/test/uitests.sikuli/uitests.py b/test/uitests.sikuli/uitests.py
index 8b0a248..b723eb9 100644
--- a/test/uitests.sikuli/uitests.py
+++ b/test/uitests.sikuli/uitests.py
@@ -1,9 +1,9 @@
import os
import sys
+sys.path.append(os.getenv('PYTHON_PKGS'))
import nose
import nose.config
-sys.path.append(os.getenv('PYTHON_PKGS'))
myconfig = os.path.join(os.getcwd(), 'tests.sikuli', 'nose.cfg')
nose.config.config_files = [myconfig]