summaryrefslogtreecommitdiffstats
path: root/test/source/table
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /test/source/table
parentInitial commit. (diff)
downloadlibreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz
libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/source/table')
-rw-r--r--test/source/table/tablecolumn.cxx53
-rw-r--r--test/source/table/tablerow.cxx40
-rw-r--r--test/source/table/xcell.cxx79
-rw-r--r--test/source/table/xcellcursor.cxx126
-rw-r--r--test/source/table/xcellrange.cxx56
-rw-r--r--test/source/table/xcolumnrowrange.cxx36
-rw-r--r--test/source/table/xtablechart.cxx60
-rw-r--r--test/source/table/xtablecharts.cxx39
-rw-r--r--test/source/table/xtablechartssupplier.cxx31
-rw-r--r--test/source/table/xtablecolumns.cxx173
-rw-r--r--test/source/table/xtablerows.cxx55
11 files changed, 748 insertions, 0 deletions
diff --git a/test/source/table/tablecolumn.cxx b/test/source/table/tablecolumn.cxx
new file mode 100644
index 000000000..08a008ce8
--- /dev/null
+++ b/test/source/table/tablecolumn.cxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/table/tablecolumn.hxx>
+#include <test/unoapi_property_testers.hxx>
+#include <comphelper/types.hxx>
+#include <rtl/ustring.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/table/XCellRange.hpp>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <cppunit/TestAssert.h>
+
+using namespace css;
+
+namespace apitest
+{
+void TableColumn::testTableColumnProperties()
+{
+ uno::Reference<beans::XPropertySet> xPS(init(), uno::UNO_QUERY_THROW);
+
+ OUString aPropName = "Width";
+ testLongProperty(xPS, aPropName);
+
+ // currently changing the value to false has no effect
+ aPropName = "OptimalWidth";
+ uno::Reference<table::XCellRange> xCR(m_xSheet, uno::UNO_QUERY_THROW);
+ xCR->getCellByPosition(0, 0)->setFormula("That's a pretty long text.");
+ const sal_Int64 nWidthBefore = ::comphelper::getINT64(xPS->getPropertyValue("Width"));
+ xPS->setPropertyValue(aPropName, uno::Any(true));
+ CPPUNIT_ASSERT(::comphelper::getBOOL(xPS->getPropertyValue(aPropName)));
+ const sal_Int64 nWidthAfter = ::comphelper::getINT64(xPS->getPropertyValue("Width"));
+ CPPUNIT_ASSERT(nWidthBefore != nWidthAfter);
+
+ aPropName = "IsVisible";
+ testBooleanProperty(xPS, aPropName);
+
+ aPropName = "IsStartOfNewPage";
+ testBooleanProperty(xPS, aPropName);
+}
+
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/test/source/table/tablerow.cxx b/test/source/table/tablerow.cxx
new file mode 100644
index 000000000..2d14c1625
--- /dev/null
+++ b/test/source/table/tablerow.cxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/table/tablerow.hxx>
+#include <test/unoapi_property_testers.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+using namespace css;
+
+namespace apitest
+{
+void TableRow::testTableRowProperties()
+{
+ uno::Reference<beans::XPropertySet> xPS(init(), uno::UNO_QUERY_THROW);
+
+ OUString aPropName;
+
+ aPropName = "Height";
+ testLongProperty(xPS, aPropName);
+
+ aPropName = "OptimalHeight";
+ testBooleanProperty(xPS, aPropName);
+
+ aPropName = "IsVisible";
+ testBooleanProperty(xPS, aPropName);
+
+ aPropName = "IsStartOfNewPage";
+ testBooleanProperty(xPS, aPropName);
+}
+
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/test/source/table/xcell.cxx b/test/source/table/xcell.cxx
new file mode 100644
index 000000000..8540117a5
--- /dev/null
+++ b/test/source/table/xcell.cxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+* This file is part of the LibreOffice project.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*/
+
+#include <test/table/xcell.hxx>
+
+#include <com/sun/star/table/XCell.hpp>
+#include <com/sun/star/table/CellContentType.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <cppunit/TestAssert.h>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+namespace apitest
+{
+void XCell::testGetError()
+{
+ uno::Reference<table::XCell> xCell(init(), UNO_QUERY_THROW);
+ const sal_Int32 nCorrectFormula = xCell->getError();
+ xCell->setFormula("=sqrt(-2)");
+ const sal_Int32 nIncorrectFormula = xCell->getError();
+
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Successfully able to get Error", sal_Int32(0), nCorrectFormula);
+ CPPUNIT_ASSERT_MESSAGE("Successfully able to get Error", (nIncorrectFormula != 0));
+}
+
+void XCell::testGetType()
+{
+ uno::Reference<table::XCell> xCell(init(), UNO_QUERY_THROW);
+ bool aResult = true;
+
+ if (xCell->getType() == table::CellContentType_EMPTY)
+ aResult &= true;
+ else if (xCell->getType() == table::CellContentType_VALUE)
+ aResult &= true;
+ else if (xCell->getType() == table::CellContentType_TEXT)
+ aResult &= true;
+ else if (xCell->getType() == table::CellContentType_FORMULA)
+ aResult &= true;
+ else
+ aResult = false;
+
+ CPPUNIT_ASSERT_MESSAGE("Successfully able to get Type", aResult);
+}
+
+void XCell::testSetGetFormula()
+{
+ uno::Reference<table::XCell> xCell(init(), UNO_QUERY_THROW);
+ OUString aFormula = "=2+2";
+
+ xCell->setFormula(aFormula);
+
+ OUString aFormula2 = xCell->getFormula();
+
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Successfully able to set and get Formula", aFormula, aFormula2);
+}
+
+void XCell::testSetGetValue()
+{
+ uno::Reference<table::XCell> xCell(init(), UNO_QUERY_THROW);
+ double nInValue = 222.555;
+
+ xCell->setValue(nInValue);
+
+ double nCellValue = xCell->getValue();
+
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Successfully able to set and get Value", nInValue, nCellValue);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/test/source/table/xcellcursor.cxx b/test/source/table/xcellcursor.cxx
new file mode 100644
index 000000000..6f6cc33e0
--- /dev/null
+++ b/test/source/table/xcellcursor.cxx
@@ -0,0 +1,126 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+* This file is part of the LibreOffice project.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*/
+
+#include <test/table/xcellcursor.hxx>
+
+#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
+#include <com/sun/star/sheet/XSheetCellCursor.hpp>
+#include <com/sun/star/sheet/XSheetCellRange.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/table/CellRangeAddress.hpp>
+#include <com/sun/star/table/XCellCursor.hpp>
+#include <com/sun/star/table/XCellRange.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <cppunit/TestAssert.h>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+namespace apitest
+{
+void XCellCursor::testGoToNext()
+{
+ uno::Reference<table::XCellCursor> xCellCursor(init(), UNO_QUERY_THROW);
+
+ uno::Reference<sheet::XCellRangeAddressable> xCellRangeAddressable(xCellCursor,
+ UNO_QUERY_THROW);
+ table::CellRangeAddress aCellRangeAddr = xCellRangeAddressable->getRangeAddress();
+ const sal_Int32 startCol = aCellRangeAddr.StartColumn;
+
+ xCellCursor->gotoNext();
+
+ aCellRangeAddr = xCellRangeAddressable->getRangeAddress();
+ const sal_Int32 startCol2 = aCellRangeAddr.StartColumn;
+
+ CPPUNIT_ASSERT_MESSAGE("Successfully able to go to Next", startCol != startCol2);
+}
+
+void XCellCursor::testGoToOffset()
+{
+ uno::Reference<table::XCellCursor> xCellCursor(init(), UNO_QUERY_THROW);
+
+ uno::Reference<sheet::XCellRangeAddressable> xCellRangeAddressable(xCellCursor,
+ UNO_QUERY_THROW);
+ table::CellRangeAddress aCellRangeAddr = xCellRangeAddressable->getRangeAddress();
+ const sal_Int32 startRow = aCellRangeAddr.StartRow;
+ const sal_Int32 startCol = aCellRangeAddr.StartColumn;
+
+ xCellCursor->gotoOffset(4, 4);
+
+ aCellRangeAddr = xCellRangeAddressable->getRangeAddress();
+ const sal_Int32 startRow2 = aCellRangeAddr.StartRow;
+ const sal_Int32 startCol2 = aCellRangeAddr.StartColumn;
+
+ CPPUNIT_ASSERT_MESSAGE("Successfully able to go to Offset",
+ (startCol != startCol2) || (startRow == startRow2));
+}
+
+void XCellCursor::testGoToPrevious()
+{
+ uno::Reference<table::XCellCursor> xCellCursor(init(), UNO_QUERY_THROW);
+
+ uno::Reference<sheet::XCellRangeAddressable> xCellRangeAddressable(xCellCursor,
+ UNO_QUERY_THROW);
+ xCellCursor->gotoOffset(4, 4);
+
+ table::CellRangeAddress aCellRangeAddr = xCellRangeAddressable->getRangeAddress();
+ const sal_Int32 startCol = aCellRangeAddr.StartColumn;
+
+ xCellCursor->gotoPrevious();
+
+ aCellRangeAddr = xCellRangeAddressable->getRangeAddress();
+ const sal_Int32 startCol2 = aCellRangeAddr.StartColumn;
+ CPPUNIT_ASSERT_MESSAGE("Successfully able to go to Previous", startCol != startCol2);
+}
+
+void XCellCursor::testGoToStart()
+{
+ uno::Reference<table::XCellCursor> xCellCursor(init(), UNO_QUERY_THROW);
+
+ uno::Reference<sheet::XCellRangeAddressable> xCellRangeAddressable(xCellCursor,
+ UNO_QUERY_THROW);
+ xCellCursor->gotoStart();
+
+ table::CellRangeAddress aCellRangeAddr = xCellRangeAddressable->getRangeAddress();
+
+ const sal_Int32 startRow = aCellRangeAddr.StartRow;
+ const sal_Int32 startCol = aCellRangeAddr.StartColumn;
+ const sal_Int32 endRow = aCellRangeAddr.EndRow;
+ const sal_Int32 endCol = aCellRangeAddr.EndColumn;
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Successfully able to go to Start", startCol, endCol);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Successfully able to go to Start", endRow, startRow);
+}
+
+void XCellCursor::testGoToEnd()
+{
+ uno::Reference<table::XCellCursor> xCellCursor(init(), UNO_QUERY_THROW);
+ uno::Reference<sheet::XSpreadsheet> xSpreadsheet(getXSpreadsheet(), UNO_QUERY_THROW);
+ uno::Reference<table::XCellRange> xCellRange(xCellCursor, UNO_QUERY_THROW);
+ xCellRange = xSpreadsheet->getCellRangeByName("$A$1:$g$7");
+ uno::Reference<sheet::XSheetCellRange> xSheetCellRange(xCellCursor, UNO_QUERY_THROW);
+ uno::Reference<sheet::XSheetCellCursor> xSheetCellCursor(xCellCursor, UNO_QUERY_THROW);
+ xSheetCellCursor = xSpreadsheet->createCursorByRange(xSheetCellRange);
+ uno::Reference<sheet::XCellRangeAddressable> xCellRangeAddressable(xCellCursor,
+ UNO_QUERY_THROW);
+
+ xCellCursor->gotoEnd();
+
+ table::CellRangeAddress aCellRangeAddr = xCellRangeAddressable->getRangeAddress();
+ const sal_Int32 startRow = aCellRangeAddr.StartRow;
+ const sal_Int32 startCol = aCellRangeAddr.StartColumn;
+ const sal_Int32 endRow = aCellRangeAddr.EndRow;
+ const sal_Int32 endCol = aCellRangeAddr.EndColumn;
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Successfully able to go to End", startCol, endCol);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Successfully able to go to End", endRow, startRow);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/test/source/table/xcellrange.cxx b/test/source/table/xcellrange.cxx
new file mode 100644
index 000000000..392904078
--- /dev/null
+++ b/test/source/table/xcellrange.cxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/table/xcellrange.hxx>
+
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/table/XCell.hpp>
+#include <com/sun/star/table/XCellRange.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <cppunit/TestAssert.h>
+
+using namespace css;
+
+namespace apitest
+{
+void XCellRange::testGetCellByPosition()
+{
+ uno::Reference<table::XCellRange> xCR(init(), uno::UNO_QUERY_THROW);
+
+ uno::Reference<table::XCell> xCell(xCR->getCellByPosition(0, 0), uno::UNO_SET_THROW);
+ CPPUNIT_ASSERT(xCell.is());
+
+ CPPUNIT_ASSERT_THROW(xCR->getCellByPosition(-1, 1), lang::IndexOutOfBoundsException);
+}
+
+void XCellRange::testGetCellRangeByName()
+{
+ uno::Reference<table::XCellRange> xCR(init(), uno::UNO_QUERY_THROW);
+
+ uno::Reference<table::XCellRange> xCellRange(xCR->getCellRangeByName(m_aRangeName),
+ uno::UNO_SET_THROW);
+ CPPUNIT_ASSERT(xCellRange.is());
+}
+
+void XCellRange::testGetCellRangeByPosition()
+{
+ uno::Reference<table::XCellRange> xCR(init(), uno::UNO_QUERY_THROW);
+
+ uno::Reference<table::XCellRange> xCellRange(xCR->getCellRangeByPosition(0, 0, 0, 0),
+ uno::UNO_SET_THROW);
+ CPPUNIT_ASSERT(xCellRange.is());
+
+ CPPUNIT_ASSERT_THROW(xCR->getCellRangeByPosition(-1, 0, -1, 1),
+ lang::IndexOutOfBoundsException);
+}
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/test/source/table/xcolumnrowrange.cxx b/test/source/table/xcolumnrowrange.cxx
new file mode 100644
index 000000000..748a4825d
--- /dev/null
+++ b/test/source/table/xcolumnrowrange.cxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+* This file is part of the LibreOffice project.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*/
+
+#include <test/table/xcolumnrowrange.hxx>
+
+#include <com/sun/star/table/XColumnRowRange.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <cppunit/TestAssert.h>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+namespace apitest
+{
+void XColumnRowRange::testGetColumns()
+{
+ uno::Reference<table::XColumnRowRange> xColumnRowRange(init(), UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xColumnRowRange->getColumns());
+}
+
+void XColumnRowRange::testGetRows()
+{
+ uno::Reference<table::XColumnRowRange> xColumnRowRange(init(), UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xColumnRowRange->getRows());
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/test/source/table/xtablechart.cxx b/test/source/table/xtablechart.cxx
new file mode 100644
index 000000000..38a43eee6
--- /dev/null
+++ b/test/source/table/xtablechart.cxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/table/xtablechart.hxx>
+#include <test/cppunitasserthelper.hxx>
+
+#include <com/sun/star/table/CellRangeAddress.hpp>
+#include <com/sun/star/table/XTableChart.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <cppunit/TestAssert.h>
+
+using namespace css;
+
+namespace apitest
+{
+void XTableChart::testGetSetHasColumnHeaders()
+{
+ uno::Reference<table::XTableChart> xTC(init(), uno::UNO_QUERY_THROW);
+
+ xTC->setHasColumnHeaders(false);
+ CPPUNIT_ASSERT(!xTC->getHasColumnHeaders());
+
+ xTC->setHasColumnHeaders(true);
+ CPPUNIT_ASSERT(xTC->getHasColumnHeaders());
+}
+
+void XTableChart::testGetSetHasRowHeaders()
+{
+ uno::Reference<table::XTableChart> xTC(init(), uno::UNO_QUERY_THROW);
+
+ xTC->setHasRowHeaders(false);
+ CPPUNIT_ASSERT(!xTC->getHasRowHeaders());
+
+ xTC->setHasRowHeaders(true);
+ CPPUNIT_ASSERT(xTC->getHasRowHeaders());
+}
+
+void XTableChart::testGetSetRanges()
+{
+ uno::Reference<table::XTableChart> xTC(init(), uno::UNO_QUERY_THROW);
+
+ uno::Sequence<table::CellRangeAddress> aCRA = xTC->getRanges();
+ aCRA.getArray()[0].EndRow = 1;
+
+ xTC->setRanges(aCRA);
+
+ CPPUNIT_ASSERT_EQUAL(aCRA[0], xTC->getRanges()[0]);
+}
+
+} // namespace apitest
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/test/source/table/xtablecharts.cxx b/test/source/table/xtablecharts.cxx
new file mode 100644
index 000000000..15aa710ff
--- /dev/null
+++ b/test/source/table/xtablecharts.cxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/table/xtablecharts.hxx>
+
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/table/CellRangeAddress.hpp>
+#include <com/sun/star/table/XTableCharts.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <cppunit/TestAssert.h>
+
+using namespace css;
+
+namespace apitest
+{
+void XTableCharts::testAddNewRemoveByName()
+{
+ uno::Reference<table::XTableCharts> xTC(init(), uno::UNO_QUERY_THROW);
+
+ uno::Sequence<table::CellRangeAddress> aRanges{ table::CellRangeAddress(0, 1, 1, 14, 4) };
+ xTC->addNewByName("XTableCharts", awt::Rectangle(500, 3000, 25000, 11000), aRanges, true, true);
+ CPPUNIT_ASSERT(xTC->hasByName("XTableCharts"));
+
+ xTC->removeByName("XTableCharts");
+ CPPUNIT_ASSERT(!xTC->hasByName("XTableCharts"));
+}
+
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/test/source/table/xtablechartssupplier.cxx b/test/source/table/xtablechartssupplier.cxx
new file mode 100644
index 000000000..047695dfc
--- /dev/null
+++ b/test/source/table/xtablechartssupplier.cxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+* This file is part of the LibreOffice project.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*/
+
+#include <test/table/xtablechartssupplier.hxx>
+
+#include <com/sun/star/table/XTableChartsSupplier.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <cppunit/TestAssert.h>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+namespace apitest
+{
+void XTableChartsSupplier::testGetCharts()
+{
+ uno::Reference<table::XTableChartsSupplier> xTableChartsSupplier(init(), UNO_QUERY_THROW);
+
+ CPPUNIT_ASSERT_MESSAGE("Successfully able to Get Charts", xTableChartsSupplier->getCharts());
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/test/source/table/xtablecolumns.cxx b/test/source/table/xtablecolumns.cxx
new file mode 100644
index 000000000..0d72a8dd1
--- /dev/null
+++ b/test/source/table/xtablecolumns.cxx
@@ -0,0 +1,173 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/table/xtablecolumns.hxx>
+
+#include <com/sun/star/table/XCellRange.hpp>
+#include <com/sun/star/table/XTableColumns.hpp>
+#include <com/sun/star/text/XSimpleText.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <cppunit/TestAssert.h>
+
+using namespace css;
+
+namespace apitest
+{
+void XTableColumns::testInsertByIndex()
+{
+ uno::Reference<table::XTableColumns> xTC(init(), uno::UNO_QUERY_THROW);
+ uno::Reference<table::XCellRange> xCR(m_xSheet, uno::UNO_QUERY_THROW);
+
+ // insert one column at position one
+ xTC->insertByIndex(1, 1);
+ CPPUNIT_ASSERT_EQUAL(OUString("0a"), getCellText(xCR->getCellByPosition(0, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("0b"), getCellText(xCR->getCellByPosition(0, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(1, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(1, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString("1a"), getCellText(xCR->getCellByPosition(2, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("1b"), getCellText(xCR->getCellByPosition(2, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString("2a"), getCellText(xCR->getCellByPosition(3, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("2b"), getCellText(xCR->getCellByPosition(3, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(4, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(4, 1)));
+
+ // insert one column at position zero
+ xTC->insertByIndex(0, 1);
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(0, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(0, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString("0a"), getCellText(xCR->getCellByPosition(1, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("0b"), getCellText(xCR->getCellByPosition(1, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(2, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(2, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString("1a"), getCellText(xCR->getCellByPosition(3, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("1b"), getCellText(xCR->getCellByPosition(3, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString("2a"), getCellText(xCR->getCellByPosition(4, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("2b"), getCellText(xCR->getCellByPosition(4, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(5, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(5, 1)));
+
+ // insert two columns at position zero
+ xTC->insertByIndex(0, 2);
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(0, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(0, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(1, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(1, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(2, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(2, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString("0a"), getCellText(xCR->getCellByPosition(3, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("0b"), getCellText(xCR->getCellByPosition(3, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(4, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(4, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString("1a"), getCellText(xCR->getCellByPosition(5, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("1b"), getCellText(xCR->getCellByPosition(5, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString("2a"), getCellText(xCR->getCellByPosition(6, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("2b"), getCellText(xCR->getCellByPosition(6, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(7, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(7, 1)));
+}
+
+void XTableColumns::testInsertByIndexWithNegativeIndex()
+{
+ uno::Reference<table::XTableColumns> xTC(init(), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_THROW(xTC->insertByIndex(-1, 1), uno::RuntimeException);
+}
+
+void XTableColumns::testInsertByIndexWithNoColumn()
+{
+ uno::Reference<table::XTableColumns> xTC(init(), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_THROW(xTC->insertByIndex(0, 0), uno::RuntimeException);
+}
+
+void XTableColumns::testInsertByIndexWithOutOfBoundIndex()
+{
+ uno::Reference<table::XTableColumns> xTC(init(), uno::UNO_QUERY_THROW);
+
+ CPPUNIT_ASSERT_THROW(xTC->insertByIndex(xTC->getCount(), 1), uno::RuntimeException);
+}
+
+void XTableColumns::testRemoveByIndex()
+{
+ uno::Reference<table::XTableColumns> xTC(init(), uno::UNO_QUERY_THROW);
+ uno::Reference<table::XCellRange> xCR(m_xSheet, uno::UNO_QUERY_THROW);
+
+ xTC->insertByIndex(1, 1); // insert one column at position one
+ xTC->insertByIndex(0, 1); // insert one column at position zero
+ xTC->insertByIndex(0, 2); // insert two columns at position zero
+
+ // remove two columns at position zero
+ xTC->removeByIndex(0, 2);
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(0, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(0, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString("0a"), getCellText(xCR->getCellByPosition(1, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("0b"), getCellText(xCR->getCellByPosition(1, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(2, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(2, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString("1a"), getCellText(xCR->getCellByPosition(3, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("1b"), getCellText(xCR->getCellByPosition(3, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString("2a"), getCellText(xCR->getCellByPosition(4, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("2b"), getCellText(xCR->getCellByPosition(4, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(5, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(5, 1)));
+
+ // remove one column at position zero
+ xTC->removeByIndex(0, 1);
+ CPPUNIT_ASSERT_EQUAL(OUString("0a"), getCellText(xCR->getCellByPosition(0, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("0b"), getCellText(xCR->getCellByPosition(0, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(1, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(1, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString("1a"), getCellText(xCR->getCellByPosition(2, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("1b"), getCellText(xCR->getCellByPosition(2, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString("2a"), getCellText(xCR->getCellByPosition(3, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("2b"), getCellText(xCR->getCellByPosition(3, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(4, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(4, 1)));
+
+ // remove one column at position one
+ xTC->removeByIndex(1, 1);
+ CPPUNIT_ASSERT_EQUAL(OUString("0a"), getCellText(xCR->getCellByPosition(0, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("0b"), getCellText(xCR->getCellByPosition(0, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString("1a"), getCellText(xCR->getCellByPosition(1, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("1b"), getCellText(xCR->getCellByPosition(1, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString("2a"), getCellText(xCR->getCellByPosition(2, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("2b"), getCellText(xCR->getCellByPosition(2, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(3, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(3, 1)));
+}
+
+void XTableColumns::testRemoveByIndexWithNegativeIndex()
+{
+ uno::Reference<table::XTableColumns> xTC(init(), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_THROW(xTC->removeByIndex(-1, 1), uno::RuntimeException);
+}
+
+void XTableColumns::testRemoveByIndexWithNoColumn()
+{
+ uno::Reference<table::XTableColumns> xTC(init(), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_THROW(xTC->removeByIndex(0, 0), uno::RuntimeException);
+}
+
+void XTableColumns::testRemoveByIndexWithOutOfBoundIndex()
+{
+ uno::Reference<table::XTableColumns> xTC(init(), uno::UNO_QUERY_THROW);
+
+ CPPUNIT_ASSERT_THROW(xTC->removeByIndex(xTC->getCount(), 1), uno::RuntimeException);
+}
+
+OUString XTableColumns::getCellText(const uno::Reference<table::XCell>& r_xCell)
+{
+ uno::Reference<text::XSimpleText> xST(r_xCell, uno::UNO_QUERY_THROW);
+ return xST->getString();
+}
+
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/test/source/table/xtablerows.cxx b/test/source/table/xtablerows.cxx
new file mode 100644
index 000000000..c241b2bb8
--- /dev/null
+++ b/test/source/table/xtablerows.cxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/table/xtablerows.hxx>
+
+#include <com/sun/star/table/XCellRange.hpp>
+#include <com/sun/star/table/XTableRows.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <cppunit/TestAssert.h>
+
+using namespace css;
+using namespace css::uno;
+
+namespace apitest
+{
+void XTableRows::testInsertByIndex()
+{
+ uno::Reference<table::XCellRange> xCellRange(getXCellRange(), uno::UNO_QUERY_THROW);
+ xCellRange->getCellByPosition(0, 0)->setValue(17);
+ xCellRange->getCellByPosition(0, 1)->setValue(15);
+
+ uno::Reference<table::XTableRows> xTableRows(init(), uno::UNO_QUERY_THROW);
+ xTableRows->removeByIndex(0, 1);
+
+ xTableRows->insertByIndex(0, 1);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(xCellRange->getCellByPosition(0, 1)->getValue(), 15.0, 0.1);
+
+ CPPUNIT_ASSERT_THROW(xTableRows->insertByIndex(-1, 1), uno::RuntimeException);
+}
+
+void XTableRows::testRemoveByIndex()
+{
+ uno::Reference<table::XCellRange> xCellRange(getXCellRange(), uno::UNO_QUERY_THROW);
+ xCellRange->getCellByPosition(0, 0)->setValue(17);
+ xCellRange->getCellByPosition(0, 1)->setValue(15);
+
+ uno::Reference<table::XTableRows> xTableRows(init(), uno::UNO_QUERY_THROW);
+ xTableRows->removeByIndex(0, 1);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(xCellRange->getCellByPosition(0, 0)->getValue(), 15.0, 0.1);
+
+ CPPUNIT_ASSERT_THROW(xTableRows->removeByIndex(-1, 1), uno::RuntimeException);
+}
+
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */