1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
/* -*- 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 <com/sun/star/drawing/XDrawView.hpp>
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <vcl/scheduler.hxx>
#include <test/a11y/accessibletestbase.hxx>
#include <test/a11y/swaccessibletestbase.hxx>
using namespace css;
CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, TestImpressDefaultStructure)
{
load(u"private:factory/simpress"_ustr);
Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT_EQUAL(rtl::OUString("<SHAPE name=\"PageShape: Slide 1\" description=\" \"/>"
"<SHAPE name=\"PresentationTitle \" description=\" \">"
"<PARAGRAPH description=\"Paragraph: 0 Click to add Title\">"
"Click to add Title"
"</PARAGRAPH>"
"</SHAPE>"
"<SHAPE name=\"PresentationSubtitle \" description=\" \">"
"<PARAGRAPH description=\"Paragraph: 0 Click to add Text\">"
"Click to add Text"
"</PARAGRAPH>"
"</SHAPE>"),
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<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxDocument,
uno::UNO_QUERY_THROW);
uno::Reference<frame::XModel> xModel(mxDocument, uno::UNO_QUERY_THROW);
uno::Reference<drawing::XDrawView> 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<drawing::XDrawPage> xDrawPage;
CPPUNIT_ASSERT(xDrawPages->getByIndex(0) >>= xDrawPage);
xDrawView->setCurrentPage(xDrawPage);
Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT_EQUAL(
rtl::OUString("<SHAPE name=\"PageShape: Slide 1\" description=\" \"/>"
"<SHAPE name=\"PresentationTitle \" description=\" \">"
"<PARAGRAPH description=\"Paragraph: 0 P1 title\">P1 title</PARAGRAPH>"
"</SHAPE>"
"<SHAPE name=\"PresentationSubtitle \" description=\" \">"
"<PARAGRAPH description=\"Paragraph: 0 Some text\">Some text</PARAGRAPH>"
"</SHAPE>"
"<TABLE name=\"TableShape \" description=\" \">"
"<TABLE_CELL name=\"A1\">"
"<PARAGRAPH description=\"Paragraph: 0 1\">1</PARAGRAPH>"
"</TABLE_CELL>"
"<TABLE_CELL name=\"B1\">"
"<PARAGRAPH description=\"Paragraph: 0 2\">2</PARAGRAPH>"
"</TABLE_CELL>"
"<TABLE_CELL name=\"C1\">"
"<PARAGRAPH description=\"Paragraph: 0 3\">3</PARAGRAPH>"
"</TABLE_CELL>"
"<TABLE_CELL name=\"D1\">"
"<PARAGRAPH description=\"Paragraph: 0 4\">4</PARAGRAPH>"
"</TABLE_CELL>"
"<TABLE_CELL name=\"E1\">"
"<PARAGRAPH description=\"Paragraph: 0 5\">5</PARAGRAPH>"
"</TABLE_CELL>"
"<TABLE_CELL name=\"A2\">"
"<PARAGRAPH description=\"Paragraph: 0 6\">6</PARAGRAPH>"
"</TABLE_CELL>"
"<TABLE_CELL name=\"B2\">"
"<PARAGRAPH description=\"Paragraph: 0 7\">7</PARAGRAPH>"
"</TABLE_CELL>"
"<TABLE_CELL name=\"C2\">"
"<PARAGRAPH description=\"Paragraph: 0 8\">8</PARAGRAPH>"
"</TABLE_CELL>"
"<TABLE_CELL name=\"D2\">"
"<PARAGRAPH description=\"Paragraph: 0 9\">9</PARAGRAPH>"
"</TABLE_CELL>"
"<TABLE_CELL name=\"E2\">"
"<PARAGRAPH description=\"Paragraph: 0 10\">10</PARAGRAPH>"
"</TABLE_CELL>"
"</TABLE>"),
collectText());
CPPUNIT_ASSERT(xDrawPages->getByIndex(1) >>= xDrawPage);
xDrawView->setCurrentPage(xDrawPage);
Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT_EQUAL(
rtl::OUString("<SHAPE name=\"PageShape: Slide 2\" description=\" \"/>"
"<SHAPE name=\"PresentationTitle \" description=\" \">"
"<PARAGRAPH description=\"Paragraph: 0 P2 title\">P2 title</PARAGRAPH>"
"</SHAPE>"
"<SHAPE name=\"PresentationOutliner \" description=\" \">"
"<PARAGRAPH description=\"Paragraph: 0 1\">1</PARAGRAPH>"
"</SHAPE>"
"<SHAPE name=\"PresentationOutliner \" description=\" \">"
"<PARAGRAPH description=\"Paragraph: 0 2\">2</PARAGRAPH>"
"</SHAPE>"
"<SHAPE name=\"PresentationOutliner \" description=\" \">"
"<PARAGRAPH description=\"Paragraph: 0 3\">3</PARAGRAPH>"
"</SHAPE>"),
collectText());
}
}
CPPUNIT_PLUGIN_IMPLEMENT();
|