summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2012-05-18 14:18:16 +0200
committerLuboš Luňák <l.lunak@suse.cz>2012-05-18 14:31:33 +0200
commitd2e09c2872e5018becf06ffb1bc4a825f047f5b2 (patch)
tree6cf8acd625a815d423ec1608e3f7a0610f55db4d
parentf73e75e91c757b20682d1df75de2f79b3972a500 (diff)
testcase for bnc#751077
Change-Id: Iee60b1d41f04f4a583c7392335068ca75668f42c
-rw-r--r--sw/qa/extras/ooxmltok/data/n751077.docxbin0 -> 22131 bytes
-rw-r--r--sw/qa/extras/ooxmltok/ooxmltok.cxx32
2 files changed, 32 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmltok/data/n751077.docx b/sw/qa/extras/ooxmltok/data/n751077.docx
new file mode 100644
index 000000000000..62304e17c277
--- /dev/null
+++ b/sw/qa/extras/ooxmltok/data/n751077.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx b/sw/qa/extras/ooxmltok/ooxmltok.cxx
index 9e0473c34ec5..896b9fd78fa7 100644
--- a/sw/qa/extras/ooxmltok/ooxmltok.cxx
+++ b/sw/qa/extras/ooxmltok/ooxmltok.cxx
@@ -54,6 +54,7 @@ public:
void testN750935();
void testN757890();
void testFdo49940();
+ void testN751077();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -63,6 +64,7 @@ public:
CPPUNIT_TEST(testN750935);
CPPUNIT_TEST(testN757890);
CPPUNIT_TEST(testFdo49940);
+ CPPUNIT_TEST(testN751077);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -206,6 +208,36 @@ void Test::testFdo49940()
CPPUNIT_ASSERT_EQUAL(OUString("First Page"), aValue);
}
+void Test::testN751077()
+{
+ load( "n751077.docx" );
+
+/*
+enum = ThisComponent.Text.createEnumeration
+enum.NextElement
+para = enum.NextElement
+xray para.String
+xray para.PageStyleName
+*/
+ uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XEnumerationAccess> paraEnumAccess(textDocument->getText(), uno::UNO_QUERY);
+ // list of paragraphs
+ uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration();
+ // go to 1st paragraph
+ (void) paraEnum->nextElement();
+ // get the 2nd paragraph
+ uno::Reference<uno::XInterface> paragraph(paraEnum->nextElement(), uno::UNO_QUERY);
+ OUString value;
+ // text of the paragraph
+ uno::Reference<text::XTextRange> text(paragraph, uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL( OUString( "TEXT1" ), text->getString());
+ // we want to test the paragraph is on the first page (it was put onto another page without the fix),
+ // use a small trick and instead of checking the page layout, check the page style
+ uno::Reference<beans::XPropertySet> paragraphProperties(paragraph, uno::UNO_QUERY);
+ paragraphProperties->getPropertyValue( "PageStyleName" ) >>= value;
+ CPPUNIT_ASSERT_EQUAL( OUString( "First Page" ), value );
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();