tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / slideshow / qa / engine / engine.cxx
blob6644ddae0d4c9d4804d28638885c7b9e0825eedf
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/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;
20 namespace
22 /// Covers slideshow/source/engine/ fixes.
23 class Test : public UnoApiTest
25 public:
26 Test()
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
33 /// (recursively).
34 uno::Reference<animations::XCommand>
35 GetFirstCommandNodeOfPage(const uno::Reference<drawing::XDrawPage>& xPage)
37 uno::Reference<animations::XAnimationNodeSupplier> xAnimationNodeSupplier(xPage,
38 uno::UNO_QUERY);
39 uno::Reference<animations::XAnimationNode> xNode = xAnimationNodeSupplier->getAnimationNode();
40 while (true)
42 if (xNode->getType() == animations::AnimationNodeType::COMMAND)
44 break;
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);
51 return xRet;
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:
66 bool bLooping
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: */