[Libreoffice-commits] core.git: 2 commits - sw/qa sw/source
Jan Holesovsky
kendy at collabora.com
Fri Jul 28 12:40:07 UTC 2017
sw/qa/extras/htmlexport/htmlexport.cxx | 31 ++++++++++++++++++++++++++-----
sw/source/filter/html/htmlflywriter.cxx | 20 ++++++++++----------
2 files changed, 36 insertions(+), 15 deletions(-)
New commits:
commit 587d6e13df7bb9c8f78ce605ebb8f8fd34b85a2c
Author: Jan Holesovsky <kendy at collabora.com>
Date: Fri Jul 28 14:15:07 2017 +0200
sw htmlexport: Avoid unnecessary conversion to base64 + unit tests.
Change-Id: Ifdd86590f4258c84006f7ca94ea06058e600db1e
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index 63435cee780a..1ea03e880de7 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -46,6 +46,8 @@ private:
{
if (getTestName().indexOf("SkipImages") != -1)
setFilterOptions("SkipImages");
+ else if (getTestName().indexOf("EmbedImages") != -1)
+ setFilterOptions("EmbedImages");
else
setFilterOptions("");
@@ -285,6 +287,25 @@ DECLARE_HTMLEXPORT_TEST(testExtbChars, "extb.html")
CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange2->getString());
}
+DECLARE_HTMLEXPORT_TEST(testNormalImageExport, "textAndImage.docx")
+{
+ htmlDocPtr pDoc = parseHtml(maTempFile);
+ CPPUNIT_ASSERT(pDoc);
+
+ assertXPath(pDoc, "/html/body", 1);
+ OUString imgSrc = getXPath(pDoc, "/html/body/p/img", "src");
+ CPPUNIT_ASSERT(imgSrc.endsWith(".png"));
+}
+
+DECLARE_HTMLEXPORT_TEST(testEmbedImagesEnabled, "textAndImage.docx")
+{
+ htmlDocPtr pDoc = parseHtml(maTempFile);
+ CPPUNIT_ASSERT(pDoc);
+
+ assertXPath(pDoc, "/html/body", 1);
+ assertXPath(pDoc, "/html/body/p/img", "src", "data:image/png;base64,iV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flywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx
index 725d4db2c2fd..b02c441a31e3 100644
--- a/sw/source/filter/html/htmlflywriter.cxx
+++ b/sw/source/filter/html/htmlflywriter.cxx
@@ -1358,19 +1358,19 @@ Writer& OutHTML_Image( Writer& rWrt, const SwFrameFormat &rFrameFormat,
aHtml.start(OOO_STRING_SVTOOLS_HTML_image);
- OUString aGraphicInBase64;
- if ( !XOutBitmap::GraphicToBase64(rGraphic, aGraphicInBase64) )
- {
- rHTMLWrt.m_nWarn = ErrCode(WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE);
- }
-
OStringBuffer sBuffer;
if(rHTMLWrt.mbEmbedImages)
{
- sBuffer.append(OOO_STRING_SVTOOLS_HTML_O_data);
- sBuffer.append(":");
- sBuffer.append(OUStringToOString(aGraphicInBase64, RTL_TEXTENCODING_UTF8));
- aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_src, sBuffer.makeStringAndClear().getStr());
+ OUString aGraphicInBase64;
+ if (XOutBitmap::GraphicToBase64(rGraphic, aGraphicInBase64))
+ {
+ sBuffer.append(OOO_STRING_SVTOOLS_HTML_O_data);
+ sBuffer.append(":");
+ sBuffer.append(OUStringToOString(aGraphicInBase64, RTL_TEXTENCODING_UTF8));
+ aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_src, sBuffer.makeStringAndClear().getStr());
+ }
+ else
+ rHTMLWrt.m_nWarn = ErrCode(WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE);
}
else
{
commit 74c8d4a8128056a35fb2c67b7f663b259665e193
Author: Jan Holesovsky <kendy at collabora.com>
Date: Fri Jul 28 13:58:29 2017 +0200
sw htmlexport: Consistent naming in the test.
Change-Id: I608b818063f3ac66c6b36f9f8d221a54bfe1be24
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index c28d1ec4b997..63435cee780a 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -44,7 +44,7 @@ private:
virtual std::unique_ptr<Resetter> preTest(const char* filename) override
{
- if (getTestName().indexOf("SkipImage") != -1)
+ if (getTestName().indexOf("SkipImages") != -1)
setFilterOptions("SkipImages");
else
setFilterOptions("");
@@ -138,7 +138,7 @@ DECLARE_HTMLEXPORT_TEST(testExportOfImages, "textAndImage.docx")
assertXPath(pDoc, "/html/body/p/img", 1);
}
-DECLARE_HTMLEXPORT_TEST(testExportOfImagesWithSkipImageEnabled, "textAndImage.docx")
+DECLARE_HTMLEXPORT_TEST(testExportOfImagesWithSkipImagesEnabled, "textAndImage.docx")
{
htmlDocPtr pDoc = parseHtml(maTempFile);
CPPUNIT_ASSERT(pDoc);
@@ -147,7 +147,7 @@ DECLARE_HTMLEXPORT_TEST(testExportOfImagesWithSkipImageEnabled, "textAndImage.do
assertXPath(pDoc, "/html/body/p/img", 0);
}
-DECLARE_HTMLEXPORT_TEST(testSkipImageEmbedded, "skipimage-embedded.doc")
+DECLARE_HTMLEXPORT_TEST(testSkipImagesEmbedded, "skipimage-embedded.doc")
{
// Embedded spreadsheet was exported as image, so content was lost. Make
// sure it's exported as HTML instead.
@@ -162,9 +162,9 @@ DECLARE_HTMLEXPORT_TEST(testSkipImageEmbedded, "skipimage-embedded.doc")
assertXPath(pDoc, "//span/table", 1);
}
-DECLARE_HTMLEXPORT_TEST(testSkipImageEmbeddedDocument, "skipimage-embedded-document.docx")
+DECLARE_HTMLEXPORT_TEST(testSkipImagesEmbeddedDocument, "skipimage-embedded-document.docx")
{
- // Similar to testSkipImageEmbedded, but with an embedded Writer object,
+ // Similar to testSkipImagesEmbedded, but with an embedded Writer object,
// not a Calc one, and this time OOXML, not WW8.
htmlDocPtr pDoc = parseHtml(maTempFile);
CPPUNIT_ASSERT(pDoc);
More information about the Libreoffice-commits
mailing list