summaryrefslogtreecommitdiff
path: root/qadevOOo/tests/basic/ifc/sheet/XCellRangeMovement/sheet_XCellRangeMovement.xba
diff options
context:
space:
mode:
Diffstat (limited to 'qadevOOo/tests/basic/ifc/sheet/XCellRangeMovement/sheet_XCellRangeMovement.xba')
-rw-r--r--qadevOOo/tests/basic/ifc/sheet/XCellRangeMovement/sheet_XCellRangeMovement.xba167
1 files changed, 167 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..8d420350ce38
--- /dev/null
+++ b/qadevOOo/tests/basic/ifc/sheet/XCellRangeMovement/sheet_XCellRangeMovement.xba
@@ -0,0 +1,167 @@
+<?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">
+
+
+'*************************************************************************
+'
+' 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.
+'
+'*************************************************************************
+'*************************************************************************
+
+
+
+
+
+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>