summaryrefslogtreecommitdiff
path: root/sw/qa/extras/ooxmlimport
diff options
context:
space:
mode:
authorAndres Gomez <agomez@igalia.com>2013-10-04 19:11:21 +0300
committerMiklos Vajna <vmiklos@collabora.co.uk>2013-10-16 12:23:34 +0200
commitb3362fc9cb410599ac54fc3badfad75354c98d84 (patch)
tree8ce98b71cb8bfdda91d6e4dc355a2af3fe08d5b7 /sw/qa/extras/ooxmlimport
parent09edaa05cd605372ac2d2da0e010fde79f56efc8 (diff)
sw: Smart-Art related UTs updated to new option
The "ooxmlexport" unit test for Smart-Art has been updated to just check for the new rendered bitmap that substitutes the generated basic shapes. The "ooxmlimport" has been updated with a new "testSmartart" unit tests which checks that the importing has been done to just basic shapes. For this, the "run" method has been customized so we can set the proper filter option. Slightly modified the expected results in the "testChartProp" unit test since linking it to additional libraries has modified the dimmensions of the imported chart in few units. Made the "ooxmlimport" C++ unit tests in the "sw" module to depend on the "drawinglayer" and "svx" components and the "utl" library. Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx Change-Id: I0900a50cfee07999511d071bc9932477ad9430c5
Diffstat (limited to 'sw/qa/extras/ooxmlimport')
-rw-r--r--sw/qa/extras/ooxmlimport/data/smartart.docxbin0 -> 20453 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx36
2 files changed, 34 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/smartart.docx b/sw/qa/extras/ooxmlimport/data/smartart.docx
new file mode 100644
index 000000000000..7a553f425188
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/smartart.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index d80188156447..7fe9b40ab06c 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -40,6 +40,7 @@
#include <com/sun/star/xml/dom/XDocument.hpp>
#include <vcl/svapp.hxx>
+#include <unotools/fltrcfg.hxx>
#include <swmodeltestbase.hxx>
#include <bordertest.hxx>
@@ -140,6 +141,7 @@ public:
void testBnc779620();
void testFdo43093();
void testMultiColumnSeparator();
+ void testSmartart();
CPPUNIT_TEST_SUITE(Test);
#if !defined(WNT)
@@ -244,12 +246,17 @@ void Test::run()
{"bnc779620.docx", &Test::testBnc779620},
{"fdo43093.docx", &Test::testFdo43093},
{"multi-column-separator-with-line.docx", &Test::testMultiColumnSeparator},
+ {"smartart.docx", &Test::testSmartart},
};
header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
{
MethodEntry<Test>& rEntry = aMethods[i];
+ if (OString(rEntry.pName) == "smartart.docx")
+ SvtFilterOptions::Get().SetSmartArt2Shape(sal_True);
load("/sw/qa/extras/ooxmlimport/data/", rEntry.pName);
+ if (OString(rEntry.pName) == "smartart.docx")
+ SvtFilterOptions::Get().SetSmartArt2Shape(sal_False);
(this->*rEntry.pMethod)();
finish();
}
@@ -1594,8 +1601,8 @@ void Test::testChartProp()
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount());
uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY);
- CPPUNIT_ASSERT_EQUAL(sal_Int32(15236), getProperty<sal_Int32>(xPropertySet, "Width"));
- CPPUNIT_ASSERT_EQUAL(sal_Int32(8886), getProperty<sal_Int32>(xPropertySet, "Height"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(15240), getProperty<sal_Int32>(xPropertySet, "Width"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(8890), getProperty<sal_Int32>(xPropertySet, "Height"));
}
void Test::testBnc779620()
@@ -1639,6 +1646,31 @@ void Test::testFdo43093()
CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB, nLLDir);
}
+void Test::testSmartart()
+{
+ uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xTextDocumentPropertySet(xTextDocument, uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount()); // One groupshape in the doc
+
+ uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xGroup->getCount()); // 3 rectangles and an arrow in the group
+
+ uno::Reference<beans::XPropertySet> xPropertySet(xGroup->getByIndex(1), uno::UNO_QUERY);
+ sal_Int32 nValue(0);
+ xPropertySet->getPropertyValue("FillColor") >>= nValue;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0x4f81bd), nValue); // If fill color is right, theme import is OK
+
+ uno::Reference<text::XTextRange> xTextRange(xGroup->getByIndex(1), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("Sample"), xTextRange->getString()); // Shape has text
+
+ uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextRange->getText(), uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
+ xPropertySet.set(xParaEnum->nextElement(), uno::UNO_QUERY);
+ xPropertySet->getPropertyValue("ParaAdjust") >>= nValue;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(style::ParagraphAdjust_CENTER), nValue); // Paragraph properties are imported
+}
void Test::testMultiColumnSeparator()
{