summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2012-05-24 16:07:06 +0200
committerLuboš Luňák <l.lunak@suse.cz>2012-05-24 17:59:43 +0200
commitac6c57e12fb18a8294c57f79ec979128c735ec68 (patch)
tree4006ec6993f20ee1c7c5fc56e2b4413e2f959f70 /sw/qa
parent5935a6db64830ac5b932803cdcac5813aa033594 (diff)
testcases for bnc#652364 and bnc#750255
Change-Id: I1be5de3e09e3eb0d52de5fb57b390c2c5fde98cb
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/ooxmltok/ooxmltok.cxx6
-rw-r--r--sw/qa/extras/ww8tok/data/n652364.docbin0 -> 22016 bytes
-rw-r--r--sw/qa/extras/ww8tok/data/n750255.docbin0 -> 22016 bytes
-rw-r--r--sw/qa/extras/ww8tok/ww8tok.cxx82
4 files changed, 85 insertions, 3 deletions
diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx b/sw/qa/extras/ooxmltok/ooxmltok.cxx
index da85c1414418..abd1a2db33fa 100644
--- a/sw/qa/extras/ooxmltok/ooxmltok.cxx
+++ b/sw/qa/extras/ooxmltok/ooxmltok.cxx
@@ -234,15 +234,15 @@ xray para.PageStyleName
(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 );
+ OUString pageStyle;
+ paragraphProperties->getPropertyValue( "PageStyleName" ) >>= pageStyle;
+ CPPUNIT_ASSERT_EQUAL( OUString( "First Page" ), pageStyle );
}
void Test::testN705956_1()
diff --git a/sw/qa/extras/ww8tok/data/n652364.doc b/sw/qa/extras/ww8tok/data/n652364.doc
new file mode 100644
index 000000000000..f7a0fe0d57d7
--- /dev/null
+++ b/sw/qa/extras/ww8tok/data/n652364.doc
Binary files differ
diff --git a/sw/qa/extras/ww8tok/data/n750255.doc b/sw/qa/extras/ww8tok/data/n750255.doc
new file mode 100644
index 000000000000..c0475c4ede26
--- /dev/null
+++ b/sw/qa/extras/ww8tok/data/n750255.doc
Binary files differ
diff --git a/sw/qa/extras/ww8tok/ww8tok.cxx b/sw/qa/extras/ww8tok/ww8tok.cxx
index dfc047ee2f42..fc9f650b24a5 100644
--- a/sw/qa/extras/ww8tok/ww8tok.cxx
+++ b/sw/qa/extras/ww8tok/ww8tok.cxx
@@ -44,11 +44,15 @@ class Test : public SwModelTestBase
public:
void testN757910();
void testN760294();
+ void testN750255();
+ void testN652364();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
CPPUNIT_TEST(testN757910);
CPPUNIT_TEST(testN760294);
+ CPPUNIT_TEST(testN750255);
+ CPPUNIT_TEST(testN652364);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -93,6 +97,84 @@ void Test::testN760294()
CPPUNIT_ASSERT_EQUAL(aTableBorder.TopLine.InnerLineWidth, aTableBorder.TopLine.LineDistance);
}
+void Test::testN750255()
+{
+ load( "n750255.doc" );
+
+/*
+Column break without columns on the page is a page break, so check those paragraphs
+are on page 2 (page style 'Convert 1') and page 3 (page style 'Convert 2')
+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( "Convert 1" ), pageStyle1 );
+ CPPUNIT_ASSERT_EQUAL( OUString( "Convert 2" ), pageStyle2 );
+
+}
+
+void Test::testN652364()
+{
+ load( "n652364.doc" );
+
+/*
+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 "Convert 1").
+ CPPUNIT_ASSERT_EQUAL( OUString( "Standard" ), pageStyle1 );
+ CPPUNIT_ASSERT_EQUAL( OUString( "Standard" ), pageStyle2 );
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();