CppunitTest_oox_mathml: inherit from UnoApiTest

Change-Id: I163fd8d635a18c1dd03eaa50720d10d4fe78d4cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141857
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Xisco Fauli 2022-10-26 08:52:46 +02:00
parent 2f795bb8bb
commit 580776cdc5
2 changed files with 10 additions and 31 deletions

View file

@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,oox_mathml, \
cppu \
oox \
sal \
subsequenttest \
test \
unotest \
))

View file

@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <test/bootstrapfixture.hxx>
#include <unotest/macros_test.hxx>
#include <test/unoapi_test.hxx>
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
#include <com/sun/star/frame/Desktop.hpp>
@ -16,46 +15,25 @@
using namespace ::com::sun::star;
/// oox mathml tests.
class OoxMathmlTest : public test::BootstrapFixture, public unotest::MacrosTest
class OoxMathmlTest : public UnoApiTest
{
private:
uno::Reference<lang::XComponent> mxComponent;
public:
void setUp() override;
void tearDown() override;
uno::Reference<lang::XComponent>& getComponent() { return mxComponent; }
OoxMathmlTest()
: UnoApiTest("/oox/qa/unit/data/")
{
}
};
void OoxMathmlTest::setUp()
{
test::BootstrapFixture::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
}
void OoxMathmlTest::tearDown()
{
if (mxComponent.is())
mxComponent->dispose();
test::BootstrapFixture::tearDown();
}
constexpr OUStringLiteral DATA_DIRECTORY = u"/oox/qa/unit/data/";
CPPUNIT_TEST_FIXTURE(OoxMathmlTest, testImportCharacters)
{
OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "import-characters.pptx";
// Without the accompanying fix in place, this failed with an assertion failure on import.
getComponent() = loadFromDesktop(aURL);
loadFromURL(u"import-characters.pptx");
}
CPPUNIT_TEST_FIXTURE(OoxMathmlTest, testImportMce)
{
OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "import-mce.pptx";
getComponent() = loadFromDesktop(aURL);
uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(getComponent(), uno::UNO_QUERY);
loadFromURL(u"import-mce.pptx");
uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
uno::UNO_QUERY);