[Libreoffice-commits] core.git: include/oox sw/qa

2021-08-23 Thread Caolán McNamara (via logerrit)
 include/oox/drawingml/drawingmltypes.hxx   |2 +-
 sw/qa/core/data/ooxml/fail/ofz37458-1.docx |binary
 2 files changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 238951d0c539d1e294a1a12f2cf7aa806af8e116
Author: Caolán McNamara 
AuthorDate: Sun Aug 22 12:25:12 2021 +0100
Commit: Caolán McNamara 
CommitDate: Mon Aug 23 17:59:08 2021 +0200

ofz#37458 use o3tl::convertSaturate in convertEmuToHmm

Change-Id: Ic177ca6042cbedc4cbe70e1f35ac3d85c1fa2f7e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120840
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/include/oox/drawingml/drawingmltypes.hxx 
b/include/oox/drawingml/drawingmltypes.hxx
index 873fb76435a8..05d218fa882e 100644
--- a/include/oox/drawingml/drawingmltypes.hxx
+++ b/include/oox/drawingml/drawingmltypes.hxx
@@ -181,7 +181,7 @@ inline sal_Int64 convertHmmToEmu( sal_Int32 nValue )
 inline sal_Int32 convertEmuToHmm( sal_Int64 nValue )
 {
 return getLimitedValue(
-o3tl::convert(nValue, o3tl::Length::emu, o3tl::Length::mm100), 
SAL_MIN_INT32,
+o3tl::convertSaturate(nValue, o3tl::Length::emu, o3tl::Length::mm100), 
SAL_MIN_INT32,
 SAL_MAX_INT32);
 }
 
diff --git a/sw/qa/core/data/ooxml/fail/ofz37458-1.docx 
b/sw/qa/core/data/ooxml/fail/ofz37458-1.docx
new file mode 100644
index ..04e7d6062978
Binary files /dev/null and b/sw/qa/core/data/ooxml/fail/ofz37458-1.docx differ


[Libreoffice-commits] core.git: include/oox sw/qa

2017-08-22 Thread Andrea Gelmini
 include/oox/export/vmlexport.hxx  |2 +-
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 1ba1bb96659d0048bff2a9a15646f6e1e04bd2c4
Author: Andrea Gelmini 
Date:   Tue Aug 22 23:09:28 2017 +0200

Fix typos

Change-Id: Ic78d3e15c5e58f1306f8448c0806db275b3ae616
Reviewed-on: https://gerrit.libreoffice.org/41435
Reviewed-by: Adolfo Jayme Barrientos 
Tested-by: Adolfo Jayme Barrientos 

diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx
index ee40b933deaa..99313638374c 100644
--- a/include/oox/export/vmlexport.hxx
+++ b/include/oox/export/vmlexport.hxx
@@ -116,7 +116,7 @@ class OOX_DLLPUBLIC VMLExport : public EscherEx
 */
 bool m_bOverrideShapeIdGeneration;
 
-/// Prefix for overriden shape id generation (used if 
m_bOverrideShapeIdGeneration is true)
+/// Prefix for overridden shape id generation (used if 
m_bOverrideShapeIdGeneration is true)
 OString m_sShapeIDPrefix;
 
 /// Counter for generating shape ids (used if m_bOverrideShapeIdGeneration 
is true)
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index f19fb6b65d76..9821751bd668 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -872,7 +872,7 @@ DECLARE_OOXMLEXPORT_TEST(testActiveXControlAlign, 
"activex_control_align.odt")
 uno::Reference xPropertySet2(xControlShape, 
uno::UNO_QUERY);
 
CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER,getProperty(xPropertySet2,"AnchorType"));
 
-// Also check positin and size
+// Also check position and size
 uno::Reference xShape(xControlShape, uno::UNO_QUERY);
 CPPUNIT_ASSERT(xShape.is());
 CPPUNIT_ASSERT_EQUAL(sal_Int32(4470), xShape->getSize().Width);
@@ -894,7 +894,7 @@ DECLARE_OOXMLEXPORT_TEST(testActiveXControlAlign, 
"activex_control_align.odt")
 
CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER,getProperty(xPropertySet2,"AnchorType"));
 
CPPUNIT_ASSERT_EQUAL(sal_Int32(text::VertOrientation::TOP),getProperty(xPropertySet2,"VertOrient"));
 
-// Also check positin and size
+// Also check position and size
 xShape.set(xControlShape, uno::UNO_QUERY);
 CPPUNIT_ASSERT(xShape.is());
 CPPUNIT_ASSERT_EQUAL(sal_Int32(4410), xShape->getSize().Width);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: include/oox sw/qa

2013-08-22 Thread Miklos Vajna
 dev/null  |binary
 include/oox/drawingml/drawingmltypes.hxx  |3 ++-
 sw/qa/extras/ooxmlexport/data/table-floating.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |   19 +++
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |   19 ---
 5 files changed, 21 insertions(+), 20 deletions(-)

New commits:
commit f26e35c93526cdd1c4fcb6614c3fb1f6a3c511e8
Author: Miklos Vajna 
Date:   Thu Aug 22 15:13:58 2013 +0200

oox::drawingml::convertEmuToHmm: fix rounding for negative values

This commit also moves the floating table DOCX import testcase to the
export suite. That test now passes fine, though previously it failed with:

- Expected: -199
- Actual  : -198

Due to the rounding error.

Change-Id: I9bdc9295f68b6bd3e5f5bee868aae15194b30804

diff --git a/include/oox/drawingml/drawingmltypes.hxx 
b/include/oox/drawingml/drawingmltypes.hxx
index 5df664e..9e011f3 100644
--- a/include/oox/drawingml/drawingmltypes.hxx
+++ b/include/oox/drawingml/drawingmltypes.hxx
@@ -150,7 +150,8 @@ inline sal_Int64 convertHmmToEmu( sal_Int32 nValue )
 /** Converts the passed 64-bit integer value from EMUs to 1/100 mm. */
 inline sal_Int32 convertEmuToHmm( sal_Int64 nValue )
 {
-return getLimitedValue< sal_Int32, sal_Int64 >( (nValue + EMU_PER_HMM / 2) 
/ EMU_PER_HMM, SAL_MIN_INT32, SAL_MAX_INT32 );
+sal_Int32 nCorrection = (nValue > 0 ? 1 : -1) * EMU_PER_HMM / 2; // So 
that the implicit floor will round.
+return getLimitedValue< sal_Int32, sal_Int64 >( (nValue + nCorrection) / 
EMU_PER_HMM, SAL_MIN_INT32, SAL_MAX_INT32 );
 }
 
 // 
diff --git a/sw/qa/extras/ooxmlimport/data/table-floating.docx 
b/sw/qa/extras/ooxmlexport/data/table-floating.docx
similarity index 100%
rename from sw/qa/extras/ooxmlimport/data/table-floating.docx
rename to sw/qa/extras/ooxmlexport/data/table-floating.docx
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 2129d9c..89c3aab 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -107,6 +107,7 @@ public:
 void testFdo64350();
 void testFdo67013();
 void testParaShadow();
+void testTableFloating();
 void testTableFloatingMargins();
 void testFdo44689_start_page_7();
 
@@ -192,6 +193,7 @@ void Test::run()
 {"fdo64350.docx", &Test::testFdo64350},
 {"fdo67013.docx", &Test::testFdo67013},
 {"para-shadow.docx", &Test::testParaShadow},
+{"table-floating.docx", &Test::testTableFloating},
 {"table-floating-margins.docx", &Test::testTableFloatingMargins},
 {"fdo44689_start_page_7.docx", &Test::testFdo44689_start_page_7},
 };
@@ -1151,6 +1153,23 @@ void Test::testParaShadow()
 CPPUNIT_ASSERT_EQUAL(sal_Int16(TWIP_TO_MM100(24/8*20)), 
aShadow.ShadowWidth);
 }
 
+void Test::testTableFloating()
+{
+// Both the size and the position of the table was incorrect.
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+// Second table was too wide: 16249, i.e. as wide as the first table.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(11248), 
getProperty(xTables->getByIndex(1), "Width"));
+
+uno::Reference xTextFramesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
+uno::Reference xFrame(xIndexAccess->getByIndex(0), 
uno::UNO_QUERY);
+// This was 0, should be the the opposite of (left margin + half of the 
border width).
+CPPUNIT_ASSERT_EQUAL(sal_Int32(-199), getProperty(xFrame, 
"HoriOrientPosition"));
+// Was 0 as well, should be the right margin.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(250), getProperty(xFrame, 
"RightMargin"));
+}
+
 void Test::testTableFloatingMargins()
 {
 uno::Reference xTextFramesSupplier(mxComponent, 
uno::UNO_QUERY);
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 3f62931..524ef58 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -128,7 +128,6 @@ public:
 void testFdo66474();
 void testGroupshapeRotation();
 void testBnc780044Spacing();
-void testTableFloating();
 void testTableFloatingMargins();
 
 CPPUNIT_TEST_SUITE(Test);
@@ -223,7 +222,6 @@ void Test::run()
 {"fdo66474.docx", &Test::testFdo66474},
 {"groupshape-rotation.docx", &Test::testGroupshapeRotation},
 {"bnc780044_spacing.docx", &Test::testBnc780044Spacing},
-{"table-floating.docx", &Test::testTableFloating},
 {"table-floating-margins.docx", &Test::testTableFloatingMargins},
 };
 header();
@@ -1554,23 +1552,6 @@ void Test::testBnc780044Spacing()
 CPPUNIT_ASSERT_EQUA