1 ' -*- tab-width: 4; indent-tabs-mode: nil -*-
3 If WScript
.Arguments
.Count
<> 1 Then
4 WScript
.Echo
"Pass $(SRCDIR) as parameter"
8 srcdir
= WScript
.Arguments
.Item(0)
16 If okCounter
<> testCounter
Then
19 WScript
.Echo
"OK (" + CStr(okCounter
) + ")"
20 WScript
.Quit(exitstatus
)
24 testCounter
= testCounter
+ 1
25 If Not Eval(expr
) Then
26 WScript
.Echo
"FAIL: " & expr
29 WScript
.Echo
"PASS: " & expr
30 okCounter
= okCounter
+ 1
35 testCounter
= testCounter
+ 1
36 If Not Eval(expr
) Then
37 WScript
.Echo
"FAIL: " & expr
39 WScript
.Echo
"PASS: " & expr
40 okCounter
= okCounter
+ 1
44 Sub CheckIfExpected(expr
, expected
)
45 testCounter
= testCounter
+ 1
47 If actual
<> expected
Then
48 WScript
.Echo
"FAIL: Value of '" & expr
& "' was expected to be '" & CStr(expected
) & "', but was " & CStr(actual
)
50 WScript
.Echo
"PASS: " & expr
& " == " & CStr(expected
)
51 okCounter
= okCounter
+ 1
55 Sub CheckErrorFatal(test
)
56 testCounter
= testCounter
+ 1
58 If Err
.Number
<> 0 Then
59 WScript
.Echo
"FAIL: " & test
60 WScript
.Echo
"ERROR: " & Err
.Description
63 WScript
.Echo
"PASS: " & test
64 okCounter
= okCounter
+ 1
69 testCounter
= testCounter
+ 1
71 If Err
.Number
<> 0 Then
72 WScript
.Echo
"FAIL: " & test
73 WScript
.Echo
"ERROR: " & Err
.Description
75 WScript
.Echo
"PASS: " & test
76 okCounter
= okCounter
+ 1
80 WScript
.Echo
"Running Automation client tests"
84 ' FIXME: How can we ever make this work specifically with the
85 ' LibreOffice in instdir, when WScript.CreateObject() wants the
86 ' symbolic name that it then looks up from the Registry to find the
89 CheckErrorFatal
"Set writer = WScript.CreateObject(""Writer.Application"")"
90 CheckErrorFatal
"writer.Visible = True"
91 CheckErrorFatal
"writer.Caption = ""=== This is Writer ==="""
92 CheckErrorFatal
"writer.ShowMe"
94 CheckErrorFatal
"Set documents = writer.Documents"
96 ' Open two randomly chosen documents
97 CheckErrorFatal
"Set d1 = documents.Open(""" & srcdir
& "/sw/qa/extras/ww8export/data/n325936.doc"")"
98 CheckErrorFatal
"Set d2 = documents.Open(""" & srcdir
& "/sw/qa/extras/ww8export/data/bnc636128.doc"")"
100 CheckErrorFatal
"n1 = d1.FullName"
101 CheckErrorFatal
"n2 = d2.FullName"
103 CheckIfExpected
"n1", "n325936.doc"
104 CheckIfExpected
"n2", "bnc636128.doc"
106 CheckErrorFatal
"Set c1 = d1.Content"
107 CheckErrorFatal
"Set c2 = d2.Content"
109 ' The range of characters in these documents
110 CheckIfExpected
"c1.Start", 0
111 CheckIfExpected
"c1.End", 4
112 CheckIfExpected
"c2.Start", 0
113 CheckIfExpected
"c2.End", 42
115 ' Check number of paragraphs in each document
116 CheckErrorFatal
"Set p1 = d1.Paragraphs"
121 CheckIfExpected
"nparas", 1
123 CheckErrorFatal
"Set p2 = d2.Paragraphs"
128 CheckIfExpected
"nparas", 1
130 CheckErrorFatal
"writer.Quit"