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/unoapi_test.hxx>
12 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
13 #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
14 #include <com/sun/star/animations/AnimationNodeType.hpp>
16 #include <animationcommandnode.hxx>
18 using namespace ::com::sun::star
;
22 /// Covers slideshow/source/engine/ fixes.
23 class Test
: public UnoApiTest
27 : UnoApiTest(u
"slideshow/qa/engine/data/"_ustr
)
32 /// Get the first command node in the animation tree of the page, assuming that it's the first child
34 uno::Reference
<animations::XCommand
>
35 GetFirstCommandNodeOfPage(const uno::Reference
<drawing::XDrawPage
>& xPage
)
37 uno::Reference
<animations::XAnimationNodeSupplier
> xAnimationNodeSupplier(xPage
,
39 uno::Reference
<animations::XAnimationNode
> xNode
= xAnimationNodeSupplier
->getAnimationNode();
42 if (xNode
->getType() == animations::AnimationNodeType::COMMAND
)
46 uno::Reference
<container::XEnumerationAccess
> xEnumAccess(xNode
, uno::UNO_QUERY
);
47 uno::Reference
<container::XEnumeration
> xNodes
= xEnumAccess
->createEnumeration();
48 xNode
.set(xNodes
->nextElement(), uno::UNO_QUERY
);
50 uno::Reference
<animations::XCommand
> xRet(xNode
, uno::UNO_QUERY
);
55 CPPUNIT_TEST_FIXTURE(Test
, testLoopingFromAnimation
)
57 // Given a document with a looping video, the looping is defined as part of its auto-play
58 // animation (and not on the media shape):
59 loadFromFile(u
"video-loop.pptx");
60 uno::Reference
<drawing::XDrawPagesSupplier
> xDoc(mxComponent
, uno::UNO_QUERY
);
61 uno::Reference
<drawing::XDrawPage
> xPage(xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY
);
62 uno::Reference
<animations::XCommand
> xCommandNode
= GetFirstCommandNodeOfPage(xPage
);
63 uno::Reference
<drawing::XShape
> xShape(xPage
->getByIndex(0), uno::UNO_QUERY
);
65 // When determining if the video should be looping or not:
67 = slideshow::internal::AnimationCommandNode::GetLoopingFromAnimation(xCommandNode
, xShape
);
69 // Then make sure that we detect the looping is wanted:
70 CPPUNIT_ASSERT(bLooping
);
73 CPPUNIT_PLUGIN_IMPLEMENT();
75 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */