[Libreoffice-commits] core.git: sw/qa
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Wed Apr 8 13:10:40 UTC 2020
sw/qa/extras/odfimport/odfimport.cxx | 18 ++---------------
sw/qa/extras/ooxmlexport/ooxmlexport10.cxx | 13 +-----------
sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 6 -----
sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 24 +++--------------------
sw/qa/extras/ooxmlexport/ooxmlexport8.cxx | 30 ++++-------------------------
sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 6 -----
6 files changed, 16 insertions(+), 81 deletions(-)
New commits:
commit 2e84b06460e4f4f1d25b1973fcc0e0493c6d9815
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Wed Apr 8 13:33:26 2020 +0200
Commit: Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Wed Apr 8 15:09:51 2020 +0200
CppunitTest: remove duplicated code
Change-Id: I7ae42a3b853aa3e4cd13566335b528a486e031d0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91909
Tested-by: Jenkins
Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index 55a477ba0aa5..30737c3454dd 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -480,11 +480,7 @@ DECLARE_ODFIMPORT_TEST(testFdo60842, "fdo60842.odt")
DECLARE_ODFIMPORT_TEST(testFdo79269, "fdo79269.odt")
{
- 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());
// The problem was that the first-footer was shared.
uno::Reference<beans::XPropertySet> xPropSet(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);
@@ -498,11 +494,7 @@ DECLARE_ODFIMPORT_TEST(testFdo79269, "fdo79269.odt")
DECLARE_ODFIMPORT_TEST(testFdo79269_header, "fdo79269_header.odt")
{
- 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());
uno::Reference<beans::XPropertySet> xPropSet(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xPropSet, "FirstIsShared"));
@@ -849,11 +841,7 @@ DECLARE_ODFIMPORT_TEST(testTdf76322_columnBreakInHeader, "tdf76322_columnBreakIn
DECLARE_ODFIMPORT_TEST(testTdf76349_1columnBreak, "tdf76349_1columnBreak.odt")
{
//single-column breaks should only be treated as page breaks for MS formats - should be only one page here.
- 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(1), xCursor->getPage());
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
}
DECLARE_ODFIMPORT_TEST(testTdf96113, "tdf96113.odt")
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index 1a59b2f8f920..09a232ae5773 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -649,25 +649,16 @@ DECLARE_OOXMLEXPORT_TEST(testFdo78883, "fdo78883.docx")
{
// fdo#78883 : LO was getting hang while opening document
// Checking there is a single page after loading a doc in LO.
- 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();
-
// Check to make sure the document loaded. Note that the page number may
// be 1 or 2 depending on the environment.
- CPPUNIT_ASSERT(xCursor->getPage() > sal_Int16(0));
+ CPPUNIT_ASSERT(getPages() > 0);
}
DECLARE_OOXMLEXPORT_TEST(testFdo79535, "fdo79535.docx")
{
// fdo#79535 : LO was crashing while opening document
// Checking there is a single page after loading a doc successfully in LO.
- 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(1), xCursor->getPage());
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
}
DECLARE_OOXMLEXPORT_TEST(testBnc875718, "bnc875718.docx")
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index 99aa70e27cd5..fbd0552b479d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -959,11 +959,7 @@ DECLARE_OOXMLEXPORT_TEST(testExtraSectionBreak, "1_page.docx")
// There was a problem for some documents during export.Invalid sectPr getting added
// because of faulty calculation of PageDesc value
// This was the reason for increasing number of pages after RT
- 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(1), xCursor->getPage());
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
// tdf126544 Styles were being added before their base/parent/inherited-from style existed, and so were using default settings.
uno::Reference<container::XNameAccess> xParaStyles(getStyles("ParagraphStyles"));
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index 91acdfe299ec..12f6cb0677d7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -221,11 +221,7 @@ DECLARE_OOXMLEXPORT_TEST(testTableRowDataDisplayedTwice,"table-row-data-displaye
// fdo#73534: There was a problem for some documents during export.Invalid sectPr getting added
// because of wrong condition in code.
// This was the reason for increasing number of pages after RT
- 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());
}
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo73556,"fdo73556.docx")
@@ -348,11 +344,7 @@ DECLARE_OOXMLEXPORT_TEST(testColumnBreak_ColumnCountIsZero,"fdo74153.docx")
assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[1]/w:br","type","column");
//tdf76349 match Word's behavior of treating breaks in single columns as page breaks.
- 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());
}
DECLARE_OOXMLEXPORT_TEST(testTdf90697_complexBreaksHeaders,"tdf90697_complexBreaksHeaders.docx")
@@ -1045,21 +1037,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf86926_A3, "tdf86926_A3.docx")
DECLARE_OOXMLEXPORT_TEST(testTdf64372_continuousBreaks,"tdf64372_continuousBreaks.docx")
{
//There are no page breaks, so everything should be on the first page.
- 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(1), xCursor->getPage());
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
}
DECLARE_OOXMLEXPORT_TEST(testTdf92724_continuousBreaksComplex,"tdf92724_continuousBreaksComplex.docx")
{
//There are 2 page breaks, so there should be 3 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(3), xCursor->getPage());
+ CPPUNIT_ASSERT_EQUAL(3, getPages());
}
DECLARE_OOXMLEXPORT_TEST(testTdf90697_continuousBreaksComplex2,"tdf92724_continuousBreaksComplex2.docx")
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index d4b32ab32466..9db6f8f09974 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -87,12 +87,8 @@ DECLARE_OOXMLEXPORT_TEST(testN751054, "n751054.docx")
DECLARE_OOXMLEXPORT_TEST(testN750935, "n750935.docx")
{
- 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();
// Some page break types were ignores, resulting in less pages.
- CPPUNIT_ASSERT_EQUAL(sal_Int16(5), xCursor->getPage());
+ CPPUNIT_ASSERT_EQUAL(5, getPages());
/*
* The problem was that the header and footer was not shared.
@@ -446,11 +442,7 @@ DECLARE_OOXMLEXPORT_TEST(testN778828, "n778828.docx")
* The problem was that a page break after a continuous section break caused
* double page break on title page.
*/
- 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());
}
DECLARE_OOXMLEXPORT_TEST(testN779834, "n779834.docx")
@@ -560,11 +552,7 @@ DECLARE_OOXMLEXPORT_TEST(testN780843, "n780843.docx")
//tdf64372 this document should only have one page break (2 pages, not 3)
- 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());
}
DECLARE_OOXMLEXPORT_TEST(testN780843b, "n780843b.docx")
@@ -634,11 +622,7 @@ DECLARE_OOXMLEXPORT_TEST(testN783638, "n783638.docx")
DECLARE_OOXMLEXPORT_TEST(testFdo52208, "fdo52208.docx")
{
// The problem was that the document had 2 pages instead of 1.
- 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(1), xCursor->getPage());
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
}
DECLARE_OOXMLEXPORT_TEST(testN785767, "n785767.docx")
@@ -1081,11 +1065,7 @@ DECLARE_OOXMLEXPORT_TEST(testBnc780044Spacing, "bnc780044_spacing.docx")
{
// The document has global w:spacing in styles.xml , and local w:spacing in w:pPr, which however
// only applied to text runs, not to as-character pictures. So the picture made the line higher.
- 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(1), xCursor->getPage());
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
}
DECLARE_OOXMLEXPORT_TEST(testTableAutoNested, "table-auto-nested.docx")
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 3b2c22e7e2d6..37603bd407be 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -64,11 +64,7 @@ public:
DECLARE_OOXMLEXPORT_TEST(testFdo55381, "fdo55381.docx")
{
- 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(4), xCursor->getPage());
+ CPPUNIT_ASSERT_EQUAL(4, getPages());
//TODO: frames not located on the correct pages
}
More information about the Libreoffice-commits
mailing list