summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2019-11-16 21:55:05 +0100
committerRegina Henschel <rb.henschel@t-online.de>2019-11-18 14:22:42 +0100
commit58ee73068fa881950e42cca22ed17cf5829b8d14 (patch)
treeaa332c2648a952cc2b3b57e1b7b0e8cc955e713d /sc/qa
parent729883cc42c7a7b2f342612ebd6c941e76264d18 (diff)
tdf#103092 export uses MeasureUnit not FieldUnit
ctor of SvXMLExport expects a util::MeasureUnit, but getMetric() from XGlobalSheetSettings returns a FieldUnit. The conversion was missing. So FieldUnit::MM (=1) was treated as MeasureUnit::MM_10TH (=1). But that one has no unit string, so the 'translate' transformation got numbers without unit, which then were wrongly interpreted. Change-Id: I433c7534be21655887863005f14836d2b733cf1f Reviewed-on: https://gerrit.libreoffice.org/83004 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/data/ods/tdf103092_RotatedImage.odsbin0 -> 15393 bytes
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx33
2 files changed, 33 insertions, 0 deletions
diff --git a/sc/qa/unit/data/ods/tdf103092_RotatedImage.ods b/sc/qa/unit/data/ods/tdf103092_RotatedImage.ods
new file mode 100644
index 000000000000..eb966406272c
--- /dev/null
+++ b/sc/qa/unit/data/ods/tdf103092_RotatedImage.ods
Binary files differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index dcd395784949..e9ad4b5eade4 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -63,12 +63,14 @@
#include <comphelper/scopeguard.hxx>
#include <unotools/syslocaleoptions.hxx>
#include <tools/datetime.hxx>
+#include <tools/fldunit.hxx>
#include <svl/zformat.hxx>
#include <test/xmltesttools.hxx>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/awt/XBitmap.hpp>
#include <com/sun/star/graphic/GraphicType.hpp>
+#include <com/sun/star/sheet/GlobalSheetSettings.hpp>
#include <comphelper/storagehelper.hxx>
using namespace ::com::sun::star;
@@ -226,6 +228,7 @@ public:
void testCommentTextHAlignment();
void testXltxExport();
+ void testRotatedImageODS();
CPPUNIT_TEST_SUITE(ScExportTest);
CPPUNIT_TEST(test);
@@ -355,6 +358,7 @@ public:
CPPUNIT_TEST(testCommentTextHAlignment);
CPPUNIT_TEST(testXltxExport);
+ CPPUNIT_TEST(testRotatedImageODS);
CPPUNIT_TEST_SUITE_END();
@@ -4522,6 +4526,35 @@ void ScExportTest::testCommentTextHAlignment()
assertXPathContent(pVmlDrawing, "/xml/v:shape/xx:ClientData/xx:TextHAlign", "Center");
}
+void ScExportTest::testRotatedImageODS()
+{
+ // Error was, that the length values in shapes were not
+ // written in the given unit into the file.
+ css::uno::Reference<css::sheet::XGlobalSheetSettings> xGlobalSheetSettings
+ = css::sheet::GlobalSheetSettings::create(comphelper::getProcessComponentContext());
+ xGlobalSheetSettings->setMetric(static_cast<sal_Int16>(FieldUnit::MM));
+
+ ScDocShellRef xDocSh = loadDoc("tdf103092_RotatedImage.", FORMAT_ODS, true);
+ CPPUNIT_ASSERT(xDocSh.is());
+
+ std::shared_ptr<utl::TempFile> pTemp = saveAs(xDocSh.get(), FORMAT_ODS);
+ CPPUNIT_ASSERT(pTemp);
+ const xmlDocPtr pXmlDoc = XPathHelper::parseExport(pTemp, m_xSFactory, "content.xml");
+ CPPUNIT_ASSERT(pXmlDoc);
+
+ const OString sPathStart = "/office:document-content/office:body/office:spreadsheet/"
+ "table:table/table:shapes/draw:frame";
+ const OUString sTransform = getXPath(pXmlDoc, sPathStart, "transform");
+ // Attribute transform has the structure skew (...) rotate (...) translate (x y)
+ // parts are separated by blank
+ OUString sTranslate(sTransform.copy(sTransform.lastIndexOf('(')));
+ sTranslate = sTranslate.copy(1, sTranslate.getLength()-2); // remove '(' and ')'
+ const OUString sX(sTranslate.getToken(0, ' '));
+ const OUString sY(sTranslate.getToken(1, ' '));
+ CPPUNIT_ASSERT(sX.endsWith("mm") && sY.endsWith("mm"));
+
+ xDocSh->DoClose();
+}
CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);