diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-05-12 17:19:14 +0200 |
---|---|---|
committer | Xisco Faulí <xiscofauli@libreoffice.org> | 2020-05-14 11:19:17 +0200 |
commit | b4359751889bb88870b2ebc04125770e0f2d535d (patch) | |
tree | 87cade86c237fc57111f654d3bfa5eb0ff6cb1ce /sw | |
parent | 6da4777b647157aa7ed65e271778bb00373098a0 (diff) |
CppUnittest: rtfexport: assert pages in odf files
Change-Id: Iab360691cd23f663b7f6bf00227e8749d4c9e48e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94114
Tested-by: Jenkins
Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport.cxx | 15 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport3.cxx | 4 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport4.cxx | 3 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport5.cxx | 2 |
4 files changed, 24 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index c17dfd2ca750..b12fd8ec1db3 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -129,6 +129,7 @@ DECLARE_RTFEXPORT_TEST(testFdo50831, "fdo50831.rtf") DECLARE_RTFEXPORT_TEST(testFdo48335, "fdo48335.odt") { + CPPUNIT_ASSERT_EQUAL(3, getPages()); /* * The problem was that we exported a fake pagebreak, make sure it's just a soft one now. * @@ -186,6 +187,7 @@ DECLARE_RTFEXPORT_TEST(testFdo38244, "fdo38244.rtf") DECLARE_RTFEXPORT_TEST(testCommentsNested, "comments-nested.odt") { + CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference<beans::XPropertySet> xOuter = getProperty<uno::Reference<beans::XPropertySet>>(getRun(getParagraph(1), 2), "TextField"); CPPUNIT_ASSERT_EQUAL(OUString("Outer"), getProperty<OUString>(xOuter, "Content").trim()); @@ -387,6 +389,7 @@ DECLARE_RTFEXPORT_TEST(testMathRuns, "math-runs.rtf") DECLARE_RTFEXPORT_TEST(testFdo77979, "fdo77979.odt") { + CPPUNIT_ASSERT_EQUAL(1, getPages()); // font name is encoded with \fcharset of font OUString aExpected(u"\u5FAE\u8F6F\u96C5\u9ED1"); CPPUNIT_ASSERT_EQUAL(aExpected, @@ -395,6 +398,7 @@ DECLARE_RTFEXPORT_TEST(testFdo77979, "fdo77979.odt") DECLARE_RTFEXPORT_TEST(testFdo53113, "fdo53113.odt") { + CPPUNIT_ASSERT_EQUAL(1, getPages()); /* * The problem was that a custom shape was missing its second (and all the other remaining) coordinates. * @@ -428,6 +432,7 @@ DECLARE_RTFEXPORT_TEST(testFdo53113, "fdo53113.odt") DECLARE_RTFEXPORT_TEST(testFdo55939, "fdo55939.odt") { + CPPUNIT_ASSERT_EQUAL(1, getPages()); // The problem was that the exported RTF was invalid. // Also, the 'Footnote text.' had an additional newline at its end. uno::Reference<text::XTextRange> xParagraph(getParagraph(1)); @@ -444,6 +449,7 @@ DECLARE_RTFEXPORT_TEST(testFdo55939, "fdo55939.odt") DECLARE_RTFEXPORT_TEST(testTextFrames, "textframes.odt") { + CPPUNIT_ASSERT_EQUAL(1, getPages()); // The output was simply invalid, so let's check if all 3 frames were imported back. uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), @@ -453,6 +459,7 @@ DECLARE_RTFEXPORT_TEST(testTextFrames, "textframes.odt") DECLARE_RTFEXPORT_TEST(testFdo53604, "fdo53604.odt") { + CPPUNIT_ASSERT_EQUAL(1, getPages()); // Invalid output on empty footnote. uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes(); @@ -461,6 +468,7 @@ DECLARE_RTFEXPORT_TEST(testFdo53604, "fdo53604.odt") DECLARE_RTFEXPORT_TEST(testFdo52286, "fdo52286.odt") { + CPPUNIT_ASSERT_EQUAL(1, getPages()); // The problem was that font size wasn't reduced in sub/super script. CPPUNIT_ASSERT_EQUAL( sal_Int32(58), getProperty<sal_Int32>(getRun(getParagraph(1), 2), "CharEscapementHeight")); @@ -499,6 +507,7 @@ DECLARE_RTFEXPORT_TEST(testFdo30983, "fdo30983.rtf") DECLARE_RTFEXPORT_TEST(testPlaceholder, "placeholder.odt") { + CPPUNIT_ASSERT_EQUAL(1, getPages()); // Only the field text was exported, make sure we still have a field with the correct Hint text. uno::Reference<text::XTextRange> xRun(getRun(getParagraph(1), 2)); CPPUNIT_ASSERT_EQUAL(OUString("TextField"), getProperty<OUString>(xRun, "TextPortionType")); @@ -681,6 +690,7 @@ DECLARE_RTFEXPORT_TEST(testParaShadow, "para-shadow.rtf") DECLARE_RTFEXPORT_TEST(testCharacterBorder, "charborder.odt") { + CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(1), 1), uno::UNO_QUERY); // RTF has just one border attribute (chbrdr) for text border so all side has // the same border with the same padding @@ -791,6 +801,7 @@ DECLARE_RTFEXPORT_TEST(testFdo80167, "fdo80167.rtf") DECLARE_RTFEXPORT_TEST(testFdo32613, "fdo32613.odt") { + CPPUNIT_ASSERT_EQUAL(1, getPages()); // This was AS_CHARACTER, RTF export did not support writing anchored pictures. CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType")); @@ -823,6 +834,7 @@ DECLARE_RTFEXPORT_TEST(testTdf113408, "tdf113408.rtf") DECLARE_RTFEXPORT_TEST(testAbi10039, "abi10039.odt") { + CPPUNIT_ASSERT_EQUAL(1, getPages()); // Make sure we don't just crash on export, and additionally the shape should not be inline (as it's at-page anchored originally). CPPUNIT_ASSERT(text::TextContentAnchorType_AS_CHARACTER != getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType")); @@ -830,6 +842,7 @@ DECLARE_RTFEXPORT_TEST(testAbi10039, "abi10039.odt") DECLARE_RTFEXPORT_TEST(testAbi10076, "abi10076.odt") { + CPPUNIT_ASSERT_EQUAL(2, getPages()); // Just make sure that we don't crash after exporting a fully calculated layout. } @@ -860,6 +873,7 @@ DECLARE_RTFEXPORT_TEST(testNumberingFont, "numbering-font.rtf") DECLARE_RTFEXPORT_TEST(testFdo82860, "fdo82860.odt") { + CPPUNIT_ASSERT_EQUAL(1, getPages()); // The problem was that: // 1) The import tried to use fieldmarks for SHAPE fields // 2) The exporter did not handle "shape with textbox" text. @@ -933,6 +947,7 @@ DECLARE_RTFEXPORT_TEST(testTdf104081, "tdf104081.rtf") DECLARE_RTFEXPORT_TEST(testTdf88583, "tdf88583.odt") { + CPPUNIT_ASSERT_EQUAL(1, getPages()); // This was FillStyle_NONE, as background color was missing from the color table during export. CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(getParagraph(1), "FillStyle")); diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx index 51390e001a51..43c06fd68208 100644 --- a/sw/qa/extras/rtfexport/rtfexport3.cxx +++ b/sw/qa/extras/rtfexport/rtfexport3.cxx @@ -25,6 +25,7 @@ public: DECLARE_RTFEXPORT_TEST(testTdf108949, "tdf108949_footnoteCharFormat.odt") { + CPPUNIT_ASSERT_EQUAL(1, getPages()); CPPUNIT_ASSERT_EQUAL_MESSAGE("Paragraph Numbering style", OUString(), getProperty<OUString>(getParagraph(2), "NumberingStyleName")); @@ -77,6 +78,7 @@ DECLARE_RTFEXPORT_TEST(testTdf130817, "tdf130817.rtf") DECLARE_RTFEXPORT_TEST(testTdf116436_tableBackground, "tdf116436_tableBackground.odt") { + CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); @@ -93,6 +95,7 @@ DECLARE_RTFEXPORT_TEST(testTdf116436_tableBackground, "tdf116436_tableBackground DECLARE_RTFEXPORT_TEST(testTdf122589_firstSection, "tdf122589_firstSection.odt") { + CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); uno::Reference<text::XTextRange> xHeaderText @@ -202,6 +205,7 @@ DECLARE_RTFEXPORT_TEST(testTdf117268, "tdf117268.rtf") DECLARE_RTFEXPORT_TEST(testTdf117505, "tdf117505.odt") { + CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference<container::XNameAccess> xPageStyles(getStyles("PageStyles")); uno::Reference<beans::XPropertySet> xFirstPage(xPageStyles->getByName("First Page"), uno::UNO_QUERY); diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx index d2a2cd98d445..e17d8743b40b 100644 --- a/sw/qa/extras/rtfexport/rtfexport4.cxx +++ b/sw/qa/extras/rtfexport/rtfexport4.cxx @@ -237,6 +237,7 @@ DECLARE_RTFEXPORT_TEST(testBtlrCell, "btlr-cell.rtf") DECLARE_RTFEXPORT_TEST(testTbrlFrame, "tbrl-frame.odt") { + CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY); auto nActual = getProperty<sal_Int16>(xShape, "WritingMode"); // Without the accompanying fix in place, this test would have failed with: @@ -248,6 +249,7 @@ DECLARE_RTFEXPORT_TEST(testTbrlFrame, "tbrl-frame.odt") DECLARE_RTFEXPORT_TEST(testBtlrFrame, "btlr-frame.odt") { + CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY); auto nActual = getProperty<sal_Int16>(xShape, "WritingMode"); // Without the accompanying fix in place, this test would have failed with: @@ -277,6 +279,7 @@ DECLARE_RTFEXPORT_TEST(testTdf129631_lostBorders, "tdf129631_lostBorders.rtf") DECLARE_RTFEXPORT_TEST(testTdf129522_removeShadowStyle, "tdf129522_removeShadowStyle.odt") { + CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference<container::XNameAccess> paragraphStyles = getStyles("ParagraphStyles"); uno::Reference<beans::XPropertySet> xStyleProps(paragraphStyles->getByName("Shadow"), uno::UNO_QUERY_THROW); diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx index 05825abdc621..af317a4980c0 100644 --- a/sw/qa/extras/rtfexport/rtfexport5.cxx +++ b/sw/qa/extras/rtfexport/rtfexport5.cxx @@ -1167,6 +1167,7 @@ DECLARE_RTFEXPORT_TEST(testTdf106950, "tdf106950.rtf") DECLARE_RTFEXPORT_TEST(testTdf116371, "tdf116371.odt") { + CPPUNIT_ASSERT_EQUAL(1, getPages()); auto xShape(getShape(1)); // Without the accompanying fix in place, this test would have failed with // 'Unknown property: RotateAngle', i.e. export lost the rotation, and then @@ -1176,6 +1177,7 @@ DECLARE_RTFEXPORT_TEST(testTdf116371, "tdf116371.odt") DECLARE_RTFEXPORT_TEST(testTdf128320, "tdf128320.odt") { + CPPUNIT_ASSERT_EQUAL(1, getPages()); // Shape does exist in RTF output auto xShape(getShape(1)); CPPUNIT_ASSERT(xShape.is()); |