[Libreoffice-commits] core.git: sw/qa
Daniel Arato (NISZ) (via logerrit)
logerrit at kemper.freedesktop.org
Thu Sep 3 05:15:32 UTC 2020
sw/qa/extras/odfexport/odfexport.cxx | 77 +++++++++++++++--------------------
1 file changed, 34 insertions(+), 43 deletions(-)
New commits:
commit f83f06475996cdf072a230aa8c0abe6d85b278ec
Author: Daniel Arato (NISZ) <arato.daniel at nisz.hu>
AuthorDate: Mon Aug 31 13:12:52 2020 +0200
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Thu Sep 3 07:14:50 2020 +0200
tdf#129423 sw: export-only tests, part 2
Convert some unit tests from "export" tests to "export only".
Remove nullptr checks on parseExport's return value to make
the test fail if parsing fails for any reason.
Change-Id: I2ced87fe8186a82e8c4e591d3ee6832cae60f7f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101713
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
Tested-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index cb131ece62de..20c8b25f0b48 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -262,25 +262,25 @@ DECLARE_ODFEXPORT_TEST(testTdf103567, "tdf103567.odt")
CPPUNIT_ASSERT_EQUAL(sal_Int32( 408), rect.Height);
}
-DECLARE_ODFEXPORT_TEST(testUserFieldDecl, "user-field-decl.odt")
+DECLARE_ODFEXPORT_EXPORTONLY_TEST(testUserFieldDecl, "user-field-decl.odt")
{
CPPUNIT_ASSERT_EQUAL(1, getPages());
- if (xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"))
- // Without the accompanying fix in place, this test would have failed with 'Expected: 2;
- // Actual: 1', i.e. the in-table field had no declaration (in the header), while the
- // outside-table one had the declaration.
- assertXPath(pXmlDoc, "//style:header/text:user-field-decls/text:user-field-decl", 2);
+ xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
+ // Without the accompanying fix in place, this test would have failed with 'Expected: 2;
+ // Actual: 1', i.e. the in-table field had no declaration (in the header), while the
+ // outside-table one had the declaration.
+ assertXPath(pXmlDoc, "//style:header/text:user-field-decls/text:user-field-decl", 2);
}
-DECLARE_ODFEXPORT_TEST(testUserFieldDeclFly, "user-field-decl-fly.odt")
+DECLARE_ODFEXPORT_EXPORTONLY_TEST(testUserFieldDeclFly, "user-field-decl-fly.odt")
{
CPPUNIT_ASSERT_EQUAL(1, getShapes());
CPPUNIT_ASSERT_EQUAL(1, getPages());
- if (xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"))
- // Without the accompanying fix in place, this test would have failed with 'Expected: 2;
- // Actual: 1', i.e. the in-textframe field had no declaration (in the header), while the
- // outside-textframe one had the declaration.
- assertXPath(pXmlDoc, "//style:header/text:user-field-decls/text:user-field-decl", 2);
+ xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
+ // Without the accompanying fix in place, this test would have failed with 'Expected: 2;
+ // Actual: 1', i.e. the in-textframe field had no declaration (in the header), while the
+ // outside-textframe one had the declaration.
+ assertXPath(pXmlDoc, "//style:header/text:user-field-decls/text:user-field-decl", 2);
}
DECLARE_ODFEXPORT_TEST(testFramebackgrounds, "framebackgrounds.odt")
@@ -2145,36 +2145,32 @@ DECLARE_ODFEXPORT_TEST(testTdf132642_keepWithNextTable, "tdf132642_keepWithNextT
CPPUNIT_ASSERT_EQUAL_MESSAGE("Row splits over 2 pages", 2, getPages());
}
-DECLARE_ODFEXPORT_TEST(testImageMimetype, "image-mimetype.odt")
+DECLARE_ODFEXPORT_EXPORTONLY_TEST(testImageMimetype, "image-mimetype.odt")
{
CPPUNIT_ASSERT_EQUAL(1, getShapes());
CPPUNIT_ASSERT_EQUAL(1, getPages());
// Test that the loext:mimetype attribute is written for exported images, tdf#109202
- if (xmlDocUniquePtr pXmlDoc = parseExport("content.xml"))
- {
- // Original image (svg)
- assertXPath(pXmlDoc, "/office:document-content/office:body/office:text/text:p/draw:frame/draw:image[@draw:mime-type='image/svg+xml']");
- }
+ xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
+ // Original image (svg)
+ assertXPath(pXmlDoc, "/office:document-content/office:body/office:text/text:p/draw:frame/draw:image[@draw:mime-type='image/svg+xml']");
}
-DECLARE_ODFEXPORT_TEST(testEmbeddedFontProps, "embedded-font-props.odt")
+DECLARE_ODFEXPORT_EXPORTONLY_TEST(testEmbeddedFontProps, "embedded-font-props.odt")
{
CPPUNIT_ASSERT_EQUAL(1, getPages());
#if !defined(MACOSX)
// Test that font style/weight of embedded fonts is exposed.
// Test file is a normal ODT, except EmbedFonts is set to true in settings.xml.
- if (xmlDocUniquePtr pXmlDoc = parseExport("content.xml"))
- {
- // These failed, the attributes were missing.
- assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[1]", "font-style", "normal");
- assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[1]", "font-weight", "normal");
- assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[2]", "font-style", "normal");
- assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[2]", "font-weight", "bold");
- assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[3]", "font-style", "italic");
- assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[3]", "font-weight", "normal");
- assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[4]", "font-style", "italic");
- assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[4]", "font-weight", "bold");
- }
+ xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
+ // These failed, the attributes were missing.
+ assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[1]", "font-style", "normal");
+ assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[1]", "font-weight", "normal");
+ assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[2]", "font-style", "normal");
+ assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[2]", "font-weight", "bold");
+ assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[3]", "font-style", "italic");
+ assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[3]", "font-weight", "normal");
+ assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[4]", "font-style", "italic");
+ assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[4]", "font-weight", "bold");
#endif
}
@@ -2254,14 +2250,13 @@ DECLARE_ODFEXPORT_TEST(testReferenceLanguage, "referencelanguage.odt")
}
}
-DECLARE_ODFEXPORT_TEST(testRubyPosition, "ruby-position.odt")
+DECLARE_ODFEXPORT_EXPORTONLY_TEST(testRubyPosition, "ruby-position.odt")
{
CPPUNIT_ASSERT_EQUAL(1, getPages());
- if (xmlDocUniquePtr pXmlDoc = parseExport("content.xml"))
- {
- assertXPath(pXmlDoc, "//style:style[@style:family='ruby']/style:ruby-properties[@loext:ruby-position='inter-character']", 1);
- assertXPath(pXmlDoc, "//style:style[@style:family='ruby']/style:ruby-properties[@style:ruby-position='below']", 1);
- }
+ xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
+
+ assertXPath(pXmlDoc, "//style:style[@style:family='ruby']/style:ruby-properties[@loext:ruby-position='inter-character']", 1);
+ assertXPath(pXmlDoc, "//style:style[@style:family='ruby']/style:ruby-properties[@style:ruby-position='below']", 1);
}
DECLARE_ODFEXPORT_TEST(testAllowOverlap, "allow-overlap.odt")
@@ -2553,7 +2548,7 @@ DECLARE_ODFEXPORT_TEST(testPageContentBottom, "page-content-bottom.odt")
CPPUNIT_ASSERT_EQUAL(nExpected, getProperty<sal_Int16>(xShape, "VertOrientRelation"));
}
-DECLARE_ODFEXPORT_TEST(tdf124470, "tdf124470TableAndEmbeddedUsedFonts.odt")
+DECLARE_ODFEXPORT_EXPORTONLY_TEST(tdf124470, "tdf124470TableAndEmbeddedUsedFonts.odt")
{
// Table styles were exported out of place, inside font-face-decls.
// Without the fix in place, this will fail already in ODF validation:
@@ -2562,8 +2557,6 @@ DECLARE_ODFEXPORT_TEST(tdf124470, "tdf124470TableAndEmbeddedUsedFonts.odt")
CPPUNIT_ASSERT_EQUAL(1, getPages());
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
- if (!pXmlDoc)
- return;
assertXPath(pXmlDoc, "/office:document-content/office:font-face-decls/style:style", 0);
assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/style:style[@style:family='table']", 1);
@@ -2571,15 +2564,13 @@ DECLARE_ODFEXPORT_TEST(tdf124470, "tdf124470TableAndEmbeddedUsedFonts.odt")
assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/style:style[@style:family='paragraph']", 1);
}
-DECLARE_ODFEXPORT_TEST(tdf135942, "nestedTableInFooter.odt")
+DECLARE_ODFEXPORT_EXPORTONLY_TEST(tdf135942, "nestedTableInFooter.odt")
{
// All table autostyles should be collected, including nested, and must not crash.
CPPUNIT_ASSERT_EQUAL(1, getPages());
xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
- if (!pXmlDoc)
- return;
assertXPath(pXmlDoc, "/office:document-styles/office:automatic-styles/style:style[@style:family='table']", 2);
}
More information about the Libreoffice-commits
mailing list