diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-06-16 10:11:47 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-06-16 12:21:46 +0200 |
commit | 3c46fd3d727e4885fedef7c9f3fcd6f4c9a9ebb9 (patch) | |
tree | cf46806a7126b0ce74d49137c0e3a559f6364034 /sw/qa/extras/htmlexport | |
parent | e838c1b9e9031de742deeff763c06b1d39f399ef (diff) |
sw HTML export: allow larger bitmaps for shapes than the vcl default
VCL default would be 500k pixels, i.e. a 2" x 1" shape at 600 dpi would
be already truncated from 1200 pixels width to 1000 pixels. That's a bit
too extreme, use a larger limit in the sw HTML export.
Change-Id: I52b85d77cd27410d53c700a89190c99348de5e19
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117287
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/qa/extras/htmlexport')
-rw-r--r-- | sw/qa/extras/htmlexport/htmlexport.cxx | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 044a6ad29e72..180a2cccc599 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -1762,12 +1762,10 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedShapeAsPNGCustomDPI) uno::Reference<css::lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<drawing::XShape> xShape( xFactory->createInstance("com.sun.star.drawing.RectangleShape"), uno::UNO_QUERY); - xShape->setSize(awt::Size(7145, 5240)); + xShape->setSize(awt::Size(5080, 2540)); uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); xDrawPageSupplier->getDrawPage()->add(xShape); - Size aSystemDPI( - Application::GetDefaultDevice()->LogicToPixel(Size(1, 1), MapMode(MapUnit::MapInch))); - sal_Int32 nDPI = aSystemDPI.getWidth() * 2; + sal_Int32 nDPI = 600; // When exporting to XHTML: uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); @@ -1786,17 +1784,18 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedShapeAsPNGCustomDPI) assertXPath(pXmlDoc, "//reqif-xhtml:p/reqif-xhtml:object", "type", "image/png"); // Then check the pixel size of the shape: - Size aPixelSize(Application::GetDefaultDevice()->LogicToPixel(Size(7145, 5240), + Size aPixelSize(Application::GetDefaultDevice()->LogicToPixel(Size(5080, 2540), MapMode(MapUnit::Map100thMM))); - tools::Long nPNGWidth = aPixelSize.getWidth() * 2; + tools::Long nPNGWidth = 1200; OUString aPngUrl = GetPngPath(); SvFileStream aFileStream(aPngUrl, StreamMode::READ); GraphicDescriptor aDescriptor(aFileStream, nullptr); aDescriptor.Detect(/*bExtendedInfo=*/true); // Without the accompanying fix in place, this test would have failed with: - // - Expected: 540 - // - Actual : 270 - // i.e. setting a double DPI didn't result in larger pixel width of the PNG. + // - Expected: 1200 + // - Actual : 1000 + // i.e. first setting a double DPI didn't result in larger pixel width of the PNG, then it was + // limited to 1000 pixels (because the pixel limit was 500k). CPPUNIT_ASSERT_EQUAL(nPNGWidth, aDescriptor.GetSizePixel().getWidth()); // Then make sure the shape's logic size (in CSS pixels) don't change: |