summaryrefslogtreecommitdiff
path: root/test/test2.py
blob: b4f3a5c87877526dba5f0492134b3bd6f5795f73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/python3

# This test opens a password encrypted file and tries to unlock it.

import os
from testCommon import pushButton
from dogtail.procedural import *

srcdir = os.environ['srcdir']

run('atril', arguments=' '+srcdir+'/test-encrypt.pdf')

# Try an incorrect password first
focus.application('atril')
type('wrong password')
click('Unlock Document', roleName=pushButton)
focus.dialog('Enter password')
click('Cancel', roleName=pushButton)

# Try again with the correct password
focus.frame('test-encrypt.pdf — Password Required')
click('Unlock Document', roleName=pushButton)
focus.dialog('Enter password')
type('Foo')
click('Unlock Document', roleName=pushButton)

# Close atril
focus.application('atril')
click('File', roleName='menu')
click('Close', roleName='menu item')