diff options
author | aqcoder <flw.aquarius@gmail.com> | 2015-12-17 21:22:34 +0800 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-01-12 20:31:21 +0100 |
commit | a16cef75e829cd48445905fc67de625640bf6398 (patch) | |
tree | 7cf144c9ceb3c61d144fbcfd04fb7b9bf2aac2f8 /sw/qa | |
parent | 8565cef55b172fd1b4825998b3e3762a530b6a6f (diff) |
tdf#96412 Fix export text table cell UserDefinedAttributes to xml.
It also export to different Fmt when only have the difference of
UserDefinedAttributes for the text table cell.
Reviewed-on: https://gerrit.libreoffice.org/20765
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: jan iversen <jani@documentfoundation.org>
Let's try to push it again, it's unclear what the tinderbox failures
were that caused it to be reverted.
Change-Id: I022b627926870b883eea363567a34b61c34ab353
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/inc/swmodeltestbase.hxx | 14 | ||||
-rw-r--r-- | sw/qa/extras/odfexport/data/userdefattr-tablecell.odt | bin | 0 -> 9172 bytes | |||
-rw-r--r-- | sw/qa/extras/odfexport/odfexport.cxx | 11 |
3 files changed, 25 insertions, 0 deletions
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx index b761116180d4..ebfacd410e4d 100644 --- a/sw/qa/extras/inc/swmodeltestbase.hxx +++ b/sw/qa/extras/inc/swmodeltestbase.hxx @@ -11,6 +11,7 @@ #define INCLUDED_SW_QA_EXTRAS_INC_SWMODELTESTBASE_HXX #include <com/sun/star/container/XContentEnumerationAccess.hpp> +#include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/packages/zip/ZipFileAccess.hpp> #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> @@ -28,6 +29,7 @@ #include <com/sun/star/sdb/DatabaseContext.hpp> #include <com/sun/star/sdb/XDocumentDataSource.hpp> #include <com/sun/star/sdbc/XRowSet.hpp> +#include <com/sun/star/xml/AttributeData.hpp> #include <test/bootstrapfixture.hxx> #include <test/xmltesttools.hxx> @@ -433,6 +435,18 @@ protected: return properties->getPropertySetInfo()->hasPropertyByName(name); } + xml::AttributeData getUserDefineAttribute(const uno::Any& obj, const OUString& name, const OUString& rValue = OUString()) const + { + uno::Reference<container::XNameContainer> attrsCnt(getProperty<uno::Any>(obj, "UserDefinedAttributes"), uno::UNO_QUERY_THROW); + + xml::AttributeData aValue; + attrsCnt->getByName(name) >>= aValue; + if (!rValue.isEmpty()) + CPPUNIT_ASSERT_EQUAL_MESSAGE("attribtes of cell does not contain expected value", rValue, aValue.Value); + + return aValue; + } + /// Get number of paragraphs of the document. int getParagraphs() { diff --git a/sw/qa/extras/odfexport/data/userdefattr-tablecell.odt b/sw/qa/extras/odfexport/data/userdefattr-tablecell.odt Binary files differnew file mode 100644 index 000000000000..c8f6dcca5f93 --- /dev/null +++ b/sw/qa/extras/odfexport/data/userdefattr-tablecell.odt diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 04d1d3cdfaba..6333b9214ba2 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -768,6 +768,17 @@ DECLARE_ODFEXPORT_TEST(testOdtBorderTypes, "border_types.odt") } while (xParaEnum->hasMoreElements()); } +DECLARE_ODFEXPORT_TEST(testCellUserDefineAttr, "userdefattr-tablecell.odt") +{ + uno::Reference<text::XTextTable> xTable(getParagraphOrTable(0), uno::UNO_QUERY); + uno::Reference<table::XCell> const xCellA1(xTable->getCellByName("A1"), uno::UNO_SET_THROW); + uno::Reference<table::XCell> const xCellB1(xTable->getCellByName("B1"), uno::UNO_SET_THROW); + uno::Reference<table::XCell> const xCellC1(xTable->getCellByName("C1"), uno::UNO_SET_THROW); + getUserDefineAttribute(uno::makeAny(xCellA1), "proName", "v1"); + getUserDefineAttribute(uno::makeAny(xCellB1), "proName", "v2"); + getUserDefineAttribute(uno::makeAny(xCellC1), "proName", "v3"); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); |