include/test/a11y/XAccessibleEventBroadcasterTester.hxx | 6 ++--- test/source/a11y/XAccessibleEventBroadcasterTester.cxx | 19 ++++++++-------- toolkit/qa/cppunit/a11y/AccessibleStatusBarTest.cxx | 4 ++- vcl/qa/cppunit/a11y/widgetaccessibilitytest.cxx | 7 +++++ 4 files changed, 23 insertions(+), 13 deletions(-)
New commits: commit 5f250b05c4b22c7206db25b4f9d926ed8767dbe2 Author: Michael Weghorn <[email protected]> AuthorDate: Wed Jun 4 15:06:00 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Thu Jun 5 07:29:08 2025 +0200 vcl a11y tests: Also test XAccessibleEventBroadcaster This was originally skipped in commit 132f22d9f6d58b4e3541ef3e8efe8ef7e3136a23 Author: Michael Weghorn <[email protected]> Date: Sat Mar 15 20:23:02 2025 -0700 tdf#157003 a11y: Replace AccessibleDropDownListBox Java with C++ test Quoting from the commit message: > The XAccessibleEventBroadcaster interface is no more > explicitly tested, since the XAccessibleEventBroadcasterTester > would require an XWindow again. However, an XWindow is no longer required since Change-Id: Iee77f293338f269a2ad7c631384d5e3797b06152 Author: Michael Weghorn <[email protected]> Date: Wed Jun 4 14:54:53 2025 +0200 a11y tests: Use vcl::Window in XAccessibleEventBroadcasterTester , so add that test now. To run the test: make CppunitTest_vcl_a11y Change-Id: Id54dfcf249ad35bf63c0ab54492291fda60523b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186201 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/vcl/qa/cppunit/a11y/widgetaccessibilitytest.cxx b/vcl/qa/cppunit/a11y/widgetaccessibilitytest.cxx index 41fcf5b46f25..63ddd0da35c7 100644 --- a/vcl/qa/cppunit/a11y/widgetaccessibilitytest.cxx +++ b/vcl/qa/cppunit/a11y/widgetaccessibilitytest.cxx @@ -20,6 +20,7 @@ #define VCL_INTERNALS #include <com/sun/star/accessibility/XAccessibleAction.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> #include <com/sun/star/accessibility/XAccessibleComponent.hpp> #include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp> #include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp> @@ -28,6 +29,7 @@ #include <test/a11y/XAccessibleActionTester.hxx> #include <test/a11y/XAccessibleComponentTester.hxx> #include <test/a11y/XAccessibleContextTester.hxx> +#include <test/a11y/XAccessibleEventBroadcasterTester.hxx> #include <test/a11y/XAccessibleExtendedComponentTester.hxx> #include <vcl/toolkit/dialog.hxx> #include <vcl/toolkit/lstbox.hxx> @@ -74,6 +76,11 @@ CPPUNIT_TEST_FIXTURE(test::AccessibleTestBase, AccessibleDropDownListBox) xAccessibleAction->getAccessibleActionCount() > 0); XAccessibleActionTester aActionTester(xAccessibleAction); aActionTester.testAll(); + + css::uno::Reference<css::accessibility::XAccessibleEventBroadcaster> xEventBroadcaster( + xContext, css::uno::UNO_QUERY_THROW); + XAccessibleEventBroadcasterTester aEventBroadcasterTester(xEventBroadcaster, pListBox); + aEventBroadcasterTester.testAll(); } CPPUNIT_PLUGIN_IMPLEMENT(); commit f52b63ca5f9ee828af52e9e917ebe870bef17170 Author: Michael Weghorn <[email protected]> AuthorDate: Wed Jun 4 14:54:53 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Thu Jun 5 07:29:01 2025 +0200 a11y tests: Use vcl::Window in XAccessibleEventBroadcasterTester ... instead of the toolkit counterpart, XWindow. This allows to use this also for vcl::Window based tests, without having to involve the UNO abstraction. Adjust AccessibleStatusBarTest accordingly to pass the vcl::Window associated with the XWindow. To run the test: make CppunitTest_toolkit_a11y Change-Id: Iee77f293338f269a2ad7c631384d5e3797b06152 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186200 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/include/test/a11y/XAccessibleEventBroadcasterTester.hxx b/include/test/a11y/XAccessibleEventBroadcasterTester.hxx index 2680f9a22e2c..c2ee1c97c3f8 100644 --- a/include/test/a11y/XAccessibleEventBroadcasterTester.hxx +++ b/include/test/a11y/XAccessibleEventBroadcasterTester.hxx @@ -24,13 +24,13 @@ #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/accessibility/XAccessibleContext.hpp> #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> -#include <com/sun/star/awt/XWindow.hpp> +#include <vcl/window.hxx> class OOO_DLLPUBLIC_TEST XAccessibleEventBroadcasterTester { private: const css::uno::Reference<css::accessibility::XAccessibleEventBroadcaster> mxBroadcaster; - const css::uno::Reference<css::awt::XWindow> mxWindow; + const VclPtr<vcl::Window> mpWindow; static bool isTransient( const css::uno::Reference<css::accessibility::XAccessibleEventBroadcaster>& xBroadcaster); @@ -42,7 +42,7 @@ private: public: XAccessibleEventBroadcasterTester( const css::uno::Reference<css::accessibility::XAccessibleEventBroadcaster>& xBroadcaster, - const css::uno::Reference<css::awt::XWindow>& xWindow); + vcl::Window* pWindow); void testAddEventListener(); void testRemoveEventListener(); diff --git a/test/source/a11y/XAccessibleEventBroadcasterTester.cxx b/test/source/a11y/XAccessibleEventBroadcasterTester.cxx index 7c4ff56127b3..2464550e73e6 100644 --- a/test/source/a11y/XAccessibleEventBroadcasterTester.cxx +++ b/test/source/a11y/XAccessibleEventBroadcasterTester.cxx @@ -75,9 +75,9 @@ public: XAccessibleEventBroadcasterTester::XAccessibleEventBroadcasterTester( const uno::Reference<accessibility::XAccessibleEventBroadcaster>& xBroadcaster, - const uno::Reference<awt::XWindow>& xWindow) + vcl::Window* pWindow) : mxBroadcaster(xBroadcaster) - , mxWindow(xWindow) + , mpWindow(pWindow) { } @@ -105,13 +105,14 @@ bool XAccessibleEventBroadcasterTester::isTransient( */ void XAccessibleEventBroadcasterTester::fireEvent() { - awt::Rectangle newPosSize = mxWindow->getPosSize(); - newPosSize.Width = newPosSize.Width - 20; - newPosSize.Height = newPosSize.Height - 20; - newPosSize.X = newPosSize.X + 20; - newPosSize.Y = newPosSize.Y + 20; - mxWindow->setPosSize(newPosSize.X, newPosSize.Y, newPosSize.Width, newPosSize.Height, - awt::PosSize::POSSIZE); + Point aPos = mpWindow->GetPosPixel(); + aPos.Move(20, 20); + + Size aSize = mpWindow->GetSizePixel(); + aSize.AdjustWidth(-20); + aSize.AdjustHeight(-20); + + mpWindow->SetPosSizePixel(aPos, aSize); } /** diff --git a/toolkit/qa/cppunit/a11y/AccessibleStatusBarTest.cxx b/toolkit/qa/cppunit/a11y/AccessibleStatusBarTest.cxx index f01798c46097..4309c3bdb1e8 100644 --- a/toolkit/qa/cppunit/a11y/AccessibleStatusBarTest.cxx +++ b/toolkit/qa/cppunit/a11y/AccessibleStatusBarTest.cxx @@ -31,6 +31,7 @@ #include <rtl/ustrbuf.hxx> #include <test/a11y/accessibletestbase.hxx> +#include <toolkit/helper/vclunohelper.hxx> #include <vcl/scheduler.hxx> #include <test/a11y/AccessibilityTools.hxx> @@ -108,7 +109,8 @@ void AccessibleStatusBarTest::runAllTests() uno::Reference<accessibility::XAccessibleEventBroadcaster> xAccessibleEventBroadcaster( xContext, uno::UNO_QUERY_THROW); - XAccessibleEventBroadcasterTester eventBroadcasterTester(xAccessibleEventBroadcaster, mxWindow); + XAccessibleEventBroadcasterTester eventBroadcasterTester(xAccessibleEventBroadcaster, + VCLUnoHelper::GetWindow(mxWindow)); eventBroadcasterTester.testAll(); }
