vcl/qa/cppunit/GraphicTest.cxx    |   12 ++++++++++++
 vcl/qa/cppunit/data/tdf156016.svg |   33 +++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)

New commits:
commit e6cf27e46a48580892ecd0d82f8e55ff9aed465d
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Jul 4 13:01:36 2023 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Jul 4 17:32:54 2023 +0200

    tdf#156016: vcl_graphic_test: Add unittest
    
    Change-Id: I0b8a9c8d8440e5084f1cce6e666e20d4508cc691
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153963
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/vcl/qa/cppunit/GraphicTest.cxx b/vcl/qa/cppunit/GraphicTest.cxx
index 3cbbcbecf112..606936c65f9e 100644
--- a/vcl/qa/cppunit/GraphicTest.cxx
+++ b/vcl/qa/cppunit/GraphicTest.cxx
@@ -1282,6 +1282,18 @@ CPPUNIT_TEST_FIXTURE(GraphicTest, testLoadSVGZ)
     CPPUNIT_ASSERT_EQUAL(tools::Long(100 * scalingY), 
aGraphic.GetSizePixel().Height());
 }
 
+CPPUNIT_TEST_FIXTURE(GraphicTest, testTdf156016)
+{
+    // Without the fix in place, this test would have failed with
+    // - Expected: 0x0(Error Area:Io Class:NONE Code:0)
+    // - Actual  : 0x8203(Error Area:Vcl Class:General Code:3)
+    Graphic aGraphic = loadGraphic(u"tdf156016.svg");
+    CPPUNIT_ASSERT_EQUAL(GraphicType::Bitmap, aGraphic.GetType());
+    const auto[scalingX, scalingY] = getDPIScaling();
+    CPPUNIT_ASSERT_EQUAL(tools::Long(100 * scalingX), 
aGraphic.GetSizePixel().Width());
+    CPPUNIT_ASSERT_EQUAL(tools::Long(100 * scalingY), 
aGraphic.GetSizePixel().Height());
+}
+
 CPPUNIT_TEST_FIXTURE(GraphicTest, testAvailableThreaded)
 {
     Graphic jpgGraphic1 = importUnloadedGraphic(u"TypeDetectionExample.jpg");
diff --git a/vcl/qa/cppunit/data/tdf156016.svg 
b/vcl/qa/cppunit/data/tdf156016.svg
new file mode 100644
index 000000000000..e54d786fe7d4
--- /dev/null
+++ b/vcl/qa/cppunit/data/tdf156016.svg
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" 
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd";>
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<svg version="1.1" baseProfile="basic" xmlns="http://www.w3.org/2000/svg"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; id="svg-root" width="100%" 
height="100%" viewBox="0 0 99 99">
+<rect x="0" y="0" width="99" height="99" fill="#000000"/>
+</svg>
+
+

Reply via email to