[pim/kdepim-addons] plugins/webengineurlinterceptor/adblock: Don't fetch adblock lists in tests

Volker Krause <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit e25ae65072e9c3d388ff65352ecd44893471746e by Volker Krause.
Committed on 15/08/2026 at 05:53.
Pushed by vkrause into branch 'master'.

Don't fetch adblock lists in tests

The tests don't make use of those (and don't wait for them), and instead
we get a whole bunch of LSAN failures from the networking and SSL stack
(nothing we can actually do much about, like one-time stuff in OpenSSL
and QNAM).

M  +1    -1    plugins/webengineurlinterceptor/adblock/adblockmanager.cpp
M  +3    -0    plugins/webengineurlinterceptor/adblock/autotests/adblockfiltertreeviewtest.cpp
M  +2    -0    plugins/webengineurlinterceptor/adblock/autotests/adblockfilterwidgettest.cpp

https://invent.kde.org/pim/kdepim-addons/-/commit/e25ae65072e9c3d388ff65352ecd44893471746e

diff --git a/plugins/webengineurlinterceptor/adblock/adblockmanager.cpp b/plugins/webengineurlinterceptor/adblock/adblockmanager.cpp
index 944a77790..af9675849 100644
--- a/plugins/webengineurlinterceptor/adblock/adblockmanager.cpp
+++ b/plugins/webengineurlinterceptor/adblock/adblockmanager.cpp
@@ -41,7 +41,7 @@ AdblockManager::AdblockManager(QObject *parent)
     connect(&m_networkManager, &QNetworkAccessManager::finished, this, &AdblockManager::handleListFetched);
     m_networkManager.setRedirectPolicy(QNetworkRequest::SameOriginRedirectPolicy);
 
-    if (QDir(filterListPath()).isEmpty()) {
+    if (QDir(filterListPath()).isEmpty() && !QStandardPaths::isTestModeEnabled()) {
         refreshLists();
     }
 }
diff --git a/plugins/webengineurlinterceptor/adblock/autotests/adblockfiltertreeviewtest.cpp b/plugins/webengineurlinterceptor/adblock/autotests/adblockfiltertreeviewtest.cpp
index b0ecb1eb0..46922a792 100644
--- a/plugins/webengineurlinterceptor/adblock/autotests/adblockfiltertreeviewtest.cpp
+++ b/plugins/webengineurlinterceptor/adblock/autotests/adblockfiltertreeviewtest.cpp
@@ -6,11 +6,14 @@
 
 #include "adblockfiltertreeviewtest.h"
 #include "adblockfiltertreeview.h"
+#include <QStandardPaths>
 #include <QTest>
+
 QTEST_MAIN(AdblockFilterTreeViewTest)
 AdblockFilterTreeViewTest::AdblockFilterTreeViewTest(QObject *parent)
     : QObject{parent}
 {
+    QStandardPaths::setTestModeEnabled(true);
 }
 
 void AdblockFilterTreeViewTest::shouldHaveDefaultValues()
diff --git a/plugins/webengineurlinterceptor/adblock/autotests/adblockfilterwidgettest.cpp b/plugins/webengineurlinterceptor/adblock/autotests/adblockfilterwidgettest.cpp
index 13287cde4..9827b5cd1 100644
--- a/plugins/webengineurlinterceptor/adblock/autotests/adblockfilterwidgettest.cpp
+++ b/plugins/webengineurlinterceptor/adblock/autotests/adblockfilterwidgettest.cpp
@@ -8,6 +8,7 @@
 #include "adblockfiltertreeview.h"
 #include "adblockfilterwidget.h"
 #include <QLineEdit>
+#include <QStandardPaths>
 #include <QTest>
 #include <QVBoxLayout>
 QTEST_MAIN(AdblockFilterWidgetTest)
@@ -15,6 +16,7 @@ QTEST_MAIN(AdblockFilterWidgetTest)
 AdblockFilterWidgetTest::AdblockFilterWidgetTest(QObject *parent)
     : QObject{parent}
 {
+    QStandardPaths::setTestModeEnabled(true);
 }
 
 void AdblockFilterWidgetTest::shouldHaveDefaultValues()
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.