summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-08-22 15:13:58 +0200
committerMiklos Vajna <vmiklos@suse.cz>2013-08-22 16:35:54 +0200
commitf26e35c93526cdd1c4fcb6614c3fb1f6a3c511e8 (patch)
tree374c65e3564fd2c969de01c9359cf11c3e6ba255 /sw
parent166510ed48bf49b75a031ce973f41d08fb4e4518 (diff)
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
Diffstat (limited to 'sw')
-rwxr-xr-xsw/qa/extras/ooxmlexport/data/table-floating.docx (renamed from sw/qa/extras/ooxmlimport/data/table-floating.docx)bin14996 -> 14996 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx19
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx19
3 files changed, 19 insertions, 19 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/table-floating.docx b/sw/qa/extras/ooxmlexport/data/table-floating.docx
index 1e0cb30ece49..1e0cb30ece49 100755
--- a/sw/qa/extras/ooxmlimport/data/table-floating.docx
+++ b/sw/qa/extras/ooxmlexport/data/table-floating.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 2129d9cd460b..89c3aabc18e3 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<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> 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<sal_Int32>(xTables->getByIndex(1), "Width"));
+
+ uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> 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<sal_Int32>(xFrame, "HoriOrientPosition"));
+ // Was 0 as well, should be the right margin.
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(250), getProperty<sal_Int32>(xFrame, "RightMargin"));
+}
+
void Test::testTableFloatingMargins()
{
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 3f6293192ef5..524ef5896f66 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_EQUAL(sal_Int16(1), xCursor->getPage());
}
-void Test::testTableFloating()
-{
- // Both the size and the position of the table was incorrect.
- uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
- uno::Reference<container::XIndexAccess> 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<sal_Int32>(xTables->getByIndex(1), "Width"));
-
- uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
- uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
- uno::Reference<beans::XPropertySet> 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<sal_Int32>(xFrame, "HoriOrientPosition"));
- // Was 0 as well, should be the right margin.
- CPPUNIT_ASSERT_EQUAL(sal_Int32(250), getProperty<sal_Int32>(xFrame, "RightMargin"));
-}
-
void Test::testTableFloatingMargins()
{
// In case the table had custom left cell margin, the horizontal position was still incorrect (too small, -199).