Dali 3D User Interface Engine
utc-Dali-CubeTransitionEffect.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #include <iostream>
19 #include <stdlib.h>
27 
28 
29 
30 using namespace Dali;
31 using namespace Dali::Toolkit;
32 
33 
34 namespace
35 {
36 const unsigned int NUM_ROWS = 16;
37 const unsigned int NUM_COLUMNS = 10;
38 const Vector2 VIEW_AREA_SIZE( 480.0f, 800.0f );
39 const float TRANSITION_DURATION = 0.5f;
40 const float CUBE_DISPLACEMENT = 55.f;
41 const Vector2 PAN_POSITION1( VIEW_AREA_SIZE.x * 0.75f, VIEW_AREA_SIZE.y * 0.25f );
42 const Vector2 PAN_DISPLACEMENT1( -5.f, 5.f );
43 const Vector2 PAN_POSITION2( VIEW_AREA_SIZE.x * 0.25f, VIEW_AREA_SIZE.y * 0.75f );
44 const Vector2 PAN_DISPLACEMENT2( 5.f, 5.f );
45 const Vector4 FULL_BRIGHTNESS(1.f,1.f,1.f,1.f);
46 const Vector4 HALF_BRIGHTNESS(0.5f, 0.5f, 0.5f, 1.f);
47 const int RENDER_FRAME_INTERVAL = 16;
48 static const float FLT_EPISILON = 0.0001f;
49 static const float EPISILON = 0.05f;
50 const float TRANSITION_BEFORE_END_DURATION = TRANSITION_DURATION - 0.05f;
51 
53 static void TestCallback(BaseHandle handle)
54 {
55  gObjectCreatedCallBackCalled = true;
56 }
57 
63 void Wait(ToolkitTestApplication& application, float durationToPass)
64 {
65  int duration = static_cast<int>(durationToPass*1000.f);
66  // wait 2 more frames to compensate the two frames used by the image waiting for the loading succeeded signal
67  for(int i = 0; i <= duration/RENDER_FRAME_INTERVAL+2 ; i++)
68  {
69  application.SendNotification();
70  application.Render(RENDER_FRAME_INTERVAL);
71  }
72 }
73 
74 
75 
76 //Callback class to test whether transition completed signal is emitted when the transition animation is finished
78 {
79 public:
80  TransitionCompletedCallback( bool& signalReceived, CubeTransitionEffect& effect, Image& image )
81  : mSignalVerified( signalReceived ),
82  mCurrentEffect( effect ),
83  mActorTransitTo( image )
84  {
85  }
86 
87  void Callback( CubeTransitionEffect effect, Image image )
88  {
89  tet_infoline( "Verifying TransitionCompletedSignal" );
90 
91  if( mCurrentEffect == effect && mActorTransitTo == image )
92  {
93  mSignalVerified = true;
94  }
95  }
96 
97  void Reset()
98  {
99  mSignalVerified = false;
100  }
101 
105 };
106 
107 } // namespace
108 
109 
110 
112 {
114 }
115 
117 {
119 }
120 
122 {
123  ToolkitTestApplication application;
124  tet_infoline(" UtcDaliCubeTransitionWaveEffectNew ");
125 
126  CubeTransitionEffect waveEffect;
127 
128  DALI_TEST_CHECK( !waveEffect );
129 
131  waveEffect.SetSize( VIEW_AREA_SIZE );
132 
133  DALI_TEST_CHECK( waveEffect );
134 
135  waveEffect.Reset();
136 
137  //Additional check to ensure object is created by checking if it's registered
139  DALI_TEST_CHECK( registry );
140 
142  registry.ObjectCreatedSignal().Connect( &TestCallback );
143  {
145  waveEffect.SetSize( VIEW_AREA_SIZE );
146  }
148  END_TEST;
149 }
150 
152 {
153  ToolkitTestApplication application;
154  tet_infoline(" UtcDaliCubeTransitionCrossEffectNew ");
155 
156  CubeTransitionEffect crossEffect;
157 
158  DALI_TEST_CHECK( !crossEffect );
159 
161  crossEffect.SetSize( VIEW_AREA_SIZE );
162 
163  DALI_TEST_CHECK( crossEffect );
164 
165  crossEffect.Reset();
166 
167  //Additional check to ensure object is created by checking if it's registered
169  DALI_TEST_CHECK( registry );
170 
172  registry.ObjectCreatedSignal().Connect( &TestCallback );
173  {
175  crossEffect.SetSize( VIEW_AREA_SIZE );
176  }
178  END_TEST;
179 }
180 
182 {
183  ToolkitTestApplication application;
184  tet_infoline( " UtcDaliCubeTransitionFoldEffectNew " );
185 
186  CubeTransitionEffect foldEffect;
187 
188  DALI_TEST_CHECK( !foldEffect );
189 
191  foldEffect.SetSize( VIEW_AREA_SIZE );
192 
193  DALI_TEST_CHECK( foldEffect );
194 
195  foldEffect.Reset();
196 
197  //Additional check to ensure object is created by checking if it is registered
199  DALI_TEST_CHECK( registry );
200 
202  registry.ObjectCreatedSignal().Connect( &TestCallback );
203  {
205  foldEffect.SetSize( VIEW_AREA_SIZE );
206  }
208  END_TEST;
209 }
210 
212 {
213  ToolkitTestApplication application;
214  tet_infoline(" UtcDaliCubeTransitionEffectSetGetTransitionDuration ");
215 
218  waveEffect.SetSize( VIEW_AREA_SIZE );
220 
222  crossEffect.SetTransitionDuration( TRANSITION_DURATION );
223  crossEffect.SetSize( VIEW_AREA_SIZE );
224  DALI_TEST_EQUALS( TRANSITION_DURATION, crossEffect.GetTransitionDuration(), TEST_LOCATION );
225 
227  foldEffect.SetSize( VIEW_AREA_SIZE );
228  foldEffect.SetTransitionDuration( TRANSITION_DURATION );
229  DALI_TEST_EQUALS( TRANSITION_DURATION, foldEffect.GetTransitionDuration(), TEST_LOCATION );
230  END_TEST;
231 }
232 
234 {
235  ToolkitTestApplication application;
236  tet_infoline(" UtcDaliCubeTransitionEffectSetGetTransitionDuration ");
237 
239  waveEffect.SetSize( VIEW_AREA_SIZE );
242 
244  crossEffect.SetSize( VIEW_AREA_SIZE );
245  crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
246  DALI_TEST_EQUALS( CUBE_DISPLACEMENT, crossEffect.GetCubeDisplacement(), TEST_LOCATION );
247 
248  //Cube displacement is not used in CubeTransitionFoldEffect
249  END_TEST;
250 }
251 
252 //Test common codes in base class
254 {
255  ToolkitTestApplication application;
256  tet_infoline(" UtcDaliCubeTransitionEffectGetRoot ");
257 
258  unsigned int totalNum = NUM_ROWS*NUM_COLUMNS;
259 
260  Image image = BufferImage::New( 40, 40 ) ;
261 
262  CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS );
263  waveEffect.SetSize( VIEW_AREA_SIZE );
264  Stage::GetCurrent().Add( waveEffect );
265  waveEffect.SetCurrentImage( image );
266  waveEffect.SetTargetImage( image );
267 
268  application.SendNotification();
269  application.Render();
270 
271  waveEffect.StartTransition();
272 
273  Wait( application, TRANSITION_DURATION * 0.5f );
274 
275  // check that we have a total of NUM_ROWS*NUM_COLUMNS cubes;
276  Actor boxesRoot = waveEffect.GetChildAt(0);
277  DALI_TEST_CHECK( totalNum == boxesRoot.GetChildCount() );
278 
279  // check that every cube has two children
280  DALI_TEST_CHECK( 2 == boxesRoot.GetChildAt(0).GetChildCount() );
281  DALI_TEST_CHECK( 2 == boxesRoot.GetChildAt(totalNum/2).GetChildCount() );
282  DALI_TEST_CHECK( 2 == boxesRoot.GetChildAt(totalNum-1).GetChildCount() );
283  END_TEST;
284 }
285 
287 {
288  ToolkitTestApplication application;
289  tet_infoline(" UtcDaliCubeTransitionEffectIsTransiting ");
290 
292  Image image = BufferImage::New( 40, 40 ) ;
293 
295  waveEffect.SetSize( VIEW_AREA_SIZE );
296  Stage::GetCurrent().Add( waveEffect );
297 
300  DALI_TEST_CHECK( !waveEffect.IsTransitioning() );
301 
302  waveEffect.SetCurrentImage( image );
303  waveEffect.SetTargetImage( image );
304  //transition is started
305  waveEffect.StartTransition();
306  DALI_TEST_CHECK( waveEffect.IsTransitioning() );
307  //transition is finished
308  Wait( application, TRANSITION_DURATION );
309  DALI_TEST_CHECK( !waveEffect.IsTransitioning() );
310 
312  crossEffect.SetSize( VIEW_AREA_SIZE );
313  Stage::GetCurrent().Add( crossEffect );
314 
315  crossEffect.SetTransitionDuration( TRANSITION_DURATION );
316  crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
317  DALI_TEST_CHECK( !crossEffect.IsTransitioning() );
318 
319  crossEffect.SetCurrentImage( image );
320  crossEffect.SetTargetImage( image );
321  //transition is started
322  crossEffect.StartTransition(false);
323  DALI_TEST_CHECK( crossEffect.IsTransitioning() );
324  //transition is finished
325  Wait( application, TRANSITION_DURATION );
326  DALI_TEST_CHECK( !crossEffect.IsTransitioning() );
327 
329  foldEffect.SetSize( VIEW_AREA_SIZE );
330  Stage::GetCurrent().Add( foldEffect );
331 
332  foldEffect.SetTransitionDuration( TRANSITION_DURATION );
333  DALI_TEST_CHECK( !foldEffect.IsTransitioning() );
334 
335  foldEffect.SetCurrentImage( image );
336  foldEffect.SetTargetImage( image );
337  //transition is started
338  foldEffect.StartTransition(true);
339  DALI_TEST_CHECK(foldEffect.IsTransitioning() );
340  //transition is finished
341  Wait( application, TRANSITION_DURATION );
342  DALI_TEST_CHECK( !foldEffect.IsTransitioning() );
343 
344  END_TEST;
345 }
346 
347 //Test common codes in base class
349 {
350  ToolkitTestApplication application;
351  tet_infoline(" UtcDaliCubeTransitionEffectSetCurrentImage ");
352 
354  Image image = BufferImage::New( 40, 40 ) ;
355 
357  waveEffect.SetSize( VIEW_AREA_SIZE );
358  waveEffect.SetCurrentImage( image );
359 
360  Stage::GetCurrent().Add( waveEffect );
361 
362  application.SendNotification();
363  application.Render();
364 
365  waveEffect.StartTransition();
366 
367  // the current image content is set to the tiles facing the camera
368  Actor currentTile = waveEffect.GetChildAt(0).GetChildAt(0).GetChildAt(0);
369  Actor targetTile = waveEffect.GetChildAt(0).GetChildAt(0).GetChildAt(1);
370 
371  //check the pixel area set to the cube
372  Vector4 pixelAreaDef( 0.f, 0.f, 1.f / NUM_COLUMNS, 1.f / NUM_ROWS);
373 
374  Property::Index textureRectIndex = currentTile.GetPropertyIndex( "uTextureRect" );
375  DALI_TEST_CHECK( textureRectIndex != Property::INVALID_INDEX );
376  Property::Value textureRectValue = currentTile.GetProperty( textureRectIndex );
377  DALI_TEST_CHECK( textureRectValue.GetType() == Property::VECTOR4 );
378  Vector4 pixelArea;
379  DALI_TEST_CHECK( textureRectValue.Get( pixelArea ) );
380 
381  DALI_TEST_EQUALS( pixelAreaDef, pixelArea, FLT_EPISILON, TEST_LOCATION );
382 
383  END_TEST;
384 }
385 
386 //Test common codes in base class
388 {
389  ToolkitTestApplication application;
390  tet_infoline(" UtcDaliCubeTransitionEffectSetTargetImage ");
391 
393  Image image = BufferImage::New( 30, 30 );
394 
396  waveEffect.SetSize( VIEW_AREA_SIZE );
397  Stage::GetCurrent().Add( waveEffect );
398 
399  waveEffect.SetCurrentImage( image );
400  waveEffect.SetTargetImage( image );
401 
402  Stage::GetCurrent().Add( waveEffect );
403 
404  application.SendNotification();
405  application.Render();
406 
407  waveEffect.StartTransition();
408 
409  // the target image content is set to the tiles currently invisible to the camera
410  Actor tile = waveEffect.GetChildAt(0).GetChildAt(0).GetChildAt(1);
411 
412  //check the pixel area set to the cube
413  Vector4 pixelAreaDef( 0.f, 0.f, 1.f / NUM_COLUMNS, 1.f / NUM_ROWS);
414 
415  Property::Index textureRectIndex = tile.GetPropertyIndex( "uTextureRect" );
416  DALI_TEST_CHECK( textureRectIndex != -1 );
417  Property::Value textureRectValue = tile.GetProperty( textureRectIndex );
418  DALI_TEST_CHECK( textureRectValue.GetType() == Property::VECTOR4 );
419  Vector4 pixelArea;
420  DALI_TEST_CHECK( textureRectValue.Get( pixelArea ) );
421 
422  DALI_TEST_EQUALS( pixelAreaDef, pixelArea, FLT_EPISILON, TEST_LOCATION );
423 
424  END_TEST;
425 }
426 
428 {
429  ToolkitTestApplication application;
430  tet_infoline(" UtcDaliCubeTransitionWaveEffectStartTransition ");
431 
433  Image image = ResourceImage::New( "Image.jpg" );
434 
436  waveEffect.SetSize( VIEW_AREA_SIZE );
439  waveEffect.SetCurrentImage( image );
440 
441  Stage::GetCurrent().Add( waveEffect );
442 
443  application.SendNotification();
444  application.Render();
445 
446  waveEffect.StartTransition( true );
447 
448  Actor cube = waveEffect.GetChildAt(0).GetChildAt(0);
449 
450  //check the cube rotation value and color values just before the end of different transitions
451  waveEffect.SetTargetImage( image );
452  Wait( application, TRANSITION_BEFORE_END_DURATION );
456 
457  waveEffect.SetTargetImage( image );
459  Wait( application, TRANSITION_BEFORE_END_DURATION );
463 
464  waveEffect.SetTargetImage( image );
465  waveEffect.StartTransition(false);
466  Wait( application, TRANSITION_BEFORE_END_DURATION );
470 
471  waveEffect.SetTargetImage( image );
473  Wait( application, TRANSITION_BEFORE_END_DURATION );
477  END_TEST;
478 }
479 
481 {
482  ToolkitTestApplication application;
483  tet_infoline(" UtcDaliCubeTransitionCrossEffectStartTransition ");
484 
486  Image image = ResourceImage::New( "Image.jpg" );
487 
489  crossEffect.SetSize( VIEW_AREA_SIZE );
491  crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
492  crossEffect.SetCurrentImage( image );
493  crossEffect.SetTargetImage( image );
494 
495  Stage::GetCurrent().Add( crossEffect );
496 
497  application.SendNotification();
498  application.Render();
499 
500  crossEffect.StartTransition(true);
501 
502  Actor cube0 = crossEffect.GetChildAt(0).GetChildAt(0);
503  Actor cube1 = crossEffect.GetChildAt(0).GetChildAt(1);
504 
505  //check the cube rotation value and color values just before the end of different transitions
506  Wait( application, TRANSITION_BEFORE_END_DURATION );
511 
512 
513  crossEffect.SetTargetImage( image );
515  Wait( application, TRANSITION_BEFORE_END_DURATION );
520 
521 
522  crossEffect.SetTargetImage( image );
523  crossEffect.StartTransition(false);
524  Wait( application, TRANSITION_BEFORE_END_DURATION );
529 
530  crossEffect.SetTargetImage( image );
532  Wait( application, TRANSITION_BEFORE_END_DURATION );
537  END_TEST;
538 }
539 
541 {
542  ToolkitTestApplication application;
543  tet_infoline(" UtcDaliCubeTransitionFoldEffectStartTransition ");
544 
546  Image image = BufferImage::New( 30, 30 );
547 
549  foldEffect.SetSize( VIEW_AREA_SIZE );
551  foldEffect.SetCurrentImage( image );
552  foldEffect.SetTargetImage( image );
553 
554  Stage::GetCurrent().Add( foldEffect );
555 
556  application.SendNotification();
557  application.Render();
558 
559  foldEffect.StartTransition(true);
560 
561  Actor cube0 = foldEffect.GetChildAt(0).GetChildAt(0);
562  Actor cube1 = foldEffect.GetChildAt(0).GetChildAt(1);
563 
564  //check the cube rotation value and color values just before the end of different transitions
565  Wait( application, TRANSITION_BEFORE_END_DURATION );
570 
571  foldEffect.SetTargetImage( image );
573  Wait( application, TRANSITION_BEFORE_END_DURATION );
578 
579 
580  foldEffect.SetTargetImage( image );
581  foldEffect.StartTransition(false);
582  Wait( application, TRANSITION_BEFORE_END_DURATION );
587 
588  foldEffect.SetTargetImage( image );
590  Wait( application, TRANSITION_BEFORE_END_DURATION );
595  END_TEST;
596 }
597 
599 {
600  ToolkitTestApplication application;
601  tet_infoline(" UtcDaliCubeTransitionEffectSignalTransitionCompleted ");
602 
604  Image firstImage = BufferImage::New( 30, 30 );
605  Image secondImage = BufferImage::New( 20, 20 );
606  Image thirdImage = BufferImage::New( 40, 40 );
607 
609  waveEffect.SetSize( VIEW_AREA_SIZE );
612  Stage::GetCurrent().Add( waveEffect );
613 
615  crossEffect.SetSize( VIEW_AREA_SIZE );
617  crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
618  Stage::GetCurrent().Add( crossEffect );
619 
621  foldEffect.SetSize( VIEW_AREA_SIZE );
623  Stage::GetCurrent().Add( foldEffect );
624 
625  bool signalVerified = false;
626  CubeTransitionEffect currentEffect;
627  Image actorTransitTo;
628  TransitionCompletedCallback callback(signalVerified, currentEffect, actorTransitTo);
629  waveEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
630  crossEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
631  foldEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
632 
633  //check that the wave effect is used to transit to secondImage
634  currentEffect = waveEffect;
635  actorTransitTo = secondImage;
636  waveEffect.SetCurrentImage( firstImage );
637  waveEffect.SetTargetImage( secondImage );
639  Wait( application, TRANSITION_DURATION );
640  DALI_TEST_CHECK(callback.mSignalVerified);
641  callback.Reset();
642 
643  //check that the wave effect is used to transit to thirdImage
644  actorTransitTo = thirdImage;
645  waveEffect.SetTargetImage( thirdImage );
647  Wait( application, TRANSITION_DURATION );
648  DALI_TEST_CHECK(callback.mSignalVerified);
649  callback.Reset();
650 
651  //check that the cross effect is used to transit to secondImage
652  currentEffect = crossEffect;
653  actorTransitTo = secondImage;
654  crossEffect.SetCurrentImage( thirdImage );
655  crossEffect.SetTargetImage( secondImage );
656  crossEffect.StartTransition(true);
657  Wait( application, TRANSITION_DURATION );
658  DALI_TEST_CHECK(callback.mSignalVerified);
659  callback.Reset();
660 
661  //check that the cross effect is used to transit to firstImage
662  actorTransitTo = firstImage;
663  crossEffect.SetTargetImage( firstImage );
664  crossEffect.StartTransition(false);
665  Wait( application, TRANSITION_DURATION );
666  DALI_TEST_CHECK(callback.mSignalVerified);
667  callback.Reset();
668 
669  //check that the fold effect is used to transit to secondImage
670  currentEffect = foldEffect;
671  actorTransitTo = secondImage;
672  foldEffect.SetCurrentImage( firstImage );
673  foldEffect.SetTargetImage( secondImage );
674  foldEffect.StartTransition();
675  Wait( application, TRANSITION_DURATION );
676  DALI_TEST_CHECK( callback.mSignalVerified );
677  callback.Reset();
678 
679  //check that the fold effect is used to transit to thirdImage
680  actorTransitTo = thirdImage;
681  foldEffect.SetTargetImage( thirdImage );
682  foldEffect.StartTransition( false );
683  Wait( application, TRANSITION_DURATION );
684  DALI_TEST_CHECK( callback.mSignalVerified );
685  END_TEST;
686 }
687 
689 {
690  ToolkitTestApplication application;
691  tet_infoline(" UtcDaliCubeTransitionEffectPauseResumeTransition ");
692 
694  Image firstImage = BufferImage::New( 30, 30 );
695  Image secondImage = BufferImage::New( 20, 20 );
696 
698  waveEffect.SetSize( VIEW_AREA_SIZE );
701  Stage::GetCurrent().Add( waveEffect );
702 
704  crossEffect.SetSize( VIEW_AREA_SIZE );
706  crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
707  Stage::GetCurrent().Add( crossEffect );
708 
710  foldEffect.SetSize( VIEW_AREA_SIZE );
712  Stage::GetCurrent().Add( foldEffect );
713 
714  bool signalVerified = false;
715  CubeTransitionEffect currentEffect;
716  Image actorTransitTo;
717  TransitionCompletedCallback callback(signalVerified, currentEffect, actorTransitTo);
718  waveEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
719  crossEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
720  foldEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
721 
722  currentEffect = waveEffect;
723  actorTransitTo = secondImage;
724  waveEffect.SetCurrentImage( firstImage );
725  waveEffect.SetTargetImage( secondImage );
726  // start transition; transit for 0.5*duration; pause for 0.5*duration;
727  // resume for 0.25*duration; pause for 0.25*duration; resume for another 0.25*duration;
728  // only until now the transition finished signal can be received
730  Wait( application, TRANSITION_DURATION*0.5f );
731  DALI_TEST_CHECK(!callback.mSignalVerified);
732  waveEffect.PauseTransition();
733  Wait( application, TRANSITION_DURATION*0.5f );
734  DALI_TEST_CHECK(!callback.mSignalVerified);
735  waveEffect.ResumeTransition();
736  Wait( application, TRANSITION_DURATION*0.25f );
737  DALI_TEST_CHECK(!callback.mSignalVerified);
738  waveEffect.PauseTransition();
739  Wait( application, TRANSITION_DURATION*0.25f );
740  DALI_TEST_CHECK(!callback.mSignalVerified);
741  waveEffect.ResumeTransition();
742  Wait( application, TRANSITION_DURATION*0.25f );
743  DALI_TEST_CHECK(callback.mSignalVerified);
744  callback.Reset();
745 
746  currentEffect = crossEffect;
747  actorTransitTo = firstImage;
748  crossEffect.SetCurrentImage( secondImage );
749  crossEffect.SetTargetImage( firstImage );
750  // start transition; transit for 0.25*duration; pause for 0.2*duration;
751  // resume for 0.5*duration; pause for 0.2*duration; resume for another 0.25*duration;
752  // only until now the transition finished signal can be received
753  crossEffect.StartTransition(false);
754  Wait( application, TRANSITION_DURATION*0.25f );
755  DALI_TEST_CHECK(!callback.mSignalVerified);
756  crossEffect.PauseTransition();
757  Wait( application, TRANSITION_DURATION*0.2f );
758  DALI_TEST_CHECK(!callback.mSignalVerified);
759  crossEffect.ResumeTransition();
760  Wait( application, TRANSITION_DURATION*0.5f );
761  DALI_TEST_CHECK(!callback.mSignalVerified);
762  crossEffect.PauseTransition();
763  Wait( application, TRANSITION_DURATION*0.2f );
764  DALI_TEST_CHECK(!callback.mSignalVerified);
765  crossEffect.ResumeTransition();
766  Wait( application, TRANSITION_DURATION*0.25f );
767  DALI_TEST_CHECK(callback.mSignalVerified);
768  callback.Reset();
769 
770  currentEffect = foldEffect;
771  actorTransitTo = secondImage;
772  foldEffect.SetCurrentImage( firstImage );
773  foldEffect.SetTargetImage( secondImage );
774  // start transition; transit for 0.5*duration; pause for 0.5*duration;
775  // resume for 0.25*duration; pause for 0.25*duration; resume for another 0.25*duration;
776  // only until now the transition finished signal can be received
778  Wait( application, TRANSITION_DURATION*0.5f );
779  DALI_TEST_CHECK(!callback.mSignalVerified);
780  foldEffect.PauseTransition();
781  Wait( application, TRANSITION_DURATION*0.5f );
782  DALI_TEST_CHECK(!callback.mSignalVerified);
783  foldEffect.ResumeTransition();
784  Wait( application, TRANSITION_DURATION*0.25f );
785  DALI_TEST_CHECK(!callback.mSignalVerified);
786  foldEffect.PauseTransition();
787  Wait( application, TRANSITION_DURATION*0.25f );
788  DALI_TEST_CHECK(!callback.mSignalVerified);
789  foldEffect.ResumeTransition();
790  Wait( application, TRANSITION_DURATION*0.25f );
791  DALI_TEST_CHECK(callback.mSignalVerified);
792  END_TEST;
793 }
794 
796 {
797  ToolkitTestApplication application;
798  tet_infoline(" UtcDaliCubeTransitionWaveEffectStopTransition ");
799 
801  Image firstImage = BufferImage::New( 30, 30 );
802  Image secondImage = BufferImage::New( 20, 20 );
803 
805  waveEffect.SetSize( VIEW_AREA_SIZE );
808  waveEffect.SetCurrentImage( firstImage );
809  waveEffect.SetTargetImage( secondImage );
810 
811  Stage::GetCurrent().Add( waveEffect );
812 
813  application.SendNotification();
814  application.Render();
815 
816  waveEffect.StartTransition(true);
817 
818  Actor cube = waveEffect.GetChildAt(0).GetChildAt(0);
819 
820  //check the cube rotation value and color values reset after stopping different transitions in the middle
821  Wait( application, TRANSITION_DURATION*0.2f );
822  waveEffect.StopTransition();
823  application.SendNotification();
824  application.Render(RENDER_FRAME_INTERVAL);
828 
829  waveEffect.SetTargetImage( firstImage );
831  Wait( application, TRANSITION_DURATION*0.4f );
832  waveEffect.StopTransition();
833  application.SendNotification();
834  application.Render(RENDER_FRAME_INTERVAL);
838 
839  waveEffect.SetTargetImage( secondImage );
840  waveEffect.StartTransition(false);
841  Wait( application, TRANSITION_DURATION*0.6f );
842  waveEffect.StopTransition();
843  application.SendNotification();
844  application.Render(RENDER_FRAME_INTERVAL);
848 
849  waveEffect.SetTargetImage( firstImage );
851  Wait( application, TRANSITION_DURATION*0.8f );
852  waveEffect.StopTransition();
853  application.SendNotification();
854  application.Render(RENDER_FRAME_INTERVAL);
858  END_TEST;
859 }
860 
862 {
863  ToolkitTestApplication application;
864  tet_infoline(" UtcDaliCubeTransitionCrossEffectStopTransition ");
865 
867  Image firstImage = BufferImage::New( 30, 30 );
868  Image secondImage = BufferImage::New( 20, 20 );
869 
871  crossEffect.SetSize( VIEW_AREA_SIZE );
873  crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
874  crossEffect.SetCurrentImage( firstImage );
875  crossEffect.SetTargetImage( secondImage );
876 
877  Stage::GetCurrent().Add( crossEffect );
878 
879  application.SendNotification();
880  application.Render();
881 
882  crossEffect.StartTransition(true);
883 
884  Actor cube0 = crossEffect.GetChildAt(0).GetChildAt(0);
885  Actor cube1 = crossEffect.GetChildAt(0).GetChildAt(1);
886 
887  //check the cube rotation values and color values reset after stop the different transitions in the middle
888  Wait( application, TRANSITION_DURATION*0.2f );
889  crossEffect.StopTransition();
890  application.SendNotification();
891  application.Render(RENDER_FRAME_INTERVAL);
896 
897  crossEffect.SetTargetImage( firstImage );
899  Wait( application, TRANSITION_DURATION*0.4f );
900  crossEffect.StopTransition();
901  application.SendNotification();
902  application.Render(RENDER_FRAME_INTERVAL);
907 
908  crossEffect.SetTargetImage( secondImage );
909  crossEffect.StartTransition(false);
910  Wait( application, TRANSITION_DURATION*0.6f );
911  crossEffect.StopTransition();
912  application.SendNotification();
913  application.Render(RENDER_FRAME_INTERVAL);
918 
919  crossEffect.SetTargetImage( firstImage );
921  Wait( application, TRANSITION_DURATION*0.8f );
922  crossEffect.StopTransition();
923  application.SendNotification();
924  application.Render(RENDER_FRAME_INTERVAL);
929  END_TEST;
930 }
931 
933 {
934  ToolkitTestApplication application;
935  tet_infoline(" UtcDaliCubeTransitionFoldEffectStopTransition ");
936 
938  Image firstImage = BufferImage::New( 30, 30 );
939  Image secondImage = BufferImage::New( 20, 20 );
940 
942  foldEffect.SetSize( VIEW_AREA_SIZE );
944  foldEffect.SetCurrentImage( firstImage );
945  foldEffect.SetTargetImage( secondImage );
946 
947  Stage::GetCurrent().Add( foldEffect );
948 
949  application.SendNotification();
950  application.Render();
951 
952  foldEffect.StartTransition(true);
953 
954  Actor cube0 = foldEffect.GetChildAt(0).GetChildAt(0);
955  Actor cube1 = foldEffect.GetChildAt(0).GetChildAt(1);
956 
957  //check the cube rotation values and color values after stop the different transitions in the middle
958  Wait( application, TRANSITION_DURATION*0.2f );
959  foldEffect.StopTransition();
960  application.SendNotification();
961  application.Render(RENDER_FRAME_INTERVAL);
962 
967 
968  foldEffect.SetTargetImage( firstImage );
970  Wait( application, TRANSITION_DURATION*0.4f );
971  foldEffect.StopTransition();
972  application.SendNotification();
973  application.Render(RENDER_FRAME_INTERVAL);
978 
979  foldEffect.SetTargetImage( secondImage );
980  foldEffect.StartTransition(false);
981  Wait( application, TRANSITION_DURATION*0.6f );
982  foldEffect.StopTransition();
983  application.SendNotification();
984  application.Render(RENDER_FRAME_INTERVAL);
989 
990  foldEffect.SetTargetImage( firstImage );
992  Wait( application, TRANSITION_DURATION*0.8f );
993  foldEffect.StopTransition();
994  application.SendNotification();
995  application.Render(RENDER_FRAME_INTERVAL);
1000  END_TEST;
1001 }
Dali Docs Home
Read more about Dali