Regina Henschel <[email protected]> writes:

> I'm looking for a co-author for a Python test for the patch 
> https://gerrit.libreoffice.org/c/core/+/194789. I work on Windows and 
> therefore cannot run Python tests.

Hi Regina,

I had a go at implementing the test with the patch attached below. It
works with the “gen” backend but if I use the “svp” backend (the default
for UI tests) then it gets stuck in a deadlock. At the end of the “with”
block for .uno:DataProvider, it tries to close the dialog with
executeAction and this waits for idle with
Scheduler::ProcessEventsToIdle. Somehow on the svp backend this blocks
with the solar mutex held in SvpSalInstance::DoYield on line 537. The
main thread never gets to idle because it is waiting for the “HTML Fetch
Thread” to join. That last thread is deadlocked by trying to get the
Solar Mutex in ScTable::CreateColumnIfNotExistsImpl.

At the point where the main thread is blocked, there is a comment saying
“TODO: use a SolarMutexReleaser here and drop the m_bNoYieldLock usage”.
I wonder if that means there is a bug in the SVP backend to fix before
we can make the test. I can try to look into it a bit more unless
someone already has some helpful insights?

Regards,
– Neil

>From e597fba12f60801b0fe76c61013e0e1ccaf39d87 Mon Sep 17 00:00:00 2001
From: Neil Roberts <[email protected]>
Date: Sat, 29 Nov 2025 12:42:11 +0100
Subject: [PATCH] tdf#169077: Add a UITest

Co-authored-by: Regina Henschel <[email protected]>
Change-Id: I7facde3d9aeea7ac3662da060ff821dfa2af7716
---
 .../calc_tests8/tdf169077_html_import.py      | 51 +++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 sc/qa/uitest/calc_tests8/tdf169077_html_import.py

diff --git a/sc/qa/uitest/calc_tests8/tdf169077_html_import.py b/sc/qa/uitest/calc_tests8/tdf169077_html_import.py
new file mode 100644
index 000000000000..aa201bea5cc4
--- /dev/null
+++ b/sc/qa/uitest/calc_tests8/tdf169077_html_import.py
@@ -0,0 +1,51 @@
+# -*- 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 uitest.uihelper.common import select_by_text
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from libreoffice.calc.document import get_cell_by_position
+
+import os
+
+class tdf169077(UITestCase):
+
+    def test_html_import(self):
+
+        with self.ui_test.create_doc_in_start_center("calc") as xDoc:
+
+            # Make a database range on A1:K11 called "TestDB"
+            with self.ui_test.execute_dialog_through_command(".uno:DefineDBName") as xDialog:
+                xName = xDialog.getChild("entry")
+                xName.executeAction("SET", mkPropertyValues({"TEXT": "TestDB"}))
+
+                xRange = xDialog.getChild("assign")
+                xRange.executeAction("SET", mkPropertyValues({"TEXT": "$Sheet1.$A$1:$K$11"}))
+
+            # Set the provider for the range to be the table in the test1.html test file
+            with self.ui_test.execute_dialog_through_command(".uno:DataProvider") as xDialog:
+                xRange = xDialog.getChild("select_db_range")
+                select_by_text(xRange, "TestDB")
+
+                xFormat = xDialog.getChild("provider_lst")
+                select_by_text(xFormat, "HTML")
+
+                test_file = os.path.join(os.getenv("SRCDIR"),
+                                         "sc", "qa", "unit", "data", "dataprovider", "html",
+                                         "test1.html")
+                xURL = xDialog.getChild("ed_url")
+                xURL.executeAction("SET", mkPropertyValues({"TEXT": test_file}))
+
+                xId = xDialog.getChild("ed_id")
+                xId.executeAction("SET", mkPropertyValues({"TEXT": "//table"}))
+
+            # Check that the import updated the A1 cell. Without the fix the cell would be empty.
+            self.assertEqual(get_cell_by_position(xDoc, 0, 0, 0).getString(), "Col1")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
-- 
2.51.1

Reply via email to