2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.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
8 // http://floralicense.org/license/
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.
19 #include <dali-toolkit-test-suite-utils.h>
20 #include <dali-toolkit/dali-toolkit.h>
23 using namespace Dali::Toolkit;
28 const unsigned int NUM_ROWS = 16;
29 const unsigned int NUM_COLUMNS = 10;
30 const Vector2 VIEW_AREA_SIZE( 480.0f, 800.0f );
31 const float TRANSITION_DURATION = 0.5f;
32 const float CUBE_DISPLACEMENT = 55.f;
33 const Vector2 PAN_POSITION1( VIEW_AREA_SIZE.x * 0.75f, VIEW_AREA_SIZE.y * 0.25f );
34 const Vector2 PAN_DISPLACEMENT1( -5.f, 5.f );
35 const Vector2 PAN_POSITION2( VIEW_AREA_SIZE.x * 0.25f, VIEW_AREA_SIZE.y * 0.75f );
36 const Vector2 PAN_DISPLACEMENT2( 5.f, 5.f );
37 const int RENDER_FRAME_INTERVAL = 16;
38 static const float ROTATION_EPSILON = 0.0001f;
39 const float OFFSCREEN_RENDER_DURATION = 0.05f;
41 static bool gObjectCreatedCallBackCalled;
42 static void TestCallback(BaseHandle handle)
44 gObjectCreatedCallBackCalled = true;
48 * Simulate time passed by, waiting for certain process to finish
49 * @param[in] application Test application instance
50 * @param[in] durationToPass Time to pass in milliseconds.
52 void Wait(ToolkitTestApplication& application, float durationToPass)
54 int duration = static_cast<int>(durationToPass*1000.f);
55 // wait 2 more frames to compensate the two frames used by the bitmapImage waiting for the loading succeeded signal
56 for(int i = 0; i <= duration/RENDER_FRAME_INTERVAL+2 ; i++)
58 application.SendNotification();
59 application.Render(RENDER_FRAME_INTERVAL);
65 //Callback class to test whether transition completed signal is emitted when the transition animation is finished
66 class TransitionCompletedCallback : public Dali::ConnectionTracker
69 TransitionCompletedCallback( bool& signalReceived, CubeTransitionEffect& effect, ImageActor& imageActor )
70 : mSignalVerified( signalReceived ),
71 mCurrentEffect( effect ),
72 mActorTransitTo( imageActor )
76 void Callback( CubeTransitionEffect effect, ImageActor imageActor )
78 tet_infoline( "Verifying TransitionCompletedSignal" );
80 if( mCurrentEffect == effect && mActorTransitTo == imageActor )
82 mSignalVerified = true;
88 mSignalVerified = false;
91 bool& mSignalVerified;
92 CubeTransitionEffect& mCurrentEffect;
93 ImageActor& mActorTransitTo;
100 void cube_transition_effect_startup(void)
102 test_return_value = TET_UNDEF;
105 void cube_transition_effect_cleanup(void)
107 test_return_value = TET_PASS;
110 int UtcDaliCubeTransitionWaveEffectNew(void)
112 ToolkitTestApplication application;
113 tet_infoline(" UtcDaliCubeTransitionWaveEffectNew ");
115 CubeTransitionEffect waveEffect;
117 DALI_TEST_CHECK( !waveEffect );
119 waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
121 DALI_TEST_CHECK( waveEffect );
125 //Additional check to ensure object is created by checking if it's registered
126 ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
127 DALI_TEST_CHECK( registry );
129 gObjectCreatedCallBackCalled = false;
130 registry.ObjectCreatedSignal().Connect( &TestCallback );
132 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
134 DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
138 int UtcDaliCubeTransitionCrossEffectNew(void)
140 ToolkitTestApplication application;
141 tet_infoline(" UtcDaliCubeTransitionCrossEffectNew ");
143 CubeTransitionEffect crossEffect;
145 DALI_TEST_CHECK( !crossEffect );
147 crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
149 DALI_TEST_CHECK( crossEffect );
153 //Additional check to ensure object is created by checking if it's registered
154 ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
155 DALI_TEST_CHECK( registry );
157 gObjectCreatedCallBackCalled = false;
158 registry.ObjectCreatedSignal().Connect( &TestCallback );
160 CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
162 DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
166 int UtcDaliCubeTransitionFoldEffectNew(void)
168 ToolkitTestApplication application;
169 tet_infoline( " UtcDaliCubeTransitionFoldEffectNew " );
171 CubeTransitionEffect foldEffect;
173 DALI_TEST_CHECK( !foldEffect );
175 foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
177 DALI_TEST_CHECK( foldEffect );
181 //Additional check to ensure object is created by checking if it is registered
182 ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
183 DALI_TEST_CHECK( registry );
185 gObjectCreatedCallBackCalled = false;
186 registry.ObjectCreatedSignal().Connect( &TestCallback );
188 CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
190 DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
194 int UtcDaliCubeTransitionEffectSetGetTransitionDuration(void)
196 ToolkitTestApplication application;
197 tet_infoline(" UtcDaliCubeTransitionEffectSetGetTransitionDuration ");
199 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
200 waveEffect.SetTransitionDuration( TRANSITION_DURATION );
201 DALI_TEST_EQUALS( TRANSITION_DURATION, waveEffect.GetTransitionDuration(), TEST_LOCATION );
203 CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
204 crossEffect.SetTransitionDuration( TRANSITION_DURATION );
205 DALI_TEST_EQUALS( TRANSITION_DURATION, crossEffect.GetTransitionDuration(), TEST_LOCATION );
207 CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
208 foldEffect.SetTransitionDuration( TRANSITION_DURATION );
209 DALI_TEST_EQUALS( TRANSITION_DURATION, foldEffect.GetTransitionDuration(), TEST_LOCATION );
213 int UtcDaliCubeTransitionEffectSetGetCubeDisplacement(void)
215 ToolkitTestApplication application;
216 tet_infoline(" UtcDaliCubeTransitionEffectSetGetTransitionDuration ");
218 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
219 waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
220 DALI_TEST_EQUALS( CUBE_DISPLACEMENT, waveEffect.GetCubeDisplacement(), TEST_LOCATION );
222 CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
223 crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
224 DALI_TEST_EQUALS( CUBE_DISPLACEMENT, crossEffect.GetCubeDisplacement(), TEST_LOCATION );
226 //Cube displacement is not used in CubeTransitionFoldEffect
230 //Test common codes in base class
231 int UtcDaliCubeTransitionEffectGetRoot(void)
233 ToolkitTestApplication application;
234 tet_infoline(" UtcDaliCubeTransitionEffectGetRoot ");
236 unsigned int totalNum = NUM_ROWS*NUM_COLUMNS;
238 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
239 Actor rootActor = waveEffect.GetRoot();
241 // check that we have a total of NUM_ROWS*NUM_COLUMNS cubes;
242 DALI_TEST_CHECK( totalNum == rootActor.GetChildCount() );
244 // check that every cube has two children
245 DALI_TEST_CHECK( 2 == rootActor.GetChildAt(0).GetChildCount() );
246 DALI_TEST_CHECK( 2 == rootActor.GetChildAt(totalNum/2).GetChildCount() );
247 DALI_TEST_CHECK( 2 == rootActor.GetChildAt(totalNum-1).GetChildCount() );
251 int UtcDaliCubeTransitionEffectIsTransiting(void)
253 ToolkitTestApplication application;
254 tet_infoline(" UtcDaliCubeTransitionEffectIsTransiting ");
256 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
257 ImageActor imageActor = CreateSolidColorImageActor(application, Color::BLUE,30,30);
259 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
260 Actor rootActor = waveEffect.GetRoot();
261 Stage::GetCurrent().Add( rootActor );
263 waveEffect.SetTransitionDuration( TRANSITION_DURATION );
264 waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
265 DALI_TEST_CHECK( !waveEffect.IsTransiting() );
267 waveEffect.SetCurrentImage(imageActor);
268 waveEffect.SetTargetImage(imageActor);
269 //transition is started
270 waveEffect.StartTransition();
271 DALI_TEST_CHECK( waveEffect.IsTransiting() );
272 //transition is finished
273 Wait( application, TRANSITION_DURATION );
274 DALI_TEST_CHECK( !waveEffect.IsTransiting() );
276 CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
277 crossEffect.SetTransitionDuration( TRANSITION_DURATION );
278 crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
279 DALI_TEST_CHECK( !crossEffect.IsTransiting() );
281 crossEffect.SetCurrentImage(imageActor);
282 crossEffect.SetTargetImage(imageActor);
283 //transition is started
284 crossEffect.StartTransition(false);
285 DALI_TEST_CHECK( crossEffect.IsTransiting() );
286 //transition is finished
287 Wait( application, TRANSITION_DURATION );
288 DALI_TEST_CHECK( !crossEffect.IsTransiting() );
290 CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
291 foldEffect.SetTransitionDuration( TRANSITION_DURATION );
292 DALI_TEST_CHECK( !foldEffect.IsTransiting() );
294 foldEffect.SetCurrentImage( imageActor );
295 foldEffect.SetTargetImage( imageActor );
296 //transition is started
297 foldEffect.StartTransition(true);
298 DALI_TEST_CHECK(foldEffect.IsTransiting() );
299 //transition is finished
300 Wait( application, TRANSITION_DURATION );
301 DALI_TEST_CHECK( !foldEffect.IsTransiting() );
306 //Test common codes in base class
307 int UtcDaliCubeTransitionEffectSetCurrentImage(void)
309 ToolkitTestApplication application;
310 tet_infoline(" UtcDaliCubeTransitionEffectSetCurrentImage ");
312 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
313 ImageActor imageActor = CreateSolidColorImageActor(application, Color::BLUE,40,40) ;
315 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
316 waveEffect.SetCurrentImage( imageActor );
318 // the current image content is set to the tiles facing the camera
319 ImageActor tile = ImageActor::DownCast( (waveEffect.GetRoot().GetChildAt(0).GetChildAt(0)));
321 //check the pixel area set to the cube
322 ImageActor::PixelArea pixelAreaDef( 0, 0, VIEW_AREA_SIZE.x / NUM_COLUMNS, VIEW_AREA_SIZE.y / NUM_ROWS);
323 ImageActor::PixelArea pixelArea = tile.GetPixelArea();
324 DALI_TEST_CHECK ( pixelAreaDef == pixelArea );
326 //check the size of the off screen rendered image
327 Wait( application, OFFSCREEN_RENDER_DURATION );
328 ImageAttributes attributes( tile.GetImage().GetAttributes() );
329 DALI_TEST_EQUALS( static_cast<float>(attributes.GetWidth()), VIEW_AREA_SIZE.x, TEST_LOCATION );
330 DALI_TEST_EQUALS( static_cast<float>(attributes.GetHeight()), VIEW_AREA_SIZE.y, TEST_LOCATION );
334 //Test common codes in base class
335 int UtcDaliCubeTransitionEffectSetTargetImage(void)
337 ToolkitTestApplication application;
338 tet_infoline(" UtcDaliCubeTransitionEffectSetTargetImage ");
340 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
341 ImageActor imageActor = CreateSolidColorImageActor(application, Color::BLUE,30,30);
343 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
344 Actor rootActor = waveEffect.GetRoot();
345 Stage::GetCurrent().Add( rootActor );
347 waveEffect.SetCurrentImage( imageActor );
348 waveEffect.SetTargetImage( imageActor );
350 // the target image content is set to the tiles currently invisible to the camera
351 ImageActor tile = ImageActor::DownCast( (rootActor.GetChildAt(0).GetChildAt(1)));
353 //check the pixel area set to the cube
354 ImageActor::PixelArea pixelAreaDef( 0, 0, VIEW_AREA_SIZE.x / NUM_COLUMNS, VIEW_AREA_SIZE.y / NUM_ROWS);
355 ImageActor::PixelArea pixelArea = tile.GetPixelArea();
356 DALI_TEST_CHECK ( pixelAreaDef == pixelArea );
358 //check the size of the off screen rendered image
359 Wait( application, OFFSCREEN_RENDER_DURATION );
360 ImageAttributes attributes( tile.GetImage().GetAttributes() );
361 DALI_TEST_EQUALS( static_cast<float>(attributes.GetWidth()), VIEW_AREA_SIZE.x, TEST_LOCATION );
362 DALI_TEST_EQUALS( static_cast<float>(attributes.GetHeight()), VIEW_AREA_SIZE.y, TEST_LOCATION );
366 int UtcDaliCubeTransitionWaveEffectStartTransition(void)
368 ToolkitTestApplication application;
369 tet_infoline(" UtcDaliCubeTransitionWaveEffectStartTransition ");
371 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
372 ImageActor imageActor = CreateSolidColorImageActor(application, Color::BLUE,30,30);
374 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
375 waveEffect.SetTransitionDuration( TRANSITION_DURATION );
376 waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
377 Actor rootActor = waveEffect.GetRoot();
378 Stage::GetCurrent().Add( rootActor );
379 Actor cube = rootActor.GetChildAt(0);
381 waveEffect.SetCurrentImage( imageActor );
383 Vector4 fullBrightness = Vector4(1.f,1.f,1.f,1.f);
384 Vector4 halfBrightness = Vector4(0.5f, 0.5f, 0.5f, 1.f);
386 //check the cube rotation value and color values after different transitions
387 waveEffect.SetTargetImage( imageActor );
388 waveEffect.StartTransition(true);
389 Wait( application, TRANSITION_DURATION );
390 DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
391 DALI_TEST_CHECK( cube.GetChildAt(0).GetCurrentColor() == halfBrightness );
392 DALI_TEST_CHECK( cube.GetChildAt(1).GetCurrentColor() == fullBrightness );
394 waveEffect.SetTargetImage( imageActor );
395 waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
396 Wait( application, TRANSITION_DURATION );
397 DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
398 DALI_TEST_CHECK( cube.GetChildAt(0).GetCurrentColor() == fullBrightness );
399 DALI_TEST_CHECK( cube.GetChildAt(1).GetCurrentColor() == halfBrightness );
401 waveEffect.SetTargetImage( imageActor );
402 waveEffect.StartTransition(false);
403 Wait( application, TRANSITION_DURATION );
404 DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
405 DALI_TEST_CHECK( cube.GetChildAt(0).GetCurrentColor() == halfBrightness );
406 DALI_TEST_CHECK( cube.GetChildAt(1).GetCurrentColor() == fullBrightness );
408 waveEffect.SetTargetImage( imageActor );
409 waveEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
410 Wait( application, TRANSITION_DURATION );
411 DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
412 DALI_TEST_CHECK( cube.GetChildAt(0).GetCurrentColor() == fullBrightness );
413 DALI_TEST_CHECK( cube.GetChildAt(1).GetCurrentColor() == halfBrightness );
417 int UtcDaliCubeTransitionCrossEffectStartTransition(void)
419 ToolkitTestApplication application;
420 tet_infoline(" UtcDaliCubeTransitionCrossEffectStartTransition ");
422 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
423 ImageActor imageActor = CreateSolidColorImageActor(application, Color::BLUE,30,30);
425 CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
426 crossEffect.SetTransitionDuration( TRANSITION_DURATION );
427 crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
428 Actor rootActor = crossEffect.GetRoot();
429 Stage::GetCurrent().Add( rootActor );
430 crossEffect.SetCurrentImage( imageActor );
431 Actor cube0 = rootActor.GetChildAt(0);
432 Actor cube1 = rootActor.GetChildAt(1);
434 Vector4 fullBrightness = Vector4(1.f,1.f,1.f,1.f);
435 Vector4 halfBrightness = Vector4(0.5f, 0.5f, 0.5f, 1.f);
437 //check the cube rotation values and color values after different transitions
438 crossEffect.SetTargetImage( imageActor );
439 crossEffect.StartTransition(true);
440 Wait( application, TRANSITION_DURATION );
441 DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
442 DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::XAXIS), ROTATION_EPSILON, TEST_LOCATION );
443 DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == halfBrightness );
444 DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == fullBrightness );
446 crossEffect.SetTargetImage( imageActor );
447 crossEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
448 Wait( application, TRANSITION_DURATION );
449 DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
450 DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 2.f*Math::PI_2, Vector3::XAXIS), ROTATION_EPSILON, TEST_LOCATION );
451 DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == fullBrightness );
452 DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == halfBrightness );
455 crossEffect.SetTargetImage( imageActor );
456 crossEffect.StartTransition(false);
457 Wait( application, TRANSITION_DURATION );
458 DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
459 DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::XAXIS), ROTATION_EPSILON, TEST_LOCATION );
460 DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == halfBrightness );
461 DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == fullBrightness );
463 crossEffect.SetTargetImage( imageActor );
464 crossEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
465 Wait( application, TRANSITION_DURATION );
466 DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
467 DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 0.f, Vector3::XAXIS), ROTATION_EPSILON, TEST_LOCATION );
468 DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == fullBrightness );
469 DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == halfBrightness );
473 int UtcDaliCubeTransitionFoldEffectStartTransition(void)
475 ToolkitTestApplication application;
476 tet_infoline(" UtcDaliCubeTransitionFoldEffectStartTransition ");
478 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
479 ImageActor imageActor = CreateSolidColorImageActor(application, Color::BLUE,30,30);
481 CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
482 foldEffect.SetTransitionDuration( TRANSITION_DURATION );
483 Actor rootActor = foldEffect.GetRoot();
484 Stage::GetCurrent().Add( rootActor );
485 foldEffect.SetCurrentImage( imageActor );
486 Actor cube0 = rootActor.GetChildAt(0);
487 Actor cube1 = rootActor.GetChildAt(1);
489 Vector4 fullBrightness = Vector4(1.f,1.f,1.f,1.f);
490 Vector4 halfBrightness = Vector4(0.5f, 0.5f, 0.5f, 1.f);
492 //check the cube rotation values and color values after different transitions
493 foldEffect.SetTargetImage( imageActor );
494 foldEffect.StartTransition(true);
495 Wait( application, TRANSITION_DURATION );
496 DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
497 DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
498 DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == halfBrightness );
499 DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == fullBrightness );
501 foldEffect.SetTargetImage( imageActor );
502 foldEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
503 Wait( application, TRANSITION_DURATION );
504 DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
505 DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 2.f*Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
506 DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == fullBrightness );
507 DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == halfBrightness );
510 foldEffect.SetTargetImage( imageActor );
511 foldEffect.StartTransition(false);
512 Wait( application, TRANSITION_DURATION );
513 DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
514 DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
515 DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == halfBrightness );
516 DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == fullBrightness );
518 foldEffect.SetTargetImage( imageActor );
519 foldEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
520 Wait( application, TRANSITION_DURATION );
521 DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
522 DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
523 DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == fullBrightness );
524 DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == halfBrightness );
528 int UtcDaliCubeTransitionEffectSignalTransitionCompleted(void)
530 ToolkitTestApplication application;
531 tet_infoline(" UtcDaliCubeTransitionEffectSignalTransitionCompleted ");
533 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
534 ImageActor firstImageActor = CreateSolidColorImageActor(application, Color::RED,30,30);
535 ImageActor secondImageActor = CreateSolidColorImageActor(application, Color::GREEN,20,20);
536 ImageActor thirdImageActor = CreateSolidColorImageActor(application, Color::BLUE,40,40);
538 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
539 waveEffect.SetTransitionDuration( TRANSITION_DURATION );
540 waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
541 Actor rootActor = waveEffect.GetRoot();
542 Stage::GetCurrent().Add( rootActor );
544 CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
545 crossEffect.SetTransitionDuration( TRANSITION_DURATION );
546 crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
547 rootActor = crossEffect.GetRoot();
548 Stage::GetCurrent().Add( rootActor );
550 CubeTransitionEffect foldEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
551 foldEffect.SetTransitionDuration( TRANSITION_DURATION );
552 rootActor = foldEffect.GetRoot();
553 Stage::GetCurrent().Add( rootActor );
555 bool signalVerified = false;
556 CubeTransitionEffect currentEffect;
557 ImageActor actorTransitTo;
558 TransitionCompletedCallback callback(signalVerified, currentEffect, actorTransitTo);
559 waveEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
560 crossEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
561 foldEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
563 //check that the wave effect is used to transit to secondImageActor
564 currentEffect = waveEffect;
565 actorTransitTo = secondImageActor;
566 waveEffect.SetCurrentImage( firstImageActor );
567 waveEffect.SetTargetImage( secondImageActor );
568 waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
569 Wait( application, TRANSITION_DURATION );
570 DALI_TEST_CHECK(callback.mSignalVerified);
573 //check that the wave effect is used to transit to thirdImageActor
574 actorTransitTo = thirdImageActor;
575 waveEffect.SetTargetImage( thirdImageActor );
576 waveEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
577 Wait( application, TRANSITION_DURATION );
578 DALI_TEST_CHECK(callback.mSignalVerified);
581 //check that the cross effect is used to transit to secondImageActor
582 currentEffect = crossEffect;
583 actorTransitTo = secondImageActor;
584 crossEffect.SetCurrentImage( thirdImageActor );
585 crossEffect.SetTargetImage( secondImageActor );
586 crossEffect.StartTransition(true);
587 Wait( application, TRANSITION_DURATION );
588 DALI_TEST_CHECK(callback.mSignalVerified);
591 //check that the cross effect is used to transit to firstImageActor
592 actorTransitTo = firstImageActor;
593 crossEffect.SetTargetImage( firstImageActor );
594 crossEffect.StartTransition(false);
595 Wait( application, TRANSITION_DURATION );
596 DALI_TEST_CHECK(callback.mSignalVerified);
599 //check that the fold effect is used to transit to secondImageActor
600 currentEffect = foldEffect;
601 actorTransitTo = secondImageActor;
602 foldEffect.SetCurrentImage( firstImageActor );
603 foldEffect.SetTargetImage( secondImageActor );
604 foldEffect.StartTransition();
605 Wait( application, TRANSITION_DURATION );
606 DALI_TEST_CHECK( callback.mSignalVerified );
609 //check that the fold effect is used to transit to thirdImageActor
610 actorTransitTo = thirdImageActor;
611 foldEffect.SetTargetImage( thirdImageActor );
612 foldEffect.StartTransition( false );
613 Wait( application, TRANSITION_DURATION );
614 DALI_TEST_CHECK( callback.mSignalVerified );
618 int UtcDaliCubeTransitionEffectPauseResumeTransition(void)
620 ToolkitTestApplication application;
621 tet_infoline(" UtcDaliCubeTransitionEffectPauseResumeTransition ");
623 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
624 ImageActor firstImageActor = CreateSolidColorImageActor(application, Color::RED,30,30);
625 ImageActor secondImageActor = CreateSolidColorImageActor(application, Color::GREEN,20,20);
627 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
628 waveEffect.SetTransitionDuration( TRANSITION_DURATION );
629 waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
630 Actor rootActor = waveEffect.GetRoot();
631 Stage::GetCurrent().Add( rootActor );
633 CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
634 crossEffect.SetTransitionDuration( TRANSITION_DURATION );
635 crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
636 rootActor = crossEffect.GetRoot();
637 Stage::GetCurrent().Add( rootActor );
639 CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
640 foldEffect.SetTransitionDuration( TRANSITION_DURATION );
641 rootActor = crossEffect.GetRoot();
642 Stage::GetCurrent().Add( rootActor );
644 bool signalVerified = false;
645 CubeTransitionEffect currentEffect;
646 ImageActor actorTransitTo;
647 TransitionCompletedCallback callback(signalVerified, currentEffect, actorTransitTo);
648 waveEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
649 crossEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
650 foldEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
652 currentEffect = waveEffect;
653 actorTransitTo = secondImageActor;
654 waveEffect.SetCurrentImage( firstImageActor );
655 waveEffect.SetTargetImage( secondImageActor );
656 // start transition; transit for 0.5*duration; pause for 0.5*duration;
657 // resume for 0.25*duration; pause for 0.25*duration; resume for another 0.25*duration;
658 // only until now the transition finished signal can be received
659 waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
660 Wait( application, TRANSITION_DURATION*0.5f );
661 DALI_TEST_CHECK(!callback.mSignalVerified);
662 waveEffect.PauseTransition();
663 Wait( application, TRANSITION_DURATION*0.5f );
664 DALI_TEST_CHECK(!callback.mSignalVerified);
665 waveEffect.ResumeTransition();
666 Wait( application, TRANSITION_DURATION*0.25f );
667 DALI_TEST_CHECK(!callback.mSignalVerified);
668 waveEffect.PauseTransition();
669 Wait( application, TRANSITION_DURATION*0.25f );
670 DALI_TEST_CHECK(!callback.mSignalVerified);
671 waveEffect.ResumeTransition();
672 Wait( application, TRANSITION_DURATION*0.25f );
673 DALI_TEST_CHECK(callback.mSignalVerified);
676 currentEffect = crossEffect;
677 actorTransitTo = firstImageActor;
678 crossEffect.SetCurrentImage( secondImageActor );
679 crossEffect.SetTargetImage( firstImageActor );
680 // start transition; transit for 0.25*duration; pause for 0.2*duration;
681 // resume for 0.5*duration; pause for 0.2*duration; resume for another 0.25*duration;
682 // only until now the transition finished signal can be received
683 crossEffect.StartTransition(false);
684 Wait( application, TRANSITION_DURATION*0.25f );
685 DALI_TEST_CHECK(!callback.mSignalVerified);
686 crossEffect.PauseTransition();
687 Wait( application, TRANSITION_DURATION*0.2f );
688 DALI_TEST_CHECK(!callback.mSignalVerified);
689 crossEffect.ResumeTransition();
690 Wait( application, TRANSITION_DURATION*0.5f );
691 DALI_TEST_CHECK(!callback.mSignalVerified);
692 crossEffect.PauseTransition();
693 Wait( application, TRANSITION_DURATION*0.2f );
694 DALI_TEST_CHECK(!callback.mSignalVerified);
695 crossEffect.ResumeTransition();
696 Wait( application, TRANSITION_DURATION*0.25f );
697 DALI_TEST_CHECK(callback.mSignalVerified);
700 currentEffect = foldEffect;
701 actorTransitTo = secondImageActor;
702 foldEffect.SetCurrentImage( firstImageActor );
703 foldEffect.SetTargetImage( secondImageActor );
704 // start transition; transit for 0.5*duration; pause for 0.5*duration;
705 // resume for 0.25*duration; pause for 0.25*duration; resume for another 0.25*duration;
706 // only until now the transition finished signal can be received
707 foldEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
708 Wait( application, TRANSITION_DURATION*0.5f );
709 DALI_TEST_CHECK(!callback.mSignalVerified);
710 foldEffect.PauseTransition();
711 Wait( application, TRANSITION_DURATION*0.5f );
712 DALI_TEST_CHECK(!callback.mSignalVerified);
713 foldEffect.ResumeTransition();
714 Wait( application, TRANSITION_DURATION*0.25f );
715 DALI_TEST_CHECK(!callback.mSignalVerified);
716 foldEffect.PauseTransition();
717 Wait( application, TRANSITION_DURATION*0.25f );
718 DALI_TEST_CHECK(!callback.mSignalVerified);
719 foldEffect.ResumeTransition();
720 Wait( application, TRANSITION_DURATION*0.25f );
721 DALI_TEST_CHECK(callback.mSignalVerified);
725 int UtcDaliCubeTransitionWaveEffectStopTransition(void)
727 ToolkitTestApplication application;
728 tet_infoline(" UtcDaliCubeTransitionWaveEffectStopTransition ");
730 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
731 ImageActor firstImageActor = CreateSolidColorImageActor(application, Color::RED,30,30);
732 ImageActor secondImageActor = CreateSolidColorImageActor(application, Color::GREEN,20,20);
734 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
735 waveEffect.SetTransitionDuration( TRANSITION_DURATION );
736 waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
737 Actor rootActor = waveEffect.GetRoot();
738 Stage::GetCurrent().Add( rootActor );
739 Actor cube = rootActor.GetChildAt(0);
740 waveEffect.SetCurrentImage( firstImageActor );
742 Vector4 fullBrightness = Vector4(1.f,1.f,1.f,1.f);
743 Vector4 halfBrightness = Vector4(0.5f, 0.5f, 0.5f, 1.f);
745 //check the cube rotation value and color values after stopping different transitions in the middle
746 waveEffect.SetTargetImage( secondImageActor );
747 waveEffect.StartTransition(true);
748 Wait( application, TRANSITION_DURATION*0.2f );
749 waveEffect.StopTransition();
750 application.SendNotification();
751 application.Render(RENDER_FRAME_INTERVAL);
752 DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
753 DALI_TEST_CHECK( cube.GetChildAt(0).GetCurrentColor() == halfBrightness );
754 DALI_TEST_CHECK( cube.GetChildAt(1).GetCurrentColor() == fullBrightness );
756 waveEffect.SetTargetImage( firstImageActor );
757 waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
758 Wait( application, TRANSITION_DURATION*0.4f );
759 waveEffect.StopTransition();
760 application.SendNotification();
761 application.Render(RENDER_FRAME_INTERVAL);
762 DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
763 DALI_TEST_CHECK( cube.GetChildAt(0).GetCurrentColor() == fullBrightness );
764 DALI_TEST_CHECK( cube.GetChildAt(1).GetCurrentColor() == halfBrightness );
766 waveEffect.SetTargetImage( secondImageActor );
767 waveEffect.StartTransition(false);
768 Wait( application, TRANSITION_DURATION*0.6f );
769 waveEffect.StopTransition();
770 application.SendNotification();
771 application.Render(RENDER_FRAME_INTERVAL);
772 DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
773 DALI_TEST_CHECK( cube.GetChildAt(0).GetCurrentColor() == halfBrightness );
774 DALI_TEST_CHECK( cube.GetChildAt(1).GetCurrentColor() == fullBrightness );
776 waveEffect.SetTargetImage( firstImageActor );
777 waveEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
778 Wait( application, TRANSITION_DURATION*0.8f );
779 waveEffect.StopTransition();
780 application.SendNotification();
781 application.Render(RENDER_FRAME_INTERVAL);
782 DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
783 DALI_TEST_CHECK( cube.GetChildAt(0).GetCurrentColor() == fullBrightness );
784 DALI_TEST_CHECK( cube.GetChildAt(1).GetCurrentColor() == halfBrightness );
788 int UtcDaliCubeTransitionCrossEffectStopTransition(void)
790 ToolkitTestApplication application;
791 tet_infoline(" UtcDaliCubeTransitionCrossEffectStopTransition ");
793 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
794 ImageActor firstImageActor = CreateSolidColorImageActor(application, Color::RED,30,30);
795 ImageActor secondImageActor = CreateSolidColorImageActor(application, Color::GREEN,20,20);
797 CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
798 crossEffect.SetTransitionDuration( TRANSITION_DURATION );
799 crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
800 Actor rootActor = crossEffect.GetRoot();
801 Stage::GetCurrent().Add( rootActor );
802 crossEffect.SetCurrentImage( firstImageActor );
803 Actor cube0 = rootActor.GetChildAt(0);
804 Actor cube1 = rootActor.GetChildAt(1);
806 Vector4 fullBrightness = Vector4(1.f,1.f,1.f,1.f);
807 Vector4 halfBrightness = Vector4(0.5f, 0.5f, 0.5f, 1.f);
809 //check the cube rotation values and color values after stop the different transitions in the middle
810 crossEffect.SetTargetImage( secondImageActor );
811 crossEffect.StartTransition(true);
812 Wait( application, TRANSITION_DURATION*0.2f );
813 crossEffect.StopTransition();
814 application.SendNotification();
815 application.Render(RENDER_FRAME_INTERVAL);
816 DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
817 DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::XAXIS), ROTATION_EPSILON, TEST_LOCATION );
819 DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == halfBrightness );
820 DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == fullBrightness );
822 crossEffect.SetTargetImage( firstImageActor );
823 crossEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
824 Wait( application, TRANSITION_DURATION*0.4f );
825 crossEffect.StopTransition();
826 application.SendNotification();
827 application.Render(RENDER_FRAME_INTERVAL);
828 DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
829 DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 2.f*Math::PI_2, Vector3::XAXIS), ROTATION_EPSILON, TEST_LOCATION );
830 DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == fullBrightness );
831 DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == halfBrightness );
833 crossEffect.SetTargetImage( secondImageActor );
834 crossEffect.StartTransition(false);
835 Wait( application, TRANSITION_DURATION*0.6f );
836 crossEffect.StopTransition();
837 application.SendNotification();
838 application.Render(RENDER_FRAME_INTERVAL);
839 DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
840 DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::XAXIS), ROTATION_EPSILON, TEST_LOCATION );
841 DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == halfBrightness );
842 DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == fullBrightness );
844 crossEffect.SetTargetImage( firstImageActor );
845 crossEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
846 Wait( application, TRANSITION_DURATION*0.8f );
847 crossEffect.StopTransition();
848 application.SendNotification();
849 application.Render(RENDER_FRAME_INTERVAL);
850 DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
851 DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 0.f, Vector3::XAXIS), ROTATION_EPSILON, TEST_LOCATION );
852 DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == fullBrightness );
853 DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == halfBrightness );
857 int UtcDaliCubeTransitionFoldEffectStopTransition(void)
859 ToolkitTestApplication application;
860 tet_infoline(" UtcDaliCubeTransitionFoldEffectStopTransition ");
862 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
863 ImageActor firstImageActor = CreateSolidColorImageActor(application, Color::RED,30,30);
864 ImageActor secondImageActor = CreateSolidColorImageActor(application, Color::GREEN,20,20);
866 CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
867 foldEffect.SetTransitionDuration( TRANSITION_DURATION );
868 Actor rootActor = foldEffect.GetRoot();
869 Stage::GetCurrent().Add( rootActor );
870 foldEffect.SetCurrentImage( firstImageActor );
871 Actor cube0 = rootActor.GetChildAt(0);
872 Actor cube1 = rootActor.GetChildAt(1);
874 Vector4 fullBrightness = Vector4(1.f,1.f,1.f,1.f);
875 Vector4 halfBrightness = Vector4(0.5f, 0.5f, 0.5f, 1.f);
877 //check the cube rotation values and color values after stop the different transitions in the middle
878 foldEffect.SetTargetImage( secondImageActor );
879 foldEffect.StartTransition(true);
880 Wait( application, TRANSITION_DURATION*0.2f );
881 foldEffect.StopTransition();
882 application.SendNotification();
883 application.Render(RENDER_FRAME_INTERVAL);
884 DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
885 DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
886 DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == halfBrightness );
887 DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == fullBrightness );
889 foldEffect.SetTargetImage( firstImageActor );
890 foldEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
891 Wait( application, TRANSITION_DURATION*0.4f );
892 foldEffect.StopTransition();
893 application.SendNotification();
894 application.Render(RENDER_FRAME_INTERVAL);
895 DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
896 DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 2.f*Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
897 DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == fullBrightness );
898 DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == halfBrightness );
900 foldEffect.SetTargetImage( secondImageActor );
901 foldEffect.StartTransition(false);
902 Wait( application, TRANSITION_DURATION*0.6f );
903 foldEffect.StopTransition();
904 application.SendNotification();
905 application.Render(RENDER_FRAME_INTERVAL);
906 DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
907 DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
908 DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == halfBrightness );
909 DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == fullBrightness );
911 foldEffect.SetTargetImage( firstImageActor );
912 foldEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
913 Wait( application, TRANSITION_DURATION*0.8f );
914 foldEffect.StopTransition();
915 application.SendNotification();
916 application.Render(RENDER_FRAME_INTERVAL);
917 DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
918 DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
919 DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == fullBrightness );
920 DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == halfBrightness );