diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-08-18 11:07:07 +0100 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-08-18 19:22:53 +0200 |
commit | 5296b0ffe3ce031cab29d64d62e1bdc3fb2595fe (patch) | |
tree | fc18edc8c8a5557c21232718fec4acda3da72a10 /cui | |
parent | 987fe1175de2db53235cc6f2441335fcc3548d64 (diff) |
don't access network during a UITest
Change-Id: If6cc3da3e75ad7689a0de35784c2d29d5b01b96e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155833
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/dialogs/AdditionsDialog.cxx | 10 | ||||
-rw-r--r-- | cui/source/inc/AdditionsDialog.hxx | 1 |
2 files changed, 9 insertions, 2 deletions
diff --git a/cui/source/dialogs/AdditionsDialog.cxx b/cui/source/dialogs/AdditionsDialog.cxx index 73b16ed06e90..f0dedf626acf 100644 --- a/cui/source/dialogs/AdditionsDialog.cxx +++ b/cui/source/dialogs/AdditionsDialog.cxx @@ -275,6 +275,11 @@ SearchAndParseThread::SearchAndParseThread(AdditionsDialog* pDialog, const bool , m_bExecute(true) , m_bIsFirstLoading(isFirstLoading) { + // if we are running a UITest, e.g. UITest_sw_options then + // don't attempt to downloading anything + static const bool bUITest = getenv("LIBO_TEST_UNIT"); + + m_bUITest = bUITest; } SearchAndParseThread::~SearchAndParseThread() {} @@ -284,7 +289,8 @@ void SearchAndParseThread::Append(AdditionInfo& additionInfo) if (!m_bExecute) return; OUString aPreviewFile; - bool bResult = getPreviewFile(additionInfo, aPreviewFile); // info vector json data + bool bResult + = !m_bUITest && getPreviewFile(additionInfo, aPreviewFile); // info vector json data if (!bResult) { @@ -398,7 +404,7 @@ void SearchAndParseThread::execute() if (m_bIsFirstLoading) { - std::string sResponse = ucbGet(m_pAdditionsDialog->m_sURL); + std::string sResponse = !m_bUITest ? ucbGet(m_pAdditionsDialog->m_sURL) : ""; parseResponse(sResponse, m_pAdditionsDialog->m_aAllExtensionsVector); std::sort(m_pAdditionsDialog->m_aAllExtensionsVector.begin(), m_pAdditionsDialog->m_aAllExtensionsVector.end(), diff --git a/cui/source/inc/AdditionsDialog.hxx b/cui/source/inc/AdditionsDialog.hxx index 302d11bbc6ea..559a4ca911ff 100644 --- a/cui/source/inc/AdditionsDialog.hxx +++ b/cui/source/inc/AdditionsDialog.hxx @@ -138,6 +138,7 @@ private: AdditionsDialog* m_pAdditionsDialog; std::atomic<bool> m_bExecute; bool m_bIsFirstLoading; + bool m_bUITest; void Search(); void Append(AdditionInfo& additionInfo); |