summaryrefslogtreecommitdiff
path: root/qadevOOo/tests/basic/ifc/document/DocumentInfo/document_DocumentInfo.xba
diff options
context:
space:
mode:
Diffstat (limited to 'qadevOOo/tests/basic/ifc/document/DocumentInfo/document_DocumentInfo.xba')
-rw-r--r--qadevOOo/tests/basic/ifc/document/DocumentInfo/document_DocumentInfo.xba206
1 files changed, 206 insertions, 0 deletions
diff --git a/qadevOOo/tests/basic/ifc/document/DocumentInfo/document_DocumentInfo.xba b/qadevOOo/tests/basic/ifc/document/DocumentInfo/document_DocumentInfo.xba
new file mode 100644
index 000000000000..4364dae08e03
--- /dev/null
+++ b/qadevOOo/tests/basic/ifc/document/DocumentInfo/document_DocumentInfo.xba
@@ -0,0 +1,206 @@
+<?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">
+
+
+'*************************************************************************
+'
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' This file is part of OpenOffice.org.
+'
+' OpenOffice.org is free software: you can redistribute it and/or modify
+' it under the terms of the GNU Lesser General Public License version 3
+' only, as published by the Free Software Foundation.
+'
+' OpenOffice.org is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU Lesser General Public License version 3 for more details
+' (a copy is included in the LICENSE file that accompanied this code).
+'
+' You should have received a copy of the GNU Lesser General Public License
+' version 3 along with OpenOffice.org. If not, see
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 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>