include/test/text/numberingrules.hxx                                |   31 ++++
 qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXChapterNumbering.csv |    4 
 qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXNumberingRules.csv   |    4 
 sw/qa/api/SwXChapterNumbering.cxx                                   |    5 
 sw/qa/api/SwXNumberingRules.cxx                                     |    5 
 test/Library_subsequenttest.mk                                      |    1 
 test/source/text/numberingrules.cxx                                 |   77 
++++++++++
 7 files changed, 117 insertions(+), 10 deletions(-)

New commits:
commit 594665e757c4adec4d243e4c33299877b2264552
Author:     anfanite396 <dipamt1...@gmail.com>
AuthorDate: Mon Jul 31 16:14:34 2023 +0530
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Fri Aug 25 08:21:14 2023 +0200

    tdf#45904 Move _NumberingRules Java tests to C++
    
    Change-Id: I86d559767204e1e8e1fd232db63f26a5c1ce67da
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155089
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/include/test/text/numberingrules.hxx 
b/include/test/text/numberingrules.hxx
new file mode 100644
index 000000000000..a6db84bd054e
--- /dev/null
+++ b/include/test/text/numberingrules.hxx
@@ -0,0 +1,31 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST NumberingRules
+{
+public:
+    virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+    void testNumberingRulesProperties();
+
+protected:
+    ~NumberingRules() {}
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git 
a/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXChapterNumbering.csv 
b/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXChapterNumbering.csv
index 89a3669e18d9..d06312d6d1ee 100644
--- a/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXChapterNumbering.csv
+++ b/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXChapterNumbering.csv
@@ -3,10 +3,6 @@
 
"SwXChapterNumbering";"com::sun::star::container::XElementAccess";"getElementType()"
 
"SwXChapterNumbering";"com::sun::star::container::XElementAccess";"hasElements()"
 
"SwXChapterNumbering";"com::sun::star::container::XIndexReplace";"replaceByIndex()"
-"SwXChapterNumbering";"com::sun::star::text::NumberingRules";"IsAbsoluteMargins#optional"
-"SwXChapterNumbering";"com::sun::star::text::NumberingRules";"IsAutomatic#optional"
-"SwXChapterNumbering";"com::sun::star::text::NumberingRules";"IsContinuousNumbering#optional"
-"SwXChapterNumbering";"com::sun::star::text::NumberingRules";"Name#optional"
 
"SwXChapterNumbering";"com::sun::star::beans::XPropertySet#optional";"getPropertySetInfo()"
 
"SwXChapterNumbering";"com::sun::star::beans::XPropertySet#optional";"setPropertyValue()"
 
"SwXChapterNumbering";"com::sun::star::beans::XPropertySet#optional";"getPropertyValue()"
diff --git a/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXNumberingRules.csv 
b/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXNumberingRules.csv
index 6b30de486f46..45c9cbb2e25f 100644
--- a/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXNumberingRules.csv
+++ b/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXNumberingRules.csv
@@ -3,10 +3,6 @@
 
"SwXNumberingRules";"com::sun::star::container::XElementAccess";"getElementType()"
 "SwXNumberingRules";"com::sun::star::container::XElementAccess";"hasElements()"
 
"SwXNumberingRules";"com::sun::star::container::XIndexReplace";"replaceByIndex()"
-"SwXNumberingRules";"com::sun::star::text::NumberingRules";"IsAbsoluteMargins#optional"
-"SwXNumberingRules";"com::sun::star::text::NumberingRules";"IsAutomatic#optional"
-"SwXNumberingRules";"com::sun::star::text::NumberingRules";"IsContinuousNumbering#optional"
-"SwXNumberingRules";"com::sun::star::text::NumberingRules";"Name#optional"
 
"SwXNumberingRules";"com::sun::star::beans::XPropertySet#optional";"getPropertySetInfo()"
 
"SwXNumberingRules";"com::sun::star::beans::XPropertySet#optional";"setPropertyValue()"
 
"SwXNumberingRules";"com::sun::star::beans::XPropertySet#optional";"getPropertyValue()"
diff --git a/sw/qa/api/SwXChapterNumbering.cxx 
b/sw/qa/api/SwXChapterNumbering.cxx
index 30dc352535c5..5a676da9c042 100644
--- a/sw/qa/api/SwXChapterNumbering.cxx
+++ b/sw/qa/api/SwXChapterNumbering.cxx
@@ -11,6 +11,7 @@
 #include <test/beans/xpropertyset.hxx>
 #include <test/container/xindexaccess.hxx>
 #include <test/container/xelementaccess.hxx>
+#include <test/text/numberingrules.hxx>
 
 #include <com/sun/star/frame/Desktop.hpp>
 
@@ -29,7 +30,8 @@ namespace
 class SwXChapterNumbering final : public UnoApiTest,
                                   public apitest::XPropertySet,
                                   public apitest::XElementAccess,
-                                  public apitest::XIndexAccess
+                                  public apitest::XIndexAccess,
+                                  public apitest::NumberingRules
 {
 public:
     SwXChapterNumbering()
@@ -76,6 +78,7 @@ public:
     CPPUNIT_TEST(testGetPropertyValue);
     CPPUNIT_TEST(testPropertyChangeListener);
     CPPUNIT_TEST(testVetoableChangeListener);
+    CPPUNIT_TEST(testNumberingRulesProperties);
     CPPUNIT_TEST_SUITE_END();
 };
 
diff --git a/sw/qa/api/SwXNumberingRules.cxx b/sw/qa/api/SwXNumberingRules.cxx
index 74febc1c027a..41fb3395aa9c 100644
--- a/sw/qa/api/SwXNumberingRules.cxx
+++ b/sw/qa/api/SwXNumberingRules.cxx
@@ -11,6 +11,7 @@
 #include <test/container/xelementaccess.hxx>
 #include <test/beans/xpropertyset.hxx>
 #include <test/container/xindexaccess.hxx>
+#include <test/text/numberingrules.hxx>
 
 #include <com/sun/star/frame/Desktop.hpp>
 
@@ -37,7 +38,8 @@ namespace
 class SwXNumberingRules final : public UnoApiTest,
                                 public apitest::XElementAccess,
                                 public apitest::XIndexAccess,
-                                public apitest::XPropertySet
+                                public apitest::XPropertySet,
+                                public apitest::NumberingRules
 {
 public:
     SwXNumberingRules()
@@ -125,6 +127,7 @@ public:
     CPPUNIT_TEST(testGetPropertyValue);
     CPPUNIT_TEST(testPropertyChangeListener);
     CPPUNIT_TEST(testVetoableChangeListener);
+    CPPUNIT_TEST(testNumberingRulesProperties);
     CPPUNIT_TEST_SUITE_END();
 };
 
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 91f4a1d8e86b..76798568d58b 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -188,6 +188,7 @@ $(eval $(call 
gb_Library_add_exception_objects,subsequenttest,\
        test/source/table/xtablecolumns \
        test/source/table/xtablerows \
        test/source/text/baseindex \
+       test/source/text/numberingrules \
        test/source/text/textcontent \
        test/source/text/xsimpletext \
        test/source/text/xtext \
diff --git a/test/source/text/numberingrules.cxx 
b/test/source/text/numberingrules.cxx
new file mode 100644
index 000000000000..c54925650523
--- /dev/null
+++ b/test/source/text/numberingrules.cxx
@@ -0,0 +1,77 @@
+/* -*- 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/text/numberingrules.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/table/CellAddress.hpp>
+#include <com/sun/star/table/TableOrientation.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <cppunit/TestAssert.h>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+namespace apitest
+{
+void NumberingRules::testNumberingRulesProperties()
+{
+    Reference<beans::XPropertySet> xNumberingRules(init(), UNO_QUERY_THROW);
+    OUString propName;
+    uno::Any aNewValue;
+
+    propName = "IsAbsoluteMargins";
+    bool bIsAbsoluteMarginsGet = false;
+    bool bIsAbsoluteMarginsSet = false;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue IsAbsoluteMargins",
+                           xNumberingRules->getPropertyValue(propName) >>= 
bIsAbsoluteMarginsGet);
+
+    aNewValue <<= !bIsAbsoluteMarginsGet;
+    xNumberingRules->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xNumberingRules->getPropertyValue(propName) >>= 
bIsAbsoluteMarginsSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue 
IsAbsoluteMargins",
+                                 !bIsAbsoluteMarginsGet, 
bIsAbsoluteMarginsSet);
+
+    propName = "IsAutomatic";
+    bool bIsAutomaticGet = false;
+    bool bIsAutomaticSet = false;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue IsAutomatic",
+                           xNumberingRules->getPropertyValue(propName) >>= 
bIsAutomaticGet);
+
+    bIsAutomaticGet = false;
+    aNewValue <<= !bIsAutomaticGet;
+    xNumberingRules->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xNumberingRules->getPropertyValue(propName) >>= 
bIsAutomaticSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue IsAutomatic", 
!bIsAutomaticGet,
+                                 bIsAutomaticSet);
+
+    propName = "IsContinuousNumbering";
+    bool bIsContinuousNumberingGet = false;
+    bool bIsContinuousNumberingSet = false;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue IsContinuousNumbering",
+                           xNumberingRules->getPropertyValue(propName)
+                           >>= bIsContinuousNumberingGet);
+
+    aNewValue <<= !bIsContinuousNumberingGet;
+    xNumberingRules->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xNumberingRules->getPropertyValue(propName) >>= 
bIsContinuousNumberingSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue 
IsContinuousNumbering",
+                                 !bIsContinuousNumberingGet, 
bIsContinuousNumberingSet);
+
+    propName = "Name";
+    OUString aNameGet = "";
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue Name",
+                           xNumberingRules->getPropertyValue(propName) >>= 
aNameGet);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */

Reply via email to