nss: upgrade to release 3.73
[LibreOffice.git] / oox / qa / unit / mathml.cxx
blobbb629ccc9097b582171172769790b6f6a1ae2c8d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <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;
18 /// oox mathml tests.
19 class OoxMathmlTest : public test::BootstrapFixture, public unotest::MacrosTest
21 private:
22 uno::Reference<lang::XComponent> mxComponent;
24 public:
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()
39 if (mxComponent.is())
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),
61 uno::UNO_QUERY);
63 // Without the accompanying fix in place, this failed with:
64 // - Expected: 1
65 // - Actual : 2
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: */