summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Carl <j.carl43@gmx.de>2017-10-15 03:10:47 +0000
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-10-29 22:10:18 +0100
commitd56be38352031695951558bf1dffd0a48c84eaca (patch)
tree1d95105e82bc6841b46fbe8e84c2c6792bdc6e48
parent410515366c466c1f8b0a81d47f8263d278af3a18 (diff)
tdf#45904: Move Java _XSheetPageBreak tests to C++
Change-Id: I29111c3495fc9767d1b2c7bab38af5f89b7840f9 Reviewed-on: https://gerrit.libreoffice.org/43399 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--include/test/sheet/xsheetpagebreak.hxx36
-rw-r--r--qadevOOo/Jar_OOoRunner.mk1
-rw-r--r--qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv3
-rw-r--r--qadevOOo/tests/java/ifc/sheet/_XSheetPageBreak.java84
-rw-r--r--sc/qa/extras/sctablesheetobj.cxx25
-rw-r--r--test/Library_subsequenttest.mk1
-rw-r--r--test/source/sheet/xsheetpagebreak.cxx70
7 files changed, 123 insertions, 97 deletions
diff --git a/include/test/sheet/xsheetpagebreak.hxx b/include/test/sheet/xsheetpagebreak.hxx
new file mode 100644
index 000000000000..3ae64b650a4f
--- /dev/null
+++ b/include/test/sheet/xsheetpagebreak.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSHEETPAGEBREAK_HXX
+#define INCLUDED_TEST_SHEET_XSHEETPAGEBREAK_HXX
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/sheet/XSheetPageBreak.hpp>
+#include <test/testdllapi.hxx>
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XSheetPageBreak
+{
+public:
+ virtual css::uno::Reference< css::uno::XInterface > init() = 0;
+
+ void testGetColumnPageBreaks();
+ void testGetRowPageBreaks();
+ void testRemoveAllManualPageBreaks();
+
+protected:
+ ~XSheetPageBreak() {}
+};
+
+}
+
+#endif // INCLUDED_TEST_SHEET_XSHEETPAGEBREAK_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk
index 5f74bc7f8818..93e01587192f 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -629,7 +629,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/ifc/sheet/_XSheetFilterDescriptor \
qadevOOo/tests/java/ifc/sheet/_XSheetLinkable \
qadevOOo/tests/java/ifc/sheet/_XSheetOperation \
- qadevOOo/tests/java/ifc/sheet/_XSheetPageBreak \
qadevOOo/tests/java/ifc/sheet/_XSpreadsheetView \
qadevOOo/tests/java/ifc/style/_CharacterProperties \
qadevOOo/tests/java/ifc/style/_CharacterPropertiesAsian \
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv
index 4d0cd3fadbfc..8f7c54adaa3d 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv
@@ -263,6 +263,3 @@
"ScTableSheetObj";"com::sun::star::util::XImportable";"doImport()"
"ScTableSheetObj";"com::sun::star::util::XSortable";"createSortDescriptor()"
"ScTableSheetObj";"com::sun::star::util::XSortable";"sort()"
-"ScTableSheetObj";"com::sun::star::sheet::XSheetPageBreak";"getColumnPageBreaks()"
-"ScTableSheetObj";"com::sun::star::sheet::XSheetPageBreak";"getRowPageBreaks()"
-"ScTableSheetObj";"com::sun::star::sheet::XSheetPageBreak";"removeAllManualPageBreaks()"
diff --git a/qadevOOo/tests/java/ifc/sheet/_XSheetPageBreak.java b/qadevOOo/tests/java/ifc/sheet/_XSheetPageBreak.java
deleted file mode 100644
index ced779316ea7..000000000000
--- a/qadevOOo/tests/java/ifc/sheet/_XSheetPageBreak.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
- */
-
-package ifc.sheet;
-
-import lib.MultiMethodTest;
-
-import com.sun.star.sheet.TablePageBreakData;
-import com.sun.star.sheet.XSheetPageBreak;
-
-/**
-* Testing <code>com.sun.star.sheet.XSheetPageBreak</code>
-* interface methods :
-* <ul>
-* <li><code> getColumnPageBreaks()</code></li>
-* <li><code> getRowPageBreaks()</code></li>
-* <li><code> removeAllManualPageBreaks()</code></li>
-* </ul> <p>
-* @see com.sun.star.sheet.XSheetPageBreak
-*/
-public class _XSheetPageBreak extends MultiMethodTest {
-
- public XSheetPageBreak oObj = null;
-
- /**
- * Test calls the method and checks returned value. <p>
- * Has <b> OK </b> status if returned value isn't null. <p>
- */
- public void _getColumnPageBreaks() {
- TablePageBreakData[] breakArr = oObj.getColumnPageBreaks();
- tRes.tested("getColumnPageBreaks()", breakArr != null);
- }
-
- /**
- * Test calls the method and checks returned value. <p>
- * Has <b> OK </b> status if returned value isn't null. <p>
- */
- public void _getRowPageBreaks() {
- TablePageBreakData[] breakArr = oObj.getRowPageBreaks();
- tRes.tested("getRowPageBreaks()", breakArr != null);
- }
-
- /**
- * Test calls the method and checks that all breaks gone. <p>
- * Has <b> OK </b> status if number of column breaks and number of row breaks
- * are equal to zero. <p>
- */
- public void _removeAllManualPageBreaks() {
- oObj.removeAllManualPageBreaks();
-
- int manualRowPageBreaks = 0;
- int manualColumnPageBreaks = 0;
-
- log.println("Check if all breaks are gone");
-
- TablePageBreakData[] breakArr = oObj.getColumnPageBreaks();
- for (int i = 0; i < breakArr.length; i++)
- if (breakArr[i].ManualBreak) manualColumnPageBreaks++;
-
- breakArr = oObj.getRowPageBreaks();
- for (int i = 0; i < breakArr.length; i++)
- if (breakArr[i].ManualBreak) manualRowPageBreaks++ ;
-
- tRes.tested(
- "removeAllManualPageBreaks()",
- manualColumnPageBreaks == 0 && manualRowPageBreaks == 0);
- }
-}
-
diff --git a/sc/qa/extras/sctablesheetobj.cxx b/sc/qa/extras/sctablesheetobj.cxx
index a509c5bd2202..8f2a4647d26a 100644
--- a/sc/qa/extras/sctablesheetobj.cxx
+++ b/sc/qa/extras/sctablesheetobj.cxx
@@ -10,9 +10,10 @@
#include <test/calc_unoapi_test.hxx>
#include <test/sheet/xcellseries.hxx>
#include <test/sheet/xprintareas.hxx>
-#include <test/sheet/xuniquecellformatrangessupplier.hxx>
+#include <test/sheet/xsheetpagebreak.hxx>
#include <test/sheet/xspreadsheet.hxx>
#include <test/sheet/xsubtotalcalculatable.hxx>
+#include <test/sheet/xuniquecellformatrangessupplier.hxx>
#include <test/util/xreplaceable.hxx>
#include <test/util/xsearchable.hxx>
@@ -25,15 +26,16 @@ using namespace css::uno;
namespace sc_apitest
{
-#define NUMBER_OF_TESTS 14
+#define NUMBER_OF_TESTS 17
-class ScTableSheetObj : public CalcUnoApiTest, public apitest::XSearchable,
- public apitest::XReplaceable,
+class ScTableSheetObj : public CalcUnoApiTest, public apitest::XCellSeries,
public apitest::XPrintAreas,
- public apitest::XCellSeries,
- public apitest::XUniqueCellFormatRangesSupplier,
+ public apitest::XReplaceable,
+ public apitest::XSearchable,
+ public apitest::XSheetPageBreak,
public apitest::XSpreadsheet,
- public apitest::XSubTotalCalculatable
+ public apitest::XSubTotalCalculatable,
+ public apitest::XUniqueCellFormatRangesSupplier
{
public:
ScTableSheetObj();
@@ -63,6 +65,11 @@ public:
CPPUNIT_TEST(testFillAuto);
CPPUNIT_TEST(testFillSeries);
+ // XSheetPageBreak
+ CPPUNIT_TEST(testGetColumnPageBreaks);
+ CPPUNIT_TEST(testGetRowPageBreaks);
+ CPPUNIT_TEST(testRemoveAllManualPageBreaks);
+
// XUniqueCellFormatRangesSupplier
CPPUNIT_TEST(testGetUniqueCellFormatRanges);
@@ -86,9 +93,9 @@ uno::Reference< lang::XComponent > ScTableSheetObj::mxComponent;
ScTableSheetObj::ScTableSheetObj():
CalcUnoApiTest("/sc/qa/extras/testdocuments"),
- apitest::XSearchable("test", 4),
+ apitest::XCellSeries(1, 0),
apitest::XReplaceable("searchReplaceString", "replaceReplaceString"),
- apitest::XCellSeries(1, 0)
+ apitest::XSearchable("test", 4)
{
}
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 9c1e8524b27b..76aa87850cbd 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -71,6 +71,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/sheet/xsheetannotations \
test/source/sheet/xsheetannotationshapesupplier \
test/source/sheet/xsheetoutline \
+ test/source/sheet/xsheetpagebreak \
test/source/sheet/xstyleloader \
test/source/sheet/xsubtotalfield \
test/source/sheet/xuniquecellformatrangessupplier\
diff --git a/test/source/sheet/xsheetpagebreak.cxx b/test/source/sheet/xsheetpagebreak.cxx
new file mode 100644
index 000000000000..551271029f18
--- /dev/null
+++ b/test/source/sheet/xsheetpagebreak.cxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/xsheetpagebreak.hxx>
+
+#include <com/sun/star/sheet/TablePageBreakData.hpp>
+#include <com/sun/star/sheet/XSheetPageBreak.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <rtl/ustring.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace apitest {
+
+void XSheetPageBreak::testGetColumnPageBreaks()
+{
+ uno::Reference< sheet::XSheetPageBreak > xSheetPageBreak(init(), UNO_QUERY_THROW);
+
+ uno::Sequence< sheet::TablePageBreakData > xColPageBreak = xSheetPageBreak->getColumnPageBreaks();
+ CPPUNIT_ASSERT_MESSAGE("Unable to get column page breaks", xColPageBreak.getLength() != 0);
+}
+
+void XSheetPageBreak::testGetRowPageBreaks()
+{
+ uno::Reference< sheet::XSheetPageBreak > xSheetPageBreak(init(), UNO_QUERY_THROW);
+
+ uno::Sequence< sheet::TablePageBreakData > xRowPageBreak = xSheetPageBreak->getRowPageBreaks();
+ CPPUNIT_ASSERT_MESSAGE("Unable to get row page breaks", xRowPageBreak.getLength() != 0);
+}
+
+void XSheetPageBreak::testRemoveAllManualPageBreaks()
+{
+ uno::Reference< sheet::XSheetPageBreak > xSheetPageBreak(init(), UNO_QUERY_THROW);
+
+ xSheetPageBreak->removeAllManualPageBreaks();
+
+ uno::Sequence< sheet::TablePageBreakData > xColPageBreak = xSheetPageBreak->getColumnPageBreaks();
+ sal_Int32 manualColPageBreaks = 0;
+ for ( const auto & data : xColPageBreak )
+ {
+ if (data.ManualBreak)
+ manualColPageBreaks++;
+ }
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Found manual column page break",
+ sal_Int32(0), manualColPageBreaks);
+
+ uno::Sequence< sheet::TablePageBreakData > xRowPageBreak = xSheetPageBreak->getRowPageBreaks();
+ sal_Int32 manualRowPageBreaks = 0;
+ for ( const auto & data : xRowPageBreak )
+ {
+ if (data.ManualBreak)
+ manualRowPageBreaks++;
+ }
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Found manual row page break",
+ sal_Int32(0), manualRowPageBreaks);
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */