android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / qa / extras / accessibility / basics.cxx
blob8a42ae8ce6bc9640de68c49746f0ec6c947af26b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <com/sun/star/awt/Key.hpp>
11 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
12 #include <vcl/scheduler.hxx>
14 #include <test/a11y/swaccessibletestbase.hxx>
15 #include <test/a11y/AccessibilityTools.hxx>
17 using namespace css;
19 CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, TestBasicStructure)
21 loadFromSrc(u"/sw/qa/python/testdocuments/xtextcontent.odt");
22 auto xContext = getDocumentAccessibleContext();
23 CPPUNIT_ASSERT(xContext.is());
25 dumpA11YTree(xContext);
26 CPPUNIT_ASSERT_EQUAL(
27 rtl::OUString("<PARAGRAPH>String1</PARAGRAPH><PARAGRAPH/><PARAGRAPH/><PARAGRAPH/>"
28 "<TABLE name=\"Table1-1\" description=\"Table1 on page 1\">"
29 "<TABLE_CELL name=\"A1\" description=\"A1\">"
30 "<PARAGRAPH>String2</PARAGRAPH>"
31 "</TABLE_CELL>"
32 "</TABLE>"
33 "<PARAGRAPH/>"
34 "<TEXT_FRAME name=\"Frame1\"><PARAGRAPH>Frame1</PARAGRAPH></TEXT_FRAME>"
35 "<TEXT_FRAME name=\"Frame2\"><PARAGRAPH>Frame2</PARAGRAPH></TEXT_FRAME>"),
36 collectText(xContext));
39 CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, TestTypeSimple)
41 load(u"private:factory/swriter");
42 auto xContext = getDocumentAccessibleContext();
43 CPPUNIT_ASSERT(xContext.is());
45 documentPostKeyEvent(LOK_KEYEVENT_KEYINPUT, 'h', 0);
46 documentPostKeyEvent(LOK_KEYEVENT_KEYINPUT, 'e', 0);
47 documentPostKeyEvent(LOK_KEYEVENT_KEYINPUT, 'l', 0);
48 documentPostKeyEvent(LOK_KEYEVENT_KEYINPUT, 'l', 0);
49 documentPostKeyEvent(LOK_KEYEVENT_KEYINPUT, 'o', 0);
50 Scheduler::ProcessEventsToIdle();
52 CPPUNIT_ASSERT_EQUAL(rtl::OUString("<PARAGRAPH>hello</PARAGRAPH>"), collectText(xContext));
55 CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, TestTypeMultiPara)
57 load(u"private:factory/swriter");
58 auto xContext = getDocumentAccessibleContext();
59 CPPUNIT_ASSERT(xContext.is());
61 documentPostKeyEvent(LOK_KEYEVENT_KEYINPUT, 'A', 0);
62 documentPostKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN);
63 documentPostKeyEvent(LOK_KEYEVENT_KEYINPUT, 'B', 0);
64 documentPostKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN);
65 documentPostKeyEvent(LOK_KEYEVENT_KEYINPUT, 'C', 0);
66 Scheduler::ProcessEventsToIdle();
68 CPPUNIT_ASSERT_EQUAL(
69 rtl::OUString("<PARAGRAPH>A</PARAGRAPH><PARAGRAPH>B</PARAGRAPH><PARAGRAPH>C</PARAGRAPH>"),
70 collectText(xContext));
73 CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, TestMenuInsertPageNumber)
75 load(u"private:factory/swriter");
76 CPPUNIT_ASSERT(activateMenuItem(u"Insert", u"Field", u"Page Number"));
77 CPPUNIT_ASSERT_EQUAL(rtl::OUString("<PARAGRAPH>1</PARAGRAPH>"), collectText());
80 CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, TestMenuInsertPageBreak)
82 load(u"private:factory/swriter");
84 CPPUNIT_ASSERT(activateMenuItem(u"Insert", u"Field", u"Page Number"));
85 CPPUNIT_ASSERT(activateMenuItem(u"Insert", u"Page Break"));
86 // we need to move focus to the paragraph after the page break to insert the page number there
87 documentPostKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::DOWN);
88 CPPUNIT_ASSERT(activateMenuItem(u"Insert", u"Field", u"Page Number"));
90 CPPUNIT_ASSERT_EQUAL(rtl::OUString("<PARAGRAPH>1</PARAGRAPH><PARAGRAPH>2</PARAGRAPH>"),
91 collectText());
94 CPPUNIT_PLUGIN_IMPLEMENT();
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */