summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am19
-rw-r--r--test/test-encrypt.pdfbin0 -> 26501 bytes
-rw-r--r--test/test-links.pdfbin0 -> 15151 bytes
-rw-r--r--test/test-mime.binbin0 -> 15151 bytes
-rw-r--r--test/test-page-labels.pdfbin0 -> 10150 bytes
-rwxr-xr-xtest/test1.py36
-rwxr-xr-xtest/test2.py28
-rwxr-xr-xtest/test3.py15
-rwxr-xr-xtest/test4.py20
-rwxr-xr-xtest/test5.py24
-rwxr-xr-xtest/test6.py31
-rwxr-xr-xtest/test7.py33
12 files changed, 206 insertions, 0 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
new file mode 100644
index 00000000..3f0a90c5
--- /dev/null
+++ b/test/Makefile.am
@@ -0,0 +1,19 @@
+
+dist_check_SCRIPTS = \
+ test1.py \
+ test2.py \
+ test3.py \
+ test4.py \
+ test5.py
+
+TESTS = $(dist_check_SCRIPTS)
+
+EXTRA_DIST = \
+ test-encrypt.pdf \
+ test-links.pdf \
+ test-mime.bin \
+ test-page-labels.pdf \
+ test6.py \
+ test7.py
+
+-include $(top_srcdir)/git.mk
diff --git a/test/test-encrypt.pdf b/test/test-encrypt.pdf
new file mode 100644
index 00000000..8f8f5c1f
--- /dev/null
+++ b/test/test-encrypt.pdf
Binary files differ
diff --git a/test/test-links.pdf b/test/test-links.pdf
new file mode 100644
index 00000000..0b1e6203
--- /dev/null
+++ b/test/test-links.pdf
Binary files differ
diff --git a/test/test-mime.bin b/test/test-mime.bin
new file mode 100644
index 00000000..0b1e6203
--- /dev/null
+++ b/test/test-mime.bin
Binary files differ
diff --git a/test/test-page-labels.pdf b/test/test-page-labels.pdf
new file mode 100644
index 00000000..c7d12671
--- /dev/null
+++ b/test/test-page-labels.pdf
Binary files differ
diff --git a/test/test1.py b/test/test1.py
new file mode 100755
index 00000000..42d83c01
--- /dev/null
+++ b/test/test1.py
@@ -0,0 +1,36 @@
+#!/usr/bin/python
+
+# This test opens the interface and just clicks around a bit.
+
+import os
+os.environ['LANG']='C'
+
+from dogtail.procedural import *
+
+run('evince')
+
+# Test file->open
+click('File', roleName='menu')
+click('Open...', roleName='menu item')
+focus.dialog('Open Document')
+click('Cancel', roleName='push button')
+
+# Toolbar editor
+click('Edit', roleName='menu')
+click('Toolbar', roleName='menu item')
+focus.dialog('Toolbar Editor')
+click('Close', roleName='push button')
+
+# About dialog
+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('Close', roleName='push button')
+
+# Close evince
+click('File', roleName='menu')
+click('Close', roleName='menu item')
diff --git a/test/test2.py b/test/test2.py
new file mode 100755
index 00000000..ca06b66b
--- /dev/null
+++ b/test/test2.py
@@ -0,0 +1,28 @@
+#!/usr/bin/python
+
+# This test opens a password encrypted file and tries to unlock it.
+
+import os
+os.environ['LANG']='C'
+srcdir = os.environ['srcdir']
+
+from dogtail.procedural import *
+
+run('evince', 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')
+click('Cancel', roleName='push button')
+
+# Try again with the correct password
+click('Unlock Document', roleName='push button')
+focus.widget('Password Entry', roleName='password text')
+type('Foo')
+click('Unlock Document', roleName='push button')
+
+# Close evince
+click('File', roleName='menu')
+click('Close', roleName='menu item')
diff --git a/test/test3.py b/test/test3.py
new file mode 100755
index 00000000..56b90df1
--- /dev/null
+++ b/test/test3.py
@@ -0,0 +1,15 @@
+#!/usr/bin/python
+
+# This test opens a file with wrong extenstion.
+
+import os
+os.environ['LANG']='C'
+srcdir = os.environ['srcdir']
+
+from dogtail.procedural import *
+
+run('evince', arguments=' '+srcdir+'/test-mime.bin')
+
+# Close evince
+click('File', roleName='menu')
+click('Close', roleName='menu item')
diff --git a/test/test4.py b/test/test4.py
new file mode 100755
index 00000000..789030e3
--- /dev/null
+++ b/test/test4.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+
+# This test tries document reload action.
+
+import os
+os.environ['LANG']='C'
+srcdir = os.environ['srcdir']
+
+from dogtail.procedural import *
+
+run('evince', 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')
+
+# Close evince
+click('File', roleName='menu')
+click('Close', roleName='menu item')
diff --git a/test/test5.py b/test/test5.py
new file mode 100755
index 00000000..9fd7276e
--- /dev/null
+++ b/test/test5.py
@@ -0,0 +1,24 @@
+#!/usr/bin/python
+
+# This test tries document reload action.
+
+import os
+os.environ['LANG']='C'
+srcdir = os.environ['srcdir']
+
+from dogtail.procedural import *
+
+run('evince', arguments=' '+srcdir+'/test-page-labels.pdf')
+
+focus.widget('page-label-entry')
+focus.widget.text = "iii"
+activate()
+
+if focus.widget.text != "III":
+ click('File', roleName='menu')
+ click('Close', roleName='menu item')
+ exit (1)
+
+# Close evince
+click('File', roleName='menu')
+click('Close', roleName='menu item')
diff --git a/test/test6.py b/test/test6.py
new file mode 100755
index 00000000..89b6e5d0
--- /dev/null
+++ b/test/test6.py
@@ -0,0 +1,31 @@
+#!/usr/bin/python
+
+# Test printing
+
+import os
+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")
+
+run('evince', arguments=' '+srcdir+'/test-page-labels.pdf')
+
+click('File', roleName='menu')
+click('Print...', roleName='menu item')
+
+focus.dialog('Print')
+click('Print to File', roleName='table cell', raw=True)
+click('Print', roleName='push button')
+
+statinfo = os.stat (homedir + "output.ps")
+if statinfo.st_size > 100000:
+ exit(1)
+os.unlink (homedir + "output.ps")
+
+# Close evince
+click('File', roleName='menu')
+click('Close', roleName='menu item')
diff --git a/test/test7.py b/test/test7.py
new file mode 100755
index 00000000..f104a472
--- /dev/null
+++ b/test/test7.py
@@ -0,0 +1,33 @@
+#!/usr/bin/python
+
+# Test printing
+
+import os
+os.environ['LANG']='C'
+srcdir = os.environ['srcdir']
+
+from dogtail.procedural import *
+
+run('evince', arguments=' '+srcdir+'/test-page-labels.pdf')
+
+#!/usr/bin/python
+from dogtail.procedural import *
+
+focus.application('evince')
+focus.frame('test-page-labels.pdf')
+click('File', roleName='menu')
+click('Print...', roleName='menu item')
+focus.dialog('Print')
+click('Pages:', roleName='radio button')
+keyCombo('Tab')
+type('1')
+click('Page Setup', roleName='page tab', raw=True)
+click('All sheets')
+click('Even sheets')
+click('Print Preview', roleName='push button')
+keyCombo('Return')
+click('Cancel')
+
+# Close evince
+click('File', roleName='menu')
+click('Close', roleName='menu item')