diff options
author | Jens Carl <j.carl43@gmx.de> | 2018-12-19 08:22:57 +0000 |
---|---|---|
committer | Jens Carl <j.carl43@gmx.de> | 2018-12-19 18:45:45 +0100 |
commit | 1a4a78efc7c8bc06de958ce64c6be5f5ef3f1e2d (patch) | |
tree | ace1bfd95cc8e30bba98da80828ee0d686336fdc /test | |
parent | 5829e8308e40203a83cfb5b91fc81e14e0630258 (diff) |
tdf#45904 Move XTableRows Java tests to C++
Move XTableRows Java tests to C++ for ScTableRowsObj.
Change-Id: I765d213e0a3e95a3925f1fc179a8a3f6c6611739
Reviewed-on: https://gerrit.libreoffice.org/65398
Tested-by: Jenkins
Reviewed-by: Jens Carl <j.carl43@gmx.de>
Diffstat (limited to 'test')
-rw-r--r-- | test/Library_subsequenttest.mk | 1 | ||||
-rw-r--r-- | test/source/table/xtablerows.cxx | 55 |
2 files changed, 56 insertions, 0 deletions
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk index 88edfeed9741..8895df3e24a0 100644 --- a/test/Library_subsequenttest.mk +++ b/test/Library_subsequenttest.mk @@ -157,6 +157,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\ test/source/table/xcellcursor \ test/source/table/xcolumnrowrange \ test/source/table/xtablechartssupplier \ + test/source/table/xtablerows \ test/source/text/xtext \ test/source/text/xtextcontent \ test/source/text/xtextfield \ diff --git a/test/source/table/xtablerows.cxx b/test/source/table/xtablerows.cxx new file mode 100644 index 000000000000..ba884281f2c5 --- /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/extensions/HelperMacros.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: */ |