From 4a764319cbad4e2589cc105145ac27defbf49ff6 Mon Sep 17 00:00:00 2001 From: Tamás Zolnai Date: Wed, 9 Aug 2017 16:06:17 +0200 Subject: tdf#91384: DOCX: import ActiveX controls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iebf2ff65fcec3231acfc962fb2f1abc2ed2dc67a Reviewed-on: https://gerrit.libreoffice.org/40930 Tested-by: Jenkins Reviewed-by: Tamás Zolnai --- .../extras/ooxmlimport/data/activex_checkbox.docx | Bin 0 -> 13851 bytes sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 29 +++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100755 sw/qa/extras/ooxmlimport/data/activex_checkbox.docx (limited to 'sw/qa') 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 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/activex_checkbox.docx 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 #include #include +#include #include +#include #include class Test : public SwModelTestBase @@ -1441,6 +1443,33 @@ DECLARE_OOXMLIMPORT_TEST(testGroupShapeFontName, "groupshape-fontname.docx") CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(getRun(getParagraphOfText(1, xText), 1), "CharFontNameAsian")); } +DECLARE_OOXMLIMPORT_TEST( testActiveXCheckbox, "activex_checkbox.docx" ) +{ + uno::Reference xControlShape( getShape(1), uno::UNO_QUERY ); + CPPUNIT_ASSERT( xControlShape.is() ); + + // Check control type + uno::Reference xPropertySet( xControlShape->getControl(), uno::UNO_QUERY ); + uno::Reference 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(xPropertySet, "Label") ); + + // Check background color (highlight system color) + CPPUNIT_ASSERT_EQUAL( sal_Int32( 0x316AC5 ), getProperty(xPropertySet, "BackgroundColor") ); + + // Check Text color (active border system color) + CPPUNIT_ASSERT_EQUAL(sal_Int32(0xD4D0C8), getProperty(xPropertySet, "TextColor")); + + // Check state of the checkbox + CPPUNIT_ASSERT_EQUAL(sal_Int16(1), getProperty(xPropertySet, "State")); + + // Check anchor type + uno::Reference xPropertySet2(xControlShape, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER,getProperty(xPropertySet2,"AnchorType")); +} + // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT CPPUNIT_PLUGIN_IMPLEMENT(); -- cgit v1.2.3