blob: 9f93ed88a0bd04ea91c2ed828123907a13f4c36a (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
import os
import signal
from uitest.framework import UITestCase
from libreoffice.uno.propertyvalue import mkPropertyValues
import time
class massTesting(UITestCase):
def load_file(self):
#TODO: Ignore password protected files
fileName = os.environ["TESTFILENAME"]
self.ui_test.create_doc_in_start_center("writer")
self.ui_test.load_file(fileName)
document = self.ui_test.get_component()
# Ignore read-only files
if not hasattr(document, 'isReadonly') or document.isReadonly():
print("mass-uitesting:skipped", flush=True)
return
try:
xDoc = self.xUITest.getTopFocusWindow()
xEdit = xDoc.getChild("writer_edit")
except:
#In case the mimetype is wrong and the file is open with another component
print("mass-uitesting:skipped", flush=True)
return
print("mass-uitesting:loaded", flush=True)
return xEdit
def test_remove_all_and_undo(self):
xEdit = self.load_file()
if xEdit:
self.xUITest.executeCommand(".uno:SelectAll")
self.xUITest.executeCommand(".uno:SelectAll")
self.xUITest.executeCommand(".uno:SelectAll")
xEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DELETE"}))
self.xUITest.executeCommand(".uno:Undo")
self.ui_test.close_doc()
def test_insert_returns_and_undo(self):
xEdit = self.load_file()
if xEdit:
for i in range(60):
xEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
for i in range(60):
self.xUITest.executeCommand(".uno:Undo")
self.ui_test.close_doc()
def test_insert_pageBreaks_and_undo(self):
xEdit = self.load_file()
if xEdit:
for i in range(5):
self.xUITest.executeCommand(".uno:InsertPagebreak")
for i in range(5):
self.xUITest.executeCommand(".uno:Undo")
self.ui_test.close_doc()
def test_copy_all_paste_undo(self):
xEdit = self.load_file()
if xEdit:
self.xUITest.executeCommand(".uno:SelectAll")
self.xUITest.executeCommand(".uno:SelectAll")
self.xUITest.executeCommand(".uno:SelectAll")
self.xUITest.executeCommand(".uno:Copy")
for i in range(5):
self.xUITest.executeCommand(".uno:Paste")
for i in range(5):
self.xUITest.executeCommand(".uno:Undo")
self.ui_test.close_doc()
def test_traverse_all_pages(self):
xEdit = self.load_file()
if xEdit:
document = self.ui_test.get_component()
pageCount = document.CurrentController.PageCount
for i in range(pageCount):
xEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"PAGEDOWN"}))
for i in range(pageCount):
xEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"PAGEUP"}))
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|