diff options
Diffstat (limited to 'qadevOOo/tests/basic/mod/dbaccess')
26 files changed, 1489 insertions, 0 deletions
diff --git a/qadevOOo/tests/basic/mod/dbaccess/ConnectionLineAccessibility/dbaccess_ConnectionLineAccessibility.xba b/qadevOOo/tests/basic/mod/dbaccess/ConnectionLineAccessibility/dbaccess_ConnectionLineAccessibility.xba new file mode 100644 index 000000000000..751479fca4ab --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/ConnectionLineAccessibility/dbaccess_ConnectionLineAccessibility.xba @@ -0,0 +1,147 @@ +<?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="dbaccess_ConnectionLineAccessibility" 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 + + +' REQUIRED VARIABLES for interface/service tests: +Global cancelButton As Object +Global queryWindow As Object + + +Sub CreateObj() + +'************************************************************************* +' COMPONENT: +' dbaccess.ConnectionLineAccessibility +'************************************************************************* +On Error Goto ErrHndl + Dim oMSF As Object, oWin As Object + Dim thRunner As Object, xRoot As Object + Dim tk As Object + + Dim dbSource As Object + dbSource = createUnoService("com.sun.star.sdb.DataSource") + + Dim info(2) As new com.sun.star.beans.PropertyValue + info(0).Name = "JavaDriverClass" + info(0).Value = "org.gjt.mm.mysql.Driver" + info(1).Name = "user" + info(1).Value = jdbcUser + info(2).Name = "password" + info(2).Value = jdbcPassword + dbSource.info = info() + dbSource.URL = jdbcUrl + + Dim dbContext As Object + dbContext = createUnoService("com.sun.star.sdb.DatabaseContext") + + Dim sourceName As String + sourceName = "AAADBSource for dbu-accessibility" + + if dbContext.hasByName(sourceName) then + dbContext.revokeObject(sourceName) + endif + + dbContext.registerObject(sourceName, dbSource) + + Dim connection As Object + connection = dbSource.getIsolatedConnection(jdbcUser, jdbcPassword) + + Dim statement As Object + statement = connection.createStatement() + + statement.executeUpdate("drop table if exists tst_table1") + statement.executeUpdate("drop table if exists tst_table2") + statement.executeUpdate("create table tst_table1 (id1 int)") + statement.executeUpdate("create table tst_table2 (id2 int)") + + Dim defContainer As Object + defContainer = dbSource.getQueryDefinitions() + + Dim newQuery As Object + newQuery = createUnoService("com.sun.star.sdb.QueryDefinition") + newQuery.Command = "select * from tst_table1, tst_table2 where " + _ + "tst_table1.id1=tst_table2.id2" + + defContainer.insertByName("Query1", newQuery) + + oMSF = getProcessServiceManager() + thRunner = oMSF.createInstance("basichelper.ThreadRunner") + tk = createUNOService("com.sun.star.awt.Toolkit") + wait(500) + thRunner.initialize(Array("ExecuteDialog", "com.sun.star.sdb.DatasourceAdministrationDialog")) + wait(3000) + + oWin = tk.getActiveTopWindow() + xRoot = utils.at_getAccessibleObject(oWin) + + Dim pageTabList As Object + pageTabList = utils.at_getAccessibleObjectForRole(xRoot, 31) + + pageTabList.selectAccessibleChild(3) + wait(500) + + Dim editQueryButton As Object + editQueryButton = utils.at_getAccessibleObjectForRole(xRoot, 35, "Edit Query") + + cancelButton = utils.at_getAccessibleObjectForRole(xRoot, 35, "Cancel") + + editQueryButton.doAccessibleAction(0) + wait(1000) + + oWin = tk.getActiveTopWindow() + queryWindow = oWin + xRoot = utils.at_getAccessibleObject(oWin) + + oObj = utils.at_getAccessibleObjectForRole(xRoot, 0, "Relation") + +Exit Sub +ErrHndl: + Test.Exception() +End Sub + +Sub DisposeObj() + queryWindow.dispose() + if NOT isNull(cancelButton) then + cancelButton.doAccessibleAction(0) + wait(1000) + End If +End Sub + +Sub fireEvent() +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/mod/dbaccess/ConnectionLineAccessibility/script.xlb b/qadevOOo/tests/basic/mod/dbaccess/ConnectionLineAccessibility/script.xlb new file mode 100644 index 000000000000..66ba217e7f6c --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/ConnectionLineAccessibility/script.xlb @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="dbaccess_ConnectionLineAccessibility" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="dbaccess_ConnectionLineAccessibility"/> +"</library:library> diff --git a/qadevOOo/tests/basic/mod/dbaccess/DBContentLoader/dbaccess_DBContentLoader.xba b/qadevOOo/tests/basic/mod/dbaccess/DBContentLoader/dbaccess_DBContentLoader.xba new file mode 100644 index 000000000000..5c7722b265bd --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/DBContentLoader/dbaccess_DBContentLoader.xba @@ -0,0 +1,63 @@ +<?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="dbaccess_DBContentLoader" 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 + + +' REQUIRED VARIABLES for interface/service tests: + +' For XFrameLoader +Global FrameLoaderURL As String + + +Sub CreateObj() + +'************************************************************************* +' COMPONENT: +' dbaccess.DBContentLoader +'************************************************************************* +On Error Goto ErrHndl + + oObj = createUnoService("com.sun.star.sdb.ContentLoader") + + ' For XFrameLoader + FrameLoaderURL = ".component:DB/DataSourceBrowser" + +Exit Sub +ErrHndl: + Test.Exception() +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/mod/dbaccess/DBContentLoader/script.xlb b/qadevOOo/tests/basic/mod/dbaccess/DBContentLoader/script.xlb new file mode 100644 index 000000000000..16dc4304c46c --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/DBContentLoader/script.xlb @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="dbaccess_DBContentLoader" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="dbaccess_DBContentLoader"/> +"</library:library> diff --git a/qadevOOo/tests/basic/mod/dbaccess/JoinViewAccessibility/dbaccess_JoinViewAccessibility.xba b/qadevOOo/tests/basic/mod/dbaccess/JoinViewAccessibility/dbaccess_JoinViewAccessibility.xba new file mode 100644 index 000000000000..3b2b98a28618 --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/JoinViewAccessibility/dbaccess_JoinViewAccessibility.xba @@ -0,0 +1,148 @@ +<?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="dbaccess_JoinViewAccessibility" 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 + + +' REQUIRED VARIABLES for interface/service tests: + +Global cancelButton As Object +Global queryWindow As Object + + +Sub CreateObj() + +'************************************************************************* +' COMPONENT: +' dbaccess.JoinViewAccessibility +'************************************************************************* +On Error Goto ErrHndl + Dim oMSF As Object, oWin As Object + Dim thRunner As Object, xRoot As Object + Dim tk As Object + + Dim dbSource As Object + dbSource = createUnoService("com.sun.star.sdb.DataSource") + + Dim info(2) As new com.sun.star.beans.PropertyValue + info(0).Name = "JavaDriverClass" + info(0).Value = "org.gjt.mm.mysql.Driver" + info(1).Name = "user" + info(1).Value = jdbcUser + info(2).Name = "password" + info(2).Value = jdbcPassword + dbSource.info = info() + dbSource.URL = jdbcUrl + + Dim dbContext As Object + dbContext = createUnoService("com.sun.star.sdb.DatabaseContext") + + Dim sourceName As String + sourceName = "AAADBSource for dbu-accessibility" + + if dbContext.hasByName(sourceName) then + dbContext.revokeObject(sourceName) + endif + + dbContext.registerObject(sourceName, dbSource) + + Dim connection As Object + connection = dbSource.getIsolatedConnection(jdbcUser, jdbcPassword) + + Dim statement As Object + statement = connection.createStatement() + + statement.executeUpdate("drop table if exists tst_table1") + statement.executeUpdate("drop table if exists tst_table2") + statement.executeUpdate("create table tst_table1 (id1 int)") + statement.executeUpdate("create table tst_table2 (id2 int)") + + Dim defContainer As Object + defContainer = dbSource.getQueryDefinitions() + + Dim newQuery As Object + newQuery = createUnoService("com.sun.star.sdb.QueryDefinition") + newQuery.Command = "select * from tst_table1, tst_table2 where " + _ + "tst_table1.id1=tst_table2.id2" + + defContainer.insertByName("Query1", newQuery) + + oMSF = getProcessServiceManager() + thRunner = oMSF.createInstance("basichelper.ThreadRunner") + tk = createUNOService("com.sun.star.awt.Toolkit") + wait(500) + thRunner.initialize(Array("ExecuteDialog", "com.sun.star.sdb.DatasourceAdministrationDialog")) + wait(3000) + + oWin = tk.getActiveTopWindow() + xRoot = utils.at_getAccessibleObject(oWin) + + Dim pageTabList As Object + pageTabList = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.PAGE_TAB_LIST) + + pageTabList.selectAccessibleChild(3) + wait(500) + + Dim editQueryButton As Object + editQueryButton = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.PUSH_BUTTON, "Edit Query") + + cancelButton = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.PUSH_BUTTON, "Cancel") + + editQueryButton.doAccessibleAction(0) + wait(1000) + + oWin = tk.getActiveTopWindow() + queryWindow = oWin + xRoot = utils.at_getAccessibleObject(oWin) + + oObj = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.VIEW_PORT) + +Exit Sub +ErrHndl: + Test.Exception() +End Sub + +Sub DisposeObj() + utils.closeObject(queryWindow) + if NOT isNull(cancelButton) then + cancelButton.doAccessibleAction(0) + wait(1000) + End If +End Sub + +Sub fireEvent() +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/mod/dbaccess/JoinViewAccessibility/script.xlb b/qadevOOo/tests/basic/mod/dbaccess/JoinViewAccessibility/script.xlb new file mode 100644 index 000000000000..8617aa03de8b --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/JoinViewAccessibility/script.xlb @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="dbaccess_JoinViewAccessibility" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="dbaccess_JoinViewAccessibility"/> +"</library:library> diff --git a/qadevOOo/tests/basic/mod/dbaccess/OCommandDefinition/dbaccess_OCommandDefinition.xba b/qadevOOo/tests/basic/mod/dbaccess/OCommandDefinition/dbaccess_OCommandDefinition.xba new file mode 100644 index 000000000000..5635743679e1 --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/OCommandDefinition/dbaccess_OCommandDefinition.xba @@ -0,0 +1,56 @@ +<?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="dbaccess_OCommandDefinition" 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 CreateObj() + +'************************************************************************* +' COMPONENT: +' dbaccess.OCommandDefinition +'************************************************************************* +On Error Goto ErrHndl + + oObj = createUnoService("com.sun.star.sdb.QueryDefinition") + +Exit Sub +ErrHndl: + Test.Exception() +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/mod/dbaccess/OCommandDefinition/script.xlb b/qadevOOo/tests/basic/mod/dbaccess/OCommandDefinition/script.xlb new file mode 100644 index 000000000000..c4d19d9c021c --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/OCommandDefinition/script.xlb @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="dbaccess_OCommandDefinition" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="dbaccess_OCommandDefinition"/> +"</library:library> diff --git a/qadevOOo/tests/basic/mod/dbaccess/ODatabaseContext/dbaccess_ODatabaseContext.xba b/qadevOOo/tests/basic/mod/dbaccess/ODatabaseContext/dbaccess_ODatabaseContext.xba new file mode 100644 index 000000000000..c90fc39d63ee --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/ODatabaseContext/dbaccess_ODatabaseContext.xba @@ -0,0 +1,56 @@ +<?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="dbaccess_ODatabaseContext" 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 + + +' REQUIRED VARIABLES for interface/service tests: + +' Required for com.sun.star.uno.XNamingService: + Global oObjectToRegister As Object + + +Sub CreateObj() + +'************************************************************************* +' COMPONENT: +' dbaccess.ODatabaseContext +'************************************************************************* + oObj = createUNOService("com.sun.star.sdb.DatabaseContext") + oObjectToRegister = createUNOService("com.sun.star.sdb.DataSource") + oObjectToRegister.URL = "sdbc:dbase:" + utils.getTempFileURL("") +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/mod/dbaccess/ODatabaseContext/script.xlb b/qadevOOo/tests/basic/mod/dbaccess/ODatabaseContext/script.xlb new file mode 100644 index 000000000000..f1a5f0302285 --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/ODatabaseContext/script.xlb @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="dbaccess_ODatabaseContext" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="dbaccess_ODatabaseContext"/> +"</library:library> diff --git a/qadevOOo/tests/basic/mod/dbaccess/ODatabaseSource/dbaccess_ODatabaseSource.xba b/qadevOOo/tests/basic/mod/dbaccess/ODatabaseSource/dbaccess_ODatabaseSource.xba new file mode 100644 index 000000000000..b3fad24fc39f --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/ODatabaseSource/dbaccess_ODatabaseSource.xba @@ -0,0 +1,88 @@ +<?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="dbaccess_ODatabaseSource" 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 + + +' REQUIRED VARIABLES for interface/service tests: + +' Required for object disposing (the name of the source) +Global sourceName as String + + +Sub CreateObj() + +'************************************************************************* +' COMPONENT: +' dbaccess.ODatabaseSource +'************************************************************************* +On Error Goto ErrHndl + Dim tmpDir as String, dbSrc as Object, dbContext as Object + + sourceName = "BasicODatabaseSource" + + oDoc = utils.createDocument("swriter", cObjectName) + dbContext =createUnoService("com.sun.star.sdb.DatabaseContext") + tmpDir = utils.getTempFileURL("") + + Out.Log("Creating datasource in " + tmpDir) + + dbSrc = createUnoService("com.sun.star.sdb.DataSource") + dbSrc.URL = "sdbc:dbase:" + tmpDir + + if dbContext.hasByName(sourceName) then + dbContext.revokeObject(sourceName) + endif + + dbContext.registerObject(sourceName, dbSrc) + + oObj = dbSrc + +Exit Sub +ErrHndl: + Test.Exception() +End Sub + +Sub DisposeObj() + Dim dbContext as Object + + dbContext =createUnoService("com.sun.star.sdb.DatabaseContext") + if dbContext.hasByName(sourceName) then + dbContext.revokeObject(sourceName) + endif + +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/mod/dbaccess/ODatabaseSource/script.xlb b/qadevOOo/tests/basic/mod/dbaccess/ODatabaseSource/script.xlb new file mode 100644 index 000000000000..6e67dd8ee35a --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/ODatabaseSource/script.xlb @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="dbaccess_ODatabaseSource" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="dbaccess_ODatabaseSource"/> +"</library:library> diff --git a/qadevOOo/tests/basic/mod/dbaccess/ODatasourceAdministrationDialog/dbaccess_ODatasourceAdministrationDialog.xba b/qadevOOo/tests/basic/mod/dbaccess/ODatasourceAdministrationDialog/dbaccess_ODatasourceAdministrationDialog.xba new file mode 100644 index 000000000000..7260d239d673 --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/ODatasourceAdministrationDialog/dbaccess_ODatasourceAdministrationDialog.xba @@ -0,0 +1,67 @@ +<?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="dbaccess_ODatasourceAdministrationDialog" 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 + + +' REQUIRED VARIABLES for interface/service tests: + +' relation for com.sun.star.lang.XInitialization +Global aInitArgs As Variant + + +Sub CreateObj() + +'************************************************************************* +' COMPONENT: +' dbaccess.ODatasourceAdministrationDialog +'************************************************************************* +On Error Goto ErrHndl + + oObj = createUnoService("com.sun.star.sdb.DatasourceAdministrationDialog") + + ' setting relation for com.sun.star.lang.XInitialization + Dim arg As new com.sun.star.beans.PropertyValue + arg.Name = "Title" + arg.Value = "ODatasourceAdministrationDialog" + + aInitArgs = Array(arg) + +Exit Sub +ErrHndl: + Test.Exception() +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/mod/dbaccess/ODatasourceAdministrationDialog/script.xlb b/qadevOOo/tests/basic/mod/dbaccess/ODatasourceAdministrationDialog/script.xlb new file mode 100644 index 000000000000..b70e65c3d620 --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/ODatasourceAdministrationDialog/script.xlb @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="dbaccess_ODatasourceAdministrationDialog" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="dbaccess_ODatasourceAdministrationDialog"/> +"</library:library> diff --git a/qadevOOo/tests/basic/mod/dbaccess/ODatasourceBrowser/dbaccess_ODatasourceBrowser.xba b/qadevOOo/tests/basic/mod/dbaccess/ODatasourceBrowser/dbaccess_ODatasourceBrowser.xba new file mode 100644 index 000000000000..db96d88a4c2d --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/ODatasourceBrowser/dbaccess_ODatasourceBrowser.xba @@ -0,0 +1,142 @@ +<?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="dbaccess_ODatasourceBrowser" 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 + + +' REQUIRED VARIABLES for interface/service tests: + +' variable for XComponent +Global oComponentInstance As Object + +' variable for XFormController +Global otherWin As Object + +' variable for XDispatchProvider +Global dispatchUrl As String + +' variable for frame.XController +Global oFrameToAttach As Object +Global oModelToAttach As Object +Global bHasNoViewData As Boolean +Global oObjToSuspend As Object +Global bHasNoModel As Boolean + +' variables for awt.XTabController +Global oXTabControllerModel as Object +Global oXTabControllerContainer as Object + +' variable for lang.XInitialization +Global aInitArgs As Variant + + +Sub CreateObj() + +'************************************************************************* +' COMPONENT: +' dbaccess.ODatasourceBrowser +'************************************************************************* +On Error Goto ErrHndl + Dim cntrlr As Object + Dim frame1 As Object, frame2 As Object + Dim url As new com.sun.star.util.URL + Dim dispatcher As Object + Dim oShape As Object, oDrawPage As Object, oModel As Object + Dim oController As Object, oCtrll As Object + Dim params(2) as new com.sun.star.beans.PropertyValue + Dim list1 as object, ctrl as object + +' oDoc = utils.createDocument("swriter", cObjectName) + oDoc = StarDesktop.loadComponentFromUrl("private:factory/swriter", "_blank",0 , args()) + + wait(500) + + cntrlr = oDoc.getCurrentController() + frame1 = StarDesktop.getCurrentFrame() + url.Complete = ".component:DB/DataSourceBrowser" + dispatcher = frame1.queryDispatch(url, "_beamer", 12) + dispatcher.dispatch(url, DimArray()) + + frame2 = frame1.findFrame("_beamer", 4) + frame2.setName("ODatasourceBrowser") + + oObj = frame2.getController() + + ' now initialize the browser to make him displaying a table in its gtrid. + ' This is required for activating of this control + params(0).Name = "DataSourceName" + params(0).Value = "Bibliography" + params(1).Name = "CommandType" + params(1).Value = com.sun.star.sdb.CommandType.TABLE + params(2).Name = "Command" + params(2).Value = "biblio" + + oObj.initialize(params()) + ' waiting while data loading ... + wait(2000) + +'setting variable for XComponent + oComponentInstance = oObj + +'setting variable for XDispatchProvider + dispatchUrl = ".uno:DataSourceBrowser/FormLetter" + +'setting variable for XController + oFrameToAttach = frame1 + oModelToAttach = oDoc + bHasNoViewData = true + oObjToSuspend = oObj + bHasNoModel = true + +'setting variables for awt.XTabController and for XFormController + oShape = toolkittools.createUNOControlShape("CommandButton", "UnoControlButton") + toolkittools.addShape(oShape) + oDrawPage = oDoc.getDrawPage() + + oModel = oShape.getControl() + oController = oDoc.getCurrentController() + otherWin = oController.getControl(oModel) + oXTabControllerContainer = otherWin.getContext() + oXTabControllerModel = oDrawPage.getForms().getByIndex(0) + +' setting variable for lang.XInitialization + aInitArgs = params() + +Exit Sub +ErrHndl: + Test.Exception() +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/mod/dbaccess/ODatasourceBrowser/script.xlb b/qadevOOo/tests/basic/mod/dbaccess/ODatasourceBrowser/script.xlb new file mode 100644 index 000000000000..1a70f0bd7f8f --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/ODatasourceBrowser/script.xlb @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="dbaccess_ODatasourceBrowser" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="dbaccess_ODatasourceBrowser"/> +"</library:library> diff --git a/qadevOOo/tests/basic/mod/dbaccess/OInteractionHandler/dbaccess_OInteractionHandler.xba b/qadevOOo/tests/basic/mod/dbaccess/OInteractionHandler/dbaccess_OInteractionHandler.xba new file mode 100644 index 000000000000..f9d73c83c5ac --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/OInteractionHandler/dbaccess_OInteractionHandler.xba @@ -0,0 +1,56 @@ +<?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="dbaccess_OInteractionHandler" 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 CreateObj() + +'************************************************************************* +' COMPONENT: +' dbaccess.OInteractionHandler +'************************************************************************* +On Error Goto ErrHndl + + oObj = createUnoService("com.sun.star.sdb.InteractionHandler") + +Exit Sub +ErrHndl: + Test.Exception() +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/mod/dbaccess/OInteractionHandler/script.xlb b/qadevOOo/tests/basic/mod/dbaccess/OInteractionHandler/script.xlb new file mode 100644 index 000000000000..019f9dc617cc --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/OInteractionHandler/script.xlb @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="dbaccess_OInteractionHandler" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="dbaccess_OInteractionHandler"/> +"</library:library> diff --git a/qadevOOo/tests/basic/mod/dbaccess/ORowSet/dbaccess_ORowSet.xba b/qadevOOo/tests/basic/mod/dbaccess/ORowSet/dbaccess_ORowSet.xba new file mode 100644 index 000000000000..60ef6a794bce --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/ORowSet/dbaccess_ORowSet.xba @@ -0,0 +1,176 @@ +<?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="dbaccess_ORowSet" 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 + + + +' REQUIRED VARIABLES for interface/service tests: + +' Required for com.sun.star.lang.XComponent: + Global oComponentInstance As Object ' it will be disposed + +' Required for com.sun.star.sdbc.XColumnLocate: + Global cExistantColumnName As String + +' Required for com.sun.star.sdbc.XResultSet + Global cXResultSetFirstRecord as String + Global cXResultSetLastRecord as String + Global cXResultSetRecord1 as String + Global cXResultSetRecord2 as String + Global cXResultSet2BeforeLastRecord as String + +' Required for com.sun.star.sdbc.XParameters + Global paramTypes as Variant + +' Required for com.sun.star.sdbc.XRow and com.sun.star.sdbc.XRowUpdate + Global rowTypes as Variant + Global rowTypesCol as Variant + +' Required for com.sun.star.sdbc.XResultSetUpdate + Global textColumn As String + + Global oConnection As Object + + +Sub CreateObj() + +'************************************************************************* +' COMPONENT: +' dbaccess.ORowSet +'************************************************************************* +On Error Goto ErrHndl + + Dim oRowSet As Object, facc As Object, dbSource As Object + Dim srcFile As String, dstFile As String, dbSrcURL As String + + ' Copying DB file to temp location + srcFile = utils.Path2URL(cTestDocsDir) + "TestDB/testDB.dbf" + dstFile = utils.getTempFileURL("TestDB.dbf") + dbSrcURL = "sdbc:dbase:" + utils.StrReplace(dstFile, "/testDB.dbf", "") + + facc = createUnoService("com.sun.star.ucb.SimpleFileAccess") + + if not facc.exists(srcFile) then + Out.log("could not find source of testDB.dbf: " + srcFile) + end if + if (facc.exists(dstFile)) then facc.kill(dstFile) + facc.copy(srcFile, dstFile) + + dbtools.RegisterDataSource("DBTest", dbSrcURL) + + oRowSet = createUnoService("com.sun.star.sdb.RowSet") + + oRowSet.DataSourceName = "DBTest" + oRowSet.Command = "TestDB" + oRowSet.CommandType = com.sun.star.sdb.CommandType.TABLE + + oRowSet.execute() + + wait(200) + + oConnection = oRowSet.ActiveConnection + + if NOT isObject(oConnection) then + Out.Log("oConnection wasn't retrieved properly !!!") + end if + + oRowSet.first() + + Out.Log("The first record has: '" + oRowSet.getString(1) + "'") + + oObj = oRowSet + + oComponentInstance = createUnoService("com.sun.star.sdb.RowSet") + cExistantColumnName = "_TEXT" + cXResultSetFirstRecord = "text1" + cXResultSetLastRecord = "text3" + cXResultSetRecord1 = "text1" + cXResultSetRecord2 = "text2" + cXResultSet2BeforeLastRecord = "text2" + + paramTypes = DimArray() + +' paramTypes = Array("boolean", "byte", "short", "int", "long", "float", "double", "string", _ +' "bytes", "date", "time", "timestamp", "binarystream", "characterstream", "object", _ +' "ref", "blob", "clob", "array") + + +' Dim dat As new com.sun.star.util.Date +' Dim tim As new com.sun.star.util.Time +' Dim datTim As new com.sun.star.util.DateTime + +' dat.Year = 2001 +' dat.Month = 1 +' dat.Day = 1 + +' tim.Hours = 1 +' tim.Minutes = 1 +' tim.Seconds = 1 + +' paramVal = Array(true, 11, 11, 111, NULL, 1.1, 11.11, "text1", NULL, dat, tim, NULL, NULL, NULL, NULL, +' NULL, NULL, NULL, NULL) + + ' for XRow and XRowUpdate + rowTypes = Array("string", "int", "long", "double", "float", "date", "datetm", "boolean") + rowTypesCol = Array(1, 2, 3, 4, 5, 6, 7, 9) +' rowTypes = Array("boolean", "byte", "short", "int", "long", "float", "double", "string", _ +' "bytes", "date", "time", "timestamp", "binarystream", "characterstream", "object", _ +' "numericobject") + + + +' Required for com.sun.star.sdbc.XResultSetUpdate + textColumn = "_TEXT" + +Exit Sub +ErrHndl: + Test.Exception() +End Sub + +Sub DisposeObj() +On Error Goto ErrHndl + Out.Log("Closing DB connection ...") + oConnection.close() + + Out.Log("Revoking 'DBTest' datasource ...") + dbtools.RevokeDB("DBTest") +Exit Sub +ErrHndl: + Test.Exception() + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/mod/dbaccess/ORowSet/script.xlb b/qadevOOo/tests/basic/mod/dbaccess/ORowSet/script.xlb new file mode 100644 index 000000000000..74871382da1c --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/ORowSet/script.xlb @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="dbaccess_ORowSet" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="dbaccess_ORowSet"/> +"</library:library> diff --git a/qadevOOo/tests/basic/mod/dbaccess/OSQLMessageDialog/dbaccess_OSQLMessageDialog.xba b/qadevOOo/tests/basic/mod/dbaccess/OSQLMessageDialog/dbaccess_OSQLMessageDialog.xba new file mode 100644 index 000000000000..6a3b67c51849 --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/OSQLMessageDialog/dbaccess_OSQLMessageDialog.xba @@ -0,0 +1,56 @@ +<?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="dbaccess_OSQLMessageDialog" 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 CreateObj() + +'************************************************************************* +' COMPONENT: +' dbaccess.OSQLMessageDialog +'************************************************************************* +On Error Goto ErrHndl + + oObj = createUnoService("com.sun.star.sdb.ErrorMessageDialog") + +Exit Sub +ErrHndl: + Test.Exception() +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/mod/dbaccess/OSQLMessageDialog/script.xlb b/qadevOOo/tests/basic/mod/dbaccess/OSQLMessageDialog/script.xlb new file mode 100644 index 000000000000..d4d9ae335fc4 --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/OSQLMessageDialog/script.xlb @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="dbaccess_OSQLMessageDialog" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="dbaccess_OSQLMessageDialog"/> +"</library:library> diff --git a/qadevOOo/tests/basic/mod/dbaccess/SbaXGridControl/dbaccess_SbaXGridControl.xba b/qadevOOo/tests/basic/mod/dbaccess/SbaXGridControl/dbaccess_SbaXGridControl.xba new file mode 100644 index 000000000000..1ba1f7cac92d --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/SbaXGridControl/dbaccess_SbaXGridControl.xba @@ -0,0 +1,222 @@ +<?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="dbaccess_SbaXGridControl" 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 + + +' REQUIRED VARIABLES for interface/service tests: + +' Required for view.XSelectionSupplier +Global SelectableObj1 as Variant +Global SelectableObj2 as Variant + +' Required for awt.XControl +Global oModel As Object +Global oContext As Object +Global oWinpeer As Object +Global oToolkit As Object + +' Required for awt.XWindow +Global oXWindow As Object +Global oCtrlShape As Variant + +' Required for awt.XView +Global oGraphics As Object + +' Required for frame.XDispatch +Global dispatchURL As String + +' Required for XContainer +Global oElementToInsert As Object +Global oContainer As Object ' in case if the + ' component tested doesn't support XNameContainer + +' Required for XComponent +Global oComponentInstance As Object 'it will be disposed + +' Required for form.XUpdateBroadcaster +Global bCustomUpdate As Boolean + + +Sub CreateObj() + +'************************************************************************* +' COMPONENT: +' dbaccess.SbaXGridControl +'************************************************************************* + Dim cntrlShape as Object, grid as Object + Dim size as new com.sun.star.awt.Size + Dim pos as new com.sun.star.awt.Point + Dim drawPage as Object, aForm as Object + Dim aColumn1 as Object, aColumn2 as Object + Dim theAccess as Object + Dim sel1(0) as Long, sel2(0) as Long + Dim device as Object + +On Error Goto ErrHndl + + oDoc = utils.createDocument("swriter", cObjectName) + + ' creating ControlShape with GridControl inside it + cntrlShape = oDoc.createInstance("com.sun.star.drawing.ControlShape") + grid = oDoc.createInstance("com.sun.star.form.component.GridControl") + grid.DefaultControl = "com.sun.star.form.control.InteractionGridControl" + pos.X = 15000 + pos.Y = 10000 + size.Width = 4500 + size.Height = 3000 + cntrlShape.setPosition(pos) + cntrlShape.setSize(size) + cntrlShape.setControl(grid) + + ' adding the shape with grid into the document + drawPage = oDoc.getDrawPage() + drawPage.add(cntrlShape) + + ' binding the form which contains a grid model to + ' the Bibliography database + aForm = drawPage.getForms().getByName("Standard") + aForm.DataSourceName = "Bibliography" + aForm.Command = "biblio" + aForm.CommandType = com.sun.star.sdb.CommandType.TABLE + + ' creating and inserting some columns + aColumn1 = grid.createColumn("TextField") + aColumn1.DataField = "Identifier" + aColumn1.Label = "Identifier" + grid.insertByName("First", aColumn1) + aColumn2 = grid.createColumn("TextField") + aColumn2.DataField = "Address" + aColumn2.Label = "Address" + grid.insertByName("Second", aColumn2) + + ' Getting the controller of the Grid + theAccess = oDoc.getCurrentController() + oObj = theAccess.getControl(grid) + + ' setting variable for XSelectionSupplier + sel1(0) = 2 + sel2(0) = 5 + SelectableObj1 = sel1() + SelectableObj2 = sel2() + + ' setting variable for XControl + oContext = oDoc + oModel = grid + oWinpeer = oObj.getPeer() + oToolkit = oWinpeer.getToolkit() + + ' setting variable for XWindow + oXWindow = theAccess.getControl(cntrlShape.getControl()) + oCtrlShape = cntrlShape + + ' setting variable for XView + device = oToolkit.createScreenCompatibleDevice(200, 200) + oGraphics = device.createGraphics() + + 'setting variable for XDispatch + dispatchURL = ".uno:FormSlots/moveToNext" + + 'setting variables for XContainer + oElementToInsert = grid.createColumn("TextField") + oElementToInsert.DataField = "Author" + oElementToInsert.Label = "Author" + oContainer = grid + + 'setting variable for XComponent + cntrlShape = oDoc.createInstance("com.sun.star.drawing.ControlShape") + grid = oDoc.createInstance("com.sun.star.form.component.GridControl") + grid.DefaultControl = "com.sun.star.form.control.InteractionGridControl" + cntrlShape.setControl(grid) + drawPage.add(cntrlShape) + + + 'setting variable for XUpdateBroadcaster + bCustomUpdate = True + + oComponentInstance = theAccess.getControl(grid) + + ' Switching to non-design mode + switchDesignMode(oDoc) + + wait(200) + +Exit Sub +ErrHndl: + Test.Exception() +End Sub + +Sub UpdateComponent() + oObj.commit +End Sub + +Sub switchDesignMode(xDoc as Object) +On Error Goto ErrHndl + + Dim frame as Variant, disp as Variant, transf as Object + Dim URL as new com.sun.star.util.URL + Dim noProps() + Dim res as Boolean + + frame = xDoc.getCurrentController().getFrame() + URL.Complete = ".uno:SwitchControlDesignMode" + transf = createUnoService("com.sun.star.util.URLTransformer") + res = transf.parseStrict(URL) + + out.log("URL parsed :" + res) + + disp = frame.queryDispatch(URL, "", com.sun.star.frame.FrameSearchFlag.SELF _ + OR com.sun.star.frame.FrameSearchFlag.CHILDREN) + + out.log("disp get.") + + disp.dispatch(URL, noProps()) +Exit Sub +ErrHndl: + Test.Exception() +End Sub + +' for XBoundComponent +Sub prepareCommit() + Out.Log("prepareCommit() called") + Out.Log("can be checked only interactively") +End Sub + +' for XBoundComponent +Function checkCommit() As Boolean + checkCommit() = True +End Function +</script:module> diff --git a/qadevOOo/tests/basic/mod/dbaccess/SbaXGridControl/script.xlb b/qadevOOo/tests/basic/mod/dbaccess/SbaXGridControl/script.xlb new file mode 100644 index 000000000000..b4f0a13080d7 --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/SbaXGridControl/script.xlb @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="dbaccess_SbaXGridControl" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="dbaccess_SbaXGridControl"/> +"</library:library> diff --git a/qadevOOo/tests/basic/mod/dbaccess/TableWindowAccessibility/dbaccess_TableWindowAccessibility.xba b/qadevOOo/tests/basic/mod/dbaccess/TableWindowAccessibility/dbaccess_TableWindowAccessibility.xba new file mode 100644 index 000000000000..b1db74c7a5cf --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/TableWindowAccessibility/dbaccess_TableWindowAccessibility.xba @@ -0,0 +1,147 @@ +<?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="dbaccess_TableWindowAccessibility" 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 + + +' REQUIRED VARIABLES for interface/service tests: +Global cancelButton As Object +Global queryWindow As Object + + +Sub CreateObj() + +'************************************************************************* +' COMPONENT: +' dbaccess.TableWindowAccessibility +'************************************************************************* +On Error Goto ErrHndl + Dim oMSF As Object, oWin As Object + Dim thRunner As Object, xRoot As Object + Dim tk As Object + + Dim dbSource As Object + dbSource = createUnoService("com.sun.star.sdb.DataSource") + + Dim info(2) As new com.sun.star.beans.PropertyValue + info(0).Name = "JavaDriverClass" + info(0).Value = "org.gjt.mm.mysql.Driver" + info(1).Name = "user" + info(1).Value = jdbcUser + info(2).Name = "password" + info(2).Value = jdbcPassword + dbSource.info = info() + dbSource.URL = jdbcUrl + + Dim dbContext As Object + dbContext = createUnoService("com.sun.star.sdb.DatabaseContext") + + Dim sourceName As String + sourceName = "AAADBSource for dbu-accessibility" + + if dbContext.hasByName(sourceName) then + dbContext.revokeObject(sourceName) + endif + + dbContext.registerObject(sourceName, dbSource) + + Dim connection As Object + connection = dbSource.getIsolatedConnection(jdbcUser, jdbcPassword) + + Dim statement As Object + statement = connection.createStatement() + + statement.executeUpdate("drop table if exists tst_table1") + statement.executeUpdate("drop table if exists tst_table2") + statement.executeUpdate("create table tst_table1 (id1 int)") + statement.executeUpdate("create table tst_table2 (id2 int)") + + Dim defContainer As Object + defContainer = dbSource.getQueryDefinitions() + + Dim newQuery As Object + newQuery = createUnoService("com.sun.star.sdb.QueryDefinition") + newQuery.Command = "select * from tst_table1, tst_table2 where " + _ + "tst_table1.id1=tst_table2.id2" + + defContainer.insertByName("Query1", newQuery) + + oMSF = getProcessServiceManager() + thRunner = oMSF.createInstance("basichelper.ThreadRunner") + tk = createUNOService("com.sun.star.awt.Toolkit") + wait(500) + thRunner.initialize(Array("ExecuteDialog", "com.sun.star.sdb.DatasourceAdministrationDialog")) + wait(3000) + + oWin = tk.getActiveTopWindow() + xRoot = utils.at_getAccessibleObject(oWin) + + Dim pageTabList As Object + pageTabList = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.PAGE_TAB_LIST) + + pageTabList.selectAccessibleChild(3) + wait(500) + + Dim editQueryButton As Object + editQueryButton = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.PUSH_BUTTON, "Edit Query") + + cancelButton = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.PUSH_BUTTON, "Cancel") + + editQueryButton.doAccessibleAction(0) + wait(1000) + + oWin = tk.getActiveTopWindow() + queryWindow = oWin + xRoot = utils.at_getAccessibleObject(oWin) + + oObj = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.PANEL) + +Exit Sub +ErrHndl: + Test.Exception() +End Sub + +Sub DisposeObj() + utils.closeObject(queryWindow) + if NOT isNull(cancelButton) then + cancelButton.doAccessibleAction(0) + wait(1000) + End If +End Sub + +Sub fireEvent() +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/mod/dbaccess/TableWindowAccessibility/script.xlb b/qadevOOo/tests/basic/mod/dbaccess/TableWindowAccessibility/script.xlb new file mode 100644 index 000000000000..cb2d0914c866 --- /dev/null +++ b/qadevOOo/tests/basic/mod/dbaccess/TableWindowAccessibility/script.xlb @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="dbaccess_TableWindowAccessibility" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="dbaccess_TableWindowAccessibility"/> +"</library:library> |