summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJens Carl <j.carl43@gmx.de>2017-08-07 23:17:51 +0000
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-08-23 23:36:47 +0200
commitaeb525c0f97727bc9add5bf9923adb69c2989aa0 (patch)
treed86f303e420743efa049fa03b68e0d5ff1594e0e /test
parentb129421764ae78a1422812169fce8eb4914a6b22 (diff)
tdf#45904 Move Java _XAreaLink tests to C++
Change-Id: I95112555de3a5dd5a75c478edb5856cf79919db9 Reviewed-on: https://gerrit.libreoffice.org/40859 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'test')
-rw-r--r--test/Library_subsequenttest.mk1
-rw-r--r--test/source/sheet/xarealink.cxx79
2 files changed, 80 insertions, 0 deletions
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index bc442ba621b9..8d1402d4f383 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -44,6 +44,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/container/xnamed \
test/source/sheet/cellproperties \
test/source/sheet/datapilotfield \
+ test/source/sheet/xarealink \
test/source/sheet/xcelladdressable \
test/source/sheet/xcellrangedata \
test/source/sheet/xcellrangereferrer \
diff --git a/test/source/sheet/xarealink.cxx b/test/source/sheet/xarealink.cxx
new file mode 100644
index 000000000000..6a5f99c485fe
--- /dev/null
+++ b/test/source/sheet/xarealink.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/sheet/xarealink.hxx>
+
+#include <com/sun/star/sheet/XAreaLink.hpp>
+#include <com/sun/star/table/CellRangeAddress.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include "cppunit/extensions/HelperMacros.h"
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+CPPUNIT_NS_BEGIN
+
+template<> struct assertion_traits<table::CellRangeAddress>
+{
+ static bool equal(const table::CellRangeAddress& x, const table::CellRangeAddress& y)
+ {
+ return x == y;
+ }
+
+ static std::string toString( const table::CellRangeAddress& x )
+ {
+ OStringStream ost;
+ ost << "Sheet: " << x.Sheet << " StartColumn: " << x.StartColumn << " StartRow: " << x.StartRow
+ << " EndColumn: " << x.EndColumn << " EndRow: " << x.EndRow;
+ return ost.str();
+ }
+};
+
+CPPUNIT_NS_END
+
+namespace apitest {
+
+void XAreaLink::testSetDestArea()
+{
+ uno::Reference< sheet::XAreaLink > xAreaLink(init(), UNO_QUERY_THROW);
+
+ xAreaLink->setDestArea(table::CellRangeAddress(1,3,4,5,8));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Couldn't set new dest area",
+ table::CellRangeAddress(1,3,4,5,8), xAreaLink->getDestArea());
+}
+
+void XAreaLink::testSetSourceArea()
+{
+ uno::Reference< sheet::XAreaLink > xAreaLink(init(), UNO_QUERY_THROW);
+
+ xAreaLink->setSourceArea("Sheet1.A1:B1");
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Couldn't set new source area",
+ OUString("Sheet1.A1:B1"), xAreaLink->getSourceArea());
+}
+
+void XAreaLink::testGetDestArea()
+{
+ uno::Reference< sheet::XAreaLink > xAreaLink(init(), UNO_QUERY_THROW);
+
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Couldn't get dest area",
+ table::CellRangeAddress(1,2,3,2,3), xAreaLink->getDestArea());
+}
+
+void XAreaLink::testGetSourceArea()
+{
+ uno::Reference< sheet::XAreaLink > xAreaLink(init(), UNO_QUERY_THROW);
+
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Couldn't get source area",
+ OUString("a1:c1"), xAreaLink->getSourceArea());
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */