auto xLOContext = xLOAccessible->getAccessibleContext();
/* role: we translate to ATSPI role, because the value was created by LO already and converted *toATK,whichinturnconvertsittoATSPI.However,ATKandATSPIareroughlyequivalent *(ATKbasicallyfollowsATSPI),butLO'sinternalmighthavemorecomplexmappingsthatcan't
* be represented with a round trip. */ const AtspiRole nLORole
= mapToAtspiRole(xLOContext->getAccessibleRole(), xLOContext->getAccessibleStateSet()); constauto nAtspiRole = pAtspiAccessible.getRole();
CPPUNIT_ASSERT_EQUAL(nLORole, nAtspiRole); /* name (no need to worry about debugging suffixes as AccessibilityTools::nameEquals does, as
* that will also be part of the name sent to ATSPI) */
CPPUNIT_ASSERT_EQUAL(xLOContext->getAccessibleName(),
OUString::fromUtf8(pAtspiAccessible.getName())); // description
CPPUNIT_ASSERT_EQUAL(xLOContext->getAccessibleDescription(),
OUString::fromUtf8(pAtspiAccessible.getDescription()));
// parent relationship (this is conditional as the ATSPI tree has additional parents, as well as // because we don't want to recurse up the tree) if (recurseFlags & RecurseFlags::PARENT)
{ // index in parent
CPPUNIT_ASSERT_EQUAL(xLOContext->getAccessibleIndexInParent(),
sal_Int64(pAtspiAccessible.getIndexInParent()));
// parent (well, that's making things a lot more expensive...)
compareObjects(xLOContext->getAccessibleParent(), pAtspiAccessible.getParent(),
RecurseFlags::NONE);
}
// ignore a state that does not map to Atspi if (atspiState == ATSPI_STATE_LAST_DEFINED) continue;
/* FIXME: The ATK implementation in LO adds FOCUSED if the obj == atk_get_focus_object() *(seeatkwrapper.cxx::wrapper_ref_state_set()),butthereseemtobesomebug(ordelay? *asit'sdoneinidle)inthetracking,sowecanendupwithextraFOCUSEDstatesonthe
* Atspi side. To work around that, we skip the case where it's not set on LO's side */ if (atspiState == ATSPI_STATE_FOCUSED && !(loStateSet & loState)) continue;
auto xLOContext = xLOAccessible->getAccessibleContext();
CPPUNIT_ASSERT(xLOContext);
constauto nLOChildCount = xLOContext->getAccessibleChildCount(); constauto nAtspiChildCount = decltype(nLOChildCount){ xAtspiAccessible.getChildCount() }; /* We use >= instead of == because GTK exposes scrollbar objects LO doesn't. We possibly *shouldcheckbetterthanmerelyacceptmorechildren,butit'sprobablyOKifthereare
* *more* children as viewed by ATSPI, rather than less. And we're comparing them anyway. */
CPPUNIT_ASSERT_GREATEREQUAL(nLOChildCount, nAtspiChildCount);
/* We need to scrolling test here, because they might modify the tree and invalidate children,
* so we can't do it from the children themselves as they might get disposed during the test */ if (nLOChildCount > 0
&& accessibility::AccessibleRole::DOCUMENT_TEXT == xLOContext->getAccessibleRole())
{
testSwScroll(xLOContext, xAtspiAccessible);
}
}
// gets the nth child of @p pAcc and check its role is @p role static Atspi::Accessible getDescendentAtPath(const Atspi::Accessible& xAcc, int nthChild,
AtspiRole role)
{
CPPUNIT_ASSERT(xAcc);
CPPUNIT_ASSERT_GREATER(nthChild, xAcc.getChildCount()); auto xChild = xAcc.getChildAtIndex(nthChild);
CPPUNIT_ASSERT(xChild);
CPPUNIT_ASSERT_EQUAL(role, xChild.getRole()); return xChild;
}
// gets the nth child of @p pAcc and check its role is @p role, then gets the nth child of that one, etc. template <typename... Ts> static Atspi::Accessible getDescendentAtPath(const Atspi::Accessible& xAcc, int nthChild,
AtspiRole role, Ts... args)
{ return getDescendentAtPath(getDescendentAtPath(xAcc, nthChild, role), args...);
}
/* FIXME: We zoom out for everything to fit in the view not to have off-screen children *thatthecontrollercodefailstocleanupproperlyinsomesituations. *OncetherootissueisfixedinLO,removethis. *Notethatzoomingoutlikeso,andnothavingoff-screenchildren,rendersthe
* Atspi2TestTree::testSwScroll() test useless as it has nothing to scroll into view. */
unotest::MacrosTest::dispatchCommand(mxDocument, ".uno:ZoomPage", {});
unotest::MacrosTest::dispatchCommand(
mxDocument, ".uno:ViewLayout",
{
comphelper::makePropertyValue("ViewLayout.Columns", sal_Int16(2)),
comphelper::makePropertyValue("ViewLayout.BookMode", false),
}); /* HACK: verify the whole content of the document is actually visible (nothing overflows)
* after zooming out above */ constauto xLODocContext = getDocumentAccessibleContext(); constauto xLODocFirstChild = xLODocContext->getAccessibleChild(0);
CPPUNIT_ASSERT(xLODocFirstChild.is());
CPPUNIT_ASSERT(
!getFirstRelationTargetOfType(xLODocFirstChild->getAccessibleContext(),
accessibility::AccessibleRelationType_CONTENT_FLOWS_FROM)); constauto nLODocChildCount = xLODocContext->getAccessibleChildCount(); constauto xLODocLastChild = xLODocContext->getAccessibleChild(nLODocChildCount - 1);
CPPUNIT_ASSERT(xLODocLastChild.is());
CPPUNIT_ASSERT(
!getFirstRelationTargetOfType(xLODocLastChild->getAccessibleContext(),
accessibility::AccessibleRelationType_CONTENT_FLOWS_TO)); // END HACK
auto xContext = getWindowAccessibleContext();
CPPUNIT_ASSERT(xContext.is());
//~ dumpA11YTree(xContext);
// get the window manager frame auto xAtspiWindow = getDescendentAtPath(m_pAtspiApp, 0, ATSPI_ROLE_FRAME);
CPPUNIT_ASSERT(xAtspiWindow);
dumpAtspiTree(xAtspiWindow);
/* The ATSPI representation has extra nodes around the relevant ones, which look like leftovers *fromthestartcenter.Ignorethoseanddivedirectlytothemeaningfulnode(whichisthe
* 1st child of the 2nd child of the 1st child -- ask me how I know) */ auto xAtspiPane = getDescendentAtPath(xAtspiWindow, 0, ATSPI_ROLE_PANEL, 1, ATSPI_ROLE_PANEL, 0,
ATSPI_ROLE_ROOT_PANE);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.