Kaydet (Commit) 3588c6c5 authored tarafından Thorsten Behrens's avatar Thorsten Behrens

slideshow: get unit tests to work again

Change-Id: I7b5c7a20677ac0f720b41daf8ca59c3cc94f1283
Reviewed-on: https://gerrit.libreoffice.org/59964
Tested-by: Jenkins
Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst ae25d5d3
......@@ -9,29 +9,17 @@
$(eval $(call gb_CppunitTest_CppunitTest,slideshow))
$(eval $(call gb_CppunitTest_use_package,slideshow,sd_qa_unit))
$(eval $(call gb_CppunitTest_set_include,slideshow,\
$$(INCLUDE) \
-I$(SRCDIR)/slideshow/source/inc \
))
$(eval $(call gb_CppunitTest_set_defs,slideshow,\
$$(DEFS) \
))
ifneq ($(strip $(debug)$(DEBUG)),)
$(eval $(call gb_CppunitTest_set_defs,slideshow,\
$$(DEFS) \
-DBOOST_SP_ENABLE_DEBUG_HOOKS \
))
endif
$(eval $(call gb_CppunitTest_use_sdk_api,slideshow))
$(eval $(call gb_CppunitTest_use_library_objects,slideshow,slideshow))
$(eval $(call gb_CppunitTest_use_libraries,slideshow,\
$(call gb_Helper_optional,AVMEDIA,avmedia) \
basegfx \
canvastools \
comphelper \
......@@ -39,6 +27,7 @@ $(eval $(call gb_CppunitTest_use_libraries,slideshow,\
cppu \
cppuhelper \
sal \
salhelper \
svt \
tl \
utl \
......
......@@ -19,8 +19,9 @@ $(eval $(call gb_Module_add_targets,slideshow,\
))
endif
# not working
# CppunitTest_slideshow \
$(eval $(call gb_Module_add_check_targets,slideshow,\
CppunitTest_slideshow \
))
# not built normally (and unbuildable anyway ;)
# Executable_demoshow \
......
......@@ -254,6 +254,19 @@ namespace slideshow
notifyShapeUpdate( rShape );
}
bool LayerManager::removeShape( const ShapeSharedPtr& rShape )
{
// remove shape from XShape hash map
if( maXShapeHash.erase( rShape->getXShape() ) == 0 )
return false; // shape not in map
OSL_ASSERT( maAllShapes.find(rShape) != maAllShapes.end() );
implRemoveShape( rShape );
return true;
}
void LayerManager::implRemoveShape( const ShapeSharedPtr& rShape )
{
OSL_ASSERT( !maLayers.empty() ); // always at least background layer
......
......@@ -111,6 +111,12 @@ namespace slideshow
*/
void addShape( const ShapeSharedPtr& rShape );
/** Remove shape from this object
This method removes a shape from the shape.
*/
bool removeShape( const ShapeSharedPtr& rShape );
/** Lookup a Shape from an XShape model object
This method looks up the internal shape map for one
......
......@@ -37,8 +37,8 @@
#include <com/sun/star/rendering/XSpriteCanvas.hpp>
#include <com/sun/star/presentation/SlideShow.hpp>
#include <com/sun/star/presentation/XSlideShowView.hpp>
#include "com/sun/star/animations/TransitionType.hpp"
#include "com/sun/star/animations/TransitionSubType.hpp"
#include <com/sun/star/animations/TransitionType.hpp>
#include <com/sun/star/animations/TransitionSubType.hpp>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
......
This diff is collapsed.
......@@ -20,8 +20,8 @@
#ifndef INCLUDED_SLIDESHOW_TEST_TESTS_HXX
#define INCLUDED_SLIDESHOW_TEST_TESTS_HXX
#include "animatableshape.hxx"
#include "unoview.hxx"
#include <animatableshape.hxx>
#include <unoview.hxx>
#include <memory>
namespace basegfx{ class B1DRange; class B2DRange; class B2DVector; }
......
......@@ -29,7 +29,7 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/range/b2drange.hxx>
#include "shape.hxx"
#include <shape.hxx>
#include "tests.hxx"
namespace target = slideshow::internal;
......@@ -64,60 +64,60 @@ public:
private:
// TestShape
virtual std::vector<std::pair<target::ViewLayerSharedPtr,bool> > getViewLayers() const
virtual std::vector<std::pair<target::ViewLayerSharedPtr,bool> > getViewLayers() const override
{
return maViewLayers;
}
virtual sal_Int32 getNumUpdates() const
virtual sal_Int32 getNumUpdates() const override
{
return mnNumUpdates;
}
virtual sal_Int32 getNumRenders() const
virtual sal_Int32 getNumRenders() const override
{
return mnNumRenders;
}
// XShape
virtual OUString SAL_CALL getShapeType( ) throw (uno::RuntimeException)
virtual OUString SAL_CALL getShapeType( ) override
{
CPPUNIT_ASSERT_MESSAGE( "TestShape::getShapeType: unexpected method call", false );
return OUString();
}
virtual awt::Point SAL_CALL getPosition( ) throw (uno::RuntimeException)
virtual awt::Point SAL_CALL getPosition( ) override
{
CPPUNIT_ASSERT_MESSAGE( "TestShape::getPosition: unexpected method call", false );
return awt::Point();
}
virtual void SAL_CALL setPosition( const awt::Point& ) throw (uno::RuntimeException)
virtual void SAL_CALL setPosition( const awt::Point& ) override
{
CPPUNIT_ASSERT_MESSAGE( "TestShape::setPosition: unexpected method call", false );
}
virtual awt::Size SAL_CALL getSize( ) throw (uno::RuntimeException)
virtual awt::Size SAL_CALL getSize( ) override
{
CPPUNIT_ASSERT_MESSAGE( "TestShape::getSize: unexpected method call", false );
return awt::Size();
}
virtual void SAL_CALL setSize( const awt::Size& /*aSize*/ ) throw (beans::PropertyVetoException, uno::RuntimeException)
virtual void SAL_CALL setSize( const awt::Size& /*aSize*/ ) override
{
CPPUNIT_ASSERT_MESSAGE( "TestShape::setSize: unexpected method call", false );
}
// Shape
virtual uno::Reference< drawing::XShape > getXShape() const
virtual uno::Reference< drawing::XShape > getXShape() const override
{
return uno::Reference< drawing::XShape >( const_cast<ImplTestShape*>(this) );
}
virtual void addViewLayer( const target::ViewLayerSharedPtr& rNewLayer,
bool bRedrawLayer )
bool bRedrawLayer ) override
{
maViewLayers.push_back( std::make_pair(rNewLayer,bRedrawLayer) );
}
virtual bool removeViewLayer( const target::ViewLayerSharedPtr& rNewLayer )
virtual bool removeViewLayer( const target::ViewLayerSharedPtr& rNewLayer ) override
{
if( std::none_of(
maViewLayers.begin(),
......@@ -136,62 +136,65 @@ private:
{ return cp.first == rNewLayer; } ) );
return true;
}
virtual bool clearAllViewLayers()
virtual void clearAllViewLayers() override
{
maViewLayers.clear();
return true;
}
virtual bool update() const
virtual bool update() const override
{
++mnNumUpdates;
return true;
}
virtual bool render() const
virtual bool render() const override
{
++mnNumRenders;
return true;
}
virtual bool isContentChanged() const
virtual bool isContentChanged() const override
{
return true;
}
virtual ::basegfx::B2DRectangle getBounds() const
virtual ::basegfx::B2DRectangle getBounds() const override
{
return maRect;
}
virtual ::basegfx::B2DRectangle getDomBounds() const
virtual ::basegfx::B2DRectangle getDomBounds() const override
{
return maRect;
}
virtual ::basegfx::B2DRectangle getUpdateArea() const
virtual ::basegfx::B2DRectangle getUpdateArea() const override
{
return maRect;
}
virtual bool isVisible() const
virtual bool isVisible() const override
{
return true;
}
virtual double getPriority() const
virtual double getPriority() const override
{
return mnPrio;
}
virtual bool isBackgroundDetached() const
virtual bool isBackgroundDetached() const override
{
return mnAnimated != 0;
}
// AnimatableShape
virtual void enterAnimationMode()
virtual void enterAnimationMode() override
{
++mnAnimated;
}
virtual void leaveAnimationMode()
virtual void leaveAnimationMode() override
{
--mnAnimated;
}
virtual sal_Int32 getAnimationCount() const override
{
return mnAnimated;
}
};
......
......@@ -33,9 +33,9 @@
#include <cppcanvas/spritecanvas.hxx>
#include "tests.hxx"
#include "view.hxx"
#include "unoview.hxx"
#include "com/sun/star/presentation/XSlideShowView.hpp"
#include <view.hxx>
#include <unoview.hxx>
#include <com/sun/star/presentation/XSlideShowView.hpp>
#include <vector>
#include <exception>
......@@ -74,132 +74,138 @@ public:
{
}
virtual ~ImplTestView()
{
}
// XSlideShowView
virtual uno::Reference< rendering::XSpriteCanvas > SAL_CALL getCanvas( ) throw (uno::RuntimeException)
virtual uno::Reference< rendering::XSpriteCanvas > SAL_CALL getCanvas( ) override
{
return uno::Reference< rendering::XSpriteCanvas >();
}
virtual void SAL_CALL clear( ) throw (uno::RuntimeException)
virtual void SAL_CALL clear( ) override
{
}
virtual geometry::AffineMatrix2D SAL_CALL getTransformation( ) throw (uno::RuntimeException)
virtual geometry::AffineMatrix2D SAL_CALL getTransformation( ) override
{
return geometry::AffineMatrix2D();
}
virtual void SAL_CALL addTransformationChangedListener( const uno::Reference< util::XModifyListener >& ) throw (uno::RuntimeException)
virtual ::css::geometry::IntegerSize2D SAL_CALL getTranslationOffset() override
{
return geometry::IntegerSize2D();
}
virtual geometry::IntegerSize2D getTranslationOffset() const override
{
return geometry::IntegerSize2D();
}
virtual void SAL_CALL addTransformationChangedListener( const uno::Reference< util::XModifyListener >& ) override
{
}
virtual void SAL_CALL removeTransformationChangedListener( const uno::Reference< util::XModifyListener >& ) throw (uno::RuntimeException)
virtual void SAL_CALL removeTransformationChangedListener( const uno::Reference< util::XModifyListener >& ) override
{
}
virtual void SAL_CALL addPaintListener( const uno::Reference< awt::XPaintListener >& ) throw (uno::RuntimeException)
virtual void SAL_CALL addPaintListener( const uno::Reference< awt::XPaintListener >& ) override
{
}
virtual void SAL_CALL removePaintListener( const uno::Reference< awt::XPaintListener >& ) throw (uno::RuntimeException)
virtual void SAL_CALL removePaintListener( const uno::Reference< awt::XPaintListener >& ) override
{
}
virtual void SAL_CALL addMouseListener( const uno::Reference< awt::XMouseListener >& ) throw (uno::RuntimeException)
virtual void SAL_CALL addMouseListener( const uno::Reference< awt::XMouseListener >& ) override
{
}
virtual void SAL_CALL removeMouseListener( const uno::Reference< awt::XMouseListener >& ) throw (uno::RuntimeException)
virtual void SAL_CALL removeMouseListener( const uno::Reference< awt::XMouseListener >& ) override
{
}
virtual void SAL_CALL addMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& ) throw (uno::RuntimeException)
virtual void SAL_CALL addMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& ) override
{
}
virtual void SAL_CALL removeMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& ) throw (uno::RuntimeException)
virtual void SAL_CALL removeMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& ) override
{
}
virtual void SAL_CALL setMouseCursor( ::sal_Int16 ) throw (uno::RuntimeException)
virtual void SAL_CALL setMouseCursor( ::sal_Int16 ) override
{
}
virtual awt::Rectangle SAL_CALL getCanvasArea( ) throw (uno::RuntimeException)
virtual awt::Rectangle SAL_CALL getCanvasArea( ) override
{
return awt::Rectangle(0,0,100,100);
}
// TestView
virtual bool isClearCalled() const
virtual bool isClearCalled() const override
{
return mbIsClearCalled;
}
virtual std::vector<std::pair<basegfx::B2DVector,double> > getCreatedSprites() const
virtual std::vector<std::pair<basegfx::B2DVector,double> > getCreatedSprites() const override
{
return maCreatedSprites;
}
virtual basegfx::B1DRange getPriority() const
virtual basegfx::B1DRange getPriority() const override
{
return maPriority;
}
virtual bool wasClipSet() const
virtual bool wasClipSet() const override
{
return mbIsClipEmptied;
}
virtual basegfx::B2DRange getBounds() const
virtual basegfx::B2DRange getBounds() const override
{
return maBounds;
}
virtual std::vector<std::shared_ptr<TestView> > getViewLayers() const
virtual std::vector<std::shared_ptr<TestView> > getViewLayers() const override
{
return maViewLayers;
}
// ViewLayer
virtual bool isOnView(target::ViewSharedPtr const& /*rView*/) const
virtual bool isOnView(target::ViewSharedPtr const& /*rView*/) const override
{
return true;
}
virtual ::cppcanvas::CanvasSharedPtr getCanvas() const
virtual ::cppcanvas::CanvasSharedPtr getCanvas() const override
{
return ::cppcanvas::CanvasSharedPtr();
}
virtual ::cppcanvas::CustomSpriteSharedPtr createSprite( const ::basegfx::B2DSize& rSpriteSizePixel,
double nPriority ) const
double nPriority ) const override
{
maCreatedSprites.push_back( std::make_pair(rSpriteSizePixel,nPriority) );
return ::cppcanvas::CustomSpriteSharedPtr();
}
virtual void setPriority( const basegfx::B1DRange& rRange )
virtual void setPriority( const basegfx::B1DRange& rRange ) override
{
maPriority = rRange;
}
virtual ::basegfx::B2DHomMatrix getTransformation() const
virtual ::basegfx::B2DHomMatrix getTransformation() const override
{
return ::basegfx::B2DHomMatrix();
}
virtual ::basegfx::B2DHomMatrix getSpriteTransformation() const
virtual ::basegfx::B2DHomMatrix getSpriteTransformation() const override
{
return ::basegfx::B2DHomMatrix();
}
virtual void setClip( const ::basegfx::B2DPolyPolygon& rClip )
virtual void setClip( const ::basegfx::B2DPolyPolygon& rClip ) override
{
if( !mbIsClipSet )
{
......@@ -223,7 +229,7 @@ public:
}
}
virtual bool resize( const basegfx::B2DRange& rArea )
virtual bool resize( const basegfx::B2DRange& rArea ) override
{
const bool bRet( maBounds != rArea );
maBounds = rArea;
......@@ -231,7 +237,7 @@ public:
}
virtual target::ViewLayerSharedPtr createViewLayer(
const basegfx::B2DRange& rLayerBounds ) const
const basegfx::B2DRange& rLayerBounds ) const override
{
maViewLayers.push_back( TestViewSharedPtr(new ImplTestView()));
maViewLayers.back()->resize( rLayerBounds );
......@@ -239,50 +245,50 @@ public:
return maViewLayers.back();
}
virtual bool updateScreen() const
virtual bool updateScreen() const override
{
// misusing updateScreen for state reporting
return !mbDisposed;
}
virtual bool paintScreen() const
virtual bool paintScreen() const override
{
// misusing updateScreen for state reporting
return !mbDisposed;
}
virtual void clear() const
virtual void clear() const override
{
}
virtual void clearAll() const
virtual void clearAll() const override
{
}
virtual void setViewSize( const ::basegfx::B2DSize& )
virtual void setViewSize( const ::basegfx::B2DSize& ) override
{
}
virtual void setCursorShape( sal_Int16 /*nPointerShape*/ )
virtual void setCursorShape( sal_Int16 /*nPointerShape*/ ) override
{
}
virtual uno::Reference< presentation::XSlideShowView > getUnoView() const
virtual uno::Reference< presentation::XSlideShowView > getUnoView() const override
{
return uno::Reference< presentation::XSlideShowView >( const_cast<ImplTestView*>(this) );
}
virtual void _dispose()
virtual void _dispose() override
{
mbDisposed = true;
}
virtual bool isSoundEnabled() const
virtual bool isSoundEnabled() const override
{
return true;
}
virtual void setIsSoundEnabled (const bool /*bValue*/)
virtual void setIsSoundEnabled (const bool /*bValue*/) override
{
}
};
......
......@@ -26,10 +26,10 @@
#include <basegfx/range/b2drectangle.hxx>
#include <cppcanvas/spritecanvas.hxx>
#include "view.hxx"
#include "unoview.hxx"
#include "unoviewcontainer.hxx"
#include "shape.hxx"
#include <view.hxx>
#include <unoview.hxx>
#include <unoviewcontainer.hxx>
#include <shape.hxx>
#include "tests.hxx"
namespace target = slideshow::internal;
......@@ -48,15 +48,17 @@ public:
TestViewSharedPtr pView = createTestView();
aContainer.addView( pView );
CPPUNIT_ASSERT_MESSAGE( "Testing container size",
1 == std::distance( aContainer.begin(),
aContainer.end() ));
CPPUNIT_ASSERT_EQUAL_MESSAGE( "Testing container size",
std::ptrdiff_t(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_EQUAL_MESSAGE( "Testing dispose: container must be empty",
std::ptrdiff_t(0),
std::distance( aContainer.begin(),
aContainer.end() ));
CPPUNIT_ASSERT_MESSAGE( "Testing dispose: all elements must receive dispose",
!pView->paintScreen() );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment