2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 #include <dali-toolkit-test-suite-utils.h>
21 #include <dali-toolkit/dali-toolkit.h>
22 #include <dali-toolkit/devel-api/transition-effects/cube-transition-effect.h>
23 #include <dali-toolkit/devel-api/transition-effects/cube-transition-cross-effect.h>
24 #include <dali-toolkit/devel-api/transition-effects/cube-transition-fold-effect.h>
25 #include <dali-toolkit/devel-api/transition-effects/cube-transition-wave-effect.h>
26 #include <dali/devel-api/adaptor-framework/image-loading.h>
27 #include <dali/devel-api/adaptor-framework/pixel-buffer.h>
31 using namespace Dali::Toolkit;
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;
52 static bool gObjectCreatedCallBackCalled;
53 static void TestCallback(BaseHandle handle)
55 gObjectCreatedCallBackCalled = true;
59 * Simulate time passed by, waiting for certain process to finish
60 * @param[in] application Test application instance
61 * @param[in] durationToPass Time to pass in milliseconds.
63 void Wait(ToolkitTestApplication& application, float durationToPass)
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++)
69 application.SendNotification();
70 application.Render(RENDER_FRAME_INTERVAL);
76 //Callback class to test whether transition completed signal is emitted when the transition animation is finished
77 class TransitionCompletedCallback : public Dali::ConnectionTracker
80 TransitionCompletedCallback( bool& signalReceived, CubeTransitionEffect& effect, Texture& image )
81 : mSignalVerified( signalReceived ),
82 mCurrentEffect( effect ),
83 mActorTransitTo( image )
87 void Callback( CubeTransitionEffect effect, Texture image )
89 tet_infoline( "Verifying TransitionCompletedSignal" );
91 if( mCurrentEffect == effect && mActorTransitTo == image )
93 mSignalVerified = true;
99 mSignalVerified = false;
102 bool& mSignalVerified;
103 CubeTransitionEffect& mCurrentEffect;
104 Texture& mActorTransitTo;
111 void cube_transition_effect_startup(void)
113 test_return_value = TET_UNDEF;
116 void cube_transition_effect_cleanup(void)
118 test_return_value = TET_PASS;
121 int UtcDaliCubeTransitionWaveEffectNew(void)
123 ToolkitTestApplication application;
124 tet_infoline(" UtcDaliCubeTransitionWaveEffectNew ");
126 CubeTransitionEffect waveEffect;
128 DALI_TEST_CHECK( !waveEffect );
130 waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS );
131 waveEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
133 DALI_TEST_CHECK( waveEffect );
137 //Additional check to ensure object is created by checking if it's registered
138 ObjectRegistry registry = application.GetCore().GetObjectRegistry();
139 DALI_TEST_CHECK( registry );
141 gObjectCreatedCallBackCalled = false;
142 registry.ObjectCreatedSignal().Connect( &TestCallback );
144 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS );
145 waveEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
147 DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
151 int UtcDaliCubeTransitionCrossEffectNew(void)
153 ToolkitTestApplication application;
154 tet_infoline(" UtcDaliCubeTransitionCrossEffectNew ");
156 CubeTransitionEffect crossEffect;
158 DALI_TEST_CHECK( !crossEffect );
160 crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS );
161 crossEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
163 DALI_TEST_CHECK( crossEffect );
167 //Additional check to ensure object is created by checking if it's registered
168 ObjectRegistry registry = application.GetCore().GetObjectRegistry();
169 DALI_TEST_CHECK( registry );
171 gObjectCreatedCallBackCalled = false;
172 registry.ObjectCreatedSignal().Connect( &TestCallback );
174 CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS );
175 crossEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
177 DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
181 int UtcDaliCubeTransitionFoldEffectNew(void)
183 ToolkitTestApplication application;
184 tet_infoline( " UtcDaliCubeTransitionFoldEffectNew " );
186 CubeTransitionEffect foldEffect;
188 DALI_TEST_CHECK( !foldEffect );
190 foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS );
191 foldEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
193 DALI_TEST_CHECK( foldEffect );
197 //Additional check to ensure object is created by checking if it is registered
198 ObjectRegistry registry = application.GetCore().GetObjectRegistry();
199 DALI_TEST_CHECK( registry );
201 gObjectCreatedCallBackCalled = false;
202 registry.ObjectCreatedSignal().Connect( &TestCallback );
204 CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS );
205 foldEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
207 DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
211 int UtcDaliCubeTransitionEffectSetGetTransitionDuration(void)
213 ToolkitTestApplication application;
214 tet_infoline(" UtcDaliCubeTransitionEffectSetGetTransitionDuration ");
216 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS );
217 waveEffect.SetTransitionDuration( TRANSITION_DURATION );
218 waveEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
219 DALI_TEST_EQUALS( TRANSITION_DURATION, waveEffect.GetTransitionDuration(), TEST_LOCATION );
221 CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS );
222 crossEffect.SetTransitionDuration( TRANSITION_DURATION );
223 crossEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
224 DALI_TEST_EQUALS( TRANSITION_DURATION, crossEffect.GetTransitionDuration(), TEST_LOCATION );
226 CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS );
227 foldEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
228 foldEffect.SetTransitionDuration( TRANSITION_DURATION );
229 DALI_TEST_EQUALS( TRANSITION_DURATION, foldEffect.GetTransitionDuration(), TEST_LOCATION );
233 int UtcDaliCubeTransitionEffectSetGetCubeDisplacement(void)
235 ToolkitTestApplication application;
236 tet_infoline(" UtcDaliCubeTransitionEffectSetGetTransitionDuration ");
238 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS);
239 waveEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
240 waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
241 DALI_TEST_EQUALS( CUBE_DISPLACEMENT, waveEffect.GetCubeDisplacement(), TEST_LOCATION );
243 CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS );
244 crossEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
245 crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
246 DALI_TEST_EQUALS( CUBE_DISPLACEMENT, crossEffect.GetCubeDisplacement(), TEST_LOCATION );
248 //Cube displacement is not used in CubeTransitionFoldEffect
252 //Test common codes in base class
253 int UtcDaliCubeTransitionEffectGetRoot(void)
255 ToolkitTestApplication application;
256 tet_infoline(" UtcDaliCubeTransitionEffectGetRoot ");
258 unsigned int totalNum = NUM_ROWS*NUM_COLUMNS;
260 Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40 );
262 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS );
263 waveEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
264 application.GetScene().Add( waveEffect );
265 waveEffect.SetCurrentTexture( texture );
266 waveEffect.SetTargetTexture( texture );
268 application.SendNotification();
269 application.Render();
271 waveEffect.StartTransition();
273 Wait( application, TRANSITION_DURATION * 0.5f );
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() );
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() );
286 int UtcDaliCubeTransitionEffectIsTransitioning(void)
288 ToolkitTestApplication application;
289 tet_infoline(" UtcDaliCubeTransitionEffectIsTransiting ");
291 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
292 Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40 );
294 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS );
295 waveEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
296 application.GetScene().Add( waveEffect );
298 waveEffect.SetTransitionDuration( TRANSITION_DURATION );
299 waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
300 DALI_TEST_CHECK( !waveEffect.IsTransitioning() );
302 waveEffect.SetCurrentTexture( texture );
303 waveEffect.SetTargetTexture( texture );
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() );
311 CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS );
312 crossEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
313 application.GetScene().Add( crossEffect );
315 crossEffect.SetTransitionDuration( TRANSITION_DURATION );
316 crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
317 DALI_TEST_CHECK( !crossEffect.IsTransitioning() );
319 crossEffect.SetCurrentTexture( texture );
320 crossEffect.SetTargetTexture( texture );
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() );
328 CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS );
329 foldEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
330 application.GetScene().Add( foldEffect );
332 foldEffect.SetTransitionDuration( TRANSITION_DURATION );
333 DALI_TEST_CHECK( !foldEffect.IsTransitioning() );
335 foldEffect.SetCurrentTexture( texture );
336 foldEffect.SetTargetTexture( texture );
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() );
347 //Test common codes in base class
348 int UtcDaliCubeTransitionEffectSetCurrentTexture(void)
350 ToolkitTestApplication application;
351 tet_infoline(" UtcDaliCubeTransitionEffectSetCurrentTexture ");
353 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
354 Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40 );
356 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS );
357 waveEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
358 waveEffect.SetCurrentTexture( texture );
360 application.GetScene().Add( waveEffect );
362 application.SendNotification();
363 application.Render();
365 waveEffect.StartTransition();
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);
371 //check the pixel area set to the cube
372 Vector4 pixelAreaDef( 0.f, 0.f, 1.f / NUM_COLUMNS, 1.f / NUM_ROWS);
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 );
379 DALI_TEST_CHECK( textureRectValue.Get( pixelArea ) );
381 DALI_TEST_EQUALS( pixelAreaDef, pixelArea, FLT_EPISILON, TEST_LOCATION );
386 //Test common codes in base class
387 int UtcDaliCubeTransitionEffectSetTargetTexture(void)
389 ToolkitTestApplication application;
390 tet_infoline(" UtcDaliCubeTransitionEffectSetTargetTexture ");
392 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
393 Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40 );
394 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS );
395 waveEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
396 application.GetScene().Add( waveEffect );
398 waveEffect.SetCurrentTexture( texture );
399 waveEffect.SetTargetTexture( texture );
401 application.GetScene().Add( waveEffect );
403 application.SendNotification();
404 application.Render();
406 waveEffect.StartTransition();
408 // the target image content is set to the tiles currently invisible to the camera
409 Actor tile = waveEffect.GetChildAt(0).GetChildAt(0).GetChildAt(1);
411 //check the pixel area set to the cube
412 Vector4 pixelAreaDef( 0.f, 0.f, 1.f / NUM_COLUMNS, 1.f / NUM_ROWS);
414 Property::Index textureRectIndex = tile.GetPropertyIndex( "uTextureRect" );
415 DALI_TEST_CHECK( textureRectIndex != -1 );
416 Property::Value textureRectValue = tile.GetProperty( textureRectIndex );
417 DALI_TEST_CHECK( textureRectValue.GetType() == Property::VECTOR4 );
419 DALI_TEST_CHECK( textureRectValue.Get( pixelArea ) );
421 DALI_TEST_EQUALS( pixelAreaDef, pixelArea, FLT_EPISILON, TEST_LOCATION );
426 int UtcDaliCubeTransitionWaveEffectStartTransition(void)
428 ToolkitTestApplication application;
429 tet_infoline(" UtcDaliCubeTransitionWaveEffectStartTransition ");
431 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
433 Devel::PixelBuffer pixelBuffer = LoadImageFromFile(TEST_RESOURCE_DIR "/gallery-small-1.jpg");
434 PixelData pixelData = Devel::PixelBuffer::Convert( pixelBuffer );
435 Texture texture = Texture::New( TextureType::TEXTURE_2D, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight() );
436 texture.Upload( pixelData );
438 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS );
439 waveEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
440 waveEffect.SetTransitionDuration( TRANSITION_DURATION );
441 waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
442 waveEffect.SetCurrentTexture( texture );
444 application.GetScene().Add( waveEffect );
446 application.SendNotification();
447 application.Render();
449 waveEffect.StartTransition( true );
451 Actor cube = waveEffect.GetChildAt(0).GetChildAt(0);
453 //check the cube rotation value and color values just before the end of different transitions
454 waveEffect.SetTargetTexture( texture );
455 Wait( application, TRANSITION_BEFORE_END_DURATION );
456 DALI_TEST_EQUALS( cube.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( -Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
457 DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION );
458 DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION );
460 waveEffect.SetTargetTexture( texture );
461 waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
462 Wait( application, TRANSITION_BEFORE_END_DURATION );
463 DALI_TEST_EQUALS( cube.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( -Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
464 DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION );
465 DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION );
467 waveEffect.SetTargetTexture( texture );
468 waveEffect.StartTransition(false);
469 Wait( application, TRANSITION_BEFORE_END_DURATION );
470 DALI_TEST_EQUALS( cube.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
471 DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION );
472 DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION );
474 waveEffect.SetTargetTexture( texture );
475 waveEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
476 Wait( application, TRANSITION_BEFORE_END_DURATION );
477 DALI_TEST_EQUALS( cube.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
478 DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION );
479 DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION );
483 int UtcDaliCubeTransitionCrossEffectStartTransition(void)
485 ToolkitTestApplication application;
486 tet_infoline(" UtcDaliCubeTransitionCrossEffectStartTransition ");
488 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
490 Devel::PixelBuffer pixelBuffer = LoadImageFromFile(TEST_RESOURCE_DIR "/gallery-small-1.jpg");
491 PixelData pixelData = Devel::PixelBuffer::Convert( pixelBuffer );
492 Texture texture = Texture::New( TextureType::TEXTURE_2D, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight() );
493 texture.Upload( pixelData );
495 CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS );
496 crossEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
497 crossEffect.SetTransitionDuration( TRANSITION_DURATION );
498 crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
499 crossEffect.SetCurrentTexture( texture );
500 crossEffect.SetTargetTexture( texture );
502 application.GetScene().Add( crossEffect );
504 application.SendNotification();
505 application.Render();
507 crossEffect.StartTransition(true);
509 Actor cube0 = crossEffect.GetChildAt(0).GetChildAt(0);
510 Actor cube1 = crossEffect.GetChildAt(0).GetChildAt(1);
512 //check the cube rotation value and color values just before the end of different transitions
513 Wait( application, TRANSITION_BEFORE_END_DURATION );
514 DALI_TEST_EQUALS( cube1.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( -Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
515 DALI_TEST_EQUALS( cube0.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_90, Vector3::XAXIS), EPISILON, TEST_LOCATION );
516 DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION );
517 DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION );
520 crossEffect.SetTargetTexture( texture );
521 crossEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
522 Wait( application, TRANSITION_BEFORE_END_DURATION );
523 DALI_TEST_EQUALS( cube1.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( -Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
524 DALI_TEST_EQUALS( cube0.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_90, Vector3::XAXIS), EPISILON, TEST_LOCATION );
525 DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION );
526 DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION );
529 crossEffect.SetTargetTexture( texture );
530 crossEffect.StartTransition(false);
531 Wait( application, TRANSITION_BEFORE_END_DURATION );
532 DALI_TEST_EQUALS( cube1.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
533 DALI_TEST_EQUALS( cube0.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( -Dali::ANGLE_90, Vector3::XAXIS), EPISILON, TEST_LOCATION );
534 DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION );
535 DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION );
537 crossEffect.SetTargetTexture( texture );
538 crossEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
539 Wait( application, TRANSITION_BEFORE_END_DURATION );
540 DALI_TEST_EQUALS( cube1.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
541 DALI_TEST_EQUALS( cube0.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( -Dali::ANGLE_90, Vector3::XAXIS), EPISILON, TEST_LOCATION );
542 DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION );
543 DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION );
547 int UtcDaliCubeTransitionFoldEffectStartTransition(void)
549 ToolkitTestApplication application;
550 tet_infoline(" UtcDaliCubeTransitionFoldEffectStartTransition ");
552 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
553 Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40 );
554 CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS );
555 foldEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
556 foldEffect.SetTransitionDuration( TRANSITION_DURATION );
557 foldEffect.SetCurrentTexture( texture );
558 foldEffect.SetTargetTexture( texture );
560 application.GetScene().Add( foldEffect );
562 application.SendNotification();
563 application.Render();
565 foldEffect.StartTransition(true);
567 Actor cube0 = foldEffect.GetChildAt(0).GetChildAt(0);
568 Actor cube1 = foldEffect.GetChildAt(0).GetChildAt(1);
570 //check the cube rotation value and color values just before the end of different transitions
571 Wait( application, TRANSITION_BEFORE_END_DURATION );
572 DALI_TEST_EQUALS( cube1.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( -Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
573 DALI_TEST_EQUALS( cube0.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
574 DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION );
575 DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION );
577 foldEffect.SetTargetTexture( texture );
578 foldEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
579 Wait( application, TRANSITION_BEFORE_END_DURATION );
580 DALI_TEST_EQUALS( cube1.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( -Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
581 DALI_TEST_EQUALS( cube0.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
582 DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION );
583 DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION );
586 foldEffect.SetTargetTexture( texture );
587 foldEffect.StartTransition(false);
588 Wait( application, TRANSITION_BEFORE_END_DURATION );
589 DALI_TEST_EQUALS( cube1.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
590 DALI_TEST_EQUALS( cube0.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( -Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
591 DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION );
592 DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ),FULL_BRIGHTNESS, EPISILON, TEST_LOCATION );
594 foldEffect.SetTargetTexture( texture );
595 foldEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
596 Wait( application, TRANSITION_BEFORE_END_DURATION );
597 DALI_TEST_EQUALS( cube1.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
598 DALI_TEST_EQUALS( cube0.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( -Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
599 DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION );
600 DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION );
604 int UtcDaliCubeTransitionEffectSignalTransitionCompleted(void)
606 ToolkitTestApplication application;
607 tet_infoline(" UtcDaliCubeTransitionEffectSignalTransitionCompleted ");
609 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
610 Texture firstTexture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 30, 30 );
611 Texture secondTexture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 20, 20 );
612 Texture thirdTexture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40 );
614 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS );
615 waveEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
616 waveEffect.SetTransitionDuration( TRANSITION_DURATION );
617 waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
618 application.GetScene().Add( waveEffect );
620 CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS );
621 crossEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
622 crossEffect.SetTransitionDuration( TRANSITION_DURATION );
623 crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
624 application.GetScene().Add( crossEffect );
626 CubeTransitionEffect foldEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS );
627 foldEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
628 foldEffect.SetTransitionDuration( TRANSITION_DURATION );
629 application.GetScene().Add( foldEffect );
631 bool signalVerified = false;
632 CubeTransitionEffect currentEffect;
633 Texture actorTransitTo;
634 TransitionCompletedCallback callback(signalVerified, currentEffect, actorTransitTo);
635 waveEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
636 crossEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
637 foldEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
639 //check that the wave effect is used to transit to secondTexture
640 currentEffect = waveEffect;
641 actorTransitTo = secondTexture;
642 waveEffect.SetCurrentTexture( firstTexture );
643 waveEffect.SetTargetTexture( secondTexture );
644 waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
645 Wait( application, TRANSITION_DURATION );
646 DALI_TEST_CHECK(callback.mSignalVerified);
649 //check that the wave effect is used to transit to thirdTexture
650 actorTransitTo = thirdTexture;
651 waveEffect.SetTargetTexture( thirdTexture );
652 waveEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
653 Wait( application, TRANSITION_DURATION );
654 DALI_TEST_CHECK(callback.mSignalVerified);
657 //check that the cross effect is used to transit to secondTexture
658 currentEffect = crossEffect;
659 actorTransitTo = secondTexture;
660 crossEffect.SetCurrentTexture( thirdTexture );
661 crossEffect.SetTargetTexture( secondTexture );
662 crossEffect.StartTransition(true);
663 Wait( application, TRANSITION_DURATION );
664 DALI_TEST_CHECK(callback.mSignalVerified);
667 //check that the cross effect is used to transit to firstTexture
668 actorTransitTo = firstTexture;
669 crossEffect.SetTargetTexture( firstTexture );
670 crossEffect.StartTransition(false);
671 Wait( application, TRANSITION_DURATION );
672 DALI_TEST_CHECK(callback.mSignalVerified);
675 //check that the fold effect is used to transit to secondTexture
676 currentEffect = foldEffect;
677 actorTransitTo = secondTexture;
678 foldEffect.SetCurrentTexture( firstTexture );
679 foldEffect.SetTargetTexture( secondTexture );
680 foldEffect.StartTransition();
681 Wait( application, TRANSITION_DURATION );
682 DALI_TEST_CHECK( callback.mSignalVerified );
685 //check that the fold effect is used to transit to thirdTexture
686 actorTransitTo = thirdTexture;
687 foldEffect.SetTargetTexture( thirdTexture );
688 foldEffect.StartTransition( false );
689 Wait( application, TRANSITION_DURATION );
690 DALI_TEST_CHECK( callback.mSignalVerified );
694 int UtcDaliCubeTransitionEffectPauseResumeTransition(void)
696 ToolkitTestApplication application;
697 tet_infoline(" UtcDaliCubeTransitionEffectPauseResumeTransition ");
699 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
700 Texture firstTexture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 30, 30 );
701 Texture secondTexture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 20, 20 );
703 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS );
704 waveEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
705 waveEffect.SetTransitionDuration( TRANSITION_DURATION );
706 waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
707 application.GetScene().Add( waveEffect );
709 CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS );
710 crossEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
711 crossEffect.SetTransitionDuration( TRANSITION_DURATION );
712 crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
713 application.GetScene().Add( crossEffect );
715 CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS );
716 foldEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
717 foldEffect.SetTransitionDuration( TRANSITION_DURATION );
718 application.GetScene().Add( foldEffect );
720 bool signalVerified = false;
721 CubeTransitionEffect currentEffect;
722 Texture actorTransitTo;
723 TransitionCompletedCallback callback(signalVerified, currentEffect, actorTransitTo);
724 waveEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
725 crossEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
726 foldEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
728 currentEffect = waveEffect;
729 actorTransitTo = secondTexture;
730 waveEffect.SetCurrentTexture( firstTexture );
731 waveEffect.SetTargetTexture( secondTexture );
732 // start transition; transit for 0.5*duration; pause for 0.5*duration;
733 // resume for 0.25*duration; pause for 0.25*duration; resume for another 0.25*duration;
734 // only until now the transition finished signal can be received
735 waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
736 Wait( application, TRANSITION_DURATION*0.5f );
737 DALI_TEST_CHECK(!callback.mSignalVerified);
738 waveEffect.PauseTransition();
739 Wait( application, TRANSITION_DURATION*0.5f );
740 DALI_TEST_CHECK(!callback.mSignalVerified);
741 waveEffect.ResumeTransition();
742 Wait( application, TRANSITION_DURATION*0.25f );
743 DALI_TEST_CHECK(!callback.mSignalVerified);
744 waveEffect.PauseTransition();
745 Wait( application, TRANSITION_DURATION*0.25f );
746 DALI_TEST_CHECK(!callback.mSignalVerified);
747 waveEffect.ResumeTransition();
748 Wait( application, TRANSITION_DURATION*0.25f );
749 DALI_TEST_CHECK(callback.mSignalVerified);
752 currentEffect = crossEffect;
753 actorTransitTo = firstTexture;
754 crossEffect.SetCurrentTexture( secondTexture );
755 crossEffect.SetTargetTexture( firstTexture );
756 // start transition; transit for 0.25*duration; pause for 0.2*duration;
757 // resume for 0.5*duration; pause for 0.2*duration; resume for another 0.25*duration;
758 // only until now the transition finished signal can be received
759 crossEffect.StartTransition(false);
760 Wait( application, TRANSITION_DURATION*0.25f );
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.5f );
767 DALI_TEST_CHECK(!callback.mSignalVerified);
768 crossEffect.PauseTransition();
769 Wait( application, TRANSITION_DURATION*0.2f );
770 DALI_TEST_CHECK(!callback.mSignalVerified);
771 crossEffect.ResumeTransition();
772 Wait( application, TRANSITION_DURATION*0.25f );
773 DALI_TEST_CHECK(callback.mSignalVerified);
776 currentEffect = foldEffect;
777 actorTransitTo = secondTexture;
778 foldEffect.SetCurrentTexture( firstTexture );
779 foldEffect.SetTargetTexture( secondTexture );
780 // start transition; transit for 0.5*duration; pause for 0.5*duration;
781 // resume for 0.25*duration; pause for 0.25*duration; resume for another 0.25*duration;
782 // only until now the transition finished signal can be received
783 foldEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
784 Wait( application, TRANSITION_DURATION*0.5f );
785 DALI_TEST_CHECK(!callback.mSignalVerified);
786 foldEffect.PauseTransition();
787 Wait( application, TRANSITION_DURATION*0.5f );
788 DALI_TEST_CHECK(!callback.mSignalVerified);
789 foldEffect.ResumeTransition();
790 Wait( application, TRANSITION_DURATION*0.25f );
791 DALI_TEST_CHECK(!callback.mSignalVerified);
792 foldEffect.PauseTransition();
793 Wait( application, TRANSITION_DURATION*0.25f );
794 DALI_TEST_CHECK(!callback.mSignalVerified);
795 foldEffect.ResumeTransition();
796 Wait( application, TRANSITION_DURATION*0.25f );
797 DALI_TEST_CHECK(callback.mSignalVerified);
801 int UtcDaliCubeTransitionWaveEffectStopTransition(void)
803 ToolkitTestApplication application;
804 tet_infoline(" UtcDaliCubeTransitionWaveEffectStopTransition ");
806 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
807 Texture firstTexture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 30, 30 );
808 Texture secondTexture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 20, 20 );
810 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS );
811 waveEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
812 waveEffect.SetTransitionDuration( TRANSITION_DURATION );
813 waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
814 waveEffect.SetCurrentTexture( firstTexture );
815 waveEffect.SetTargetTexture( secondTexture );
817 application.GetScene().Add( waveEffect );
819 application.SendNotification();
820 application.Render();
822 waveEffect.StartTransition(true);
824 Actor cube = waveEffect.GetChildAt(0).GetChildAt(0);
826 //check the cube rotation value and color values reset after stopping different transitions in the middle
827 Wait( application, TRANSITION_DURATION*0.2f );
828 waveEffect.StopTransition();
829 application.SendNotification();
830 application.Render(RENDER_FRAME_INTERVAL);
831 DALI_TEST_EQUALS( cube.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::ZERO), FLT_EPISILON, TEST_LOCATION );
832 DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
833 DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
835 waveEffect.SetTargetTexture( firstTexture );
836 waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
837 Wait( application, TRANSITION_DURATION*0.4f );
838 waveEffect.StopTransition();
839 application.SendNotification();
840 application.Render(RENDER_FRAME_INTERVAL);
841 DALI_TEST_EQUALS( cube.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::ZERO), FLT_EPISILON, TEST_LOCATION );
842 DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
843 DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
845 waveEffect.SetTargetTexture( secondTexture );
846 waveEffect.StartTransition(false);
847 Wait( application, TRANSITION_DURATION*0.6f );
848 waveEffect.StopTransition();
849 application.SendNotification();
850 application.Render(RENDER_FRAME_INTERVAL);
851 DALI_TEST_EQUALS( cube.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::ZERO), FLT_EPISILON, TEST_LOCATION );
852 DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
853 DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
855 waveEffect.SetTargetTexture( firstTexture );
856 waveEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
857 Wait( application, TRANSITION_DURATION*0.8f );
858 waveEffect.StopTransition();
859 application.SendNotification();
860 application.Render(RENDER_FRAME_INTERVAL);
861 DALI_TEST_EQUALS( cube.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::ZERO), FLT_EPISILON, TEST_LOCATION );
862 DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
863 DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
867 int UtcDaliCubeTransitionCrossEffectStopTransition(void)
869 ToolkitTestApplication application;
870 tet_infoline(" UtcDaliCubeTransitionCrossEffectStopTransition ");
872 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
873 Texture firstTexture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 30, 30 );
874 Texture secondTexture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 20, 20 );
876 CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS );
877 crossEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
878 crossEffect.SetTransitionDuration( TRANSITION_DURATION );
879 crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
880 crossEffect.SetCurrentTexture( firstTexture );
881 crossEffect.SetTargetTexture( secondTexture );
883 application.GetScene().Add( crossEffect );
885 application.SendNotification();
886 application.Render();
888 crossEffect.StartTransition(true);
890 Actor cube0 = crossEffect.GetChildAt(0).GetChildAt(0);
891 Actor cube1 = crossEffect.GetChildAt(0).GetChildAt(1);
893 //check the cube rotation values and color values reset after stop the different transitions in the middle
894 Wait( application, TRANSITION_DURATION*0.2f );
895 crossEffect.StopTransition();
896 application.SendNotification();
897 application.Render(RENDER_FRAME_INTERVAL);
898 DALI_TEST_EQUALS( cube0.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::ZERO), FLT_EPISILON, TEST_LOCATION );
899 DALI_TEST_EQUALS( cube1.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::ZERO), FLT_EPISILON, TEST_LOCATION );
900 DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
901 DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
903 crossEffect.SetTargetTexture( firstTexture );
904 crossEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
905 Wait( application, TRANSITION_DURATION*0.4f );
906 crossEffect.StopTransition();
907 application.SendNotification();
908 application.Render(RENDER_FRAME_INTERVAL);
909 DALI_TEST_EQUALS( cube0.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::ZERO), FLT_EPISILON, TEST_LOCATION );
910 DALI_TEST_EQUALS( cube1.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::ZERO), FLT_EPISILON, TEST_LOCATION );
911 DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
912 DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
914 crossEffect.SetTargetTexture( secondTexture );
915 crossEffect.StartTransition(false);
916 Wait( application, TRANSITION_DURATION*0.6f );
917 crossEffect.StopTransition();
918 application.SendNotification();
919 application.Render(RENDER_FRAME_INTERVAL);
920 DALI_TEST_EQUALS( cube0.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::ZERO), FLT_EPISILON, TEST_LOCATION );
921 DALI_TEST_EQUALS( cube1.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::ZERO), FLT_EPISILON, TEST_LOCATION );
922 DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
923 DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
925 crossEffect.SetTargetTexture( firstTexture );
926 crossEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
927 Wait( application, TRANSITION_DURATION*0.8f );
928 crossEffect.StopTransition();
929 application.SendNotification();
930 application.Render(RENDER_FRAME_INTERVAL);
931 DALI_TEST_EQUALS( cube1.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
932 DALI_TEST_EQUALS( cube0.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION );
933 DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
934 DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
938 int UtcDaliCubeTransitionFoldEffectStopTransition(void)
940 ToolkitTestApplication application;
941 tet_infoline(" UtcDaliCubeTransitionFoldEffectStopTransition ");
943 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
944 Texture firstTexture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 30, 30 );
945 Texture secondTexture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 20, 20 );
947 CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS );
948 foldEffect.SetProperty( Actor::Property::SIZE, Vector2( VIEW_AREA_SIZE ) );
949 foldEffect.SetTransitionDuration( TRANSITION_DURATION );
950 foldEffect.SetCurrentTexture( firstTexture );
951 foldEffect.SetTargetTexture( secondTexture );
953 application.GetScene().Add( foldEffect );
955 application.SendNotification();
956 application.Render();
958 foldEffect.StartTransition(true);
960 Actor cube0 = foldEffect.GetChildAt(0).GetChildAt(0);
961 Actor cube1 = foldEffect.GetChildAt(0).GetChildAt(1);
963 //check the cube rotation values and color values after stop the different transitions in the middle
964 Wait( application, TRANSITION_DURATION*0.2f );
965 foldEffect.StopTransition();
966 application.SendNotification();
967 application.Render(RENDER_FRAME_INTERVAL);
969 DALI_TEST_EQUALS( cube1.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
970 DALI_TEST_EQUALS( cube0.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION );
971 DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
972 DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
974 foldEffect.SetTargetTexture( firstTexture );
975 foldEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
976 Wait( application, TRANSITION_DURATION*0.4f );
977 foldEffect.StopTransition();
978 application.SendNotification();
979 application.Render(RENDER_FRAME_INTERVAL);
980 DALI_TEST_EQUALS( cube1.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
981 DALI_TEST_EQUALS( cube0.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION );
982 DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
983 DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
985 foldEffect.SetTargetTexture( secondTexture );
986 foldEffect.StartTransition(false);
987 Wait( application, TRANSITION_DURATION*0.6f );
988 foldEffect.StopTransition();
989 application.SendNotification();
990 application.Render(RENDER_FRAME_INTERVAL);
991 DALI_TEST_EQUALS( cube1.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
992 DALI_TEST_EQUALS( cube0.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION );
993 DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
994 DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
996 foldEffect.SetTargetTexture( firstTexture );
997 foldEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
998 Wait( application, TRANSITION_DURATION*0.8f );
999 foldEffect.StopTransition();
1000 application.SendNotification();
1001 application.Render(RENDER_FRAME_INTERVAL);
1002 DALI_TEST_EQUALS( cube1.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
1003 DALI_TEST_EQUALS( cube0.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
1004 DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
1005 DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );