diff --git a/forms/CppunitTest_forms_unit.mk b/forms/CppunitTest_forms_unit.mk new file mode 100644 index 000000000000..4a740fe34417 --- /dev/null +++ b/forms/CppunitTest_forms_unit.mk @@ -0,0 +1,39 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_CppunitTest_CppunitTest,forms_unit)) + +$(eval $(call gb_CppunitTest_use_sdk_api,forms_unit)) + +$(eval $(call gb_CppunitTest_use_externals,forms_unit, \ + libxml2 \ +)) + +$(eval $(call gb_CppunitTest_add_exception_objects,forms_unit, \ + forms/qa/unit/forms_test \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,forms_unit, \ + comphelper \ + cppu \ + cppuhelper \ + sal \ + subsequenttest \ + test \ + tl \ + unotest \ + utl \ +)) + +$(eval $(call gb_CppunitTest_use_ure,forms_unit)) +$(eval $(call gb_CppunitTest_use_vcl,forms_unit)) +$(eval $(call gb_CppunitTest_use_rdb,forms_unit,services)) +$(eval $(call gb_CppunitTest_use_configuration,forms_unit)) + +# vim: set noet sw=4 ts=4: diff --git a/forms/Module_forms.mk b/forms/Module_forms.mk index 7ba484b81d3a..d708317c3b31 100644 --- a/forms/Module_forms.mk +++ b/forms/Module_forms.mk @@ -13,6 +13,10 @@ $(eval $(call gb_Module_add_targets,forms,\ Library_frm \ )) +$(eval $(call gb_Module_add_check_targets,forms,\ + CppunitTest_forms_unit \ +)) + $(eval $(call gb_Module_add_l10n_targets,forms,\ AllLangMoTarget_frm \ )) diff --git a/forms/qa/unit/forms_test.cxx b/forms/qa/unit/forms_test.cxx new file mode 100644 index 000000000000..6a45d3d565c7 --- /dev/null +++ b/forms/qa/unit/forms_test.cxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include +#include +#include + +using namespace com::sun::star; + +namespace +{ +class FormsTest : public UnoApiTest +{ +public: + FormsTest() + : UnoApiTest(u""_ustr) + { + } + + uno::Reference createFormComponent(const OUString& rServiceName) + { + return uno::Reference( + comphelper::getProcessServiceFactory()->createInstance(rServiceName), + uno::UNO_QUERY_THROW); + } +}; + +CPPUNIT_TEST_FIXTURE(FormsTest, testTdf51727_GridControlTabStopDefault) +{ + auto xModel = createFormComponent(u"com.sun.star.form.component.GridControl"_ustr); + + // Without the fix in place, this test would have failed with + // - Expected: false + // - Actual : void + // i.e. the tab stop property of the grid control was not initialized correctly + uno::Any aTabStop = xModel->getPropertyValue(u"Tabstop"_ustr); + CPPUNIT_ASSERT(aTabStop.hasValue()); + bool bTabStop = true; + CPPUNIT_ASSERT(aTabStop >>= bTabStop); + CPPUNIT_ASSERT_EQUAL(false, bTabStop); +} + +} // namespace + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/component/Grid.cxx b/forms/source/component/Grid.cxx index 67957dbfff88..ba2e0b107063 100644 --- a/forms/source/component/Grid.cxx +++ b/forms/source/component/Grid.cxx @@ -82,6 +82,8 @@ OGridControlModel::OGridControlModel(const Reference& _rxFact ,m_bDisplaySynchron(true) { m_nClassId = FormComponentType::GRIDCONTROL; + // tdf#51727 - explicitly set to false so tab navigation skips this control by default + m_aTabStop <<= false; } OGridControlModel::OGridControlModel( const OGridControlModel* _pOriginal, const Reference< XComponentContext >& _rxFactory ) @@ -104,6 +106,7 @@ OGridControlModel::OGridControlModel( const OGridControlModel* _pOriginal, const m_bPrintable = _pOriginal->m_bPrintable; m_bAlwaysShowCursor = _pOriginal->m_bAlwaysShowCursor; m_bDisplaySynchron = _pOriginal->m_bDisplaySynchron; + m_aTabStop = _pOriginal->m_aTabStop; // clone the columns cloneColumns( _pOriginal ); // TODO: clone the events? @@ -662,6 +665,7 @@ Any OGridControlModel::getPropertyDefaultByHandle( sal_Int32 nHandle ) const aReturn <<= true; break; case PROPERTY_ID_ALWAYSSHOWCURSOR: + case PROPERTY_ID_TABSTOP: aReturn <<= false; break; case PROPERTY_ID_HELPURL: @@ -672,7 +676,6 @@ Any OGridControlModel::getPropertyDefaultByHandle( sal_Int32 nHandle ) const aReturn <<= sal_Int16(1); break; case PROPERTY_ID_BORDERCOLOR: - case PROPERTY_ID_TABSTOP: case PROPERTY_ID_BACKGROUNDCOLOR: case PROPERTY_ID_ROWHEIGHT: case PROPERTY_ID_CURSORCOLOR: