[Libreoffice-commits] .: sw/qa

Miklos Vajna vmiklos at kemper.freedesktop.org
Wed Jun 13 04:20:30 PDT 2012


 sw/qa/extras/ooxmltok/data/n766477.docx |binary
 sw/qa/extras/ooxmltok/ooxmltok.cxx      |   19 +++++++++++++++++++
 2 files changed, 19 insertions(+)

New commits:
commit 743d423258dec9f4f3b6ddd004a578147b56b2df
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Jun 13 13:20:22 2012 +0200

    n#766477 testcase
    
    Change-Id: I6dec02fbcf6c2f518f0d9003ded71040a7c1c30c

diff --git a/sw/qa/extras/ooxmltok/data/n766477.docx b/sw/qa/extras/ooxmltok/data/n766477.docx
new file mode 100644
index 0000000..a144463
Binary files /dev/null and b/sw/qa/extras/ooxmltok/data/n766477.docx differ
diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx b/sw/qa/extras/ooxmltok/ooxmltok.cxx
index c53a35f..5165ab0 100644
--- a/sw/qa/extras/ooxmltok/ooxmltok.cxx
+++ b/sw/qa/extras/ooxmltok/ooxmltok.cxx
@@ -35,6 +35,7 @@
 #include <com/sun/star/text/SetVariableType.hpp>
 #include <com/sun/star/text/TextContentAnchorType.hpp>
 #include <com/sun/star/text/XDependentTextField.hpp>
+#include <com/sun/star/text/XFormField.hpp>
 #include <com/sun/star/text/XPageCursor.hpp>
 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
 #include <com/sun/star/text/XTextFramesSupplier.hpp>
@@ -66,6 +67,7 @@ public:
     void testN764005();
     void testSmartart();
     void testN764745();
+    void testN766477();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -85,6 +87,7 @@ public:
     CPPUNIT_TEST(testN764005);
     CPPUNIT_TEST(testSmartart);
     CPPUNIT_TEST(testN764745);
+    CPPUNIT_TEST(testN766477);
 #endif
     CPPUNIT_TEST_SUITE_END();
 
@@ -496,6 +499,22 @@ void Test::testN764745()
     CPPUNIT_ASSERT( pos.X > 10000 );
 }
 
+void Test::testN766477()
+{
+    load("n766477.docx");
+    uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
+    uno::Reference<container::XEnumeration> xParaEnum(xParaEnumAccess->createEnumeration());
+    uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
+    uno::Reference<container::XEnumeration> xRunEnum(xRunEnumAccess->createEnumeration());
+    uno::Reference<beans::XPropertySet> xRun(xRunEnum->nextElement(), uno::UNO_QUERY);
+    uno::Reference<text::XFormField> xFormField(xRun->getPropertyValue("Bookmark"), uno::UNO_QUERY);
+    uno::Reference<container::XNameContainer> xParameters(xFormField->getParameters());
+    uno::Sequence<OUString> aElementNames(xParameters->getElementNames());
+    // The problem was that the checkbox was not checked.
+    CPPUNIT_ASSERT_EQUAL(OUString("Checkbox_Checked"), aElementNames[0]);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list