diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-07-16 13:40:03 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-07-16 16:03:08 +0200 |
commit | 828b26bdc22743974655d64dada69e154159435a (patch) | |
tree | fe28de9425779c617bc50133c21d53d087293ac8 /vcl | |
parent | efae4fc42d5fe3c0a69757226f38efc10d101194 (diff) |
use generic clipboard when running UI tests
rather than the system clipboard, which makes no sense, since then the
tests interfere with each other
Change-Id: I911e88f5547dfc4f3558b9ed3ef670cef4903420
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170574
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/salinst.hxx | 2 | ||||
-rw-r--r-- | vcl/osx/service_entry.cxx | 2 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 7 | ||||
-rw-r--r-- | vcl/source/components/dtranscomp.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/generic/dtrans/X11_service.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtkinst.cxx | 2 | ||||
-rw-r--r-- | vcl/win/dtrans/WinClipboard.cxx | 2 |
7 files changed, 15 insertions, 6 deletions
diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx index ca6a6920bf76..45c031db30ae 100644 --- a/vcl/inc/salinst.hxx +++ b/vcl/inc/salinst.hxx @@ -214,6 +214,8 @@ public: // Note: we cannot make this a global variable, because it might be initialised BEFORE the putenv() call in cppunittester. static bool IsRunningUnitTest() { return getenv("LO_TESTNAME") != nullptr; } + static bool IsRunningUITest(); + // both must be implemented, if the VCL plugin needs to run via system event loop virtual bool DoExecute(int &nExitCode); virtual void DoQuit(); diff --git a/vcl/osx/service_entry.cxx b/vcl/osx/service_entry.cxx index 849e73a77dcd..a970b6a65917 100644 --- a/vcl/osx/service_entry.cxx +++ b/vcl/osx/service_entry.cxx @@ -38,7 +38,7 @@ using namespace ::com::sun::star::datatransfer::clipboard; uno::Reference< XInterface > AquaSalInstance::CreateClipboard( const Sequence< Any >& i_rArguments ) { - if ( Application::IsHeadlessModeEnabled() || IsRunningUnitTest() ) + if ( Application::IsHeadlessModeEnabled() || IsRunningUnitTest() || IsRunningUITest() ) return SalInstance::CreateClipboard( i_rArguments ); SalData* pSalData = GetSalData(); diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 353f3ecfb285..67ac9f971a63 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -180,6 +180,13 @@ void SalInstance::DoQuit() std::abort(); } +// static +bool SalInstance::IsRunningUITest() +{ + static const bool bRunningUITest = getenv("LIBO_TEST_UNIT"); + return bRunningUITest; +} + SalTimer::~SalTimer() COVERITY_NOEXCEPT_FALSE {} void SalBitmap::DropScaledCache() diff --git a/vcl/source/components/dtranscomp.cxx b/vcl/source/components/dtranscomp.cxx index 49cb61eb37fa..9c052468aaef 100644 --- a/vcl/source/components/dtranscomp.cxx +++ b/vcl/source/components/dtranscomp.cxx @@ -446,7 +446,7 @@ Reference< XInterface > SalInstance::CreateDragSource(const SystemEnvData* pSysE { // We run unit tests in parallel, which is a problem when touching a shared resource // the system clipboard, so rather use the dummy GenericClipboard. - if (Application::IsHeadlessModeEnabled() || IsRunningUnitTest()) + if (Application::IsHeadlessModeEnabled() || IsRunningUnitTest() || IsRunningUITest()) return getXWeak(new vcl::GenericDragSource()); return ImplCreateDragSource(pSysEnv); } @@ -459,7 +459,7 @@ uno::Reference<uno::XInterface> SalInstance::ImplCreateDropTarget(const SystemEn Reference< XInterface > SalInstance::CreateDropTarget(const SystemEnvData* pSysEnv) { // see SalInstance::CreateDragSource - if (Application::IsHeadlessModeEnabled() || IsRunningUnitTest()) + if (Application::IsHeadlessModeEnabled() || IsRunningUnitTest() || IsRunningUITest()) return getXWeak(new vcl::GenericDropTarget()); return ImplCreateDropTarget(pSysEnv); } diff --git a/vcl/unx/generic/dtrans/X11_service.cxx b/vcl/unx/generic/dtrans/X11_service.cxx index 73c0487370c7..19f8b20fda05 100644 --- a/vcl/unx/generic/dtrans/X11_service.cxx +++ b/vcl/unx/generic/dtrans/X11_service.cxx @@ -47,7 +47,7 @@ Sequence< OUString > x11::Xdnd_dropTarget_getSupportedServiceNames() css::uno::Reference< XInterface > X11SalInstance::CreateClipboard( const Sequence< Any >& arguments ) { - if ( IsRunningUnitTest() ) + if ( IsRunningUnitTest() || IsRunningUITest() ) return SalInstance::CreateClipboard( arguments ); SelectionManager& rManager = SelectionManager::get(); diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index aaf69e92d186..698f2dbe1575 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -1578,7 +1578,7 @@ void VclGtkClipboard::removeClipboardListener( const Reference< datatransfer::cl Reference< XInterface > GtkInstance::CreateClipboard(const Sequence< Any >& arguments) { - if ( IsRunningUnitTest() ) + if ( IsRunningUnitTest() || IsRunningUITest() ) return SalInstance::CreateClipboard( arguments ); OUString sel; diff --git a/vcl/win/dtrans/WinClipboard.cxx b/vcl/win/dtrans/WinClipboard.cxx index 8341e446360b..2592d82f6b8b 100644 --- a/vcl/win/dtrans/WinClipboard.cxx +++ b/vcl/win/dtrans/WinClipboard.cxx @@ -336,7 +336,7 @@ dtrans_CWinClipboard_get_implementation(css::uno::XComponentContext* context, { // We run unit tests in parallel, which is a problem when touching a shared resource // like the system clipboard, so rather use the dummy GenericClipboard. - static const bool bRunningUnitTest = getenv("LO_TESTNAME"); + static const bool bRunningUnitTest = getenv("LO_TESTNAME") || getenv("LIBO_TEST_UNIT"); if (bRunningUnitTest) { |