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="dbaccess_TableWindowAccessibility" 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' REQUIRED VARIABLES for interface/service tests: 36Global cancelButton As Object 37Global queryWindow As Object 38 39 40Sub CreateObj() 41 42'************************************************************************* 43' COMPONENT: 44' dbaccess.TableWindowAccessibility 45'************************************************************************* 46On Error Goto ErrHndl 47 Dim oMSF As Object, oWin As Object 48 Dim thRunner As Object, xRoot As Object 49 Dim tk As Object 50 51 Dim dbSource As Object 52 dbSource = createUnoService("com.sun.star.sdb.DataSource") 53 54 Dim info(2) As new com.sun.star.beans.PropertyValue 55 info(0).Name = "JavaDriverClass" 56 info(0).Value = "org.gjt.mm.mysql.Driver" 57 info(1).Name = "user" 58 info(1).Value = jdbcUser 59 info(2).Name = "password" 60 info(2).Value = jdbcPassword 61 dbSource.info = info() 62 dbSource.URL = jdbcUrl 63 64 Dim dbContext As Object 65 dbContext = createUnoService("com.sun.star.sdb.DatabaseContext") 66 67 Dim sourceName As String 68 sourceName = "AAADBSource for dbu-accessibility" 69 70 if dbContext.hasByName(sourceName) then 71 dbContext.revokeObject(sourceName) 72 endif 73 74 dbContext.registerObject(sourceName, dbSource) 75 76 Dim connection As Object 77 connection = dbSource.getIsolatedConnection(jdbcUser, jdbcPassword) 78 79 Dim statement As Object 80 statement = connection.createStatement() 81 82 statement.executeUpdate("drop table if exists tst_table1") 83 statement.executeUpdate("drop table if exists tst_table2") 84 statement.executeUpdate("create table tst_table1 (id1 int)") 85 statement.executeUpdate("create table tst_table2 (id2 int)") 86 87 Dim defContainer As Object 88 defContainer = dbSource.getQueryDefinitions() 89 90 Dim newQuery As Object 91 newQuery = createUnoService("com.sun.star.sdb.QueryDefinition") 92 newQuery.Command = "select * from tst_table1, tst_table2 where " + _ 93 "tst_table1.id1=tst_table2.id2" 94 95 defContainer.insertByName("Query1", newQuery) 96 97 oMSF = getProcessServiceManager() 98 thRunner = oMSF.createInstance("basichelper.ThreadRunner") 99 tk = createUNOService("com.sun.star.awt.Toolkit") 100 wait(500) 101 thRunner.initialize(Array("ExecuteDialog", "com.sun.star.sdb.DatasourceAdministrationDialog")) 102 wait(3000) 103 104 oWin = tk.getActiveTopWindow() 105 xRoot = utils.at_getAccessibleObject(oWin) 106 107 Dim pageTabList As Object 108 pageTabList = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.PAGE_TAB_LIST) 109 110 pageTabList.selectAccessibleChild(3) 111 wait(500) 112 113 Dim editQueryButton As Object 114 editQueryButton = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.PUSH_BUTTON, "Edit Query") 115 116 cancelButton = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.PUSH_BUTTON, "Cancel") 117 118 editQueryButton.doAccessibleAction(0) 119 wait(1000) 120 121 oWin = tk.getActiveTopWindow() 122 queryWindow = oWin 123 xRoot = utils.at_getAccessibleObject(oWin) 124 125 oObj = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.PANEL) 126 127Exit Sub 128ErrHndl: 129 Test.Exception() 130End Sub 131 132Sub DisposeObj() 133 utils.closeObject(queryWindow) 134 if NOT isNull(cancelButton) then 135 cancelButton.doAccessibleAction(0) 136 wait(1000) 137 End If 138End Sub 139 140Sub fireEvent() 141End Sub 142</script:module> 143