summaryrefslogtreecommitdiff
path: root/slideshow/test
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2007-07-17 14:22:20 +0000
committerOliver Bolte <obo@openoffice.org>2007-07-17 14:22:20 +0000
commit6bee0dc16efd4ee5a4345a3f2f3dd4194affef26 (patch)
treefd95511ad08fc8c3de026bacb60b7d1fbc692064 /slideshow/test
parentb714a1f57ba57731a3dd26e398bc8479b325dcae (diff)
INTEGRATION: CWS presfixes12 (1.2.12); FILE MERGED
2007/02/10 23:23:54 thb 1.2.12.4: #i37778# Renamed setMouseCursor() to setCursorShape() at View interface (name clash with API method otherwise); added LayerManager/Layer unit tests; fixed a bunch of bugs/glitches found during unit testing 2007/02/06 17:18:15 thb 1.2.12.3: #i37778# Moved clear() method from View to ViewLayer (also sprites need to be cleared); fixed a few more cases of local code style violations; removed redundant inline keywords; finished Layer/LayerManager rework (Layer now represents ViewLayers, shapes and rendering are fully under LayerManager control); made shape comparator reusable 2007/01/31 14:30:34 thb 1.2.12.2: #i37778# removed View::isContentDestroyed() and mbContentValid distinction on View::clear() - clear() now always clears view the hard way; added explicit screen update to CombTransition, which bypasses SlideChangeBase functionality 2007/01/31 11:25:19 thb 1.2.12.1: #i37778# Added prefetch to Animation interface (to facilitate prefetching - nice for slide transitions, which otherwise lag noticeably while generating the slide bitmap); brought tests up to par, re-enabling unit tests and demo show
Diffstat (limited to 'slideshow/test')
-rw-r--r--slideshow/test/views.cxx234
1 files changed, 13 insertions, 221 deletions
diff --git a/slideshow/test/views.cxx b/slideshow/test/views.cxx
index e2fb6baebeaa..cc9bf7ee19d5 100644
--- a/slideshow/test/views.cxx
+++ b/slideshow/test/views.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: views.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: kz $ $Date: 2006-12-13 16:09:23 $
+ * last change: $Author: obo $ $Date: 2007-07-17 15:22:20 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -37,10 +37,15 @@
#include <cppuhelper/compbase1.hxx>
#include <comphelper/broadcasthelper.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/range/b2drectangle.hxx>
+#include <cppcanvas/spritecanvas.hxx>
+
+#include "view.hxx"
#include "unoview.hxx"
#include "unoviewcontainer.hxx"
#include "shape.hxx"
-#include "layermanager.hxx"
+#include "tests.hxx"
#include "com/sun/star/presentation/XSlideShowView.hpp"
namespace target = slideshow::internal;
@@ -52,243 +57,30 @@ namespace
class UnoViewContainerTest : public CppUnit::TestFixture
{
public:
- // our test view subject
- class TestUnoView : public target::UnoView
- {
- bool mbDisposed;
-
- public:
- TestUnoView() : mbDisposed( false )
- {
- }
-
- virtual ~TestUnoView()
- {
- }
-
- virtual ::cppcanvas::CanvasSharedPtr getCanvas() const
- {
- return ::cppcanvas::CanvasSharedPtr();
- }
-
- virtual ::cppcanvas::CustomSpriteSharedPtr createSprite( const ::basegfx::B2DSize& rSpriteSizePixel ) const
- {
- return ::cppcanvas::CustomSpriteSharedPtr();
- }
-
- virtual double getSpritePriority( double nSpritePrio ) const
- {
- return 0.0;
- }
-
- virtual void setPriority( double nPrio )
- {
- }
-
- virtual target::ViewLayerSharedPtr createViewLayer() const
- {
- return target::ViewLayerSharedPtr();
- }
-
- virtual void clear() const
- {
- }
-
- virtual bool isContentDestroyed() const
- {
- return true;
- }
-
- virtual bool updateScreen() const
- {
- return true;
- }
-
- virtual ::basegfx::B2DHomMatrix getTransformation() const
- {
- return ::basegfx::B2DHomMatrix();
- }
-
- virtual void setViewSize( const ::basegfx::B2DSize& )
- {
- }
-
- virtual void setClip( const ::basegfx::B2DPolyPolygon& rClip )
- {
- }
-
- virtual void setMouseCursor( sal_Int16 nPointerShape )
- {
- }
-
- virtual uno::Reference< presentation::XSlideShowView > getUnoView() const
- {
- return uno::Reference< presentation::XSlideShowView >();
- }
-
- virtual void _dispose()
- {
- mbDisposed = true;
- }
-
- bool isDisposed() { return mbDisposed; }
- };
-
- // our test shape subject
- typedef ::cppu::WeakComponentImplHelper1< drawing::XShape > ShapeBase;
- class TestShape : public target::Shape, public comphelper::OBaseMutex, public ShapeBase
- {
- const basegfx::B2DRectangle maRect;
- const double mnPrio;
-
- virtual ::rtl::OUString SAL_CALL getShapeType( ) throw (uno::RuntimeException)
- {
- return ::rtl::OUString();
- }
-
- virtual awt::Point SAL_CALL getPosition( ) throw (uno::RuntimeException)
- {
- return awt::Point();
- }
-
- virtual void SAL_CALL setPosition( const awt::Point& aPosition ) throw (uno::RuntimeException)
- {
- }
-
- virtual awt::Size SAL_CALL getSize( ) throw (uno::RuntimeException)
- {
- return awt::Size();
- }
-
- virtual void SAL_CALL setSize( const awt::Size& aSize ) throw (beans::PropertyVetoException, uno::RuntimeException)
- {
- }
-
- public:
- TestShape( const basegfx::B2DRectangle& rRect,
- double nPrio ) :
- ShapeBase( m_aMutex ),
- maRect( rRect ),
- mnPrio( nPrio )
- {}
-
- virtual uno::Reference< drawing::XShape > getXShape() const
- {
- return uno::Reference< drawing::XShape >( const_cast<TestShape*>(this) );
- }
-
- virtual void addViewLayer( const target::ViewLayerSharedPtr& rNewLayer,
- bool bRedrawLayer )
- {
- }
- virtual bool removeViewLayer( const target::ViewLayerSharedPtr& rNewLayer )
- {
- return true;
- }
- virtual bool clearAllViewLayers()
- {
- return true;
- }
-
- virtual bool update() const
- {
- return true;
- }
- virtual bool render() const
- {
- return true;
- }
- virtual bool isUpdateNecessary() const
- {
- return true;
- }
-
- virtual ::basegfx::B2DRectangle getPosSize() const
- {
- return maRect;
- }
- virtual ::basegfx::B2DRectangle getDOMBounds() const
- {
- return maRect;
- }
- virtual ::basegfx::B2DRectangle getUpdateArea() const
- {
- return maRect;
- }
-
- virtual bool isVisible() const
- {
- return true;
- }
- virtual double getPriority() const
- {
- return mnPrio;
- }
- virtual bool isBackgroundDetached() const
- {
- return false;
- }
- virtual bool hasIntrinsicAnimation() const
- {
- return false;
- }
- virtual bool hasHyperlinks() const
- {
- return false;
- }
- virtual HyperLinkRegions getHyperlinkRegions() const
- {
- return HyperLinkRegions();
- }
- };
-
void testContainer()
{
target::UnoViewContainer aContainer;
- boost::shared_ptr<TestUnoView> pView( new TestUnoView() );
+ TestViewSharedPtr pView = createTestView();
aContainer.addView( pView );
CPPUNIT_ASSERT_MESSAGE( "Testing container size",
1 == std::distance( aContainer.begin(),
aContainer.end() ));
+ CPPUNIT_ASSERT_MESSAGE( "Testing disposedness",
+ pView->paintScreen() );
aContainer.dispose();
CPPUNIT_ASSERT_MESSAGE( "Testing dispose: container must be empty",
0 == std::distance( aContainer.begin(),
aContainer.end() ));
CPPUNIT_ASSERT_MESSAGE( "Testing dispose: all elements must receive dispose",
- pView->isDisposed() );
- }
-
- void testLayerManager()
- {
- basegfx::B2DRectangle aRect(0,0,1600,1200);
- const basegfx::B2DRectangle aRect2( aRect );
- target::LayerManager aLayerManager( aRect );
- boost::shared_ptr<TestUnoView> pView( new TestUnoView() );
-
- aRect.reset();
-
- CPPUNIT_ASSERT_MESSAGE( "Testing page bounds",
- aRect2 == aLayerManager.getPageBounds());
-
- aLayerManager.addView( pView );
- CPPUNIT_ASSERT_EQUAL_MESSAGE( "Testing view removal",
- true,
- aLayerManager.removeView( pView ));
-
- boost::shared_ptr<TestShape> pShape( new TestShape(basegfx::B2DRectangle(10,10,100,100),
- 1.0) );
- aLayerManager.addShape( pShape );
- CPPUNIT_ASSERT_EQUAL_MESSAGE( "Testing shape removal",
- true,
- aLayerManager.removeShape( pShape ));
+ !pView->paintScreen() );
}
// hook up the test
CPPUNIT_TEST_SUITE(UnoViewContainerTest);
CPPUNIT_TEST(testContainer);
- CPPUNIT_TEST(testLayerManager);
+ //CPPUNIT_TEST(testLayerManager);
CPPUNIT_TEST_SUITE_END();
}; // class UnoViewContainerTest