Kaydet (Commit) ac6c57e1 authored tarafından Luboš Luňák's avatar Luboš Luňák

testcases for bnc#652364 and bnc#750255

Change-Id: I1be5de3e09e3eb0d52de5fb57b390c2c5fde98cb
üst 5935a6db
......@@ -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()
......
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment