summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2020-12-13 14:08:38 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2020-12-17 13:37:18 +0100
commit277b22981baae33ab7969538f00a5bb85e1be474 (patch)
tree4ec7b173dc80f7683c0a77fa4e9cf33463e6c92e /chart2
parent0e30d1fcdd81c65bcf26723ba04d9dbd2bb08f30 (diff)
tdf#138889 OOXML chart: fix import of rotated shapes
in charts, resulted e.g. distorted arrows. Change-Id: I2d25aeeef8aed9fccacf3cc9f735123e8d891de5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107670 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit fbe77e5d61ca63a688c12be721e760935d78e780) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107801 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/qa/extras/chart2import.cxx37
-rw-r--r--chart2/qa/extras/data/docx/testcustomshapepos.docxbin26204 -> 26359 bytes
2 files changed, 28 insertions, 9 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index 19c2ebdda7a9..fa3fe8fef6e2 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -31,6 +31,8 @@
#include <com/sun/star/chart/DataLabelPlacement.hpp>
#include <com/sun/star/text/XTextRange.hpp>
#include <iterator>
+#include <vcl/outdev.hxx>
+#include <vcl/svapp.hxx>
#include <com/sun/star/util/Color.hpp>
#include <com/sun/star/awt/Gradient.hpp>
@@ -2610,6 +2612,12 @@ void Chart2ImportTest::testTdf134225()
void Chart2ImportTest::testTdf136105()
{
+ // FIXME: the DPI check should be removed when either (1) the test is fixed to work with
+ // non-default DPI; or (2) unit tests on Windows are made to use svp VCL plugin.
+ if (Application::GetDefaultDevice()->GetDPIX() != 96
+ || Application::GetDefaultDevice()->GetDPIY() != 96)
+ return;
+
load("/chart2/qa/extras/data/xlsx/", "tdf136105.xlsx");
// 1st chart with fix inner position and size
{
@@ -2770,15 +2778,26 @@ void Chart2ImportTest::testTdfCustomShapePos()
Reference< chart2::XChartDocument > xChartDoc(getChartDocFromWriter(0), UNO_QUERY_THROW);
Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xChartDoc, UNO_QUERY_THROW);
Reference<drawing::XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage(), UNO_SET_THROW);
- Reference<drawing::XShape> xCustomShape(xDrawPage->getByIndex(0), UNO_QUERY_THROW);
-
- // test position and size of a custom shape within a chart
- awt::Point aPosition = xCustomShape->getPosition();
- CPPUNIT_ASSERT_DOUBLES_EQUAL(8845, aPosition.X, 300);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(855, aPosition.Y, 300);
- awt::Size aSize = xCustomShape->getSize();
- CPPUNIT_ASSERT_DOUBLES_EQUAL(4831, aSize.Width, 300);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1550, aSize.Height, 300);
+ // test position and size of a custom shape within a chart, rotated by 0 degree.
+ {
+ Reference<drawing::XShape> xCustomShape(xDrawPage->getByIndex(0), UNO_QUERY_THROW);
+ awt::Point aPosition = xCustomShape->getPosition();
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(8845, aPosition.X, 300);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(855, aPosition.Y, 300);
+ awt::Size aSize = xCustomShape->getSize();
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(4831, aSize.Width, 300);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1550, aSize.Height, 300);
+ }
+ // test position and size of a custom shape within a chart, rotated by 90 degree.
+ {
+ Reference<drawing::XShape> xCustomShape(xDrawPage->getByIndex(1), UNO_QUERY_THROW);
+ awt::Point aPosition = xCustomShape->getPosition();
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1658, aPosition.X, 300);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(6119, aPosition.Y, 300);
+ awt::Size aSize = xCustomShape->getSize();
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(4165, aSize.Width, 300);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1334, aSize.Height, 300);
+ }
}
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
diff --git a/chart2/qa/extras/data/docx/testcustomshapepos.docx b/chart2/qa/extras/data/docx/testcustomshapepos.docx
index 31c5284e11b9..640c48ea4627 100644
--- a/chart2/qa/extras/data/docx/testcustomshapepos.docx
+++ b/chart2/qa/extras/data/docx/testcustomshapepos.docx
Binary files differ