/* -*- 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 #include #include #include using namespace css; /* This test only works if spell checking is available for en_US */ CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, tdf155705) { loadFromSrc(u"/sw/qa/extras/accessibility/testdocuments/tdf155705.fodt"_ustr); /* we need to give it a second to fully set up the XAccessibleTextMarkup, otherwise we get a * dysfunctional one that asserts out on m_pTextFrame */ Scheduler::ProcessEventsToIdle(); uno::Reference xLSM2 = linguistic2::LinguServiceManager::create(m_xContext); uno::Reference xSpell(xLSM2->getSpellChecker(), uno::UNO_QUERY); if (!xSpell.is() || !xSpell->hasLanguage(static_cast(LANGUAGE_ENGLISH_US))) return; auto xContext = getDocumentAccessibleContext(); CPPUNIT_ASSERT(xContext.is()); auto xChildContext = getAllChildren(xContext).back(); uno::Reference xMarkup(xChildContext, uno::UNO_QUERY_THROW); // make sure the idle spellcheck pass runs AccessibilityTools::Await( [&xMarkup]() { return 0 < xMarkup->getTextMarkupCount(text::TextMarkupType::SPELLCHECK); }); CPPUNIT_ASSERT_GREATER(sal_Int32(0), xMarkup->getTextMarkupCount(text::TextMarkupType::SPELLCHECK)); auto aSegment = xMarkup->getTextMarkup(0, text::TextMarkupType::SPELLCHECK); CPPUNIT_ASSERT_GREATEREQUAL(sal_Int32(0), aSegment.SegmentStart); CPPUNIT_ASSERT_GREATER(aSegment.SegmentStart, aSegment.SegmentEnd); } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */