summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-06-21 16:43:10 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-06-21 17:17:47 +0200
commit6713b8d3ecd14293ecc6ba1f37a7a77f8a1cdea0 (patch)
treef6745c0c112df4327c1967816baedbe164589c9f
parenta208d96584009de2b902534e62f03de8124160a9 (diff)
n#758883 testcase
Change-Id: Ibcaf427849ef69f379e0d6e77f586d77e4d0c92f
-rw-r--r--sw/CppunitTest_sw_subsequent_ooxmltok.mk11
-rw-r--r--sw/qa/extras/ooxmltok/data/n758883.docxbin0 -> 11362 bytes
-rw-r--r--sw/qa/extras/ooxmltok/ooxmltok.cxx47
3 files changed, 58 insertions, 0 deletions
diff --git a/sw/CppunitTest_sw_subsequent_ooxmltok.mk b/sw/CppunitTest_sw_subsequent_ooxmltok.mk
index 92a4cc48ade3..4348603e9e68 100644
--- a/sw/CppunitTest_sw_subsequent_ooxmltok.mk
+++ b/sw/CppunitTest_sw_subsequent_ooxmltok.mk
@@ -39,10 +39,21 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_subsequent_ooxmltok, \
sal \
test \
unotest \
+ sw \
vcl \
$(gb_STDLIBS) \
))
+$(eval $(call gb_CppunitTest_use_externals,sw_subsequent_ooxmltok,\
+ libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sw_subsequent_ooxmltok,\
+ -I$(SRCDIR)/sw/inc \
+ -I$(SRCDIR)/sw/source/core/inc \
+ $$(INCLUDE) \
+))
+
$(eval $(call gb_CppunitTest_use_api,sw_subsequent_ooxmltok,\
offapi \
udkapi \
diff --git a/sw/qa/extras/ooxmltok/data/n758883.docx b/sw/qa/extras/ooxmltok/data/n758883.docx
new file mode 100644
index 000000000000..fed398fd29b8
--- /dev/null
+++ b/sw/qa/extras/ooxmltok/data/n758883.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx b/sw/qa/extras/ooxmltok/ooxmltok.cxx
index 792b1dbd6668..a34dd392f473 100644
--- a/sw/qa/extras/ooxmltok/ooxmltok.cxx
+++ b/sw/qa/extras/ooxmltok/ooxmltok.cxx
@@ -45,6 +45,14 @@
#include <vcl/svapp.hxx>
+#include <unotxdoc.hxx>
+#include <docsh.hxx>
+#include <doc.hxx>
+#include <rootfrm.hxx>
+
+#include <libxml/xmlwriter.h>
+#include <libxml/xpath.h>
+
using rtl::OString;
using rtl::OUString;
using rtl::OUStringBuffer;
@@ -69,6 +77,7 @@ public:
void testSmartart();
void testN764745();
void testN766477();
+ void testN758883();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -89,6 +98,7 @@ public:
CPPUNIT_TEST(testSmartart);
CPPUNIT_TEST(testN764745);
CPPUNIT_TEST(testN766477);
+ CPPUNIT_TEST(testN758883);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -551,6 +561,43 @@ void Test::testN766477()
CPPUNIT_ASSERT_EQUAL(OUString("Checkbox_Checked"), aElementNames[0]);
}
+void Test::testN758883()
+{
+ /*
+ * The problem was that direct formatting of the paragraph was not applied
+ * to the numbering. This is easier to test using a layout dump.
+ */
+
+ // create xml writer
+ xmlBufferPtr pXmlBuffer = xmlBufferCreate();
+ xmlTextWriterPtr pXmlWriter = xmlNewTextWriterMemory(pXmlBuffer, 0);
+ xmlTextWriterStartDocument(pXmlWriter, NULL, NULL, NULL);
+
+ // create dump
+ load("n758883.docx");
+ SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
+ SwDoc* pDoc = pTxtDoc->GetDocShell()->GetDoc();
+ SwRootFrm* pLayout = pDoc->GetCurrentLayout();
+ pLayout->dumpAsXml(pXmlWriter);
+
+ // delete xml writer
+ xmlTextWriterEndDocument(pXmlWriter);
+ xmlFreeTextWriter(pXmlWriter);
+
+ // parse the dump
+ xmlDocPtr pXmlDoc = xmlParseMemory((const char*)xmlBufferContent(pXmlBuffer), xmlBufferLength(pXmlBuffer));;
+ xmlXPathContextPtr pXmlXpathCtx = xmlXPathNewContext(pXmlDoc);
+ xmlXPathObjectPtr pXmlXpathObj = xmlXPathEvalExpression(BAD_CAST("/root/page/body/txt/Special"), pXmlXpathCtx);
+ xmlNodeSetPtr pXmlNodes = pXmlXpathObj->nodesetval;
+ xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
+ OUString aHeight = OUString::createFromAscii((const char*)xmlGetProp(pXmlNode, BAD_CAST("nHeight")));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(220), aHeight.toInt32()); // It was 280
+
+ // delete dump
+ xmlFreeDoc(pXmlDoc);
+ xmlBufferFree(pXmlBuffer);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();