xref: /aoo41x/main/slideshow/test/views.cxx (revision 70f497fb)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #include <testshl/simpleheader.hxx>
25 #include <cppuhelper/compbase1.hxx>
26 #include <comphelper/broadcasthelper.hxx>
27 
28 #include <basegfx/matrix/b2dhommatrix.hxx>
29 #include <basegfx/range/b2drectangle.hxx>
30 #include <cppcanvas/spritecanvas.hxx>
31 
32 #include "view.hxx"
33 #include "unoview.hxx"
34 #include "unoviewcontainer.hxx"
35 #include "shape.hxx"
36 #include "tests.hxx"
37 #include "com/sun/star/presentation/XSlideShowView.hpp"
38 
39 namespace target = slideshow::internal;
40 using namespace ::com::sun::star;
41 
42 namespace
43 {
44 
45 class UnoViewContainerTest : public CppUnit::TestFixture
46 {
47 public:
testContainer()48     void testContainer()
49     {
50         target::UnoViewContainer aContainer;
51 
52         TestViewSharedPtr pView = createTestView();
53         aContainer.addView( pView );
54 
55         CPPUNIT_ASSERT_MESSAGE( "Testing container size",
56                                 1 == std::distance( aContainer.begin(),
57                                                     aContainer.end() ));
58         CPPUNIT_ASSERT_MESSAGE( "Testing disposedness",
59                                 pView->paintScreen() );
60         aContainer.dispose();
61         CPPUNIT_ASSERT_MESSAGE( "Testing dispose: container must be empty",
62                                 0 == std::distance( aContainer.begin(),
63                                                     aContainer.end() ));
64         CPPUNIT_ASSERT_MESSAGE( "Testing dispose: all elements must receive dispose",
65                                 !pView->paintScreen() );
66     }
67 
68     // hook up the test
69     CPPUNIT_TEST_SUITE(UnoViewContainerTest);
70     CPPUNIT_TEST(testContainer);
71     //CPPUNIT_TEST(testLayerManager);
72     CPPUNIT_TEST_SUITE_END();
73 
74 }; // class UnoViewContainerTest
75 
76 // -----------------------------------------------------------------------------
77 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(UnoViewContainerTest, "UnoViewContainerTest");
78 } // namespace
79 
80 
81 // -----------------------------------------------------------------------------
82 
83 // this macro creates an empty function, which will called by the RegisterAllFunctions()
84 // to let the user the possibility to also register some functions by hand.
85 NOADDITIONAL;
86 
87