1#!/usr/bin/python3
2
3# Test opening a password encrypted file and unlocking it.
4
5from testCommon import run_app, bail
6
7from dogtail.procedural import *
8
9try:
10
11	run_app(file='test-encrypt.pdf')
12
13	# Try an incorrect password first
14	focus.dialog('Enter password')
15	type('wrong password')
16	click('Unlock Document', roleName='push button')
17	focus.dialog('Enter password')
18	click('Cancel', roleName='push button')
19
20	# Try again with the correct password
21	focus.frame('test-encrypt.pdf — Password Required')
22	click('Unlock Document', roleName='push button')
23	type('Foo')
24	focus.dialog('Enter password')
25	click('Unlock Document', roleName='push button')
26
27	# Close xreader
28	focus.frame('test-encrypt.pdf — Dokument1')
29	click('File', roleName='menu')
30	click('Close', roleName='menu item')
31
32except:
33	bail()
34