diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2012-05-24 17:58:27 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-05-24 17:59:46 +0200 |
commit | fe7a4aad76c051bc46ae46b175fb182b6e7e3f89 (patch) | |
tree | a98cb5697afc212c6b1036820ecc774fc3115f03 /sw/qa | |
parent | d4798414f2705ee987d79617ae2e76da2524e26d (diff) |
testcases for bnc#652364 and bnc#750255 for .docx too
Change-Id: I4a98f4df6fde3f52b099fa627baa861f496bb452
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/ooxmltok/data/n652364.docx | bin | 0 -> 8975 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmltok/data/n750255.docx | bin | 0 -> 10102 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmltok/ooxmltok.cxx | 82 |
3 files changed, 82 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmltok/data/n652364.docx b/sw/qa/extras/ooxmltok/data/n652364.docx Binary files differnew file mode 100644 index 000000000000..0845509e84b7 --- /dev/null +++ b/sw/qa/extras/ooxmltok/data/n652364.docx diff --git a/sw/qa/extras/ooxmltok/data/n750255.docx b/sw/qa/extras/ooxmltok/data/n750255.docx Binary files differnew file mode 100644 index 000000000000..a0c7370022b0 --- /dev/null +++ b/sw/qa/extras/ooxmltok/data/n750255.docx diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx b/sw/qa/extras/ooxmltok/ooxmltok.cxx index abd1a2db33fa..fb5e3d2a9298 100644 --- a/sw/qa/extras/ooxmltok/ooxmltok.cxx +++ b/sw/qa/extras/ooxmltok/ooxmltok.cxx @@ -59,6 +59,8 @@ public: void testN705956_1(); void testN705956_2(); void testN747461(); + void testN750255(); + void testN652364(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -72,6 +74,8 @@ public: CPPUNIT_TEST(testN705956_1); CPPUNIT_TEST(testN705956_2); CPPUNIT_TEST(testN747461); + CPPUNIT_TEST(testN750255); + CPPUNIT_TEST(testN652364); #endif CPPUNIT_TEST_SUITE_END(); @@ -321,6 +325,84 @@ after they are loaded. CPPUNIT_ASSERT_EQUAL( OUString( "Green" ), descr3 ); } +void Test::testN750255() +{ + load( "n750255.docx" ); + +/* +Column break without columns on the page is a page break, so check those paragraphs +are on page 2 (page style 'Converted1') and page 3 (page style 'Converted2') +enum = ThisComponent.Text.createEnumeration +enum.nextElement +para1 = enum.nextElement +xray para1.String +xray para1.PageStyleName +para2 = enum.nextElement +xray para2.String +xray para2.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 and 3rd paragraph + uno::Reference<uno::XInterface> paragraph1(paraEnum->nextElement(), uno::UNO_QUERY); + uno::Reference<uno::XInterface> paragraph2(paraEnum->nextElement(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> text1(paragraph1, uno::UNO_QUERY); + uno::Reference<text::XTextRange> text2(paragraph2, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL( OUString( "one" ), text1->getString()); + CPPUNIT_ASSERT_EQUAL( OUString( "two" ), text2->getString()); + uno::Reference<beans::XPropertySet> paragraphProperties1(paragraph1, uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> paragraphProperties2(paragraph2, uno::UNO_QUERY); + OUString pageStyle1, pageStyle2; + paragraphProperties1->getPropertyValue( "PageStyleName" ) >>= pageStyle1; + paragraphProperties2->getPropertyValue( "PageStyleName" ) >>= pageStyle2; + CPPUNIT_ASSERT_EQUAL( OUString( "Converted1" ), pageStyle1 ); + CPPUNIT_ASSERT_EQUAL( OUString( "Converted2" ), pageStyle2 ); + +} + +void Test::testN652364() +{ + load( "n652364.docx" ); + +/* +Related to 750255 above, column break with columns on the page however should be a column break. +enum = ThisComponent.Text.createEnumeration +enum.nextElement +para1 = enum.nextElement +xray para1.String +xray para1.PageStyleName +enum.nextElement +para2 = enum.nextElement +xray para2.String +xray para2.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(); + // get the 2nd and 4th paragraph + (void) paraEnum->nextElement(); + uno::Reference<uno::XInterface> paragraph1(paraEnum->nextElement(), uno::UNO_QUERY); + (void) paraEnum->nextElement(); + uno::Reference<uno::XInterface> paragraph2(paraEnum->nextElement(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> text1(paragraph1, uno::UNO_QUERY); + uno::Reference<text::XTextRange> text2(paragraph2, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL( OUString( "text1" ), text1->getString()); + CPPUNIT_ASSERT_EQUAL( OUString( "text2" ), text2->getString()); + uno::Reference<beans::XPropertySet> paragraphProperties1(paragraph1, uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> paragraphProperties2(paragraph2, uno::UNO_QUERY); + OUString pageStyle1, pageStyle2; + paragraphProperties1->getPropertyValue( "PageStyleName" ) >>= pageStyle1; + paragraphProperties2->getPropertyValue( "PageStyleName" ) >>= pageStyle2; + // "Standard" is the style for the first page (2nd is "Converted1"). + CPPUNIT_ASSERT_EQUAL( OUString( "Standard" ), pageStyle1 ); + CPPUNIT_ASSERT_EQUAL( OUString( "Standard" ), pageStyle2 ); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); |