tdf#169110 tdf#171441 tdf#171636 sc: add UI test for VBA CutCopyMode after opening Basic IDE

Open the Basic IDE, activate the VBA module window, then run the
document macro and verify it does not fail with
'Property or method not found: CutCopyMode'.

This covers the regression where Basic IDE / Object Browser activity
 disturb VBA member resolution for the active document.

Change-Id: Id54b76cc633ba76377f201e3c4afca06a094ea7e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197754
Tested-by: Jenkins
Reviewed-by: Neil Roberts <nroberts@libreoffice.org>
This commit is contained in:
Devansh Varshney
2026-06-22 12:54:06 +02:00
committed by Neil Roberts
parent 5e3784870e
commit 13c8228073
4 changed files with 61 additions and 0 deletions
+1
View File
@@ -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 \
+20
View File
@@ -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:
Binary file not shown.
+40
View File
@@ -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: