[Libreoffice-commits] core.git: sw/qa
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Thu May 14 09:20:36 UTC 2020
sw/qa/extras/ww8export/ww8export.cxx | 14 ++++++++++++++
sw/qa/extras/ww8export/ww8export2.cxx | 10 ++++++++++
sw/qa/extras/ww8export/ww8export3.cxx | 9 +++++++++
3 files changed, 33 insertions(+)
New commits:
commit 29c017327585ea12c4fc7493a95ab378761aeafe
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Tue May 12 17:18:50 2020 +0200
Commit: Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Thu May 14 11:19:57 2020 +0200
CppUnittest: ww8export: assert pages in odf files
Change-Id: Ia1e67cd70c0327a95db96ed4a78fac631017e660
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94113
Tested-by: Jenkins
Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index cc84bda0f18c..9efd5aa9616e 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -747,6 +747,7 @@ DECLARE_WW8EXPORT_TEST(testTscp, "tscp.doc")
DECLARE_WW8EXPORT_TEST(testFdo45724, "fdo45724.odt")
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
// The text and background color of the control shape was not correct.
uno::Reference<drawing::XControlShape> xControlShape(getShape(1), uno::UNO_QUERY);
uno::Reference<form::validation::XValidatableFormComponent> xComponent(xControlShape->getControl(), uno::UNO_QUERY);
@@ -756,6 +757,7 @@ DECLARE_WW8EXPORT_TEST(testFdo45724, "fdo45724.odt")
DECLARE_WW8EXPORT_TEST(testFdo46020, "fdo46020.odt")
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
// The footnote in that document wasn't exported, check that it is actually exported
uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes();
@@ -818,6 +820,7 @@ DECLARE_WW8EXPORT_TEST(testNewPageStylesTable, "new-page-styles.doc")
DECLARE_WW8EXPORT_TEST(testFdo42144, "fdo42144.odt")
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
// Footer wasn't disabled -- instead empty footer was exported.
uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xStyle, "FooterIsOn"));
@@ -825,6 +828,7 @@ DECLARE_WW8EXPORT_TEST(testFdo42144, "fdo42144.odt")
DECLARE_WW8EXPORT_TEST(testCharacterBorder, "charborder.odt")
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(1),1), uno::UNO_QUERY);
// WW8 has just one border attribute (sprmCBrc) for text border so all side has
// the same border
@@ -861,6 +865,7 @@ DECLARE_WW8EXPORT_TEST(testCharacterBorder, "charborder.odt")
DECLARE_WW8EXPORT_TEST(testTdf41542_imagePadding, "tdf41542_imagePadding.odt")
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
// borderlessImage - image WITHOUT BORDERS : simulate padding with -crop
text::GraphicCrop crop = getProperty<text::GraphicCrop>(getShape(2), "GraphicCrop");
CPPUNIT_ASSERT( crop.Left != 0 && crop.Right != 0 );
@@ -944,6 +949,7 @@ DECLARE_WW8EXPORT_TEST(testCommentsNested, "comments-nested.doc")
DECLARE_WW8EXPORT_TEST(testBorderColoursExport, "bordercolours.odt")
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
// This is very close to testBorderColours in ww8import.cxx, but for export
// The following 6 colours can only be represented with WW9 (Word 2000)
@@ -1069,6 +1075,7 @@ DECLARE_WW8EXPORT_TEST(testBorderColoursExport, "bordercolours.odt")
DECLARE_WW8EXPORT_TEST(testRedlineExport1, "redline-export-1.odt")
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
uno::Reference<text::XTextRange> xParagraph = getParagraph(1);
uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParagraph, uno::UNO_QUERY);
uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration();
@@ -1082,12 +1089,14 @@ DECLARE_WW8EXPORT_TEST(testRedlineExport1, "redline-export-1.odt")
DECLARE_WW8EXPORT_TEST(testRedlineExport2, "redline-export-2.odt")
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
//there must be redline information on the first portion of the third paragraph before and after reloading
CPPUNIT_ASSERT_EQUAL(true, hasProperty(getRun(getParagraph(3), 1), "RedlineType"));
}
DECLARE_WW8EXPORT_TEST(testRedlineExport3, "redline-export-3.odt")
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
//there must be redline information just on the para-break boundary between para one and two
CPPUNIT_ASSERT_EQUAL(false, hasProperty(getRun(getParagraph(1), 1), "RedlineType"));
CPPUNIT_ASSERT_EQUAL(true, hasProperty(getRun(getParagraph(1), 2), "RedlineType"));
@@ -1097,6 +1106,7 @@ DECLARE_WW8EXPORT_TEST(testRedlineExport3, "redline-export-3.odt")
DECLARE_WW8EXPORT_TEST(testCellBgColor, "cell-bg-color.odt")
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
@@ -1218,6 +1228,7 @@ DECLARE_WW8EXPORT_TEST(testRES_MIRROR_GRAPH_BOTH, "tdf56321_flipImage_both.doc")
DECLARE_WW8EXPORT_TEST(testCommentExport, "comment-export.odt")
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
struct TextPortionInfo {
OUString sKind;
OUString sText;
@@ -1284,6 +1295,7 @@ DECLARE_WW8EXPORT_TEST(testCommentExport, "comment-export.odt")
#if HAVE_MORE_FONTS
DECLARE_WW8EXPORT_TEST(testTableKeep, "tdf91083.odt")
{
+ CPPUNIT_ASSERT_EQUAL(7, getPages());
//emulate table "keep with next" -do not split table
CPPUNIT_ASSERT_EQUAL( OUString("Row 1"), parseDump("/root/page[3]/body/tab[1]/row[2]/cell[1]/txt[1]") );
CPPUNIT_ASSERT_EQUAL( OUString("Row 1"), parseDump("/root/page[6]/body/tab[1]/row[2]/cell[1]/txt[1]") );
@@ -1306,6 +1318,7 @@ DECLARE_WW8EXPORT_TEST(testMoveRange, "fdo66304-1.odt")
DECLARE_WW8EXPORT_TEST(testClearFramePams, "tdf46441-2.odt")
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
//the save must survive without asserting
}
@@ -1337,6 +1350,7 @@ DECLARE_WW8EXPORT_TEST(testTdf94386, "tdf94386.odt")
DECLARE_WW8EXPORT_TEST(testTdf99474, "tdf99474.odt")
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
// The bullet colour of paragraph #3 should be COL_AUTO
auto xPara = getParagraph(3);
uno::Reference<container::XIndexReplace> xNumRules =
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx
index 0f0f9bebd713..3324061edb5c 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -78,6 +78,7 @@ DECLARE_WW8EXPORT_TEST(testTdf128700_relativeTableWidth, "tdf128700_relativeTabl
DECLARE_WW8EXPORT_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);
uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
@@ -225,6 +226,7 @@ DECLARE_WW8EXPORT_TEST(testTdf112517_maxSprms, "tdf112517_maxSprms.doc")
DECLARE_WW8EXPORT_TEST(testTdf108448_endNote, "tdf108448_endNote.odt")
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
uno::Reference<text::XEndnotesSupplier> xEndnotesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xEndnotes = xEndnotesSupplier->getEndnotes();
uno::Reference<text::XText> xEndnote;
@@ -235,6 +237,7 @@ DECLARE_WW8EXPORT_TEST(testTdf108448_endNote, "tdf108448_endNote.odt")
DECLARE_WW8EXPORT_TEST(testTdf106062_nonHangingFootnote, "tdf106062_nonHangingFootnote.odt")
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes();
uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY);
@@ -244,6 +247,7 @@ DECLARE_WW8EXPORT_TEST(testTdf106062_nonHangingFootnote, "tdf106062_nonHangingFo
DECLARE_WW8EXPORT_TEST(testTdf116570_exportFootnote, "tdf116570_exportFootnote.odt")
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes();
uno::Reference<text::XText> xFootnoteText;
@@ -431,6 +435,7 @@ DECLARE_WW8EXPORT_TEST(testTdf111480, "tdf111480.doc")
DECLARE_WW8EXPORT_TEST(testTdf70838, "tdf70838.odt")
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
CPPUNIT_ASSERT(pTextDoc);
SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
@@ -441,6 +446,7 @@ DECLARE_WW8EXPORT_TEST(testTdf70838, "tdf70838.odt")
DECLARE_WW8EXPORT_TEST(testTdf70838b_verticalRotation, "tdf70838b_verticalRotation.odt")
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
CPPUNIT_ASSERT(pTextDoc);
SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
@@ -454,6 +460,7 @@ DECLARE_WW8EXPORT_TEST(testTdf70838b_verticalRotation, "tdf70838b_verticalRotati
DECLARE_WW8EXPORT_TEST( testActiveXCheckbox, "checkbox_control.odt" )
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
// First check box anchored as a floating object
uno::Reference<drawing::XControlShape> xControlShape;
if(!mbExported)
@@ -524,6 +531,7 @@ DECLARE_WW8EXPORT_TEST(testTdf67207_MERGEFIELD, "mailmerge.doc")
DECLARE_OOXMLEXPORT_TEST( testTableCrossReference, "table_cross_reference.odt" )
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
// tdf#42346: Cross references to tables were not saved
// MSO uses simple bookmarks for referencing table caption, so we do the same by export
if (!mbExported)
@@ -682,6 +690,7 @@ DECLARE_OOXMLEXPORT_TEST( testTableCrossReference, "table_cross_reference.odt" )
DECLARE_OOXMLEXPORT_TEST( testTableCrossReferenceCustomFormat, "table_cross_reference_custom_format.odt" )
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
// tdf#42346: Cross references to tables were not saved
// Check also captions with custom formatting
if (!mbExported)
@@ -798,6 +807,7 @@ DECLARE_OOXMLEXPORT_TEST( testTableCrossReferenceCustomFormat, "table_cross_refe
DECLARE_OOXMLEXPORT_TEST( testObjectCrossReference, "object_cross_reference.odt" )
{
+ CPPUNIT_ASSERT_EQUAL(2, getPages());
// tdf#42346: Cross references to objects were not saved
// MSO uses simple bookmarks for referencing table caption, so we do the same by export
if (!mbExported)
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index f021491a164e..976819fc9a26 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -152,6 +152,7 @@ DECLARE_WW8EXPORT_TEST(testTdf122429_header, "tdf122429_header.doc")
DECLARE_WW8EXPORT_TEST(testTdf122460_header, "tdf122460_header.odt")
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
uno::Reference<container::XNameAccess> pageStyles = getStyles("PageStyles");
uno::Reference<style::XStyle> pageStyle(pageStyles->getByName("Default Page Style"), uno::UNO_QUERY);
bool headerIsOn = getProperty<bool>(pageStyle, "HeaderIsOn");
@@ -278,6 +279,7 @@ DECLARE_WW8EXPORT_TEST(testTdf120225_textControlCrossRef, "tdf120225_textControl
DECLARE_WW8EXPORT_TEST(testTdf127316_autoEscapement, "tdf127316_autoEscapement.odt")
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
uno::Reference<text::XTextRange> xPara = getParagraph(2);
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.f, getProperty<float>(getRun(xPara, 1, "Normal text "), "CharEscapement"), 0);
// Negative escapements (subscripts) were decreasing by 1% every round-trip due to bad manual rounding.
@@ -290,6 +292,7 @@ DECLARE_WW8EXPORT_TEST(testTdf127316_autoEscapement, "tdf127316_autoEscapement.o
DECLARE_WW8EXPORT_TEST(testTdf127316_autoEscapement2, "tdf127316_autoEscapement2.odt")
{
+ CPPUNIT_ASSERT_EQUAL(2, getPages());
uno::Reference<text::XTextRange> xPara = getParagraph(1);
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.f, getProperty<float>(getRun(xPara, 1, "Base1"), "CharEscapement"), 0);
// Font is 80% of 40pt or 32pt, original escapement is 6.4pt, so round-trip escapement is 20%.
@@ -323,6 +326,7 @@ DECLARE_WW8EXPORT_TEST(testTdf121111_fillStyleNone, "tdf121111_fillStyleNone.doc
DECLARE_WW8EXPORT_TEST(testTdf128608_fillStyleNoneB, "tdf128608_fillStyleNoneB.odt")
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
uno::Reference<text::XTextRange> xText(getParagraph(1));
CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(getProperty<sal_uInt32>(xText, "ParaBackColor")));
CPPUNIT_ASSERT_EQUAL_MESSAGE("No fill", drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xText, "FillStyle"));
@@ -364,6 +368,7 @@ DECLARE_WW8EXPORT_TEST(testTdf123433_fillStyleStop, "tdf123433_fillStyleStop.doc
DECLARE_WW8EXPORT_TEST(testTdf127862_pageFillStyle, "tdf127862_pageFillStyle.odt")
{
+ CPPUNIT_ASSERT_EQUAL(6, getPages());
uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);
CPPUNIT_ASSERT(drawing::FillStyle_NONE != getProperty<drawing::FillStyle>(xStyle, "FillStyle"));
}
@@ -386,6 +391,7 @@ DECLARE_WW8EXPORT_TEST(testTdf128608_tableParaBackColor, "tdf128608_tableParaBac
DECLARE_WW8EXPORT_TEST(testTdf94009_zeroPgMargin, "tdf94009_zeroPgMargin.odt")
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
uno::Reference<beans::XPropertySet> defaultStyle(getStyles("PageStyles")->getByName("Standard"),
uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(defaultStyle, "TopMargin"));
@@ -400,6 +406,7 @@ DECLARE_WW8EXPORT_TEST(testTdf120711_joinedParagraphWithChangeTracking, "tdf1207
DECLARE_WW8EXPORT_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);
table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(xStyleProps, "ParaShadowFormat");
@@ -481,6 +488,7 @@ DECLARE_WW8EXPORT_TEST(testImageCommentAtChar, "image-comment-at-char.doc")
DECLARE_WW8EXPORT_TEST(testTdf126708emf, "tdf126708_containsemf.odt")
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
auto xShape = getShape(1);
// First check the size of the EMF graphic contained in the shape.
auto xGraphic = getProperty< uno::Reference<graphic::XGraphic> >(
@@ -498,6 +506,7 @@ DECLARE_WW8EXPORT_TEST(testTdf126708emf, "tdf126708_containsemf.odt")
DECLARE_WW8EXPORT_TEST(testBtlrFrame, "btlr-frame.odt")
{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
if (!mbExported)
{
return;
More information about the Libreoffice-commits
mailing list