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