From 0f330ea25840690d05516adc20cfb3d1a9d33317 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 2 Apr 2012 14:24:53 +0200 Subject: RtfModelTest: introduce common getPages() method --- sw/qa/extras/rtftok/rtftok.cxx | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'sw/qa/extras/rtftok/rtftok.cxx') 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 mxComponent; }; @@ -130,6 +132,15 @@ int RtfModelTest::getLength() return aBuf.getLength(); } +int RtfModelTest::getPages() +{ + uno::Reference xModel(mxComponent, uno::UNO_QUERY); + uno::Reference xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY); + uno::Reference 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 xModel(mxComponent, uno::UNO_QUERY); - uno::Reference xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY); - uno::Reference 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 xModel(mxComponent, uno::UNO_QUERY); - uno::Reference xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY); - uno::Reference 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); -- cgit