include/test/text/documentindexmark.hxx                              |   31 
++++
 qadevOOo/Jar_OOoRunner.mk                                            |    1 
 qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXDocumentIndexMark.csv |    3 
 qadevOOo/tests/java/ifc/text/_DocumentIndexMark.java                 |   38 
-----
 sw/qa/api/SwXDocumentIndexMark.cxx                                   |    5 
 test/Library_subsequenttest.mk                                       |    1 
 test/source/text/documentindexmark.cxx                               |   69 
++++++++++
 7 files changed, 105 insertions(+), 43 deletions(-)

New commits:
commit d1fef008f10da02700fe9d46bc86c3a50cae7a21
Author:     anfanite396 <[email protected]>
AuthorDate: Tue Aug 1 19:39:26 2023 +0530
Commit:     Tomaž Vajngerl <[email protected]>
CommitDate: Sat Aug 26 13:30:26 2023 +0200

    tdf#45904: Move _DocumentIndexMark Java tests to C++
    
    Change-Id: I144d06ab3abb47134060d554a4016009246aa739
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155163
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <[email protected]>

diff --git a/include/test/text/documentindexmark.hxx 
b/include/test/text/documentindexmark.hxx
new file mode 100644
index 000000000000..228668c3b070
--- /dev/null
+++ b/include/test/text/documentindexmark.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 DocumentIndexMark
+{
+public:
+    virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+    void testDocumentIndexMarkProperties();
+
+protected:
+    ~DocumentIndexMark() {}
+};
+}
+
+/* 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 336b99b81e9a..9e89070e0a97 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -593,7 +593,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
     qadevOOo/tests/java/ifc/text/_CellRange \
     qadevOOo/tests/java/ifc/text/_Defaults \
     qadevOOo/tests/java/ifc/text/_DocumentIndex \
-    qadevOOo/tests/java/ifc/text/_DocumentIndexMark \
     qadevOOo/tests/java/ifc/text/_DocumentSettings \
     qadevOOo/tests/java/ifc/text/_Footnote \
     qadevOOo/tests/java/ifc/text/_FootnoteSettings \
diff --git 
a/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXDocumentIndexMark.csv 
b/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXDocumentIndexMark.csv
index 6e02c6c3f748..cc1e491f1987 100644
--- a/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXDocumentIndexMark.csv
+++ b/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXDocumentIndexMark.csv
@@ -4,8 +4,5 @@
 
"SwXDocumentIndexMark";"com::sun::star::text::TextContent";"AnchorType#optional"
 
"SwXDocumentIndexMark";"com::sun::star::text::TextContent";"AnchorTypes#optional"
 "SwXDocumentIndexMark";"com::sun::star::text::TextContent";"TextWrap#optional"
-"SwXDocumentIndexMark";"com::sun::star::text::DocumentIndexMark";"PrimaryKey"
-"SwXDocumentIndexMark";"com::sun::star::text::DocumentIndexMark";"SecondaryKey"
-"SwXDocumentIndexMark";"com::sun::star::text::DocumentIndexMark";"IsMainEntry"
 "SwXDocumentIndexMark";"com::sun::star::text::XTextContent";"attach()"
 "SwXDocumentIndexMark";"com::sun::star::text::XTextContent";"getAnchor()"
diff --git a/qadevOOo/tests/java/ifc/text/_DocumentIndexMark.java 
b/qadevOOo/tests/java/ifc/text/_DocumentIndexMark.java
deleted file mode 100644
index d78730727e12..000000000000
--- a/qadevOOo/tests/java/ifc/text/_DocumentIndexMark.java
+++ /dev/null
@@ -1,38 +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.text;
-
-import lib.MultiPropertyTest;
-
-/**
-* Testing <code>com.sun.star.text.DocumentIndexMark</code>
-* service properties :
-* <ul>
-*  <li><code> PrimaryKey</code></li>
-*  <li><code> SecondaryKey</code></li>
-*  <li><code> IsMainEntry</code></li>
-* </ul> <p>
-* Properties testing is automated by <code>lib.MultiPropertyTest</code>.
-* @see com.sun.star.text.DocumentIndexMark
-*/
-public class _DocumentIndexMark extends MultiPropertyTest {
-
-}  // finish class _DocumentIndexMark
-
-
diff --git a/sw/qa/api/SwXDocumentIndexMark.cxx 
b/sw/qa/api/SwXDocumentIndexMark.cxx
index cccb83733055..395769c5cca7 100644
--- a/sw/qa/api/SwXDocumentIndexMark.cxx
+++ b/sw/qa/api/SwXDocumentIndexMark.cxx
@@ -11,6 +11,7 @@
 #include <test/lang/xcomponent.hxx>
 #include <test/text/xtextcontent.hxx>
 #include <test/text/baseindexmark.hxx>
+#include <test/text/documentindexmark.hxx>
 #include <unotest/macros_test.hxx>
 
 #include <com/sun/star/frame/Desktop.hpp>
@@ -35,7 +36,8 @@ class SwXDocumentIndexMark final : public 
test::BootstrapFixture,
                                    public unotest::MacrosTest,
                                    public apitest::XComponent,
                                    public apitest::XTextContent,
-                                   public apitest::BaseIndexMark
+                                   public apitest::BaseIndexMark,
+                                   public apitest::DocumentIndexMark
 {
 public:
     virtual void setUp() override;
@@ -55,6 +57,7 @@ public:
     CPPUNIT_TEST(testAttach);
     CPPUNIT_TEST(testGetAnchor);
     CPPUNIT_TEST(testBaseIndexMarkProperties);
+    CPPUNIT_TEST(testDocumentIndexMarkProperties);
     CPPUNIT_TEST_SUITE_END();
 
 private:
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index a8f4258df040..f8fd36e1d2ba 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -189,6 +189,7 @@ $(eval $(call 
gb_Library_add_exception_objects,subsequenttest,\
        test/source/table/xtablerows \
        test/source/text/baseindex \
        test/source/text/baseindexmark \
+       test/source/text/documentindexmark \
        test/source/text/numberingrules \
        test/source/text/textcontent \
        test/source/text/xautotextcontainer \
diff --git a/test/source/text/documentindexmark.cxx 
b/test/source/text/documentindexmark.cxx
new file mode 100644
index 000000000000..86c1cd9bc151
--- /dev/null
+++ b/test/source/text/documentindexmark.cxx
@@ -0,0 +1,69 @@
+/* -*- 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/documentindexmark.hxx>
+
+#include <com/sun/star/beans/XPropertySet.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 DocumentIndexMark::testDocumentIndexMarkProperties()
+{
+    Reference<beans::XPropertySet> xDocumentIndexMark(init(), UNO_QUERY_THROW);
+    OUString propName;
+    uno::Any aNewValue;
+
+    propName = "PrimaryKey";
+    OUString aPrimaryKeyGet = "";
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue PrimaryKey",
+                           xDocumentIndexMark->getPropertyValue(propName) >>= 
aPrimaryKeyGet);
+
+    OUString aPrimaryKeySet = "testPropertyPK";
+    aNewValue <<= aPrimaryKeySet;
+    xDocumentIndexMark->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xDocumentIndexMark->getPropertyValue(propName) >>= 
aPrimaryKeyGet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue PrimaryKey", 
aPrimaryKeyGet,
+                                 aPrimaryKeySet);
+
+    propName = "SecondaryKey";
+    OUString aSecondaryKeyGet = "";
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue SecondaryKey",
+                           xDocumentIndexMark->getPropertyValue(propName) >>= 
aSecondaryKeyGet);
+
+    OUString aSecondaryKeySet = "testPropertySK";
+    aNewValue <<= aSecondaryKeySet;
+    xDocumentIndexMark->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xDocumentIndexMark->getPropertyValue(propName) >>= 
aSecondaryKeyGet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue SecondaryKey", 
aSecondaryKeyGet,
+                                 aSecondaryKeySet);
+
+    propName = "IsMainEntry";
+    bool bIsMainEntryGet = false;
+    bool bIsMainEntrySet = false;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue IsMainEntry",
+                           xDocumentIndexMark->getPropertyValue(propName) >>= 
bIsMainEntryGet);
+
+    aNewValue <<= !bIsMainEntryGet;
+    xDocumentIndexMark->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xDocumentIndexMark->getPropertyValue(propName) >>= 
bIsMainEntrySet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue IsMainEntry", 
!bIsMainEntryGet,
+                                 bIsMainEntrySet);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */

Reply via email to