summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-11-21 22:31:56 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-11-21 23:06:09 +0100
commit186d021c157ddcbe98474dd347c80e8dcc7ab471 (patch)
treea9e72625dcc3a4e05887675385d8c7ceb8613ab9
parent93e5b09f3acab7998cac2b1879e43e98ad7cc81a (diff)
Use oox::drawingml::convertEmuToHmm()
This makes the +1 hack unnecessary in CppunitTest_sw_ooxmlexport2. Change-Id: Ibf0a32b0bf03e9b47850edb335947e4ec383327b
-rw-r--r--sw/qa/extras/inc/swmodeltestbase.hxx1
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport2.cxx12
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx11
3 files changed, 12 insertions, 12 deletions
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index e5966e31ff69..4f71ff6b8e1e 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -51,7 +51,6 @@
using namespace css;
#define DEFAULT_STYLE "Default Style"
-#define EMU_TO_MM100(EMU) (EMU / 360)
/**
* Macro to declare a new test (with full round-trip. To test
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
index 8dc4e9445b8a..6d7a87a68896 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
@@ -49,6 +49,7 @@
#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
#include <com/sun/star/drawing/Hatch.hpp>
+#include <oox/drawingml/drawingmltypes.hxx>
#include <string>
@@ -974,17 +975,16 @@ DECLARE_OOXMLEXPORT_TEST(testFdo65718, "fdo65718.docx")
// the actual attributes where 'distT', 'distB', 'distL', 'distR'
uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY);
- CPPUNIT_ASSERT_EQUAL(sal_Int32( EMU_TO_MM100(0) ), getProperty<sal_Int32>(xPropertySet, "TopMargin") );
- CPPUNIT_ASSERT_EQUAL(sal_Int32( EMU_TO_MM100(0) ), getProperty<sal_Int32>(xPropertySet, "BottomMargin") );
+ CPPUNIT_ASSERT_EQUAL(sal_Int32( oox::drawingml::convertEmuToHmm(0) ), getProperty<sal_Int32>(xPropertySet, "TopMargin") );
+ CPPUNIT_ASSERT_EQUAL(sal_Int32( oox::drawingml::convertEmuToHmm(0) ), getProperty<sal_Int32>(xPropertySet, "BottomMargin") );
- // Going to do '+1' because the 'getProperty' return 318 (instead of 317.5)
+ // 'getProperty' return 318 (instead of 317.5)
// I think this is because it returns an integer, instead of a float.
// The actual exporting to DOCX exports the correct value (114300 = 317.5 * 360)
// The exporting to DOCX uses the 'SvxLRSpacing' that stores the value in TWIPS (180 TWIPS)
// However, the 'LeftMargin' property is an integer property that holds that value in 'MM100' (should hold 317.5, but it is 318)
- // So I had to add the hack of the '+1' to make the test-case pass
- CPPUNIT_ASSERT_EQUAL(sal_Int32( EMU_TO_MM100(114300) + 1 ), getProperty<sal_Int32>(xPropertySet, "LeftMargin") );
- CPPUNIT_ASSERT_EQUAL(sal_Int32( EMU_TO_MM100(114300) + 1), getProperty<sal_Int32>(xPropertySet, "RightMargin") );
+ CPPUNIT_ASSERT_EQUAL(sal_Int32( oox::drawingml::convertEmuToHmm(114300) ), getProperty<sal_Int32>(xPropertySet, "LeftMargin") );
+ CPPUNIT_ASSERT_EQUAL(sal_Int32( oox::drawingml::convertEmuToHmm(114300) ), getProperty<sal_Int32>(xPropertySet, "RightMargin") );
}
DECLARE_OOXMLEXPORT_TEST(testFdo64350, "fdo64350.docx")
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 27fe3d627b77..0c095e36df50 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -64,6 +64,7 @@
#include <com/sun/star/text/GraphicCrop.hpp>
#include <swtypes.hxx>
#include <tools/datetimeutils.hxx>
+#include <oox/drawingml/drawingmltypes.hxx>
#include <bordertest.hxx>
@@ -1216,7 +1217,7 @@ DECLARE_OOXMLIMPORT_TEST(testfdo78904, "fdo78904.docx")
if (xIndexAccess->getCount())
{
uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
- CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(0)), getProperty<sal_Int32>(xFrame, "HoriOrientPosition"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(oox::drawingml::convertEmuToHmm(0)), getProperty<sal_Int32>(xFrame, "HoriOrientPosition"));
}
}
@@ -1381,7 +1382,7 @@ DECLARE_OOXMLIMPORT_TEST(testFdo43641, "fdo43641.docx")
uno::Reference<container::XIndexAccess> xGroupShape(getShape(1), uno::UNO_QUERY);
uno::Reference<drawing::XShape> xLine(xGroupShape->getByIndex(1), uno::UNO_QUERY);
// This was 2200, not 2579 in mm100, i.e. the size of the line shape was incorrect.
- CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(928694)), xLine->getSize().Width);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(oox::drawingml::convertEmuToHmm(928440)), xLine->getSize().Width);
}
DECLARE_OOXMLIMPORT_TEST(testTableAutoColumnFixedSize, "table-auto-column-fixed-size.docx")
@@ -1660,7 +1661,7 @@ DECLARE_OOXMLIMPORT_TEST(testWpsOnly, "wps-only.docx")
CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_PARAGRAPH, eValue);
// Check position, it was 0. This is a shape, so use getPosition(), not a property.
- CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(671830)), xShape->getPosition().X);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(oox::drawingml::convertEmuToHmm(671830)), xShape->getPosition().X);
// Left margin was 0, instead of 114300 EMU's.
CPPUNIT_ASSERT_EQUAL(sal_Int32(318), getProperty<sal_Int32>(xShape, "LeftMargin"));
@@ -1705,7 +1706,7 @@ DECLARE_OOXMLIMPORT_TEST(testWpgOnly, "wpg-only.docx")
{
uno::Reference<drawing::XShape> xShape = getShape(1);
// Check position, it was nearly 0. This is a shape, so use getPosition(), not a property.
- CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(548005)), xShape->getPosition().X);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(oox::drawingml::convertEmuToHmm(548005)), xShape->getPosition().X);
}
DECLARE_OOXMLIMPORT_TEST(testWpgNested, "wpg-nested.docx")
@@ -1871,7 +1872,7 @@ DECLARE_OOXMLIMPORT_TEST(testDmlCharheightDefault, "dml-charheight-default.docx"
DECLARE_OOXMLIMPORT_TEST(testGroupshapeRelsize, "groupshape-relsize.docx")
{
// This was 43760, i.e. the height of the groupshape was larger than the page height, which is obviously incorrect.
- CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(9142730)), getShape(1)->getSize().Height);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(oox::drawingml::convertEmuToHmm(9142730)), getShape(1)->getSize().Height);
}
DECLARE_OOXMLIMPORT_TEST(testOleAnchor, "ole-anchor.docx")