summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/test/table/xcell.hxx37
-rw-r--r--qadevOOo/Jar_OOoRunner.mk1
-rw-r--r--qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellObj.csv6
-rw-r--r--qadevOOo/tests/java/ifc/table/_XCell.java157
-rw-r--r--sc/qa/extras/sccellobj.cxx8
-rw-r--r--test/Library_subsequenttest.mk1
-rw-r--r--test/source/table/xcell.cxx80
7 files changed, 126 insertions, 164 deletions
diff --git a/include/test/table/xcell.hxx b/include/test/table/xcell.hxx
new file mode 100644
index 000000000000..a0249aac9163
--- /dev/null
+++ b/include/test/table/xcell.hxx
@@ -0,0 +1,37 @@
+/* -*- 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/.
+*/
+
+#ifndef INCLUDED_TEST_TABLE_XCELL_HXX
+#define INCLUDED_TEST_TABLE_XCELL_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XCell
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+ void testGetError();
+ void testGetType();
+ void testSetGetFormula();
+ void testSetGetValue();
+
+protected:
+ ~XCell() {}
+};
+}
+
+#endif // INCLUDED_TEST_TABLE_XCELL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk
index 4aba76420ecb..c096f498c63a 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -587,7 +587,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/ifc/table/_TableColumn \
qadevOOo/tests/java/ifc/table/_TableRow \
qadevOOo/tests/java/ifc/table/_XAutoFormattable \
- qadevOOo/tests/java/ifc/table/_XCell \
qadevOOo/tests/java/ifc/table/_XCellRange \
qadevOOo/tests/java/ifc/table/_XColumnRowRange \
qadevOOo/tests/java/ifc/table/_XTableChart \
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellObj.csv
index aab8c8f92f01..b936c50045d4 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellObj.csv
@@ -126,12 +126,6 @@
"ScCellObj";"com::sun::star::sheet::XCellRangesQuery";"queryIntersection()"
"ScCellObj";"com::sun::star::container::XElementAccess";"getElementType()"
"ScCellObj";"com::sun::star::container::XElementAccess";"hasElements()"
-"ScCellObj";"com::sun::star::table::XCell";"getFormula()"
-"ScCellObj";"com::sun::star::table::XCell";"setFormula()"
-"ScCellObj";"com::sun::star::table::XCell";"getValue()"
-"ScCellObj";"com::sun::star::table::XCell";"setValue()"
-"ScCellObj";"com::sun::star::table::XCell";"getType()"
-"ScCellObj";"com::sun::star::table::XCell";"getError()"
"ScCellObj";"com::sun::star::text::XTextRange";"getText()"
"ScCellObj";"com::sun::star::text::XTextRange";"getStart()"
"ScCellObj";"com::sun::star::text::XTextRange";"getEnd()"
diff --git a/qadevOOo/tests/java/ifc/table/_XCell.java b/qadevOOo/tests/java/ifc/table/_XCell.java
deleted file mode 100644
index e81776c974db..000000000000
--- a/qadevOOo/tests/java/ifc/table/_XCell.java
+++ /dev/null
@@ -1,157 +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.table;
-
-import lib.MultiMethodTest;
-import util.utils;
-
-import com.sun.star.table.CellContentType;
-import com.sun.star.table.XCell;
-
-
-/**
-* Testing <code>com.sun.star.table.XCell</code>
-* interface methods :
-* <ul>
-* <li><code> getFormula()</code></li>
-* <li><code> setFormula()</code></li>
-* <li><code> getValue()</code></li>
-* <li><code> setValue()</code></li>
-* <li><code> getType()</code></li>
-* <li><code> getError()</code></li>
-* </ul> <p>
-* Test is <b> NOT </b> multithread compliant. <p>
-* @see com.sun.star.table.XCell
-*/
-public class _XCell extends MultiMethodTest {
- public XCell oObj = null;
-
- /**
- * First time errors checked when a proper formula is entered.
- * Second time an incorrect formula entered and errors are checked.<p>
- * Has <b> OK </b> status if in the first case error code 0 returned,
- * and in the second case none-zerro code returned. <p>
- * The following method tests are to be completed successfully before :
- * <ul>
- * <li> <code> setFormula() </code> : the method must set proper
- * formula into cell, so there must be no errors </li>
- * </ul>
- */
- public void _getError() {
- requiredMethod("setFormula()") ;
-
- boolean result = true;
-
- if (oObj.getError() != 0) {
- result = false ;
- log.println("getError(): Expected error code is 0, but returned " +
- oObj.getError()) ;
- }
- oObj.setFormula("=sqrt(-2)") ; // incorrect formula
- if (oObj.getError() == 0) {
- result = false ;
- log.println("getError(): # Non zero error code expected,"+
- " but 0 returned") ;
- }
-
- tRes.tested("getError()", result);
- } // end getError()
-
- /**
- * Sets a formula and then gets it. <p>
- * Has <b> OK </b> status if the formula set are the same as get. <p>
- */
- public void _getFormula() {
- boolean result = true;
-
- String formula = "";
- log.println("getFormula()");
- oObj.setFormula("=2+2");
-
- formula = oObj.getFormula();
-
- result &= formula.endsWith("2+2");
- tRes.tested("getFormula()", result);
- } // end getFormula()
-
- /**
- * Gets the type and check it. <p>
- * Has <b> OK </b> status if the type is one of valid values. <p>
- */
- public void _getType() {
- boolean result = true;
- result = true ;
- log.println("getType() ...");
-
- if(oObj.getType() == CellContentType.EMPTY) result &= true ;
- else if (oObj.getType() == CellContentType.VALUE) result &= true ;
- else if (oObj.getType() == CellContentType.TEXT) result &= true ;
- else if (oObj.getType() == CellContentType.FORMULA) result &= true ;
- else result = false;
-
- tRes.tested ("getType()", result) ;
- } // end getType()
-
- /**
- * Test calls the method. <p>
- * Has <b> OK </b> status if the method successfully returns
- * and no exceptions were thrown. <p>
- */
- public void _getValue() {
- boolean result = true;
- log.println("getValue() ...");
-
- oObj.getValue();
-
- tRes.tested("getValue()",result);
- } // end getValue()
-
- /**
- * Sets a formula and then gets it. <p>
- * Has <b> OK </b> status if the formula set are the same as get. <p>
- */
- public void _setFormula() {
- boolean result = true;
- String formula = "";
- log.println("setFormula() ...");
-
- oObj.setFormula("=2/6") ;
-
- formula = oObj.getFormula();
-
- result &= formula.endsWith("2/6");
- tRes.tested ("setFormula()", result) ;
- } // end setFormula
-
- /**
- * Sets a value and then gets it. <p>
- * Has <b> OK </b> status if the value set is equal to value get. <p>
- */
- public void _setValue() {
- log.println("setValue() ...");
-
- double inValue = 222.333;
- oObj.setValue(inValue) ;
- double cellValue = oObj.getValue() ;
-
- boolean result = utils.approxEqual(cellValue, inValue);
- tRes.tested("setValue()", result);
- } // end setValue()
-}
-
diff --git a/sc/qa/extras/sccellobj.cxx b/sc/qa/extras/sccellobj.cxx
index ec8170b4e462..2361b3c5d208 100644
--- a/sc/qa/extras/sccellobj.cxx
+++ b/sc/qa/extras/sccellobj.cxx
@@ -9,6 +9,7 @@
#include <test/calc_unoapi_test.hxx>
#include <test/sheet/sheetcell.hxx>
+#include <test/table/xcell.hxx>
#include <test/sheet/xcelladdressable.hxx>
#include <test/sheet/xformulaquery.hxx>
#include <test/sheet/xsheetannotationanchor.hxx>
@@ -29,6 +30,7 @@ using namespace css::uno;
namespace sc_apitest {
class ScCellObj : public CalcUnoApiTest, public apitest::SheetCell,
+ public apitest::XCell,
public apitest::XCellAddressable,
public apitest::XFormulaQuery,
public apitest::XSheetAnnotationAnchor
@@ -46,6 +48,12 @@ public:
// SheetCell
CPPUNIT_TEST(testSheetCellProperties);
+ // XCell
+ CPPUNIT_TEST(testGetError);
+ CPPUNIT_TEST(testGetType);
+ CPPUNIT_TEST(testSetGetFormula);
+ CPPUNIT_TEST(testSetGetValue);
+
// XCellAddressable
CPPUNIT_TEST(testGetCellAddress);
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 1697a4639273..604800a73cb2 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -146,6 +146,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/sheet/xviewsplitable \
test/source/sheet/xsubtotalcalculatable \
test/source/sheet/xsubtotaldescriptor \
+ test/source/table/xcell \
test/source/table/xcellcursor \
test/source/text/xtext \
test/source/text/xtextfield \
diff --git a/test/source/table/xcell.cxx b/test/source/table/xcell.cxx
new file mode 100644
index 000000000000..8b1e0bb1b9e0
--- /dev/null
+++ b/test/source/table/xcell.cxx
@@ -0,0 +1,80 @@
+/* -*- 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/cppunitasserthelper.hxx>
+#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/extensions/HelperMacros.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_MESSAGE("Successfully able to get Error",
+ (nCorrectFormula == 0) && (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: */