summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2017-08-09 16:06:17 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2017-08-09 19:07:33 +0200
commit4a764319cbad4e2589cc105145ac27defbf49ff6 (patch)
tree9e020cfde1025dea3b1b1fc5839bba27b39ddd8e /sw/qa
parent286c27e805c4501451857abff19c23b3719146a3 (diff)
tdf#91384: DOCX: import ActiveX controls
Change-Id: Iebf2ff65fcec3231acfc962fb2f1abc2ed2dc67a Reviewed-on: https://gerrit.libreoffice.org/40930 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'sw/qa')
-rwxr-xr-xsw/qa/extras/ooxmlimport/data/activex_checkbox.docxbin0 -> 13851 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx29
2 files changed, 29 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/activex_checkbox.docx b/sw/qa/extras/ooxmlimport/data/activex_checkbox.docx
new file mode 100755
index 000000000000..d7415ef5a5c6
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/activex_checkbox.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index bbbf1e65e740..bea70605fdae 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -60,7 +60,9 @@
#include <unotools/streamwrap.hxx>
#include <comphelper/propertysequence.hxx>
#include <com/sun/star/drawing/HomogenMatrix3.hpp>
+#include <com/sun/star/drawing/XControlShape.hpp>
#include <com/sun/star/awt/CharSet.hpp>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
#include <test/mtfxmldump.hxx>
class Test : public SwModelTestBase
@@ -1441,6 +1443,33 @@ DECLARE_OOXMLIMPORT_TEST(testGroupShapeFontName, "groupshape-fontname.docx")
CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(getRun(getParagraphOfText(1, xText), 1), "CharFontNameAsian"));
}
+DECLARE_OOXMLIMPORT_TEST( testActiveXCheckbox, "activex_checkbox.docx" )
+{
+ uno::Reference<drawing::XControlShape> xControlShape( getShape(1), uno::UNO_QUERY );
+ CPPUNIT_ASSERT( xControlShape.is() );
+
+ // Check control type
+ uno::Reference<beans::XPropertySet> xPropertySet( xControlShape->getControl(), uno::UNO_QUERY );
+ uno::Reference<lang::XServiceInfo> xServiceInfo( xPropertySet, uno::UNO_QUERY );
+ CPPUNIT_ASSERT_EQUAL( true, bool( xServiceInfo->supportsService( "com.sun.star.form.component.CheckBox" ) ) );
+
+ // Check custom label
+ CPPUNIT_ASSERT_EQUAL( OUString( "Custom Caption" ), getProperty<OUString>(xPropertySet, "Label") );
+
+ // Check background color (highlight system color)
+ CPPUNIT_ASSERT_EQUAL( sal_Int32( 0x316AC5 ), getProperty<sal_Int32>(xPropertySet, "BackgroundColor") );
+
+ // Check Text color (active border system color)
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0xD4D0C8), getProperty<sal_Int32>(xPropertySet, "TextColor"));
+
+ // Check state of the checkbox
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(1), getProperty<sal_Int16>(xPropertySet, "State"));
+
+ // Check anchor type
+ uno::Reference<beans::XPropertySet> xPropertySet2(xControlShape, uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER,getProperty<text::TextContentAnchorType>(xPropertySet2,"AnchorType"));
+}
+
// tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT
CPPUNIT_PLUGIN_IMPLEMENT();