summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWu Xiaotian <[email protected]>2019-06-23 22:20:50 +0800
committerraveit65 <[email protected]>2019-07-01 16:22:46 +0200
commitcb4293fe6cb01c7ffcb890a22e91ed0702d2656f (patch)
tree9b1482e969046b3d82b6d074a334d530ae32e6e6
parent449f6af7514251c7dda6fdf4ad2d1c6e37d42835 (diff)
downloadatril-cb4293fe6cb01c7ffcb890a22e91ed0702d2656f.tar.bz2
atril-cb4293fe6cb01c7ffcb890a22e91ed0702d2656f.tar.xz
migrate to python3 for test cases
-rwxr-xr-xtest/test1.py24
-rwxr-xr-xtest/test2.py9
-rwxr-xr-xtest/test3.py2
-rwxr-xr-xtest/test4.py8
-rwxr-xr-xtest/test5.py9
-rwxr-xr-xtest/test6.py31
-rwxr-xr-xtest/test7.py2
7 files changed, 53 insertions, 32 deletions
diff --git a/test/test1.py b/test/test1.py
index 7bd0698e..97db085c 100755
--- a/test/test1.py
+++ b/test/test1.py
@@ -1,36 +1,38 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# This test opens the interface and just clicks around a bit.
import os
-os.environ['LANG']='C'
+import dogtail.config
+dogtail.config.config.logDebugToStdOut = True
+dogtail.config.config.logDebugToFile = False
from dogtail.procedural import *
+os.environ['LANG']='C'
run('atril')
# Test file->open
+focus.application('atril')
click('File', roleName='menu')
-click('Open...', roleName='menu item')
-focus.dialog('Open Document')
+click('Open…', roleName='menu item')
click('Cancel', roleName='push button')
# Toolbar editor
+focus.application('atril')
click('Edit', roleName='menu')
click('Toolbar', roleName='menu item')
-focus.dialog('Toolbar Editor')
click('Close', roleName='push button')
# About dialog
+focus.application('atril')
click('Help', roleName='menu')
click('About', roleName='menu item')
-focus.dialog('About Document Viewer')
-click('Credits', roleName='push button')
-focus.dialog('Credits')
-click('Close', roleName='push button')
-focus.dialog('About Document Viewer')
+click('Credits', roleName='toggle button')
+click('Credits', roleName='toggle button')
click('Close', roleName='push button')
# Close atril
-click('File', roleName='menu')
+focus.application('atril')
+click.menu('File')
click('Close', roleName='menu item')
diff --git a/test/test2.py b/test/test2.py
index 910a8425..f4263e52 100755
--- a/test/test2.py
+++ b/test/test2.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# This test opens a password encrypted file and tries to unlock it.
@@ -11,18 +11,19 @@ from dogtail.procedural import *
run('atril', arguments=' '+srcdir+'/test-encrypt.pdf')
# Try an incorrect password first
-focus.dialog('Enter password')
-focus.widget('Password Entry', roleName='password text')
type('wrong password')
click('Unlock Document', roleName='push button')
+focus.dialog('Enter password')
click('Cancel', roleName='push button')
# Try again with the correct password
+focus.application('atril')
click('Unlock Document', roleName='push button')
-focus.widget('Password Entry', roleName='password text')
+focus.dialog('Enter password')
type('Foo')
click('Unlock Document', roleName='push button')
# Close atril
+focus.application('atril')
click('File', roleName='menu')
click('Close', roleName='menu item')
diff --git a/test/test3.py b/test/test3.py
index 2f091036..f73feec7 100755
--- a/test/test3.py
+++ b/test/test3.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# This test opens a file with wrong extenstion.
diff --git a/test/test4.py b/test/test4.py
index 75da32ef..9ac27286 100755
--- a/test/test4.py
+++ b/test/test4.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# This test tries document reload action.
@@ -12,9 +12,11 @@ run('atril', arguments=' '+srcdir+'/test-links.pdf')
# Reload document a few times
for i in range(1,6):
- click('View', roleName='menu')
- click('Reload', roleName='menu item')
+ focus.application('atril')
+ click('View', roleName='menu')
+ click('Reload', roleName='menu item')
# Close atril
+focus.application('atril')
click('File', roleName='menu')
click('Close', roleName='menu item')
diff --git a/test/test5.py b/test/test5.py
index c78ebc6f..87729995 100755
--- a/test/test5.py
+++ b/test/test5.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# This test tries document reload action.
@@ -15,10 +15,11 @@ focus.widget.text = "iii"
activate()
if focus.widget.text != "III":
- click('File', roleName='menu')
- click('Close', roleName='menu item')
- exit (1)
+ click('File', roleName='menu')
+ click('Close', roleName='menu item')
+ exit (1)
# Close atril
+focus.application('atril')
click('File', roleName='menu')
click('Close', roleName='menu item')
diff --git a/test/test6.py b/test/test6.py
index b7e3a2f2..60c7bc4e 100755
--- a/test/test6.py
+++ b/test/test6.py
@@ -1,31 +1,46 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# Test printing
import os
+import dogtail.config
+dogtail.config.config.logDebugToStdOut = True
+dogtail.config.config.logDebugToFile = False
+
os.environ['LANG']='C'
srcdir = os.environ['srcdir']
-homedir = os.environ["HOME"] + "/";
from dogtail.procedural import *
-if os.path.exists(homedir + "output.ps"):
- os.unlink(homedir + "output.ps")
+recent_used = os.path.expanduser('~/.local/share/recently-used.xbel')
+recent_used_orig = recent_used + '.orig'
+
+ps_file = os.path.expanduser('~/output.ps')
+
+if os.path.isfile(recent_used):
+ os.rename(recent_used, recent_used_orig)
+
+if os.path.exists(ps_file):
+ os.unlink(ps_file)
run('atril', arguments=' '+srcdir+'/test-page-labels.pdf')
click('File', roleName='menu')
-click('Print...', roleName='menu item')
+click('Print…', roleName='menu item')
-focus.dialog('Print')
click('Print to File', roleName='table cell', raw=True)
+click('Postscript', roleName='radio button', raw=True)
click('Print', roleName='push button')
-statinfo = os.stat (homedir + "output.ps")
+statinfo = os.stat (ps_file)
if statinfo.st_size > 100000:
exit(1)
-os.unlink (homedir + "output.ps")
+os.unlink (ps_file)
# Close atril
+focus.application('atril')
click('File', roleName='menu')
click('Close', roleName='menu item')
+
+if os.path.isfile(recent_used_orig):
+ os.rename(recent_used_orig, recent_used)
diff --git a/test/test7.py b/test/test7.py
index 0d6c047c..be70a1bc 100755
--- a/test/test7.py
+++ b/test/test7.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# Test printing