summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-04-02 14:24:53 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-04-02 14:27:12 +0200
commit0f330ea25840690d05516adc20cfb3d1a9d33317 (patch)
tree1f9e1b4aae7cd032ffa79ec8e49334e361dfdeb5
parent7b58fc3dafc789aa55fff5ffef6ab83c3aa8b6e0 (diff)
RtfModelTest: introduce common getPages() method
-rw-r--r--sw/qa/extras/rtftok/rtftok.cxx23
1 files changed, 13 insertions, 10 deletions
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index 7f9b4989e20f..ac7a2e41f1ab 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -103,6 +103,8 @@ private:
void load(const OUString& rURL);
/// Get the length of the whole document.
int getLength();
+ /// Get page count.
+ int getPages();
uno::Reference<lang::XComponent> mxComponent;
};
@@ -130,6 +132,15 @@ int RtfModelTest::getLength()
return aBuf.getLength();
}
+int RtfModelTest::getPages()
+{
+ uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
+ uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
+ xCursor->jumpToLastPage();
+ return xCursor->getPage();
+}
+
void RtfModelTest::setUp()
{
test::BootstrapFixture::setUp();
@@ -382,11 +393,7 @@ void RtfModelTest::testFdo43965()
CPPUNIT_ASSERT_EQUAL(sal_uInt32(26), aBorder.LineWidth);
// Finally, make sure that we have two pages
- uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
- uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
- uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
- xCursor->jumpToLastPage();
- CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xCursor->getPage());
+ CPPUNIT_ASSERT_EQUAL(2, getPages());
}
void RtfModelTest::testN751020()
@@ -476,11 +483,7 @@ void RtfModelTest::testFdo45394()
void RtfModelTest::testFdo48104()
{
load(OUString(RTL_CONSTASCII_USTRINGPARAM("fdo48104.rtf")));
- uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
- uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
- uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
- xCursor->jumpToLastPage();
- CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xCursor->getPage());
+ CPPUNIT_ASSERT_EQUAL(2, getPages());
}
CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);