xref: /aoo42x/main/slideshow/test/views.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #include <testshl/simpleheader.hxx>
29 #include <cppuhelper/compbase1.hxx>
30 #include <comphelper/broadcasthelper.hxx>
31 
32 #include <basegfx/matrix/b2dhommatrix.hxx>
33 #include <basegfx/range/b2drectangle.hxx>
34 #include <cppcanvas/spritecanvas.hxx>
35 
36 #include "view.hxx"
37 #include "unoview.hxx"
38 #include "unoviewcontainer.hxx"
39 #include "shape.hxx"
40 #include "tests.hxx"
41 #include "com/sun/star/presentation/XSlideShowView.hpp"
42 
43 namespace target = slideshow::internal;
44 using namespace ::com::sun::star;
45 
46 namespace
47 {
48 
49 class UnoViewContainerTest : public CppUnit::TestFixture
50 {
51 public:
52     void testContainer()
53     {
54         target::UnoViewContainer aContainer;
55 
56         TestViewSharedPtr pView = createTestView();
57         aContainer.addView( pView );
58 
59         CPPUNIT_ASSERT_MESSAGE( "Testing container size",
60                                 1 == std::distance( aContainer.begin(),
61                                                     aContainer.end() ));
62         CPPUNIT_ASSERT_MESSAGE( "Testing disposedness",
63                                 pView->paintScreen() );
64         aContainer.dispose();
65         CPPUNIT_ASSERT_MESSAGE( "Testing dispose: container must be empty",
66                                 0 == std::distance( aContainer.begin(),
67                                                     aContainer.end() ));
68         CPPUNIT_ASSERT_MESSAGE( "Testing dispose: all elements must receive dispose",
69                                 !pView->paintScreen() );
70     }
71 
72     // hook up the test
73     CPPUNIT_TEST_SUITE(UnoViewContainerTest);
74     CPPUNIT_TEST(testContainer);
75     //CPPUNIT_TEST(testLayerManager);
76     CPPUNIT_TEST_SUITE_END();
77 
78 }; // class UnoViewContainerTest
79 
80 // -----------------------------------------------------------------------------
81 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(UnoViewContainerTest, "UnoViewContainerTest");
82 } // namespace
83 
84 
85 // -----------------------------------------------------------------------------
86 
87 // this macro creates an empty function, which will called by the RegisterAllFunctions()
88 // to let the user the possibility to also register some functions by hand.
89 NOADDITIONAL;
90 
91