diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk index 1e79930f178b..6f2a8fb56d02 100644 --- a/sc/Module_sc.mk +++ b/sc/Module_sc.mk @@ -291,6 +291,7 @@ $(eval $(call gb_Module_add_uicheck_targets,sc,\ UITest_goalSeek \ UITest_protect \ UITest_sc_options \ + UITest_sc_vba \ UITest_validity \ UITest_key_f4 \ UITest_textCase \ diff --git a/sc/UITest_sc_vba.mk b/sc/UITest_sc_vba.mk new file mode 100644 index 000000000000..392f0f113145 --- /dev/null +++ b/sc/UITest_sc_vba.mk @@ -0,0 +1,20 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*- +# +# 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_UITest_UITest,sc_vba)) + +$(eval $(call gb_UITest_add_modules,sc_vba,$(SRCDIR)/sc/qa/uitest,\ + vba/ \ +)) + +$(eval $(call gb_UITest_set_defs,sc_vba, \ + TDOC="$(SRCDIR)/sc/qa/uitest/data" \ +)) + +# vim: set noet sw=4 ts=4: \ No newline at end of file diff --git a/sc/qa/uitest/data/tdf169110.ods b/sc/qa/uitest/data/tdf169110.ods new file mode 100644 index 000000000000..bb158058554f Binary files /dev/null and b/sc/qa/uitest/data/tdf169110.ods differ diff --git a/sc/qa/uitest/vba/tdf169110.py b/sc/qa/uitest/vba/tdf169110.py new file mode 100644 index 000000000000..3f79c7379e5d --- /dev/null +++ b/sc/qa/uitest/vba/tdf169110.py @@ -0,0 +1,40 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-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/. +# + +from uitest.framework import UITestCase +from com.sun.star.uno import Exception as UnoException +from uitest.uihelper.common import get_url_for_data_file + +class TDF169110(UITestCase): + + def test_vba_cutcopymode_corruption_with_ide(self): + # This test reproduces a regression where opening the Basic IDE + # triggered full VBA initialization during code indexing, + # corrupting the runtime state (CutCopyMode) of active scripts. + + with self.ui_test.load_file(get_url_for_data_file("tdf169110.ods")) as document: + self.xUITest.executeCommand(".uno:BasicIDEAppear") + + xScriptProvider = document.getScriptProvider() + sScriptURL = ( + "vnd.sun.star.script:" + "VBAProject.Module1.countifs_benchmark" + "?language=Basic&location=document" + ) + xScript = xScriptProvider.getScript(sScriptURL) + + try: + xScript.invoke((), (), ()) + except UnoException as e: + self.fail( + "Regression tdf#169110 reproduced: macro failed after " + f"Basic IDE/Object Browser activation: {e}" + ) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: