1<?xml version="1.0" encoding="UTF-8"?> 2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> 3<script:module xmlns:script="http://openoffice.org/2000/script" script:name="ui_dialogs_XFilePickerControlAccess" script:language="StarBasic"> 4 5 6'************************************************************************* 7' 8' Licensed to the Apache Software Foundation (ASF) under one 9' or more contributor license agreements. See the NOTICE file 10' distributed with this work for additional information 11' regarding copyright ownership. The ASF licenses this file 12' to you under the Apache License, Version 2.0 (the 13' "License"); you may not use this file except in compliance 14' with the License. You may obtain a copy of the License at 15' 16' http://www.apache.org/licenses/LICENSE-2.0 17' 18' Unless required by applicable law or agreed to in writing, 19' software distributed under the License is distributed on an 20' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 21' KIND, either express or implied. See the License for the 22' specific language governing permissions and limitations 23' under the License. 24' 25'************************************************************************* 26 27 28 29 30 31' Be sure that all variables are dimensioned: 32option explicit 33 34'************************************************************************* 35' This Interface/Service test depends on the following GLOBAL variables, 36' which must be specified in the object creation: 37 38' - Global controlId As Short 39' Global controlInitVal As Variant 40 41'************************************************************************* 42 43 44 45 46 47 48Sub RunTest() 49 50'************************************************************************* 51' INTERFACE: 52' com.sun.star.ui.dialogs.XFilePickerControlAccess 53'************************************************************************* 54On Error Goto ErrHndl 55 Dim bOK As Boolean 56 Dim oldVal As Variant, newVal As Variant, resVal As Variant 57 Dim oldLabel As String, newLabel As String, resLabel As String 58 59 Test.StartMethod("setValue()") 60 Test.StartMethod("getValue()") 61 bOK = true 62 newVal = controlInitVal 'PropertyTester.Change(oldVal, oCoreRefl.getType(oldVal).Name) 63 oObj.setValue(controlId, 0, newVal) 64 wait(100) 65 resVal = oObj.getValue(controlId, 0) 66 Out.Log("New: " + newVal + ", Res: " + resVal) 67 bOK = bOK AND PropertyTester.equals(newVal, resVal) 68 69 Test.MethodTested("setValue()", bOK) 70 Test.MethodTested("getValue()", bOK) 71 72 Test.StartMethod("getLabel()") 73 bOK = true 74 oldLabel = oObj.getLabel(controlId) 75 Test.MethodTested("getLabel()", bOK) 76 77 Test.StartMethod("setLabel()") 78 bOK = true 79 newLabel = oldLabel + "_" 80 oObj.setLabel(controlId, newLabel) 81 resLabel = oObj.getLabel(controlId) 82 bOK = bOK AND (resLabel = newLabel) 83 Test.MethodTested("setLabel()", bOK) 84 85 Test.StartMethod("enableControl()") 86 bOK = true 87 oObj.enableControl(controlId, false) 88 oObj.enableControl(controlId, true) 89 Test.MethodTested("enableControl()", bOK) 90 91Exit Sub 92ErrHndl: 93 Test.Exception() 94 bOK = false 95 resume next 96End Sub 97</script:module> 98