[Libreoffice-commits] core.git: Branch 'private/moggi/ui-test' - 2 commits - uitest/calc_tests uitest/helper.py uitest/main.py uitest/screenshot.py
Markus Mohrhard
markus.mohrhard at googlemail.com
Wed Mar 23 23:47:17 UTC 2016
uitest/calc_tests/about_test.py | 25 ++-----------------------
uitest/helper.py | 30 ------------------------------
uitest/main.py | 2 +-
uitest/screenshot.py | 12 ------------
4 files changed, 3 insertions(+), 66 deletions(-)
New commits:
commit 6868e4d5b79ea3337f2e2d55d918b06fb59d0ad1
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Mar 24 00:45:44 2016 +0100
also remove the screenshot part from function names
Change-Id: Iac4f1724ed9c2a470ea1a1fe1ab0e834eb3f1795
diff --git a/uitest/calc_tests/about_test.py b/uitest/calc_tests/about_test.py
index a9beb8e..9766518 100644
--- a/uitest/calc_tests/about_test.py
+++ b/uitest/calc_tests/about_test.py
@@ -9,7 +9,7 @@ import time
from uitest_helper import UITest
-def test_about_dlg_with_screenshot(xContext):
+def test_about_dlg(xContext):
xUITest = xContext.ServiceManager.createInstanceWithContext(
"org.libreoffice.uitest.UITest", xContext)
diff --git a/uitest/main.py b/uitest/main.py
index 11e92ee..e4d4f39 100644
--- a/uitest/main.py
+++ b/uitest/main.py
@@ -57,7 +57,7 @@ if __name__ == "__main__":
generic_test(opts, line)
elif "--calc-demo" in opts:
- generic_test(opts, "calc_tests.about_test.test_about_dlg_with_screenshot")
+ generic_test(opts, "calc_tests.about_test.test_about_dlg")
generic_test(opts, "calc_tests.create_range_name.create_range_name")
else:
usage()
commit 471ae05697708c4a345db76cf0733947e13a813c
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Mar 24 00:43:51 2016 +0100
remove all references to the screenshot functionality
Change-Id: I3fb853fafbb2bc8271597cc1743fee99913257af
diff --git a/uitest/calc_tests/about_test.py b/uitest/calc_tests/about_test.py
index d90ee06..a9beb8e 100644
--- a/uitest/calc_tests/about_test.py
+++ b/uitest/calc_tests/about_test.py
@@ -8,20 +8,6 @@
import time
from uitest_helper import UITest
-from helper import Screenshot
-
-def get_bounding_box(props):
- size_str = None
- pos_str = None
- for prop in props:
- if prop.Name == "AbsPosition":
- pos_str = prop.Value
- elif prop.Name == "Size":
- size_str = prop.Value
-
- x1, y1 = pos_str.split("x")
- dx, dy = size_str.split("x")
- return x1, y1, str(int(x1) + int(dx)), str(int(y1) + int(dy))
def test_about_dlg_with_screenshot(xContext):
xUITest = xContext.ServiceManager.createInstanceWithContext(
@@ -35,13 +21,6 @@ def test_about_dlg_with_screenshot(xContext):
xAboutDlg = xUITest.getTopFocusWindow()
- # take the screenshot
- time.sleep(1)
- aboutDlgState = xAboutDlg.getState()
- x1, y1, x2, y2 = get_bounding_box(aboutDlgState)
- screenshot = Screenshot()
- screenshot.take_screenshot(x1, y1, x2, y2)
-
xCloseBtn = xAboutDlg.getChild("close")
xCloseBtn.executeAction("CLICK", tuple())
diff --git a/uitest/helper.py b/uitest/helper.py
index e660739..2c57d11 100644
--- a/uitest/helper.py
+++ b/uitest/helper.py
@@ -49,36 +49,6 @@ class EventListener(XDocumentEventListener,unohelper.Base):
def disposing(event):
pass
-class Screenshot(object):
-
- def __init__(self):
- pass
-
- def _create_python_path(self):
- """ creates a clean PATH env variable
-
- We need to avoid picking the LibreOffice python and
- the corresponding PYTHONPATH, PYTHONHOME variables
- """
- env = os.environ.copy()
-
- # remove any python properties pointing to soffice internal python
- del env['PYTHONPATH']
- del env['PYTHONHOME']
-
- # remove path pointing to instdir to avoid picking up the soffice provided python
- path = env['PATH']
- path_parts = path.split(':')
- cleaned_path = (path for path in path_parts if path.find("instdir") == -1)
- new_path = ":".join( cleaned_path )
- env['PATH'] = new_path
- return env
-
- def take_screenshot(self, x1, y1, x2, y2):
- env = self._create_python_path()
- popen = subprocess.Popen(" ".join(["./screenshot.py", x1, y1, x2, y2]), shell=True, env=env)
- popen.wait()
-
def mkPropertyValue(name, value):
""" Create a UNO ProertyValue from two input values.
"""
diff --git a/uitest/screenshot.py b/uitest/screenshot.py
deleted file mode 100755
index af3cd44..0000000
--- a/uitest/screenshot.py
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env python
-
-import sys
-
-import pyscreenshot as ImageGrab
-
-if __name__ == "__main__":
- # part of the screen
- if len(sys.argv) != 5:
- sys.exit(1)
- im=ImageGrab.grab(bbox=(int(sys.argv[1]),int(sys.argv[2]),int(sys.argv[3]),int(sys.argv[4]))) # X1,Y1,X2,Y2
- im.show()
More information about the Libreoffice-commits
mailing list