blob: bbe671d69ddb00cf4050b0871d2e32b98cb20d48 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="document_DocumentInfo" script:language="StarBasic">
'*************************************************************************
'
' Licensed to the Apache Software Foundation (ASF) under one
' or more contributor license agreements. See the NOTICE file
' distributed with this work for additional information
' regarding copyright ownership. The ASF licenses this file
' to you under the Apache License, Version 2.0 (the
' "License"); you may not use this file except in compliance
' with the License. You may obtain a copy of the License at
'
' http://www.apache.org/licenses/LICENSE-2.0
'
' Unless required by applicable law or agreed to in writing,
' software distributed under the License is distributed on an
' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
' KIND, either express or implied. See the License for the
' specific language governing permissions and limitations
' under the License.
'
'*************************************************************************
' Be sure that all variables are dimensioned:
option explicit
Sub RunTest()
'*************************************************************************
' SERVICE:
' com.sun.star.document.DocumentInfo
'*************************************************************************
On Error Goto ErrHndl
Dim bOK As Boolean
Dim pval As Variant, resVal As Variant
PropertyTester.TestProperty("Author")
PropertyTester.TestProperty("BlindCopiesTo")
PropertyTester.TestProperty("CopyTo")
testDateTime("CreationDate")
PropertyTester.TestProperty("Description")
PropertyTester.TestProperty("InReplyTo")
PropertyTester.TestProperty("Keywords")
PropertyTester.TestProperty("MIMEType")
testDateTime("ModifyDate")
PropertyTester.TestProperty("ModifiedBy")
PropertyTester.TestProperty("Newsgroups")
PropertyTester.TestProperty("Original")
Test.StartMethod("Priority")
bOK =true
pval = oObj.Priority
Out.Log("Was:" + pval)
oObj.Priority = pval + 1
resVal = oObj.Priority
Out.Log("Res:" + resVal)
bOK = bOK AND (pval + 1 = resVal)
Test.MethodTested("Priority", bOK)
PropertyTester.TestProperty("Recipient")
PropertyTester.TestProperty("References")
PropertyTester.TestProperty("ReplyTo")
PropertyTester.TestProperty("Theme")
PropertyTester.TestProperty("Title")
PropertyTester.TestProperty("Template")
testDateTime("TemplateDate")
PropertyTester.TestProperty("IsEncrypted")
testDateTime("PrintDate")
PropertyTester.TestProperty("PrintedBy")
PropertyTester.TestProperty("AutoloadEnabled")
PropertyTester.TestProperty("AutoloadURL")
Test.StartMethod("AutoloadSecs")
bOK =true
pval = oObj.AutoloadSecs
Out.Log("Was:" + pval)
oObj.AutoloadSecs = pval + 10
resVal = oObj.AutoloadSecs
Out.Log("Res:" + resval)
bOK = bOK AND (pval + 10 = resVal)
Test.MethodTested("AutoloadSecs", bOK)
PropertyTester.TestProperty("DefaultTarget")
PropertyTester.TestProperty("Generator")
PropertyTester.TestProperty("CreationDate")
PropertyTester.TestProperty("Subject")
PropertyTester.TestProperty("Language")
PropertyTester.TestProperty("ModifyDate")
PropertyTester.TestProperty("PrintDate")
PropertyTester.TestProperty("TemplateDate")
Exit Sub
ErrHndl:
Test.Exception()
resume next
End Sub
Sub testDateTime(propName As String)
Dim oldVal As Variant, resVal As Variant
Dim newVal As New com.sun.star.util.DateTime
Dim bOK As Boolean
bOK = true
Test.StartMethod(propName)
oldVal = oObj.getPropertyValue(propName)
Out.Log("OldVal :" + dateTime2String(oldVal))
if isNull(oldVal) then
newVal.Year = 2001
newVal.Month = 11
newVal.Day = 12
newVal.Hours = 16
newVal.Minutes = 14
newVal.Seconds = 48
newVal.HundredthSeconds = 0
else
newVal.Year = oldVal.Year
newVal.Month = oldVal.Month
newVal.Day = oldVal.Day
newVal.Hours = oldVal.Hours
newVal.Minutes = oldVal.Minutes
newVal.HundredthSeconds = oldVal.HundredthSeconds
newVal.Seconds = oldVal.Seconds + 1
if (newVal.Seconds > 59) then newVal.Seconds = 0
end if
Out.Log("NewVal :" + dateTime2String(newVal))
oObj.setPropertyValue(propName, newVal)
resVal = oObj.getPropertyValue(propName)
Out.Log("ResVal :" + dateTime2String(resVal))
bOK = bOK AND (newVal.Year = resVal.Year)
bOK = bOK AND (newVal.Month = resVal.Month)
bOK = bOK AND (newVal.Day = resVal.Day)
bOK = bOK AND (newVal.Hours = resVal.Hours)
bOK = bOK AND (newVal.Minutes = resVal.Minutes)
bOK = bOK AND (newVal.Seconds = resVal.Seconds)
bOK = bOK AND (newVal.HundredthSeconds = resVal.HundredthSeconds)
' ### The following property was not found in correspond IDL file! ###
Test.MethodTested(propName, bOK)
Exit Sub
ErrHndl:
Test.Exception()
bOK = false
resume next
End Sub
Function dateTime2String (dT As Variant) As String
dateTime2String = "" + dT.Day + "." + dT.Month + "." + dT.Year + _
" " + dT.Hours + ":" + dT.Minutes + ":" + dT.Seconds + "." + _
dT.HundredthSeconds
End Function
</script:module>