summaryrefslogtreecommitdiff
path: root/toolkit/qa
diff options
context:
space:
mode:
authorColomban Wendling <cwendling@hypra.fr>2023-02-14 11:45:29 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2023-02-22 16:53:41 +0000
commitc75e975a20258650baa6c906ac8cc1bc4e8f6244 (patch)
tree44f30a2d466fc7c4c362c8f6af065510cc0f08d1 /toolkit/qa
parent27a454359a0d57de872bc110d6e88d5e51f26202 (diff)
toolkit: Port AccessibleStatusBarTest to test::AccessibleTestBase
Now we have test::AccessibleTestBase we can use it instead of performing some setup operations manually. The only actual change is that we don't pass OpenFlags=S when creating an Impress document, but it never seemed useful (it was only ported from Java out of zeal), and I can't even find what the S option is for. In all cases, this doesn't affect the tests themselves. Change-Id: Ic8d56dd9bc3ec957891868b23bb241ba3bf33049 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147003 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'toolkit/qa')
-rw-r--r--toolkit/qa/cppunit/a11y/AccessibleStatusBarTest.cxx67
1 files changed, 11 insertions, 56 deletions
diff --git a/toolkit/qa/cppunit/a11y/AccessibleStatusBarTest.cxx b/toolkit/qa/cppunit/a11y/AccessibleStatusBarTest.cxx
index 20d8b42f8c0c..5bf522fb2e2e 100644
--- a/toolkit/qa/cppunit/a11y/AccessibleStatusBarTest.cxx
+++ b/toolkit/qa/cppunit/a11y/AccessibleStatusBarTest.cxx
@@ -24,18 +24,13 @@
#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
#include <com/sun/star/awt/XWindow.hpp>
-#include <com/sun/star/awt/XTopWindow.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <comphelper/sequence.hxx>
#include <rtl/ustrbuf.hxx>
-#include <test/bootstrapfixture.hxx>
+#include <test/a11y/accessibletestbase.hxx>
#include <vcl/scheduler.hxx>
#include <test/a11y/AccessibilityTools.hxx>
@@ -48,15 +43,12 @@ using namespace css;
namespace
{
-class AccessibleStatusBarTest : public test::BootstrapFixture
+class AccessibleStatusBarTest : public test::AccessibleTestBase
{
private:
- uno::Reference<frame::XDesktop2> mxDesktop;
-
uno::Reference<accessibility::XAccessibleContext>
getTestObject(const uno::Reference<awt::XWindow>& xWindow);
- void runAllTests(const uno::Reference<awt::XWindow>& xWindow);
- uno::Reference<lang::XComponent> openDocument(std::string_view sKind);
+ void runAllTests();
void testDocument(std::string_view sKind);
void testWriterDoc() { testDocument("swriter"); }
@@ -66,8 +58,6 @@ private:
void testCalcDoc() { testDocument("scalc"); }
public:
- virtual void setUp() override;
-
CPPUNIT_TEST_SUITE(AccessibleStatusBarTest);
CPPUNIT_TEST(testWriterDoc);
CPPUNIT_TEST(testMathDoc);
@@ -77,13 +67,6 @@ public:
CPPUNIT_TEST_SUITE_END();
};
-void AccessibleStatusBarTest::setUp()
-{
- test::BootstrapFixture::setUp();
-
- mxDesktop = frame::Desktop::create(mxComponentContext);
-}
-
uno::Reference<accessibility::XAccessibleContext>
AccessibleStatusBarTest::getTestObject(const uno::Reference<awt::XWindow>& xWindow)
{
@@ -108,9 +91,9 @@ AccessibleStatusBarTest::getTestObject(const uno::Reference<awt::XWindow>& xWind
return xContext;
}
-void AccessibleStatusBarTest::runAllTests(const uno::Reference<awt::XWindow>& xWindow)
+void AccessibleStatusBarTest::runAllTests()
{
- auto xContext = getTestObject(xWindow);
+ auto xContext = getTestObject(mxWindow);
uno::Reference<accessibility::XAccessibleComponent> xAccessibleComponent(xContext,
uno::UNO_QUERY_THROW);
@@ -127,53 +110,25 @@ void AccessibleStatusBarTest::runAllTests(const uno::Reference<awt::XWindow>& xW
uno::Reference<accessibility::XAccessibleEventBroadcaster> xAccessibleEventBroadcaster(
xContext, uno::UNO_QUERY_THROW);
- XAccessibleEventBroadcasterTester eventBroadcasterTester(xAccessibleEventBroadcaster, xWindow);
+ XAccessibleEventBroadcasterTester eventBroadcasterTester(xAccessibleEventBroadcaster, mxWindow);
eventBroadcasterTester.testAll();
}
-uno::Reference<lang::XComponent> AccessibleStatusBarTest::openDocument(std::string_view sKind)
+void AccessibleStatusBarTest::testDocument(std::string_view sKind)
{
- /* not sure what's that about, but from SOfficeFactory.java:openDoc() */
- // that noargs thing for load attributes
- std::vector<beans::PropertyValue> aArgs;
- if (sKind == "simpress")
- {
- beans::PropertyValue aValue;
- aValue.Name = "OpenFlags";
- aValue.Handle = -1;
- aValue.Value <<= OUString("S");
- aValue.State = beans::PropertyState_DIRECT_VALUE;
- aArgs.push_back(aValue);
- }
-
rtl::OUStringBuffer sURL("private:factory/");
sURL.appendAscii(sKind.data(), sKind.length());
- return mxDesktop->loadComponentFromURL(sURL.makeStringAndClear(), "_blank", 40,
- comphelper::containerToSequence(aArgs));
-}
+ load(sURL.makeStringAndClear());
-void AccessibleStatusBarTest::testDocument(std::string_view sKind)
-{
- auto xDoc = openDocument(sKind);
- std::cout << "got document: " << xDoc << std::endl;
- CPPUNIT_ASSERT(xDoc.is());
- uno::Reference<frame::XModel> xModel(xDoc, uno::UNO_QUERY_THROW);
- std::cout << "got model: " << xModel << std::endl;
- uno::Reference<awt::XWindow> xWindow(
- xModel->getCurrentController()->getFrame()->getContainerWindow());
- std::cout << "got window: " << xWindow << std::endl;
- uno::Reference<awt::XTopWindow> xTopWindow(xWindow, uno::UNO_QUERY_THROW);
- std::cout << "got top window: " << xTopWindow << std::endl;
- xTopWindow->toFront();
+ std::cout << "got document: " << mxDocument << std::endl;
Scheduler::ProcessEventsToIdle();
- runAllTests(xWindow);
+ runAllTests();
// close document
- uno::Reference<css::util::XCloseable> xCloseable(xDoc, uno::UNO_QUERY_THROW);
- xCloseable->close(false);
+ close();
}
CPPUNIT_TEST_SUITE_REGISTRATION(AccessibleStatusBarTest);