CppunitTest_slideshow_engine: inherit from UnoApiTest

Change-Id: Id945ba8b9c7943c07063cb9456981ce542f61347
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143096
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Xisco Fauli 2022-11-22 10:42:43 +01:00
parent 25245dba23
commit 81791adc41
2 changed files with 12 additions and 27 deletions

View file

@ -23,9 +23,13 @@ $(eval $(call gb_CppunitTest_use_libraries,slideshow_engine, \
comphelper \ comphelper \
cppu \ cppu \
slideshow \ slideshow \
cppuhelper \
sal \ sal \
subsequenttest \
test \ test \
unotest \ unotest \
utl \
tl \
)) ))
$(eval $(call gb_CppunitTest_use_sdk_api,slideshow_engine)) $(eval $(call gb_CppunitTest_use_sdk_api,slideshow_engine))

View file

@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
#include <test/bootstrapfixture.hxx> #include <test/unoapi_test.hxx>
#include <unotest/macros_test.hxx>
#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp> #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
@ -22,32 +21,15 @@ using namespace ::com::sun::star;
namespace namespace
{ {
/// Covers slideshow/source/engine/ fixes. /// Covers slideshow/source/engine/ fixes.
class Test : public test::BootstrapFixture, public unotest::MacrosTest class Test : public UnoApiTest
{ {
private:
uno::Reference<lang::XComponent> mxComponent;
public: public:
void setUp() override; Test()
void tearDown() override; : UnoApiTest("slideshow/qa/engine/data/")
uno::Reference<lang::XComponent>& getComponent() { return mxComponent; } {
}
}; };
void Test::setUp()
{
test::BootstrapFixture::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
}
void Test::tearDown()
{
if (mxComponent.is())
mxComponent->dispose();
test::BootstrapFixture::tearDown();
}
/// Get the first command node in the animation tree of the page, assuming that it's the first child /// Get the first command node in the animation tree of the page, assuming that it's the first child
/// (recursively). /// (recursively).
uno::Reference<animations::XCommand> uno::Reference<animations::XCommand>
@ -75,9 +57,8 @@ CPPUNIT_TEST_FIXTURE(Test, testLoopingFromAnimation)
{ {
// Given a document with a looping video, the looping is defined as part of its auto-play // Given a document with a looping video, the looping is defined as part of its auto-play
// animation (and not on the media shape): // animation (and not on the media shape):
OUString aURL = m_directories.getURLFromSrc(u"slideshow/qa/engine/data/video-loop.pptx"); loadFromURL(u"video-loop.pptx");
getComponent().set(loadFromDesktop(aURL)); uno::Reference<drawing::XDrawPagesSupplier> xDoc(mxComponent, uno::UNO_QUERY);
uno::Reference<drawing::XDrawPagesSupplier> xDoc(getComponent(), uno::UNO_QUERY);
uno::Reference<drawing::XDrawPage> xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY); uno::Reference<drawing::XDrawPage> xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
uno::Reference<animations::XCommand> xCommandNode = GetFirstCommandNodeOfPage(xPage); uno::Reference<animations::XCommand> xCommandNode = GetFirstCommandNodeOfPage(xPage);
uno::Reference<drawing::XShape> xShape(xPage->getByIndex(0), uno::UNO_QUERY); uno::Reference<drawing::XShape> xShape(xPage->getByIndex(0), uno::UNO_QUERY);