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' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9'
10' Copyright 2000, 2010 Oracle and/or its affiliates.
11'
12' OpenOffice.org - a multi-platform office productivity suite
13'
14' This file is part of OpenOffice.org.
15'
16' OpenOffice.org is free software: you can redistribute it and/or modify
17' it under the terms of the GNU Lesser General Public License version 3
18' only, as published by the Free Software Foundation.
19'
20' OpenOffice.org is distributed in the hope that it will be useful,
21' but WITHOUT ANY WARRANTY; without even the implied warranty of
22' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23' GNU Lesser General Public License version 3 for more details
24' (a copy is included in the LICENSE file that accompanied this code).
25'
26' You should have received a copy of the GNU Lesser General Public License
27' version 3 along with OpenOffice.org.  If not, see
28' <http://www.openoffice.org/license.html>
29' for a copy of the LGPLv3 License.
30'
31'*************************************************************************
32'*************************************************************************
33
34
35
36' Be sure that all variables are dimensioned:
37option explicit
38
39
40' REQUIRED VARIABLES for interface/service tests:
41Global cancelButton As Object
42Global queryWindow As Object
43
44
45Sub CreateObj()
46
47'*************************************************************************
48' COMPONENT:
49' dbaccess.TableWindowAccessibility
50'*************************************************************************
51On Error Goto ErrHndl
52    Dim oMSF As Object, oWin As Object
53    Dim thRunner As Object, xRoot As Object
54    Dim tk As Object
55
56    Dim dbSource As Object
57    dbSource = createUnoService("com.sun.star.sdb.DataSource")
58
59    Dim info(2) As new com.sun.star.beans.PropertyValue
60    info(0).Name = "JavaDriverClass"
61    info(0).Value = "org.gjt.mm.mysql.Driver"
62    info(1).Name = "user"
63    info(1).Value = jdbcUser
64    info(2).Name = "password"
65    info(2).Value = jdbcPassword
66    dbSource.info = info()
67    dbSource.URL = jdbcUrl
68
69    Dim dbContext As Object
70    dbContext = createUnoService("com.sun.star.sdb.DatabaseContext")
71
72    Dim sourceName As String
73    sourceName = "AAADBSource for dbu-accessibility"
74
75    if dbContext.hasByName(sourceName) then
76        dbContext.revokeObject(sourceName)
77    endif
78
79    dbContext.registerObject(sourceName, dbSource)
80
81    Dim connection As Object
82    connection = dbSource.getIsolatedConnection(jdbcUser, jdbcPassword)
83
84    Dim statement As Object
85    statement = connection.createStatement()
86
87    statement.executeUpdate("drop table if exists tst_table1")
88    statement.executeUpdate("drop table if exists tst_table2")
89    statement.executeUpdate("create table tst_table1 (id1 int)")
90    statement.executeUpdate("create table tst_table2 (id2 int)")
91
92    Dim defContainer As Object
93    defContainer = dbSource.getQueryDefinitions()
94
95    Dim newQuery As Object
96    newQuery = createUnoService("com.sun.star.sdb.QueryDefinition")
97    newQuery.Command = "select * from tst_table1, tst_table2 where " + _
98                       "tst_table1.id1=tst_table2.id2"
99
100    defContainer.insertByName("Query1", newQuery)
101
102    oMSF = getProcessServiceManager()
103    thRunner = oMSF.createInstance("basichelper.ThreadRunner")
104    tk = createUNOService("com.sun.star.awt.Toolkit")
105    wait(500)
106    thRunner.initialize(Array("ExecuteDialog", "com.sun.star.sdb.DatasourceAdministrationDialog"))
107    wait(3000)
108
109    oWin = tk.getActiveTopWindow()
110    xRoot = utils.at_getAccessibleObject(oWin)
111
112    Dim pageTabList As Object
113    pageTabList = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.PAGE_TAB_LIST)
114
115    pageTabList.selectAccessibleChild(3)
116    wait(500)
117
118    Dim editQueryButton As Object
119    editQueryButton = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.PUSH_BUTTON, "Edit Query")
120
121    cancelButton = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.PUSH_BUTTON, "Cancel")
122
123    editQueryButton.doAccessibleAction(0)
124    wait(1000)
125
126    oWin = tk.getActiveTopWindow()
127    queryWindow = oWin
128    xRoot = utils.at_getAccessibleObject(oWin)
129
130    oObj = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.PANEL)
131
132Exit Sub
133ErrHndl:
134    Test.Exception()
135End Sub
136
137Sub DisposeObj()
138    utils.closeObject(queryWindow)
139    if NOT isNull(cancelButton) then
140        cancelButton.doAccessibleAction(0)
141        wait(1000)
142    End If
143End Sub
144
145Sub fireEvent()
146End Sub
147</script:module>
148