[Libreoffice-commits] core.git: include/test qadevOOo/Jar_OOoRunner.mk qadevOOo/objdsc qadevOOo/tests sc/qa test/Library_subsequenttest.mk test/source

Abhyudaya Sharma sharmaabhyudaya at gmail.com
Sat Mar 31 22:17:02 UTC 2018


 include/test/drawing/captionshape.hxx                                |   33 +
 qadevOOo/Jar_OOoRunner.mk                                            |    1 
 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScAnnotationShapeObj.csv |   12 
 qadevOOo/tests/java/ifc/drawing/_CaptionShape.java                   |   26 -
 sc/qa/extras/scannotationshapeobj.cxx                                |    6 
 test/Library_subsequenttest.mk                                       |    1 
 test/source/drawing/captionshape.cxx                                 |  178 ++++++++++
 7 files changed, 217 insertions(+), 40 deletions(-)

New commits:
commit e4bf7cbc082a428dbef65f0d92cb0cdbda7af16e
Author: Abhyudaya Sharma <sharmaabhyudaya at gmail.com>
Date:   Mon Mar 19 21:50:12 2018 +0530

    tdf#45904 Move _CaptionShape Java tests to C++
    
    Change-Id: I66fd554a542912784cf730e28cc223591ad5c723
    Reviewed-on: https://gerrit.libreoffice.org/51575
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jens Carl <j.carl43 at gmx.de>

diff --git a/include/test/drawing/captionshape.hxx b/include/test/drawing/captionshape.hxx
new file mode 100644
index 000000000000..321de6e792a0
--- /dev/null
+++ b/include/test/drawing/captionshape.hxx
@@ -0,0 +1,33 @@
+/* -*- 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_DRAWING_CAPTION_SHAPE_HXX
+#define INCLUDED_TEST_DRAWING_CAPTION_SHAPE_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 CaptionShape
+{
+public:
+    virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+    void testCaptionShapeProperties();
+
+protected:
+    ~CaptionShape() {}
+};
+}
+#endif // INCLUDED_TEST_DRAWING_CAPTION_SHAPE_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 1f9af86d89b6..bf742f150711 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -317,7 +317,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
     qadevOOo/tests/java/ifc/document/_XTypeDetection \
     qadevOOo/tests/java/ifc/document/_XViewDataSupplier \
     qadevOOo/tests/java/ifc/drawing/_AreaShapeDescriptor \
-    qadevOOo/tests/java/ifc/drawing/_CaptionShape \
     qadevOOo/tests/java/ifc/drawing/_ConnectorProperties \
     qadevOOo/tests/java/ifc/drawing/_ConnectorShape \
     qadevOOo/tests/java/ifc/drawing/_ConnectorShapeDescriptor \
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 66f2a890537e..8709cf403bc5 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScAnnotationShapeObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScAnnotationShapeObj.csv
@@ -163,18 +163,6 @@
 "ScAnnotationShapeObj";"com::sun::star::text::XTextRange";"getEnd()"
 "ScAnnotationShapeObj";"com::sun::star::text::XTextRange";"getString()"
 "ScAnnotationShapeObj";"com::sun::star::text::XTextRange";"setString()"
-"ScAnnotationShapeObj";"com::sun::star::drawing::CaptionShape";"CornerRadius"
-"ScAnnotationShapeObj";"com::sun::star::drawing::CaptionShape";"CaptionPoint"
-"ScAnnotationShapeObj";"com::sun::star::drawing::CaptionShape";"CaptionType"
-"ScAnnotationShapeObj";"com::sun::star::drawing::CaptionShape";"CaptionIsFixedAngle"
-"ScAnnotationShapeObj";"com::sun::star::drawing::CaptionShape";"CaptionAngle"
-"ScAnnotationShapeObj";"com::sun::star::drawing::CaptionShape";"CaptionGap"
-"ScAnnotationShapeObj";"com::sun::star::drawing::CaptionShape";"CaptionEscapeDirection"
-"ScAnnotationShapeObj";"com::sun::star::drawing::CaptionShape";"CaptionIsEscapeRelative"
-"ScAnnotationShapeObj";"com::sun::star::drawing::CaptionShape";"CaptionEscapeRelative"
-"ScAnnotationShapeObj";"com::sun::star::drawing::CaptionShape";"CaptionEscapeAbsolute"
-"ScAnnotationShapeObj";"com::sun::star::drawing::CaptionShape";"CaptionLineLength"
-"ScAnnotationShapeObj";"com::sun::star::drawing::CaptionShape";"CaptionIsFitLineLength"
 "ScAnnotationShapeObj";"com::sun::star::style::CharacterProperties";"CharFontName"
 "ScAnnotationShapeObj";"com::sun::star::style::CharacterProperties";"CharFontStyleName"
 "ScAnnotationShapeObj";"com::sun::star::style::CharacterProperties";"CharFontFamily"
diff --git a/qadevOOo/tests/java/ifc/drawing/_CaptionShape.java b/qadevOOo/tests/java/ifc/drawing/_CaptionShape.java
deleted file mode 100644
index 01803f7c5903..000000000000
--- a/qadevOOo/tests/java/ifc/drawing/_CaptionShape.java
+++ /dev/null
@@ -1,26 +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.drawing;
-
-import lib.MultiPropertyTest;
-
-public class _CaptionShape extends MultiPropertyTest {
-
-}
-
diff --git a/sc/qa/extras/scannotationshapeobj.cxx b/sc/qa/extras/scannotationshapeobj.cxx
index dbcc32903920..795a0fdb9b35 100644
--- a/sc/qa/extras/scannotationshapeobj.cxx
+++ b/sc/qa/extras/scannotationshapeobj.cxx
@@ -9,6 +9,7 @@
 
 #include <test/calc_unoapi_test.hxx>
 #include <test/text/xtext.hxx>
+#include <test/drawing/captionshape.hxx>
 
 #include <com/sun/star/sheet/XSheetAnnotationAnchor.hpp>
 #include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
@@ -22,7 +23,7 @@ using namespace css::uno;
 
 namespace sc_apitest {
 
-class ScAnnotationShapeObj : public CalcUnoApiTest, public apitest::XText
+class ScAnnotationShapeObj : public CalcUnoApiTest, public apitest::XText, public apitest::CaptionShape
 {
 public:
     ScAnnotationShapeObj();
@@ -37,6 +38,9 @@ public:
     // XText
     CPPUNIT_TEST(testInsertRemoveTextContent);
 
+    // CaptionShape
+    CPPUNIT_TEST(testCaptionShapeProperties);
+
     CPPUNIT_TEST_SUITE_END();
 
 private:
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 02a125d3dec5..d83a964711e0 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -47,6 +47,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
 	test/source/container/xnamecontainer \
 	test/source/container/xnamereplace \
 	test/source/container/xnamed \
+	test/source/drawing/captionshape \
 	test/source/sheet/cellarealink \
 	test/source/sheet/cellproperties \
 	test/source/sheet/databaseimportdescriptor \
diff --git a/test/source/drawing/captionshape.cxx b/test/source/drawing/captionshape.cxx
new file mode 100644
index 000000000000..fc3d8ea6755d
--- /dev/null
+++ b/test/source/drawing/captionshape.cxx
@@ -0,0 +1,178 @@
+/* -*- 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/drawing/captionshape.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/awt/Point.hpp>
+
+#include <cppunit/extensions/HelperMacros.h>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+namespace apitest
+{
+void CaptionShape::testCaptionShapeProperties()
+{
+    uno::Reference<beans::XPropertySet> xCaptionShape(init(), UNO_QUERY_THROW);
+    rtl::OUString propName;
+    uno::Any aNewValue;
+
+    propName = "CornerRadius";
+    sal_Int32 nCornerRadiusGet = 5;
+    sal_Int32 nCornerRadiusSet = 0;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue CornerRadius",
+                           xCaptionShape->getPropertyValue(propName) >>= nCornerRadiusGet);
+
+    aNewValue <<= nCornerRadiusGet + 5;
+    xCaptionShape->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xCaptionShape->getPropertyValue(propName) >>= nCornerRadiusSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue CornerRadius", nCornerRadiusGet + 5,
+                                 nCornerRadiusSet);
+
+    propName = "CaptionPoint";
+    awt::Point aCaptionPointGet;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue of CaptionPoint",
+                           xCaptionShape->getPropertyValue(propName) >>= aCaptionPointGet);
+
+    awt::Point aCaptionPointSet;
+    aNewValue <<= awt::Point(5, 5);
+    xCaptionShape->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xCaptionShape->getPropertyValue(propName) >>= aCaptionPointSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Able to set PropertyValue of CaptionPoint", aCaptionPointSet,
+                                 awt::Point(5, 5));
+
+    propName = "CaptionType";
+    sal_Int16 captionTypeGet = 0;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue of CaptionType",
+                           xCaptionShape->getPropertyValue(propName) >>= captionTypeGet);
+
+    sal_Int16 captionTypeSet = 0;
+    const sal_Int16 FIVE = 5;
+    aNewValue <<= FIVE;
+    xCaptionShape->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xCaptionShape->getPropertyValue(propName) >>= captionTypeSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set the PropertyValue of CaptionType", FIVE,
+                                 captionTypeSet);
+
+    propName = "CaptionIsFixedAngle";
+    bool captionIsFixedAngleGet = false;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue of CaptionPointIsFixedAngle",
+                           xCaptionShape->getPropertyValue(propName) >>= captionIsFixedAngleGet);
+
+    bool captionIsFixedAngleSet = false;
+    aNewValue <<= !captionIsFixedAngleGet;
+    xCaptionShape->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xCaptionShape->getPropertyValue(propName) >>= captionIsFixedAngleSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set the PropertyValue of CaptionPointisFixedAngle",
+                                 captionIsFixedAngleSet, !captionIsFixedAngleGet);
+
+    propName = "CaptionAngle";
+    sal_Int32 captionAngleGet;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionAngle",
+                           xCaptionShape->getPropertyValue(propName) >>= captionAngleGet);
+
+    sal_Int32 captionAngleSet = 0;
+    aNewValue <<= captionAngleGet + 5;
+    xCaptionShape->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xCaptionShape->getPropertyValue(propName) >>= captionAngleSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set the PropertyValue of CaptionAngle", captionAngleSet,
+                                 captionAngleGet + 5);
+
+    propName = "CaptionGap";
+    sal_Int32 captionGapGet;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionGap",
+                           xCaptionShape->getPropertyValue(propName) >>= captionGapGet);
+
+    sal_Int32 captionGapSet = 0;
+    aNewValue <<= captionGapGet + 5;
+    xCaptionShape->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xCaptionShape->getPropertyValue(propName) >>= captionGapSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set the PropertyValue of CaptionGap", captionGapSet,
+                                 captionGapGet + 5);
+
+    propName = "CaptionEscapeDirection";
+    sal_Int32 captionEscapeDirectionGet;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionEscapeDirection",
+                           xCaptionShape->getPropertyValue(propName) >>= captionEscapeDirectionGet);
+
+    sal_Int32 captionEscapeDirectionSet = 0;
+    aNewValue <<= captionEscapeDirectionGet + 5;
+    xCaptionShape->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xCaptionShape->getPropertyValue(propName) >>= captionEscapeDirectionSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set the PropertyValue of CaptionEscapeDirection",
+                                 captionEscapeDirectionSet, captionEscapeDirectionGet + 5);
+
+    propName = "CaptionIsEscapeRelative";
+    bool captionIsEscapeRelativeGet = false;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue of CaptionIsEscapeRelative",
+                           xCaptionShape->getPropertyValue(propName)
+                           >>= captionIsEscapeRelativeGet);
+
+    bool captionIsEscapeRelativeSet = false;
+    aNewValue <<= !captionIsEscapeRelativeGet;
+    xCaptionShape->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xCaptionShape->getPropertyValue(propName) >>= captionIsEscapeRelativeSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set the PropertyValue of CaptionIsEscapeRelative",
+                                 captionIsEscapeRelativeSet, !captionIsEscapeRelativeGet);
+
+    propName = "CaptionEscapeRelative";
+    sal_Int32 captionEscapeRelativeGet;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionEscapeRelative",
+                           xCaptionShape->getPropertyValue(propName) >>= captionEscapeRelativeGet);
+
+    sal_Int32 captionEscapeRelativeSet = 0;
+    aNewValue <<= captionEscapeRelativeGet + 5;
+    xCaptionShape->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xCaptionShape->getPropertyValue(propName) >>= captionEscapeRelativeSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set the PropertyValue of CaptionEscapeRelative",
+                                 captionEscapeRelativeSet, captionEscapeRelativeGet + 5);
+
+    propName = "CaptionEscapeAbsolute";
+    sal_Int32 captionEscapeAbsoluteGet;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionEscapeAbsolute",
+                           xCaptionShape->getPropertyValue(propName) >>= captionEscapeAbsoluteGet);
+
+    sal_Int32 captionEscapeAbsoluteSet = 0;
+    aNewValue <<= captionEscapeAbsoluteGet + 5;
+    xCaptionShape->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xCaptionShape->getPropertyValue(propName) >>= captionEscapeAbsoluteSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set the PropertyValue of CaptionEscapeAbsolute",
+                                 captionEscapeAbsoluteSet, captionEscapeAbsoluteGet + 5);
+
+    propName = "CaptionLineLength";
+    sal_Int32 captionLineLengthGet;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionLineLength",
+                           xCaptionShape->getPropertyValue(propName) >>= captionLineLengthGet);
+
+    sal_Int32 captionLineLengthSet = 0;
+    aNewValue <<= captionLineLengthGet + 5;
+    xCaptionShape->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xCaptionShape->getPropertyValue(propName) >>= captionLineLengthSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set the PropertyValue of CaptionEscapeAbsolute",
+                                 captionLineLengthSet, captionLineLengthGet + 5);
+
+    propName = "CaptionIsFitLineLength";
+    bool captionIsFitLineLengthGet = false;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue of CaptionIsFitLineLength",
+                           xCaptionShape->getPropertyValue(propName) >>= captionIsFitLineLengthGet);
+
+    bool captionIsFitLineLengthSet = false;
+    aNewValue <<= !captionIsFitLineLengthGet;
+    xCaptionShape->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xCaptionShape->getPropertyValue(propName) >>= captionIsFitLineLengthSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set the PropertyValue of CaptionIsFitLineLength",
+                                 captionIsFitLineLengthSet, !captionIsFitLineLengthGet);
+}
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */


More information about the Libreoffice-commits mailing list