tdf#51727 - Init tab stop property correctly to prevent default tab navigation
In addition, added the test facilities for the forms module. Change-Id: I8ff70f803a9cd549320f8c46b77e30f65cd327e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206773 Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de> Tested-by: Jenkins
This commit is contained in:
@@ -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:
|
||||
@@ -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 \
|
||||
))
|
||||
|
||||
@@ -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 <test/unoapi_test.hxx>
|
||||
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||
#include <comphelper/processfactory.hxx>
|
||||
|
||||
using namespace com::sun::star;
|
||||
|
||||
namespace
|
||||
{
|
||||
class FormsTest : public UnoApiTest
|
||||
{
|
||||
public:
|
||||
FormsTest()
|
||||
: UnoApiTest(u""_ustr)
|
||||
{
|
||||
}
|
||||
|
||||
uno::Reference<beans::XPropertySet> createFormComponent(const OUString& rServiceName)
|
||||
{
|
||||
return uno::Reference<beans::XPropertySet>(
|
||||
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: */
|
||||
@@ -82,6 +82,8 @@ OGridControlModel::OGridControlModel(const Reference<XComponentContext>& _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:
|
||||
|
||||
Reference in New Issue
Block a user