/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include #include #include #include #include #include using namespace css; CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, TestImpressDefaultStructure) { load(u"private:factory/simpress"_ustr); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(rtl::OUString("" "" "" "Click to add Title" "" "" "" "" "Click to add Text" "" ""), collectText()); } // a basic check of the content order for https://bugs.documentfoundation.org/show_bug.cgi?id=150064 CPPUNIT_TEST_FIXTURE(test::AccessibleTestBase, TestImpressDefaultLayout) { load(u"private:factory/simpress"_ustr); Scheduler::ProcessEventsToIdle(); auto xDocumentContext = getDocumentAccessibleContext(); /* The tree inside the document is a bit awkward, as the page is not the parent of the other * shapes, but well. It looks like this: * document_presentation * shape (page) * shape (title) * paragraph * shape (subtitle) * paragraph */ CPPUNIT_ASSERT_EQUAL(sal_Int64(3), xDocumentContext->getAccessibleChildCount()); CPPUNIT_ASSERT_EQUAL( OUString("PresentationTitle "), xDocumentContext->getAccessibleChild(1)->getAccessibleContext()->getAccessibleName()); CPPUNIT_ASSERT_EQUAL( OUString("PresentationSubtitle "), xDocumentContext->getAccessibleChild(2)->getAccessibleContext()->getAccessibleName()); } // test a11y tree order is stable (https://bugs.documentfoundation.org/show_bug.cgi?id=150064) CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, tdf150064) { loadFromSrc(u"/sd/qa/unit/a11y/data/tdf150064.fodp"_ustr); Scheduler::ProcessEventsToIdle(); uno::Reference xDrawPagesSupplier(mxDocument, uno::UNO_QUERY_THROW); uno::Reference xModel(mxDocument, uno::UNO_QUERY_THROW); uno::Reference xDrawView(xModel->getCurrentController(), uno::UNO_QUERY_THROW); auto xDrawPages = xDrawPagesSupplier->getDrawPages(); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDrawPages->getCount()); // Loop a couple times to make sure output is stable when loading and when switching pages for (int i = 0; i < 2; i++) { uno::Reference xDrawPage; CPPUNIT_ASSERT(xDrawPages->getByIndex(0) >>= xDrawPage); xDrawView->setCurrentPage(xDrawPage); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL( rtl::OUString("" "" "P1 title" "" "" "Some text" "" "" "" "1" "" "" "2" "" "" "3" "" "" "4" "" "" "5" "" "" "6" "" "" "7" "" "" "8" "" "" "9" "" "" "10" "" "
"), collectText()); CPPUNIT_ASSERT(xDrawPages->getByIndex(1) >>= xDrawPage); xDrawView->setCurrentPage(xDrawPage); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL( rtl::OUString("" "" "P2 title" "" "" "1" "" "" "2" "" "" "3" ""), collectText()); } } CPPUNIT_PLUGIN_IMPLEMENT();