Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  layout.cxx   Sprache: C

 
/* -*- 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>

using namespace css;

CPPUNIT_TEST_FIXTURE(test::AccessibleTestBase, TestImpressDefaultStructure)
{
    load(u"private:factory/simpress"_ustr);
    Scheduler::ProcessEventsToIdle();

    CPPUNIT_ASSERT_EQUAL(u"PageShape: Slide 1\"/>"
                         "PresentationTitle \">"
                         ""
                         "Click to add Title"
                         ""
                         "
"

                         "PresentationSubtitle \">"
                         ""
                         "Click to add Text"
                         ""
                         "
"
_ustr,
                         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(
        u"PresentationTitle "_ustr,
        xDocumentContext->getAccessibleChild(1)->getAccessibleContext()->getAccessibleName());
    CPPUNIT_ASSERT_EQUAL(
        u"PresentationSubtitle "_ustr,
        xDocumentContext->getAccessibleChild(2)->getAccessibleContext()->getAccessibleName());
}

// test a11y tree order is stable (https://bugs.documentfoundation.org/show_bug.cgi?id=150064)
CPPUNIT_TEST_FIXTURE(test::AccessibleTestBase, 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(u"PageShape: Slide 1\"/>"
                             "PresentationTitle \">"
                             "P1 title"
                             "
"

                             "PresentationSubtitle \">"
                             "Some text"
                             "
"

                             "TableShape \">"
                             "A1\">"
                             "1"
                             "
"

                             "B1\">"
                             "2"
                             "
"

                             "C1\">"
                             "3"
                             "
"

                             "D1\">"
                             "4"
                             "
"

                             "E1\">"
                             "5"
                             "
"

                             "A2\">"
                             "6"
                             "
"

                             "B2\">"
                             "7"
                             "
"

                             "C2\">"
                             "8"
                             "
"

                             "D2\">"
                             "9"
                             "
"

                             "E2\">"
                             "10"
                             "
"

                             "
"

                             "MyRectangle\" description=\"Some Rectangle\">"
                             "Text inside Shape"
                             "
"
_ustr,
                             collectText());

        CPPUNIT_ASSERT(xDrawPages->getByIndex(1) >>= xDrawPage);
        xDrawView->setCurrentPage(xDrawPage);
        Scheduler::ProcessEventsToIdle();

        CPPUNIT_ASSERT_EQUAL(u"PageShape: Slide 2\"/>"
                             "PresentationTitle \">"
                             "P2 title"
                             "
"

                             "PresentationOutliner \">"
                             "1"
                             "
"

                             "PresentationOutliner \">"
                             "2"
                             "
"

                             "PresentationOutliner \">"
                             "3"
                             "
"
_ustr,
                             collectText());
    }
}

CPPUNIT_PLUGIN_IMPLEMENT();

Messung V0.5
C=94 H=96 G=94

¤ Dauer der Verarbeitung: 0.12 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge