1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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/.
10 #include <com/sun/star/drawing/XDrawView.hpp>
11 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
12 #include <com/sun/star/frame/XModel.hpp>
14 #include <vcl/scheduler.hxx>
16 #include <test/a11y/accessibletestbase.hxx>
17 #include <test/a11y/swaccessibletestbase.hxx>
21 CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase
, TestImpressDefaultStructure
)
23 load(u
"private:factory/simpress");
24 Scheduler::ProcessEventsToIdle();
26 CPPUNIT_ASSERT_EQUAL(rtl::OUString("<SHAPE name=\"PageShape: Slide 1\" description=\" \"/>"
27 "<SHAPE name=\"PresentationTitle \" description=\" \">"
28 "<PARAGRAPH description=\"Paragraph: 0 Click to add Title\">"
32 "<SHAPE name=\"PresentationSubtitle \" description=\" \">"
33 "<PARAGRAPH description=\"Paragraph: 0 Click to add Text\">"
40 // a basic check of the content order for https://bugs.documentfoundation.org/show_bug.cgi?id=150064
41 CPPUNIT_TEST_FIXTURE(test::AccessibleTestBase
, TestImpressDefaultLayout
)
43 load(u
"private:factory/simpress");
44 Scheduler::ProcessEventsToIdle();
46 auto xDocumentContext
= getDocumentAccessibleContext();
48 /* The tree inside the document is a bit awkward, as the page is not the parent of the other
49 * shapes, but well. It looks like this:
50 * document_presentation
57 CPPUNIT_ASSERT_EQUAL(sal_Int64(3), xDocumentContext
->getAccessibleChildCount());
59 OUString("PresentationTitle "),
60 xDocumentContext
->getAccessibleChild(1)->getAccessibleContext()->getAccessibleName());
62 OUString("PresentationSubtitle "),
63 xDocumentContext
->getAccessibleChild(2)->getAccessibleContext()->getAccessibleName());
66 // test a11y tree order is stable (https://bugs.documentfoundation.org/show_bug.cgi?id=150064)
67 CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase
, tdf150064
)
69 loadFromSrc(u
"/sd/qa/unit/a11y/data/tdf150064.fodp");
70 Scheduler::ProcessEventsToIdle();
72 uno::Reference
<drawing::XDrawPagesSupplier
> xDrawPagesSupplier(mxDocument
,
73 uno::UNO_QUERY_THROW
);
74 uno::Reference
<frame::XModel
> xModel(mxDocument
, uno::UNO_QUERY_THROW
);
75 uno::Reference
<drawing::XDrawView
> xDrawView(xModel
->getCurrentController(),
76 uno::UNO_QUERY_THROW
);
78 auto xDrawPages
= xDrawPagesSupplier
->getDrawPages();
79 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDrawPages
->getCount());
81 // Loop a couple times to make sure output is stable when loading and when switching pages
82 for (int i
= 0; i
< 2; i
++)
84 uno::Reference
<drawing::XDrawPage
> xDrawPage
;
86 CPPUNIT_ASSERT(xDrawPages
->getByIndex(0) >>= xDrawPage
);
87 xDrawView
->setCurrentPage(xDrawPage
);
88 Scheduler::ProcessEventsToIdle();
91 rtl::OUString("<SHAPE name=\"PageShape: Slide 1\" description=\" \"/>"
92 "<SHAPE name=\"PresentationTitle \" description=\" \">"
93 "<PARAGRAPH description=\"Paragraph: 0 P1 title\">P1 title</PARAGRAPH>"
95 "<SHAPE name=\"PresentationSubtitle \" description=\" \">"
96 "<PARAGRAPH description=\"Paragraph: 0 Some text\">Some text</PARAGRAPH>"
98 "<TABLE name=\"TableShape \" description=\" \">"
99 "<TABLE_CELL name=\"A1\">"
100 "<PARAGRAPH description=\"Paragraph: 0 1\">1</PARAGRAPH>"
102 "<TABLE_CELL name=\"B1\">"
103 "<PARAGRAPH description=\"Paragraph: 0 2\">2</PARAGRAPH>"
105 "<TABLE_CELL name=\"C1\">"
106 "<PARAGRAPH description=\"Paragraph: 0 3\">3</PARAGRAPH>"
108 "<TABLE_CELL name=\"D1\">"
109 "<PARAGRAPH description=\"Paragraph: 0 4\">4</PARAGRAPH>"
111 "<TABLE_CELL name=\"E1\">"
112 "<PARAGRAPH description=\"Paragraph: 0 5\">5</PARAGRAPH>"
114 "<TABLE_CELL name=\"A2\">"
115 "<PARAGRAPH description=\"Paragraph: 0 6\">6</PARAGRAPH>"
117 "<TABLE_CELL name=\"B2\">"
118 "<PARAGRAPH description=\"Paragraph: 0 7\">7</PARAGRAPH>"
120 "<TABLE_CELL name=\"C2\">"
121 "<PARAGRAPH description=\"Paragraph: 0 8\">8</PARAGRAPH>"
123 "<TABLE_CELL name=\"D2\">"
124 "<PARAGRAPH description=\"Paragraph: 0 9\">9</PARAGRAPH>"
126 "<TABLE_CELL name=\"E2\">"
127 "<PARAGRAPH description=\"Paragraph: 0 10\">10</PARAGRAPH>"
132 CPPUNIT_ASSERT(xDrawPages
->getByIndex(1) >>= xDrawPage
);
133 xDrawView
->setCurrentPage(xDrawPage
);
134 Scheduler::ProcessEventsToIdle();
136 CPPUNIT_ASSERT_EQUAL(
137 rtl::OUString("<SHAPE name=\"PageShape: Slide 2\" description=\" \"/>"
138 "<SHAPE name=\"PresentationTitle \" description=\" \">"
139 "<PARAGRAPH description=\"Paragraph: 0 P2 title\">P2 title</PARAGRAPH>"
141 "<SHAPE name=\"PresentationOutliner \" description=\" \">"
142 "<PARAGRAPH description=\"Paragraph: 0 1\">1</PARAGRAPH>"
144 "<SHAPE name=\"PresentationOutliner \" description=\" \">"
145 "<PARAGRAPH description=\"Paragraph: 0 2\">2</PARAGRAPH>"
147 "<SHAPE name=\"PresentationOutliner \" description=\" \">"
148 "<PARAGRAPH description=\"Paragraph: 0 3\">3</PARAGRAPH>"
154 CPPUNIT_PLUGIN_IMPLEMENT();