summaryrefslogtreecommitdiff
path: root/sw/qa/extras
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-04-20 16:32:00 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-04-20 21:04:35 +0200
commitedda1e5fc8113aa4744e32f97c96a3cc311485ca (patch)
treeb6da5a4a637a9a3ae3ed9307fe59d6f1df80b197 /sw/qa/extras
parente9c52f55f0cc7155d6883e4d2abf14f1638b03b3 (diff)
DOCX import: lazy-read images without external headers
So that similar to ODT, images are not loaded on file open, only when the user scrolls there. Notes: 1) GraphicDescriptor::ImpDetectJPG() would try to calculate the logic size before the pixel size is available, so the logic size would be 0x0. Also, ImpGraphic::ImplSetPrepared() would always work with a pixel map mode. Any of these two would result in a failure of testDMLShapeFillBitmapCrop in CppunitTest_sw_ooxmlexport6. 2) Lazy-loading seems to (at the moment) not recognize EMF files, so don't lazy-load in case an external header is provided. This probably has to be revisited, since the ODF import doesn't go via GraphicProvider::queryGraphic(). Change-Id: I44754e659effebca8339715df114dbaadb9b5e9f Reviewed-on: https://gerrit.libreoffice.org/53215 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw/qa/extras')
-rw-r--r--sw/qa/extras/ooxmlimport/data/image-lazy-read.docxbin0 -> 9392 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx8
2 files changed, 8 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/image-lazy-read.docx b/sw/qa/extras/ooxmlimport/data/image-lazy-read.docx
new file mode 100644
index 000000000000..faf80e41dcd6
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/image-lazy-read.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 439658a63b39..7b60b191df67 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1422,6 +1422,14 @@ DECLARE_OOXMLIMPORT_TEST(testTdf108714, "tdf108714.docx")
CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, breakType);
}
+DECLARE_OOXMLIMPORT_TEST(testImageLazyRead, "image-lazy-read.docx")
+{
+ auto xGraphic = getProperty<uno::Reference<graphic::XGraphic>>(getShape(1), "Graphic");
+ Graphic aGraphic(xGraphic);
+ // This failed, import loaded the graphic, it wasn't lazy-read.
+ CPPUNIT_ASSERT(!aGraphic.isAvailable());
+}
+
DECLARE_OOXMLIMPORT_TEST(testTdf108995, "xml_space.docx")
{
CPPUNIT_ASSERT_EQUAL(1, getParagraphs());