diff options
Diffstat (limited to 'qadevOOo/tests/basic/ifc/sheet/XCellRangeMovement/sheet_XCellRangeMovement.xba')
-rw-r--r-- | qadevOOo/tests/basic/ifc/sheet/XCellRangeMovement/sheet_XCellRangeMovement.xba | 201 |
1 files changed, 201 insertions, 0 deletions
diff --git a/qadevOOo/tests/basic/ifc/sheet/XCellRangeMovement/sheet_XCellRangeMovement.xba b/qadevOOo/tests/basic/ifc/sheet/XCellRangeMovement/sheet_XCellRangeMovement.xba new file mode 100644 index 000000000000..d7f977d2ff24 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/sheet/XCellRangeMovement/sheet_XCellRangeMovement.xba @@ -0,0 +1,201 @@ +<?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="sheet_XCellRangeMovement" script:language="StarBasic"> + + +'************************************************************************* +'* +'* $RCSfile: sheet_XCellRangeMovement.xba,v $ +'* +'* $Revision: 1.1 $ +'* +'* last change:$Date: 2003-01-27 17:52:37 $ +'* +'* The Contents of this file are made available subject to the terms of +'* either of the following licenses +'* +'* - GNU Lesser General Public License Version 2.1 +'* - Sun Industry Standards Source License Version 1.1 +'* +'* Sun Microsystems Inc., October, 2000 +'* +'* GNU Lesser General Public License Version 2.1 +'* ============================================= +'* Copyright 2000 by Sun Microsystems, Inc. +'* 901 San Antonio Road, Palo Alto, CA 94303, USA +'* +'* This library is free software; you can redistribute it and/or +'* modify it under the terms of the GNU Lesser General Public +'* License version 2.1, as published by the Free Software Foundation. +'* +'* This library 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 for more details. +'* +'* You should have received a copy of the GNU Lesser General Public +'* License along with this library; if not, write to the Free Software +'* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +'* MA 02111-1307 USA +'* +'* +'* Sun Industry Standards Source License Version 1.1 +'* ================================================= +'* The contents of this file are subject to the Sun Industry Standards +'* Source License Version 1.1 (the "License"); You may not use this file +'* except in compliance with the License. You may obtain a copy of the +'* License at http://www.openoffice.org/license.html. +'* +'* Software provided under this License is provided on an "AS IS" basis, +'* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +'* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +'* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +'* See the License for the specific provisions governing your rights and +'* obligations concerning the Software. +'* +'* The Initial Developer of the Original Code is: Sun Microsystems, Inc. +'* +'* Copyright: 2000 by Sun Microsystems, Inc. +'* +'* All Rights Reserved. +'* +'* Contributor(s): _______________________________________ +'* +'* +'************************************************************************* +'************************************************************************* + + + + + +Sub RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.sheet.XCellRangeMovement +'************************************************************************* +On Error Goto ErrHndl + Dim bOK As Boolean + + Out.Log("Prepearing test...") + for i = 0 to 5 + for j = 0 to 5 + oObj.getCellByPosition(j, i).Value = i * 6 + j + next j + next i + + Test.StartMethod("insertCells()") + bOK = true + Dim newCellAddress As New com.sun.star.table.CellRangeAddress + newCellAddress.Sheet = 0 + newCellAddress.StartColumn = 1 + newCellAddress.StartRow = 1 + newCellAddress.EndColumn = 1 + newCellAddress.EndRow = 1 + oObj.insertCells(newCellAddress, com.sun.star.sheet.CellInsertMode.DOWN) + bOK = bOK AND oObj.getCellByPosition(1, 1).String = "" + bOK = bOK AND oObj.getCellByPosition(2, 2).Value = 14 + bOK = bOK AND oObj.getCellByPosition(1, 2).Value = 7 + bOK = bOK AND oObj.getCellByPosition(0, 2).Value = 12 + + oObj.insertCells(newCellAddress, com.sun.star.sheet.CellInsertMode.RIGHT) + bOK = bOK AND oObj.getCellByPosition(1, 1).String = "" + bOK = bOK AND oObj.getCellByPosition(3, 0).Value = 3 + bOK = bOK AND oObj.getCellByPosition(3, 1).Value = 8 + bOK = bOK AND oObj.getCellByPosition(3, 2).Value = 15 + + oObj.insertCells(newCellAddress, com.sun.star.sheet.CellInsertMode.ROWS) + bOK = bOK AND oObj.getCellByPosition(1, 1).String = "" + bOK = bOK AND oObj.getCellByPosition(4, 0).Value = 4 + bOK = bOK AND oObj.getCellByPosition(4, 1).String = "" + bOK = bOK AND oObj.getCellByPosition(4, 2).Value = 9 + + oObj.insertCells(newCellAddress, com.sun.star.sheet.CellInsertMode.COLUMNS) + bOK = bOK AND oObj.getCellByPosition(1, 1).String = "" + bOK = bOK AND oObj.getCellByPosition(0, 5).Value = 24 + bOK = bOK AND oObj.getCellByPosition(1, 5).String = "" + bOK = bOK AND oObj.getCellByPosition(2, 5).Value = 19 + + Test.MethodTested("insertCells()", bOK) + + Test.StartMethod("removeRange()") + bOK = true + oObj.removeRange(newCellAddress, com.sun.star.sheet.CellDeleteMode.ROWS) + bOK = bOK AND oObj.getCellByPosition(1, 1).String = "" + bOK = bOK AND oObj.getCellByPosition(4, 0).Value = 3 + bOK = bOK AND oObj.getCellByPosition(4, 1).Value = 8 + bOK = bOK AND oObj.getCellByPosition(4, 2).Value = 15 + + oObj.removeRange(newCellAddress, com.sun.star.sheet.CellDeleteMode.COLUMNS) + bOK = bOK AND oObj.getCellByPosition(1, 1).String = "" + bOK = bOK AND oObj.getCellByPosition(4, 0).Value = 4 + bOK = bOK AND oObj.getCellByPosition(4, 1).Value = 9 + bOK = bOK AND oObj.getCellByPosition(4, 2).Value = 16 + + oObj.removeRange(newCellAddress, com.sun.star.sheet.CellDeleteMode.UP) + bOK = bOK AND oObj.getCellByPosition(1, 1).Value = 7 + bOK = bOK AND oObj.getCellByPosition(1, 2).Value = 13 + bOK = bOK AND oObj.getCellByPosition(1, 3).Value = 19 + bOK = bOK AND oObj.getCellByPosition(0, 3).Value = 18 + + oObj.removeRange(newCellAddress, com.sun.star.sheet.CellDeleteMode.LEFT) + bOK = bOK AND oObj.getCellByPosition(1, 1).String = "" + bOK = bOK AND oObj.getCellByPosition(0, 1).Value = 6 + bOK = bOK AND oObj.getCellByPosition(1, 1).String = "" + bOK = bOK AND oObj.getCellByPosition(2, 1).Value = 8 + + Test.MethodTested("removeRange()", bOK) + + Test.StartMethod("moveRange()") + bOK = true + newCellAddress.Sheet = 0 + newCellAddress.StartColumn = 0 + newCellAddress.StartRow = 0 + newCellAddress.EndColumn = 1 + newCellAddress.EndRow = 1 + Dim sCell As New com.sun.star.table.CellAddress + sCell.Sheet = 0 + sCell.Column = 3 + sCell.Row = 3 + oObj.moveRange(sCell, newCellAddress) + + bOK = bOK AND oObj.getCellByPosition(0, 0).String = "" + bOK = bOK AND oObj.getCellByPosition(1, 0).String = "" + bOK = bOK AND oObj.getCellByPosition(0, 1).String = "" + bOK = bOK AND oObj.getCellByPosition(1, 1).String = "" + + bOK = bOK AND oObj.getCellByPosition(3, 3).Value = 0 + bOK = bOK AND oObj.getCellByPosition(3, 4).Value = 6 + bOK = bOK AND oObj.getCellByPosition(4, 3).Value = 1 + bOK = bOK AND oObj.getCellByPosition(4, 4).String = "" + + Test.MethodTested("moveRange()", bOK) + + Test.StartMethod("copyRange()") + bOK = true + newCellAddress.Sheet = 0 + newCellAddress.StartColumn = 2 + newCellAddress.StartRow = 2 + newCellAddress.EndColumn = 3 + newCellAddress.EndRow = 3 + sCell.Sheet = 0 + sCell.Column = 0 + sCell.Row = 0 + + oObj.copyRange(sCell, newCellAddress) + + bOK = bOK AND oObj.getCellByPosition(0, 0).Value = oObj.getCellByPosition(2, 2).Value + bOK = bOK AND oObj.getCellByPosition(0, 1).Value = oObj.getCellByPosition(2, 3).Value + bOK = bOK AND oObj.getCellByPosition(1, 0).Value = oObj.getCellByPosition(3, 2).Value + bOK = bOK AND oObj.getCellByPosition(1, 1).Value = oObj.getCellByPosition(3, 3).Value + + Test.MethodTested("copyRange()", bOK) + +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> |