/* -*- 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 using namespace css; CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, TestBasicStructure) { loadFromSrc(u"/sw/qa/python/testdocuments/xtextcontent.odt"_ustr); auto xContext = getDocumentAccessibleContext(); CPPUNIT_ASSERT(xContext.is()); dumpA11YTree(xContext); CPPUNIT_ASSERT_EQUAL( u"String1" "" "" "String2" "" "
" "" "Frame1" "Frame2"_ustr, collectText(xContext)); } CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, TestTypeSimple) { load(u"private:factory/swriter"_ustr); auto xContext = getDocumentAccessibleContext(); CPPUNIT_ASSERT(xContext.is()); documentPostKeyEvent(LOK_KEYEVENT_KEYINPUT, 'h', 0); documentPostKeyEvent(LOK_KEYEVENT_KEYINPUT, 'e', 0); documentPostKeyEvent(LOK_KEYEVENT_KEYINPUT, 'l', 0); documentPostKeyEvent(LOK_KEYEVENT_KEYINPUT, 'l', 0); documentPostKeyEvent(LOK_KEYEVENT_KEYINPUT, 'o', 0); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(u"hello"_ustr, collectText(xContext)); } CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, TestTypeMultiPara) { load(u"private:factory/swriter"_ustr); auto xContext = getDocumentAccessibleContext(); CPPUNIT_ASSERT(xContext.is()); documentPostKeyEvent(LOK_KEYEVENT_KEYINPUT, 'A', 0); documentPostKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN); documentPostKeyEvent(LOK_KEYEVENT_KEYINPUT, 'B', 0); documentPostKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN); documentPostKeyEvent(LOK_KEYEVENT_KEYINPUT, 'C', 0); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL( u"ABC"_ustr, collectText(xContext)); } CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, TestMenuInsertPageNumber) { load(u"private:factory/swriter"_ustr); CPPUNIT_ASSERT(activateMenuItem(u"Insert", u"Field", u"Page Number")); CPPUNIT_ASSERT_EQUAL(u"1"_ustr, collectText()); } CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, TestMenuInsertPageBreak) { load(u"private:factory/swriter"_ustr); CPPUNIT_ASSERT(activateMenuItem(u"Insert", u"Field", u"Page Number")); CPPUNIT_ASSERT(activateMenuItem(u"Insert", u"Page Break")); // we need to move focus to the paragraph after the page break to insert the page number there documentPostKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::DOWN); CPPUNIT_ASSERT(activateMenuItem(u"Insert", u"Field", u"Page Number")); CPPUNIT_ASSERT_EQUAL(u"12"_ustr, collectText()); } CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ value='distro/collabora/cp-5.0'>distro/collabora/cp-5.0 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2022-10-12tdf#151071 Revise Sifr (Update color to follow symbolic Adwaita)Rizal Muttaqin