From 5ec7c4eecf955090cc3bdd7a283aa5a291d12385 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 27 Mar 2024 21:56:50 +0200 Subject: fix comparison of UIObject's inside UITests using == to compare them doesnt work, because we return a new one with every call to getTopFocusWindow and similar. So add a equals() method to the UNO interface to do the comparison. Change-Id: Ie909fe9b4e84fe07f4ca87bbebf65b56d3da8f78 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165436 Tested-by: Jenkins Reviewed-by: Noel Grandin --- chart2/source/controller/inc/uiobject.hxx | 2 ++ chart2/source/controller/uitest/uiobject.cxx | 8 ++++++++ 2 files changed, 10 insertions(+) (limited to 'chart2/source') diff --git a/chart2/source/controller/inc/uiobject.hxx b/chart2/source/controller/inc/uiobject.hxx index 917ba322bf5e..6de63f5d3fdf 100644 --- a/chart2/source/controller/inc/uiobject.hxx +++ b/chart2/source/controller/inc/uiobject.hxx @@ -32,6 +32,8 @@ public: virtual OUString get_type() const override; + virtual bool equals(const UIObject& rOther) const override; + private: OUString maCID; diff --git a/chart2/source/controller/uitest/uiobject.cxx b/chart2/source/controller/uitest/uiobject.cxx index 783a91982f84..c75f15c3885c 100644 --- a/chart2/source/controller/uitest/uiobject.cxx +++ b/chart2/source/controller/uitest/uiobject.cxx @@ -95,6 +95,14 @@ OUString ChartUIObject::get_type() const return "ChartUIObject for type: "; } +bool ChartUIObject::equals(const UIObject& rOther) const +{ + const ChartUIObject* pOther = dynamic_cast(&rOther); + if (!pOther) + return false; + return mxChartWindow.get() == pOther->mxChartWindow.get(); +} + ChartWindowUIObject::ChartWindowUIObject(const VclPtr& xChartWindow): WindowUIObject(xChartWindow), mxChartWindow(xChartWindow) -- cgit v1.2.3