diff --git a/src/Bloc-Animation/BlBaseAnimation.class.st b/src/Bloc-Animation/BlBaseAnimation.class.st index f9ff50dc0..63af48ba9 100644 --- a/src/Bloc-Animation/BlBaseAnimation.class.st +++ b/src/Bloc-Animation/BlBaseAnimation.class.st @@ -362,8 +362,8 @@ BlBaseAnimation >> shouldStop [ { #category : #'api - running' } BlBaseAnimation >> start [ - isRunning ifTrue: [ - self error: 'Animation can not be start multiple times without stop' ]. + "Ignore if it's already started" + isRunning ifTrue: [ ^ self ]. self initStart ] @@ -410,8 +410,8 @@ BlBaseAnimation >> step [ { #category : #'api - running' } BlBaseAnimation >> stop [ - isRunning ifFalse: [ - self error: 'Animation is not running' ]. + "Ignore if it's already stopped" + isRunning ifFalse: [ ^ self ]. isRunning := false. diff --git a/src/Bloc-Examples/BlAnimationExamplesTest.class.st b/src/Bloc-Examples/BlAnimationExamplesTest.class.st index 3b9eb7b07..e8d13426c 100644 --- a/src/Bloc-Examples/BlAnimationExamplesTest.class.st +++ b/src/Bloc-Examples/BlAnimationExamplesTest.class.st @@ -310,6 +310,31 @@ BlAnimationExamplesTest >> testBaseAnimation [ ^ aBaseAnimation ] +{ #category : #'examples - base animation' } +BlAnimationExamplesTest >> testBaseAnimationTolaratesRedundantStartAndStop [ + + | anAnimation | + anAnimation := BlAnimation new. + self deny: anAnimation isRunning. + anAnimation stop. + self deny: anAnimation isRunning. + anAnimation stop; stop; stop. + self deny: anAnimation isRunning. + + anAnimation start. + self assert: anAnimation isRunning. + anAnimation run. + anAnimation start; start; start. + self assert: anAnimation isRunning. + anAnimation run. + self assert: anAnimation isRunning. + + anAnimation stop. + self deny: anAnimation isRunning. + anAnimation stop. + self deny: anAnimation isRunning +] + { #category : #'examples - base animation' } BlAnimationExamplesTest >> testBaseAnimationWithDelay [