summaryrefslogtreecommitdiff
path: root/sw/qa/extras/unowriter/unowriter.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/qa/extras/unowriter/unowriter.cxx')
-rw-r--r--sw/qa/extras/unowriter/unowriter.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx
index 3fefa93f4d87..19bd0673d0fe 100644
--- a/sw/qa/extras/unowriter/unowriter.cxx
+++ b/sw/qa/extras/unowriter/unowriter.cxx
@@ -16,6 +16,7 @@
#include <com/sun/star/rdf/URIs.hpp>
#include <com/sun/star/awt/XDevice.hpp>
#include <com/sun/star/awt/XToolkit.hpp>
+#include <com/sun/star/style/LineSpacing.hpp>
#include <comphelper/propertyvalue.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <wrtsh.hxx>
@@ -123,6 +124,31 @@ DECLARE_UNOAPI_TEST_FILE(testRenderablePagePosition, "renderable-page-position.o
CPPUNIT_ASSERT_GREATER(aPosition1.Y, aPosition2.Y);
}
+
+CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTextConvertToTableLineSpacing)
+{
+ // Load a document which has a table with a single cell.
+ // The cell has both a table style and a paragraph style, with different line spacing
+ // heights.
+ load(mpTestDocumentPath, "table-line-spacing.docx");
+ uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(),
+ uno::UNO_QUERY);
+ uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<table::XCell> xCell = xTable->getCellByName("A1");
+ uno::Reference<text::XText> xCellText(xCell, uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, xCellText);
+ style::LineSpacing aLineSpacing
+ = getProperty<style::LineSpacing>(xParagraph, "ParaLineSpacing");
+ // Make sure that we take the line spacing from the paragraph style, not from the table style.
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 388
+ // - Actual : 635
+ // I.e. the 360 twips line spacing was taken from the table style, not the 220 twips one from
+ // the paragraph style.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(convertTwipToMm100(220)), aLineSpacing.Height);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */