1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <test/bootstrapfixture.hxx>
11 #include <unotest/macros_test.hxx>
13 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
14 #include <com/sun/star/frame/Desktop.hpp>
16 using namespace ::com::sun::star
;
19 class OoxMathmlTest
: public test::BootstrapFixture
, public unotest::MacrosTest
22 uno::Reference
<lang::XComponent
> mxComponent
;
25 void setUp() override
;
26 void tearDown() override
;
27 uno::Reference
<lang::XComponent
>& getComponent() { return mxComponent
; }
30 void OoxMathmlTest::setUp()
32 test::BootstrapFixture::setUp();
34 mxDesktop
.set(frame::Desktop::create(mxComponentContext
));
37 void OoxMathmlTest::tearDown()
40 mxComponent
->dispose();
42 test::BootstrapFixture::tearDown();
45 char const DATA_DIRECTORY
[] = "/oox/qa/unit/data/";
47 CPPUNIT_TEST_FIXTURE(OoxMathmlTest
, testImportCharacters
)
49 OUString aURL
= m_directories
.getURLFromSrc(DATA_DIRECTORY
) + "import-characters.pptx";
50 // Without the accompanying fix in place, this failed with an assertion failure on import.
51 getComponent() = loadFromDesktop(aURL
);
52 CPPUNIT_ASSERT(getComponent().is());
55 CPPUNIT_TEST_FIXTURE(OoxMathmlTest
, testImportMce
)
57 OUString aURL
= m_directories
.getURLFromSrc(DATA_DIRECTORY
) + "import-mce.pptx";
58 getComponent() = loadFromDesktop(aURL
);
59 uno::Reference
<drawing::XDrawPagesSupplier
> xDrawPagesSupplier(getComponent(), uno::UNO_QUERY
);
60 uno::Reference
<drawing::XDrawPage
> xDrawPage(xDrawPagesSupplier
->getDrawPages()->getByIndex(0),
63 // Without the accompanying fix in place, this failed with:
66 // i.e. both the math object and its replacement image was imported, as two separate objects.
67 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(1), xDrawPage
->getCount());
70 CPPUNIT_PLUGIN_IMPLEMENT();
72 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */