fix sd local unit test failers after adding media foundation api

sd.check fails in CppunitTest_sd_export_tests-ooxml2 because
of not finished async calls before closing the unit test files.

Workaround to not create any media player objects (temporary) for
unit test files.

Co-authored-by: Mike Kaganski <mike.kaganski@collabora.com>

Change-Id: I93c8108a9806f2f6f171e07467afd4e79eae7ee8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189886
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Balazs Varga
2025-08-19 06:32:43 +02:00
committed by Mike Kaganski
co-authored by Mike Kaganski
parent fd48da7236
commit 9639193cc9
+10 -4
View File
@@ -36,6 +36,7 @@
#include "window.hxx"
#include <cppuhelper/supportsservice.hxx>
#include <o3tl/char16_t2wchar_t.hxx>
#include <o3tl/test_info.hxx>
#include <osl/file.hxx>
#include <rtl/ref.hxx>
@@ -405,11 +406,16 @@ HRESULT Player::InitializeWindow(bool bAddSoundWindow)
&g_pPlayer
);
// Create a new media item for this URL.
// The CreateMediaItemFromURL method completes asynchronously. When it does,
// MFPlay sends an MFP_EVENT_TYPE_MEDIAITEM_CREATED event.
// synchronous for unit tests (TODO)
static const BOOL bSync
= o3tl::IsRunningUnitTest() ? TRUE : FALSE;
if (SUCCEEDED(hr))
hr = g_pPlayer->CreateMediaItemFromURL(o3tl::toW(maURL.getStr()), FALSE, 0, nullptr);
{
// Create a new media item for this URL.
// The CreateMediaItemFromURL method completes asynchronously. When it does,
// MFPlay sends an MFP_EVENT_TYPE_MEDIAITEM_CREATED event.
hr = g_pPlayer->CreateMediaItemFromURL(o3tl::toW(maURL.getStr()), bSync, 0, nullptr);
}
if (SUCCEEDED(hr))
m_state = Stopped;