diff options
author | Jens Carl <j.carl43@gmx.de> | 2019-09-13 22:19:32 -0700 |
---|---|---|
committer | Jens Carl <j.carl43@gmx.de> | 2019-09-14 08:17:59 +0200 |
commit | 0d0e8533afe565564835e6d51500e64066fd565b (patch) | |
tree | 9910b12f84ddf4d23f024ec499954e619b4f60ff | |
parent | 5e4d564e27d062a48fd04cb7263b769819dd3a50 (diff) |
tdf#45904 Move XShape Java tests to C++
Move XShape Java tests to C++ for ScAnnotationShapeObj.
Change-Id: I26658ea7b0b26f68659024100c4d3c40e383899e
Reviewed-on: https://gerrit.libreoffice.org/78898
Tested-by: Jenkins
Reviewed-by: Jens Carl <j.carl43@gmx.de>
-rw-r--r-- | qadevOOo/objdsc/sc/com.sun.star.comp.office.ScAnnotationShapeObj.csv | 4 | ||||
-rw-r--r-- | sc/qa/extras/scannotationshapeobj.cxx | 88 | ||||
-rw-r--r-- | solenv/clang-format/blacklist | 1 |
3 files changed, 54 insertions, 39 deletions
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScAnnotationShapeObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScAnnotationShapeObj.csv index 8709cf403bc5..c65940379cc2 100644 --- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScAnnotationShapeObj.csv +++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScAnnotationShapeObj.csv @@ -221,10 +221,6 @@ "ScAnnotationShapeObj";"com::sun::star::beans::XPropertySet";"removePropertyChangeListener()" "ScAnnotationShapeObj";"com::sun::star::beans::XPropertySet";"addVetoableChangeListener()" "ScAnnotationShapeObj";"com::sun::star::beans::XPropertySet";"removeVetoableChangeListener()" -"ScAnnotationShapeObj";"com::sun::star::drawing::XShape";"getPosition()" -"ScAnnotationShapeObj";"com::sun::star::drawing::XShape";"setPosition()" -"ScAnnotationShapeObj";"com::sun::star::drawing::XShape";"getSize()" -"ScAnnotationShapeObj";"com::sun::star::drawing::XShape";"setSize()" "ScAnnotationShapeObj";"com::sun::star::text::XText";"insertTextContent()" "ScAnnotationShapeObj";"com::sun::star::text::XText";"removeTextContent()" "ScAnnotationShapeObj";"com::sun::star::style::ParagraphPropertiesAsian#optional";"ParaIsHangingPunctuation" diff --git a/sc/qa/extras/scannotationshapeobj.cxx b/sc/qa/extras/scannotationshapeobj.cxx index 77fce301ce1f..5cf3fc927464 100644 --- a/sc/qa/extras/scannotationshapeobj.cxx +++ b/sc/qa/extras/scannotationshapeobj.cxx @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * This file is part of the LibreOffice project. * @@ -8,22 +8,35 @@ */ #include <test/calc_unoapi_test.hxx> -#include <test/text/xtext.hxx> #include <test/drawing/captionshape.hxx> +#include <test/drawing/xshape.hxx> +#include <test/text/xtext.hxx> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/sheet/XSheetAnnotation.hpp> #include <com/sun/star/sheet/XSheetAnnotationAnchor.hpp> -#include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp> #include <com/sun/star/sheet/XSheetAnnotationShapeSupplier.hpp> -#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> +#include <com/sun/star/sheet/XSheetAnnotations.hpp> +#include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp> #include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> #include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/table/XCell.hpp> +#include <com/sun/star/text/XSimpleText.hpp> +#include <com/sun/star/uno/XInterface.hpp> -using namespace css; -using namespace css::uno; +#include <com/sun/star/uno/Reference.hxx> -namespace sc_apitest { +using namespace css; -class ScAnnotationShapeObj : public CalcUnoApiTest, public apitest::XText, public apitest::CaptionShape +namespace sc_apitest +{ +class ScAnnotationShapeObj : public CalcUnoApiTest, + public apitest::CaptionShape, + public apitest::XShape, + public apitest::XText { public: ScAnnotationShapeObj(); @@ -35,20 +48,24 @@ public: CPPUNIT_TEST_SUITE(ScAnnotationShapeObj); - // XText - CPPUNIT_TEST(testInsertRemoveTextContent); - // CaptionShape CPPUNIT_TEST(testCaptionShapeProperties); + // XShape + CPPUNIT_TEST(testGetSetSize); + CPPUNIT_TEST(testGetSetPosition); + + // XText + CPPUNIT_TEST(testInsertRemoveTextContent); + CPPUNIT_TEST_SUITE_END(); private: - uno::Reference<lang::XComponent> mxComponent; - static uno::Reference<text::XTextContent> mxField; + uno::Reference<lang::XComponent> m_xComponent; + static uno::Reference<text::XTextContent> m_xField; }; -uno::Reference<text::XTextContent> ScAnnotationShapeObj::mxField; +uno::Reference<text::XTextContent> ScAnnotationShapeObj::m_xField; ScAnnotationShapeObj::ScAnnotationShapeObj() : CalcUnoApiTest("sc/qa/extras/testdocuments") @@ -58,58 +75,61 @@ ScAnnotationShapeObj::ScAnnotationShapeObj() void ScAnnotationShapeObj::setUp() { CalcUnoApiTest::setUp(); - mxComponent = loadFromDesktop("private:factory/scalc"); + m_xComponent = loadFromDesktop("private:factory/scalc"); } void ScAnnotationShapeObj::tearDown() { - mxField.clear(); - closeDocument(mxComponent); + m_xField.clear(); + closeDocument(m_xComponent); CalcUnoApiTest::tearDown(); } uno::Reference<uno::XInterface> ScAnnotationShapeObj::init() { - uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheetDocument> xDoc(m_xComponent, uno::UNO_QUERY_THROW); - uno::Reference<container::XIndexAccess> xIA(xDoc->getSheets(), UNO_QUERY_THROW); - uno::Reference<sheet::XSpreadsheet> xSheet(xIA->getByIndex(0), UNO_QUERY_THROW); + uno::Reference<container::XIndexAccess> xIA(xDoc->getSheets(), uno::UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheet> xSheet(xIA->getByIndex(0), uno::UNO_QUERY_THROW); // Use cell A1 for this. - table::CellAddress aNotePos(0, 0, 0); - Reference<sheet::XSheetAnnotationsSupplier> xAnnosSupp(xSheet, UNO_QUERY_THROW); - Reference<sheet::XSheetAnnotations> xAnnos(xAnnosSupp->getAnnotations(), UNO_SET_THROW); + uno::Reference<sheet::XSheetAnnotationsSupplier> xAnnosSupp(xSheet, uno::UNO_QUERY_THROW); + uno::Reference<sheet::XSheetAnnotations> xAnnos(xAnnosSupp->getAnnotations(), + uno::UNO_SET_THROW); // non-empty string required by note implementation (real text will be added below) xAnnos->insertNew(aNotePos, OUString(' ')); uno::Reference<table::XCell> xCell = xSheet->getCellByPosition(0, 0); - uno::Reference<sheet::XSheetAnnotationAnchor> xAnchor(xCell, UNO_QUERY_THROW); - uno::Reference<sheet::XSheetAnnotation> xAnnotation(xAnchor->getAnnotation(), UNO_SET_THROW); - uno::Reference<text::XSimpleText> xAnnoText(xAnnotation, UNO_QUERY_THROW); + uno::Reference<sheet::XSheetAnnotationAnchor> xAnchor(xCell, uno::UNO_QUERY_THROW); + uno::Reference<sheet::XSheetAnnotation> xAnnotation(xAnchor->getAnnotation(), + uno::UNO_SET_THROW); + uno::Reference<text::XSimpleText> xAnnoText(xAnnotation, uno::UNO_QUERY_THROW); xAnnoText->setString("ScAnnotationShapeObj"); - uno::Reference<sheet::XSheetAnnotationShapeSupplier> xShapeSupp(xAnnotation, UNO_QUERY_THROW); - uno::Reference<drawing::XShape> xShape(xShapeSupp->getAnnotationShape(), UNO_SET_THROW); + uno::Reference<sheet::XSheetAnnotationShapeSupplier> xShapeSupp(xAnnotation, + uno::UNO_QUERY_THROW); + uno::Reference<drawing::XShape> xShape(xShapeSupp->getAnnotationShape(), uno::UNO_SET_THROW); return xShape; } uno::Reference<text::XTextContent> ScAnnotationShapeObj::getTextContent() { - if (!mxField.is()) + if (!m_xField.is()) { - uno::Reference<lang::XMultiServiceFactory> xSM(mxComponent, UNO_QUERY_THROW); - mxField.set(xSM->createInstance("com.sun.star.text.TextField.DateTime"), UNO_QUERY_THROW); + uno::Reference<lang::XMultiServiceFactory> xSM(m_xComponent, uno::UNO_QUERY_THROW); + m_xField.set(xSM->createInstance("com.sun.star.text.TextField.DateTime"), + uno::UNO_QUERY_THROW); } - return mxField; + return m_xField; } CPPUNIT_TEST_SUITE_REGISTRATION(ScAnnotationShapeObj); -} +} // namespace sc_apitest CPPUNIT_PLUGIN_IMPLEMENT(); -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist index 0bf27165bfe1..eb44f9aeec41 100644 --- a/solenv/clang-format/blacklist +++ b/solenv/clang-format/blacklist @@ -9973,7 +9973,6 @@ sc/qa/extras/macros-test.cxx sc/qa/extras/new_cond_format.cxx sc/qa/extras/recordchanges-test.cxx sc/qa/extras/regression-test.cxx -sc/qa/extras/scannotationshapeobj.cxx sc/qa/extras/scannotationsobj.cxx sc/qa/extras/scarealinkobj.cxx sc/qa/extras/sccellcursorobj.cxx |