2 * Copyright (c) 2022 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.
21 #include <dali-toolkit-test-suite-utils.h>
22 #include <dali-toolkit/dali-toolkit.h>
24 #include <dali-toolkit/devel-api/transition-effects/cube-transition-cross-effect.h>
25 #include <dali-toolkit/devel-api/transition-effects/cube-transition-effect.h>
26 #include <dali-toolkit/devel-api/transition-effects/cube-transition-fold-effect.h>
27 #include <dali-toolkit/devel-api/transition-effects/cube-transition-wave-effect.h>
28 #include <dali/devel-api/adaptor-framework/image-loading.h>
29 #include <dali/devel-api/adaptor-framework/pixel-buffer.h>
32 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);
74 //Callback class to test whether transition completed signal is emitted when the transition animation is finished
75 class TransitionCompletedCallback : public Dali::ConnectionTracker
78 TransitionCompletedCallback(bool& signalReceived, CubeTransitionEffect& effect, Texture& image)
79 : mSignalVerified(signalReceived),
80 mCurrentEffect(effect),
81 mActorTransitTo(image)
85 void Callback(CubeTransitionEffect effect, Texture image)
87 tet_infoline("Verifying TransitionCompletedSignal");
89 if(mCurrentEffect == effect && mActorTransitTo == image)
91 mSignalVerified = true;
97 mSignalVerified = false;
100 bool& mSignalVerified;
101 CubeTransitionEffect& mCurrentEffect;
102 Texture& mActorTransitTo;
107 void cube_transition_effect_startup(void)
109 test_return_value = TET_UNDEF;
112 void cube_transition_effect_cleanup(void)
114 test_return_value = TET_PASS;
117 int UtcDaliCubeTransitionWaveEffectNew(void)
119 ToolkitTestApplication application;
120 tet_infoline(" UtcDaliCubeTransitionWaveEffectNew ");
122 CubeTransitionEffect waveEffect;
124 DALI_TEST_CHECK(!waveEffect);
126 waveEffect = CubeTransitionWaveEffect::New(NUM_ROWS, NUM_COLUMNS);
127 waveEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
129 DALI_TEST_CHECK(waveEffect);
133 //Additional check to ensure object is created by checking if it's registered
134 ObjectRegistry registry = application.GetCore().GetObjectRegistry();
135 DALI_TEST_CHECK(registry);
137 gObjectCreatedCallBackCalled = false;
138 registry.ObjectCreatedSignal().Connect(&TestCallback);
140 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New(NUM_ROWS, NUM_COLUMNS);
141 waveEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
143 DALI_TEST_CHECK(gObjectCreatedCallBackCalled);
147 int UtcDaliCubeTransitionCrossEffectNew(void)
149 ToolkitTestApplication application;
150 tet_infoline(" UtcDaliCubeTransitionCrossEffectNew ");
152 CubeTransitionEffect crossEffect;
154 DALI_TEST_CHECK(!crossEffect);
156 crossEffect = CubeTransitionCrossEffect::New(NUM_ROWS, NUM_COLUMNS);
157 crossEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
159 DALI_TEST_CHECK(crossEffect);
163 //Additional check to ensure object is created by checking if it's registered
164 ObjectRegistry registry = application.GetCore().GetObjectRegistry();
165 DALI_TEST_CHECK(registry);
167 gObjectCreatedCallBackCalled = false;
168 registry.ObjectCreatedSignal().Connect(&TestCallback);
170 CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New(NUM_ROWS, NUM_COLUMNS);
171 crossEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
173 DALI_TEST_CHECK(gObjectCreatedCallBackCalled);
177 int UtcDaliCubeTransitionFoldEffectNew(void)
179 ToolkitTestApplication application;
180 tet_infoline(" UtcDaliCubeTransitionFoldEffectNew ");
182 CubeTransitionEffect foldEffect;
184 DALI_TEST_CHECK(!foldEffect);
186 foldEffect = CubeTransitionFoldEffect::New(NUM_ROWS, NUM_COLUMNS);
187 foldEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
189 DALI_TEST_CHECK(foldEffect);
193 //Additional check to ensure object is created by checking if it is registered
194 ObjectRegistry registry = application.GetCore().GetObjectRegistry();
195 DALI_TEST_CHECK(registry);
197 gObjectCreatedCallBackCalled = false;
198 registry.ObjectCreatedSignal().Connect(&TestCallback);
200 CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New(NUM_ROWS, NUM_COLUMNS);
201 foldEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
203 DALI_TEST_CHECK(gObjectCreatedCallBackCalled);
207 int UtcDaliCubeTransitionEffectSetGetTransitionDuration(void)
209 ToolkitTestApplication application;
210 tet_infoline(" UtcDaliCubeTransitionEffectSetGetTransitionDuration ");
212 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New(NUM_ROWS, NUM_COLUMNS);
213 waveEffect.SetTransitionDuration(TRANSITION_DURATION);
214 waveEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
215 DALI_TEST_EQUALS(TRANSITION_DURATION, waveEffect.GetTransitionDuration(), TEST_LOCATION);
217 CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New(NUM_ROWS, NUM_COLUMNS);
218 crossEffect.SetTransitionDuration(TRANSITION_DURATION);
219 crossEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
220 DALI_TEST_EQUALS(TRANSITION_DURATION, crossEffect.GetTransitionDuration(), TEST_LOCATION);
222 CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New(NUM_ROWS, NUM_COLUMNS);
223 foldEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
224 foldEffect.SetTransitionDuration(TRANSITION_DURATION);
225 DALI_TEST_EQUALS(TRANSITION_DURATION, foldEffect.GetTransitionDuration(), TEST_LOCATION);
229 int UtcDaliCubeTransitionEffectSetGetCubeDisplacement(void)
231 ToolkitTestApplication application;
232 tet_infoline(" UtcDaliCubeTransitionEffectSetGetTransitionDuration ");
234 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New(NUM_ROWS, NUM_COLUMNS);
235 waveEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
236 waveEffect.SetCubeDisplacement(CUBE_DISPLACEMENT);
237 DALI_TEST_EQUALS(CUBE_DISPLACEMENT, waveEffect.GetCubeDisplacement(), TEST_LOCATION);
239 CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New(NUM_ROWS, NUM_COLUMNS);
240 crossEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
241 crossEffect.SetCubeDisplacement(CUBE_DISPLACEMENT);
242 DALI_TEST_EQUALS(CUBE_DISPLACEMENT, crossEffect.GetCubeDisplacement(), TEST_LOCATION);
244 //Cube displacement is not used in CubeTransitionFoldEffect
248 //Test common codes in base class
249 int UtcDaliCubeTransitionEffectGetRoot(void)
251 ToolkitTestApplication application;
252 tet_infoline(" UtcDaliCubeTransitionEffectGetRoot ");
254 unsigned int totalNum = NUM_ROWS * NUM_COLUMNS;
256 Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40);
258 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New(NUM_ROWS, NUM_COLUMNS);
259 waveEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
260 application.GetScene().Add(waveEffect);
261 waveEffect.SetCurrentTexture(texture);
262 waveEffect.SetTargetTexture(texture);
264 application.SendNotification();
265 application.Render();
267 waveEffect.StartTransition();
269 Wait(application, TRANSITION_DURATION * 0.5f);
271 // check that we have a total of NUM_ROWS*NUM_COLUMNS cubes;
272 Actor boxesRoot = waveEffect.GetChildAt(0);
273 DALI_TEST_CHECK(totalNum == boxesRoot.GetChildCount());
275 // check that every cube has two children
276 DALI_TEST_CHECK(2 == boxesRoot.GetChildAt(0).GetChildCount());
277 DALI_TEST_CHECK(2 == boxesRoot.GetChildAt(totalNum / 2).GetChildCount());
278 DALI_TEST_CHECK(2 == boxesRoot.GetChildAt(totalNum - 1).GetChildCount());
282 int UtcDaliCubeTransitionEffectIsTransitioning(void)
284 ToolkitTestApplication application;
285 tet_infoline(" UtcDaliCubeTransitionEffectIsTransiting ");
287 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
288 Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40);
290 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New(NUM_ROWS, NUM_COLUMNS);
291 waveEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
292 application.GetScene().Add(waveEffect);
294 waveEffect.SetTransitionDuration(TRANSITION_DURATION);
295 waveEffect.SetCubeDisplacement(CUBE_DISPLACEMENT);
296 DALI_TEST_CHECK(!waveEffect.IsTransitioning());
298 waveEffect.SetCurrentTexture(texture);
299 waveEffect.SetTargetTexture(texture);
300 //transition is started
301 waveEffect.StartTransition();
302 DALI_TEST_CHECK(waveEffect.IsTransitioning());
303 //transition is finished
304 Wait(application, TRANSITION_DURATION);
305 DALI_TEST_CHECK(!waveEffect.IsTransitioning());
307 CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New(NUM_ROWS, NUM_COLUMNS);
308 crossEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
309 application.GetScene().Add(crossEffect);
311 crossEffect.SetTransitionDuration(TRANSITION_DURATION);
312 crossEffect.SetCubeDisplacement(CUBE_DISPLACEMENT);
313 DALI_TEST_CHECK(!crossEffect.IsTransitioning());
315 crossEffect.SetCurrentTexture(texture);
316 crossEffect.SetTargetTexture(texture);
317 //transition is started
318 crossEffect.StartTransition(false);
319 DALI_TEST_CHECK(crossEffect.IsTransitioning());
320 //transition is finished
321 Wait(application, TRANSITION_DURATION);
322 DALI_TEST_CHECK(!crossEffect.IsTransitioning());
324 CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New(NUM_ROWS, NUM_COLUMNS);
325 foldEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
326 application.GetScene().Add(foldEffect);
328 foldEffect.SetTransitionDuration(TRANSITION_DURATION);
329 DALI_TEST_CHECK(!foldEffect.IsTransitioning());
331 foldEffect.SetCurrentTexture(texture);
332 foldEffect.SetTargetTexture(texture);
333 //transition is started
334 foldEffect.StartTransition(true);
335 DALI_TEST_CHECK(foldEffect.IsTransitioning());
336 //transition is finished
337 Wait(application, TRANSITION_DURATION);
338 DALI_TEST_CHECK(!foldEffect.IsTransitioning());
343 //Test common codes in base class
344 int UtcDaliCubeTransitionEffectSetCurrentTexture(void)
346 ToolkitTestApplication application;
347 tet_infoline(" UtcDaliCubeTransitionEffectSetCurrentTexture ");
349 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
350 Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40);
352 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New(NUM_ROWS, NUM_COLUMNS);
353 waveEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
354 waveEffect.SetCurrentTexture(texture);
356 application.GetScene().Add(waveEffect);
358 application.SendNotification();
359 application.Render();
361 waveEffect.StartTransition();
363 // the current image content is set to the tiles facing the camera
364 Actor currentTile = waveEffect.GetChildAt(0).GetChildAt(0).GetChildAt(0);
365 Actor targetTile = waveEffect.GetChildAt(0).GetChildAt(0).GetChildAt(1);
367 //check the pixel area set to the cube
368 Vector4 pixelAreaDef(0.f, 0.f, 1.f / NUM_COLUMNS, 1.f / NUM_ROWS);
370 Property::Index textureRectIndex = currentTile.GetPropertyIndex("uTextureRect");
371 DALI_TEST_CHECK(textureRectIndex != Property::INVALID_INDEX);
372 Property::Value textureRectValue = currentTile.GetProperty(textureRectIndex);
373 DALI_TEST_CHECK(textureRectValue.GetType() == Property::VECTOR4);
375 DALI_TEST_CHECK(textureRectValue.Get(pixelArea));
377 DALI_TEST_EQUALS(pixelAreaDef, pixelArea, FLT_EPISILON, TEST_LOCATION);
382 //Test common codes in base class
383 int UtcDaliCubeTransitionEffectSetTargetTexture(void)
385 ToolkitTestApplication application;
386 tet_infoline(" UtcDaliCubeTransitionEffectSetTargetTexture ");
388 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
389 Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40);
390 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New(NUM_ROWS, NUM_COLUMNS);
391 waveEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
392 application.GetScene().Add(waveEffect);
394 waveEffect.SetCurrentTexture(texture);
395 waveEffect.SetTargetTexture(texture);
397 application.GetScene().Add(waveEffect);
399 application.SendNotification();
400 application.Render();
402 waveEffect.StartTransition();
404 // the target image content is set to the tiles currently invisible to the camera
405 Actor tile = waveEffect.GetChildAt(0).GetChildAt(0).GetChildAt(1);
407 //check the pixel area set to the cube
408 Vector4 pixelAreaDef(0.f, 0.f, 1.f / NUM_COLUMNS, 1.f / NUM_ROWS);
410 Property::Index textureRectIndex = tile.GetPropertyIndex("uTextureRect");
411 DALI_TEST_CHECK(textureRectIndex != -1);
412 Property::Value textureRectValue = tile.GetProperty(textureRectIndex);
413 DALI_TEST_CHECK(textureRectValue.GetType() == Property::VECTOR4);
415 DALI_TEST_CHECK(textureRectValue.Get(pixelArea));
417 DALI_TEST_EQUALS(pixelAreaDef, pixelArea, FLT_EPISILON, TEST_LOCATION);
422 int UtcDaliCubeTransitionWaveEffectStartTransition(void)
424 ToolkitTestApplication application;
425 tet_infoline(" UtcDaliCubeTransitionWaveEffectStartTransition ");
427 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
429 Devel::PixelBuffer pixelBuffer = LoadImageFromFile(TEST_RESOURCE_DIR "/gallery-small-1.jpg");
430 PixelData pixelData = Devel::PixelBuffer::Convert(pixelBuffer);
431 Texture texture = Texture::New(TextureType::TEXTURE_2D, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight());
432 texture.Upload(pixelData);
434 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New(NUM_ROWS, NUM_COLUMNS);
435 waveEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
436 waveEffect.SetTransitionDuration(TRANSITION_DURATION);
437 waveEffect.SetCubeDisplacement(CUBE_DISPLACEMENT);
438 waveEffect.SetCurrentTexture(texture);
440 application.GetScene().Add(waveEffect);
442 application.SendNotification();
443 application.Render();
445 waveEffect.StartTransition(true);
447 Actor cube = waveEffect.GetChildAt(0).GetChildAt(0);
449 //check the cube rotation value and color values just before the end of different transitions
450 waveEffect.SetTargetTexture(texture);
451 Wait(application, TRANSITION_BEFORE_END_DURATION);
452 DALI_TEST_EQUALS(cube.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(-Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION);
453 DALI_TEST_EQUALS(cube.GetChildAt(0).GetCurrentProperty<Vector4>(Actor::Property::COLOR), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION);
454 DALI_TEST_EQUALS(cube.GetChildAt(1).GetCurrentProperty<Vector4>(Actor::Property::COLOR), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION);
456 waveEffect.SetTargetTexture(texture);
457 waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
458 Wait(application, TRANSITION_BEFORE_END_DURATION);
459 DALI_TEST_EQUALS(cube.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(-Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION);
460 DALI_TEST_EQUALS(cube.GetChildAt(0).GetCurrentProperty<Vector4>(Actor::Property::COLOR), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION);
461 DALI_TEST_EQUALS(cube.GetChildAt(1).GetCurrentProperty<Vector4>(Actor::Property::COLOR), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION);
463 waveEffect.SetTargetTexture(texture);
464 waveEffect.StartTransition(false);
465 Wait(application, TRANSITION_BEFORE_END_DURATION);
466 DALI_TEST_EQUALS(cube.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION);
467 DALI_TEST_EQUALS(cube.GetChildAt(0).GetCurrentProperty<Vector4>(Actor::Property::COLOR), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION);
468 DALI_TEST_EQUALS(cube.GetChildAt(1).GetCurrentProperty<Vector4>(Actor::Property::COLOR), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION);
470 waveEffect.SetTargetTexture(texture);
471 waveEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
472 Wait(application, TRANSITION_BEFORE_END_DURATION);
473 DALI_TEST_EQUALS(cube.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION);
474 DALI_TEST_EQUALS(cube.GetChildAt(0).GetCurrentProperty<Vector4>(Actor::Property::COLOR), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION);
475 DALI_TEST_EQUALS(cube.GetChildAt(1).GetCurrentProperty<Vector4>(Actor::Property::COLOR), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION);
479 int UtcDaliCubeTransitionCrossEffectStartTransition(void)
481 ToolkitTestApplication application;
482 tet_infoline(" UtcDaliCubeTransitionCrossEffectStartTransition ");
484 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
486 Devel::PixelBuffer pixelBuffer = LoadImageFromFile(TEST_RESOURCE_DIR "/gallery-small-1.jpg");
487 PixelData pixelData = Devel::PixelBuffer::Convert(pixelBuffer);
488 Texture texture = Texture::New(TextureType::TEXTURE_2D, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight());
489 texture.Upload(pixelData);
491 CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New(NUM_ROWS, NUM_COLUMNS);
492 crossEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
493 crossEffect.SetTransitionDuration(TRANSITION_DURATION);
494 crossEffect.SetCubeDisplacement(CUBE_DISPLACEMENT);
495 crossEffect.SetCurrentTexture(texture);
496 crossEffect.SetTargetTexture(texture);
498 application.GetScene().Add(crossEffect);
500 application.SendNotification();
501 application.Render();
503 crossEffect.StartTransition(true);
505 Actor cube0 = crossEffect.GetChildAt(0).GetChildAt(0);
506 Actor cube1 = crossEffect.GetChildAt(0).GetChildAt(1);
508 //check the cube rotation value and color values just before the end of different transitions
509 Wait(application, TRANSITION_BEFORE_END_DURATION);
510 DALI_TEST_EQUALS(cube1.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(-Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION);
511 DALI_TEST_EQUALS(cube0.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_90, Vector3::XAXIS), EPISILON, TEST_LOCATION);
512 DALI_TEST_EQUALS(cube0.GetChildAt(0).GetCurrentProperty<Vector4>(Actor::Property::COLOR), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION);
513 DALI_TEST_EQUALS(cube0.GetChildAt(1).GetCurrentProperty<Vector4>(Actor::Property::COLOR), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION);
515 crossEffect.SetTargetTexture(texture);
516 crossEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
517 Wait(application, TRANSITION_BEFORE_END_DURATION);
518 DALI_TEST_EQUALS(cube1.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(-Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION);
519 DALI_TEST_EQUALS(cube0.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_90, Vector3::XAXIS), EPISILON, TEST_LOCATION);
520 DALI_TEST_EQUALS(cube0.GetChildAt(0).GetCurrentProperty<Vector4>(Actor::Property::COLOR), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION);
521 DALI_TEST_EQUALS(cube0.GetChildAt(1).GetCurrentProperty<Vector4>(Actor::Property::COLOR), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION);
523 crossEffect.SetTargetTexture(texture);
524 crossEffect.StartTransition(false);
525 Wait(application, TRANSITION_BEFORE_END_DURATION);
526 DALI_TEST_EQUALS(cube1.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION);
527 DALI_TEST_EQUALS(cube0.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(-Dali::ANGLE_90, Vector3::XAXIS), EPISILON, TEST_LOCATION);
528 DALI_TEST_EQUALS(cube0.GetChildAt(0).GetCurrentProperty<Vector4>(Actor::Property::COLOR), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION);
529 DALI_TEST_EQUALS(cube0.GetChildAt(1).GetCurrentProperty<Vector4>(Actor::Property::COLOR), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION);
531 crossEffect.SetTargetTexture(texture);
532 crossEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
533 Wait(application, TRANSITION_BEFORE_END_DURATION);
534 DALI_TEST_EQUALS(cube1.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION);
535 DALI_TEST_EQUALS(cube0.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(-Dali::ANGLE_90, Vector3::XAXIS), EPISILON, TEST_LOCATION);
536 DALI_TEST_EQUALS(cube0.GetChildAt(0).GetCurrentProperty<Vector4>(Actor::Property::COLOR), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION);
537 DALI_TEST_EQUALS(cube0.GetChildAt(1).GetCurrentProperty<Vector4>(Actor::Property::COLOR), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION);
541 int UtcDaliCubeTransitionFoldEffectStartTransition(void)
543 ToolkitTestApplication application;
544 tet_infoline(" UtcDaliCubeTransitionFoldEffectStartTransition ");
546 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
547 Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40);
548 CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New(NUM_ROWS, NUM_COLUMNS);
549 foldEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
550 foldEffect.SetTransitionDuration(TRANSITION_DURATION);
551 foldEffect.SetCurrentTexture(texture);
552 foldEffect.SetTargetTexture(texture);
554 application.GetScene().Add(foldEffect);
556 application.SendNotification();
557 application.Render();
559 foldEffect.StartTransition(true);
561 Actor cube0 = foldEffect.GetChildAt(0).GetChildAt(0);
562 Actor cube1 = foldEffect.GetChildAt(0).GetChildAt(1);
564 //check the cube rotation value and color values just before the end of different transitions
565 Wait(application, TRANSITION_BEFORE_END_DURATION);
566 DALI_TEST_EQUALS(cube1.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(-Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION);
567 DALI_TEST_EQUALS(cube0.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION);
568 DALI_TEST_EQUALS(cube0.GetChildAt(0).GetCurrentProperty<Vector4>(Actor::Property::COLOR), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION);
569 DALI_TEST_EQUALS(cube0.GetChildAt(1).GetCurrentProperty<Vector4>(Actor::Property::COLOR), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION);
571 foldEffect.SetTargetTexture(texture);
572 foldEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
573 Wait(application, TRANSITION_BEFORE_END_DURATION);
574 DALI_TEST_EQUALS(cube1.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(-Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION);
575 DALI_TEST_EQUALS(cube0.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION);
576 DALI_TEST_EQUALS(cube0.GetChildAt(0).GetCurrentProperty<Vector4>(Actor::Property::COLOR), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION);
577 DALI_TEST_EQUALS(cube0.GetChildAt(1).GetCurrentProperty<Vector4>(Actor::Property::COLOR), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION);
579 foldEffect.SetTargetTexture(texture);
580 foldEffect.StartTransition(false);
581 Wait(application, TRANSITION_BEFORE_END_DURATION);
582 DALI_TEST_EQUALS(cube1.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION);
583 DALI_TEST_EQUALS(cube0.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(-Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION);
584 DALI_TEST_EQUALS(cube0.GetChildAt(0).GetCurrentProperty<Vector4>(Actor::Property::COLOR), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION);
585 DALI_TEST_EQUALS(cube0.GetChildAt(1).GetCurrentProperty<Vector4>(Actor::Property::COLOR), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION);
587 foldEffect.SetTargetTexture(texture);
588 foldEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
589 Wait(application, TRANSITION_BEFORE_END_DURATION);
590 DALI_TEST_EQUALS(cube1.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION);
591 DALI_TEST_EQUALS(cube0.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(-Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION);
592 DALI_TEST_EQUALS(cube0.GetChildAt(0).GetCurrentProperty<Vector4>(Actor::Property::COLOR), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION);
593 DALI_TEST_EQUALS(cube0.GetChildAt(1).GetCurrentProperty<Vector4>(Actor::Property::COLOR), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION);
597 int UtcDaliCubeTransitionEffectSignalTransitionCompleted(void)
599 ToolkitTestApplication application;
600 tet_infoline(" UtcDaliCubeTransitionEffectSignalTransitionCompleted ");
602 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
603 Texture firstTexture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 30, 30);
604 Texture secondTexture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 20, 20);
605 Texture thirdTexture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40);
607 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New(NUM_ROWS, NUM_COLUMNS);
608 waveEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
609 waveEffect.SetTransitionDuration(TRANSITION_DURATION);
610 waveEffect.SetCubeDisplacement(CUBE_DISPLACEMENT);
611 application.GetScene().Add(waveEffect);
613 CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New(NUM_ROWS, NUM_COLUMNS);
614 crossEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
615 crossEffect.SetTransitionDuration(TRANSITION_DURATION);
616 crossEffect.SetCubeDisplacement(CUBE_DISPLACEMENT);
617 application.GetScene().Add(crossEffect);
619 CubeTransitionEffect foldEffect = CubeTransitionCrossEffect::New(NUM_ROWS, NUM_COLUMNS);
620 foldEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
621 foldEffect.SetTransitionDuration(TRANSITION_DURATION);
622 application.GetScene().Add(foldEffect);
624 bool signalVerified = false;
625 CubeTransitionEffect currentEffect;
626 Texture actorTransitTo;
627 TransitionCompletedCallback callback(signalVerified, currentEffect, actorTransitTo);
628 waveEffect.TransitionCompletedSignal().Connect(&callback, &TransitionCompletedCallback::Callback);
629 crossEffect.TransitionCompletedSignal().Connect(&callback, &TransitionCompletedCallback::Callback);
630 foldEffect.TransitionCompletedSignal().Connect(&callback, &TransitionCompletedCallback::Callback);
632 //check that the wave effect is used to transit to secondTexture
633 currentEffect = waveEffect;
634 actorTransitTo = secondTexture;
635 waveEffect.SetCurrentTexture(firstTexture);
636 waveEffect.SetTargetTexture(secondTexture);
637 waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
638 Wait(application, TRANSITION_DURATION);
639 DALI_TEST_CHECK(callback.mSignalVerified);
642 //check that the wave effect is used to transit to thirdTexture
643 actorTransitTo = thirdTexture;
644 waveEffect.SetTargetTexture(thirdTexture);
645 waveEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
646 Wait(application, TRANSITION_DURATION);
647 DALI_TEST_CHECK(callback.mSignalVerified);
650 //check that the cross effect is used to transit to secondTexture
651 currentEffect = crossEffect;
652 actorTransitTo = secondTexture;
653 crossEffect.SetCurrentTexture(thirdTexture);
654 crossEffect.SetTargetTexture(secondTexture);
655 crossEffect.StartTransition(true);
656 Wait(application, TRANSITION_DURATION);
657 DALI_TEST_CHECK(callback.mSignalVerified);
660 //check that the cross effect is used to transit to firstTexture
661 actorTransitTo = firstTexture;
662 crossEffect.SetTargetTexture(firstTexture);
663 crossEffect.StartTransition(false);
664 Wait(application, TRANSITION_DURATION);
665 DALI_TEST_CHECK(callback.mSignalVerified);
668 //check that the fold effect is used to transit to secondTexture
669 currentEffect = foldEffect;
670 actorTransitTo = secondTexture;
671 foldEffect.SetCurrentTexture(firstTexture);
672 foldEffect.SetTargetTexture(secondTexture);
673 foldEffect.StartTransition();
674 Wait(application, TRANSITION_DURATION);
675 DALI_TEST_CHECK(callback.mSignalVerified);
678 //check that the fold effect is used to transit to thirdTexture
679 actorTransitTo = thirdTexture;
680 foldEffect.SetTargetTexture(thirdTexture);
681 foldEffect.StartTransition(false);
682 Wait(application, TRANSITION_DURATION);
683 DALI_TEST_CHECK(callback.mSignalVerified);
687 int UtcDaliCubeTransitionEffectPauseResumeTransition(void)
689 ToolkitTestApplication application;
690 tet_infoline(" UtcDaliCubeTransitionEffectPauseResumeTransition ");
692 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
693 Texture firstTexture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 30, 30);
694 Texture secondTexture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 20, 20);
696 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New(NUM_ROWS, NUM_COLUMNS);
697 waveEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
698 waveEffect.SetTransitionDuration(TRANSITION_DURATION);
699 waveEffect.SetCubeDisplacement(CUBE_DISPLACEMENT);
700 application.GetScene().Add(waveEffect);
702 CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New(NUM_ROWS, NUM_COLUMNS);
703 crossEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
704 crossEffect.SetTransitionDuration(TRANSITION_DURATION);
705 crossEffect.SetCubeDisplacement(CUBE_DISPLACEMENT);
706 application.GetScene().Add(crossEffect);
708 CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New(NUM_ROWS, NUM_COLUMNS);
709 foldEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
710 foldEffect.SetTransitionDuration(TRANSITION_DURATION);
711 application.GetScene().Add(foldEffect);
713 bool signalVerified = false;
714 CubeTransitionEffect currentEffect;
715 Texture actorTransitTo;
716 TransitionCompletedCallback callback(signalVerified, currentEffect, actorTransitTo);
717 waveEffect.TransitionCompletedSignal().Connect(&callback, &TransitionCompletedCallback::Callback);
718 crossEffect.TransitionCompletedSignal().Connect(&callback, &TransitionCompletedCallback::Callback);
719 foldEffect.TransitionCompletedSignal().Connect(&callback, &TransitionCompletedCallback::Callback);
721 currentEffect = waveEffect;
722 actorTransitTo = secondTexture;
723 waveEffect.SetCurrentTexture(firstTexture);
724 waveEffect.SetTargetTexture(secondTexture);
725 // start transition; transit for 0.5*duration; pause for 0.5*duration;
726 // resume for 0.25*duration; pause for 0.25*duration; resume for another 0.25*duration;
727 // only until now the transition finished signal can be received
728 waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
729 Wait(application, TRANSITION_DURATION * 0.5f);
730 DALI_TEST_CHECK(!callback.mSignalVerified);
731 waveEffect.PauseTransition();
732 Wait(application, TRANSITION_DURATION * 0.5f);
733 DALI_TEST_CHECK(!callback.mSignalVerified);
734 waveEffect.ResumeTransition();
735 Wait(application, TRANSITION_DURATION * 0.25f);
736 DALI_TEST_CHECK(!callback.mSignalVerified);
737 waveEffect.PauseTransition();
738 Wait(application, TRANSITION_DURATION * 0.25f);
739 DALI_TEST_CHECK(!callback.mSignalVerified);
740 waveEffect.ResumeTransition();
741 Wait(application, TRANSITION_DURATION * 0.25f);
742 DALI_TEST_CHECK(callback.mSignalVerified);
745 currentEffect = crossEffect;
746 actorTransitTo = firstTexture;
747 crossEffect.SetCurrentTexture(secondTexture);
748 crossEffect.SetTargetTexture(firstTexture);
749 // start transition; transit for 0.25*duration; pause for 0.2*duration;
750 // resume for 0.5*duration; pause for 0.2*duration; resume for another 0.25*duration;
751 // only until now the transition finished signal can be received
752 crossEffect.StartTransition(false);
753 Wait(application, TRANSITION_DURATION * 0.25f);
754 DALI_TEST_CHECK(!callback.mSignalVerified);
755 crossEffect.PauseTransition();
756 Wait(application, TRANSITION_DURATION * 0.2f);
757 DALI_TEST_CHECK(!callback.mSignalVerified);
758 crossEffect.ResumeTransition();
759 Wait(application, TRANSITION_DURATION * 0.5f);
760 DALI_TEST_CHECK(!callback.mSignalVerified);
761 crossEffect.PauseTransition();
762 Wait(application, TRANSITION_DURATION * 0.2f);
763 DALI_TEST_CHECK(!callback.mSignalVerified);
764 crossEffect.ResumeTransition();
765 Wait(application, TRANSITION_DURATION * 0.25f);
766 DALI_TEST_CHECK(callback.mSignalVerified);
769 currentEffect = foldEffect;
770 actorTransitTo = secondTexture;
771 foldEffect.SetCurrentTexture(firstTexture);
772 foldEffect.SetTargetTexture(secondTexture);
773 // start transition; transit for 0.5*duration; pause for 0.5*duration;
774 // resume for 0.25*duration; pause for 0.25*duration; resume for another 0.25*duration;
775 // only until now the transition finished signal can be received
776 foldEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
777 Wait(application, TRANSITION_DURATION * 0.5f);
778 DALI_TEST_CHECK(!callback.mSignalVerified);
779 foldEffect.PauseTransition();
780 Wait(application, TRANSITION_DURATION * 0.5f);
781 DALI_TEST_CHECK(!callback.mSignalVerified);
782 foldEffect.ResumeTransition();
783 Wait(application, TRANSITION_DURATION * 0.25f);
784 DALI_TEST_CHECK(!callback.mSignalVerified);
785 foldEffect.PauseTransition();
786 Wait(application, TRANSITION_DURATION * 0.25f);
787 DALI_TEST_CHECK(!callback.mSignalVerified);
788 foldEffect.ResumeTransition();
789 Wait(application, TRANSITION_DURATION * 0.25f);
790 DALI_TEST_CHECK(callback.mSignalVerified);
794 int UtcDaliCubeTransitionWaveEffectStopTransition(void)
796 ToolkitTestApplication application;
797 tet_infoline(" UtcDaliCubeTransitionWaveEffectStopTransition ");
799 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
800 Texture firstTexture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 30, 30);
801 Texture secondTexture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 20, 20);
803 CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New(NUM_ROWS, NUM_COLUMNS);
804 waveEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
805 waveEffect.SetTransitionDuration(TRANSITION_DURATION);
806 waveEffect.SetCubeDisplacement(CUBE_DISPLACEMENT);
807 waveEffect.SetCurrentTexture(firstTexture);
808 waveEffect.SetTargetTexture(secondTexture);
810 application.GetScene().Add(waveEffect);
812 application.SendNotification();
813 application.Render();
815 waveEffect.StartTransition(true);
817 Actor cube = waveEffect.GetChildAt(0).GetChildAt(0);
819 //check the cube rotation value and color values reset after stopping different transitions in the middle
820 Wait(application, TRANSITION_DURATION * 0.2f);
821 waveEffect.StopTransition();
822 application.SendNotification();
823 application.Render(RENDER_FRAME_INTERVAL);
824 DALI_TEST_EQUALS(cube.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZERO), FLT_EPISILON, TEST_LOCATION);
825 DALI_TEST_EQUALS(cube.GetChildAt(0).GetCurrentProperty<Vector4>(Actor::Property::COLOR), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION);
826 DALI_TEST_EQUALS(cube.GetChildAt(1).GetCurrentProperty<Vector4>(Actor::Property::COLOR), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION);
828 waveEffect.SetTargetTexture(firstTexture);
829 waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
830 Wait(application, TRANSITION_DURATION * 0.4f);
831 waveEffect.StopTransition();
832 application.SendNotification();
833 application.Render(RENDER_FRAME_INTERVAL);
834 DALI_TEST_EQUALS(cube.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZERO), FLT_EPISILON, TEST_LOCATION);
835 DALI_TEST_EQUALS(cube.GetChildAt(0).GetCurrentProperty<Vector4>(Actor::Property::COLOR), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION);
836 DALI_TEST_EQUALS(cube.GetChildAt(1).GetCurrentProperty<Vector4>(Actor::Property::COLOR), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION);
838 waveEffect.SetTargetTexture(secondTexture);
839 waveEffect.StartTransition(false);
840 Wait(application, TRANSITION_DURATION * 0.6f);
841 waveEffect.StopTransition();
842 application.SendNotification();
843 application.Render(RENDER_FRAME_INTERVAL);
844 DALI_TEST_EQUALS(cube.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZERO), FLT_EPISILON, TEST_LOCATION);
845 DALI_TEST_EQUALS(cube.GetChildAt(0).GetCurrentProperty<Vector4>(Actor::Property::COLOR), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION);
846 DALI_TEST_EQUALS(cube.GetChildAt(1).GetCurrentProperty<Vector4>(Actor::Property::COLOR), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION);
848 waveEffect.SetTargetTexture(firstTexture);
849 waveEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
850 Wait(application, TRANSITION_DURATION * 0.8f);
851 waveEffect.StopTransition();
852 application.SendNotification();
853 application.Render(RENDER_FRAME_INTERVAL);
854 DALI_TEST_EQUALS(cube.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZERO), FLT_EPISILON, TEST_LOCATION);
855 DALI_TEST_EQUALS(cube.GetChildAt(0).GetCurrentProperty<Vector4>(Actor::Property::COLOR), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION);
856 DALI_TEST_EQUALS(cube.GetChildAt(1).GetCurrentProperty<Vector4>(Actor::Property::COLOR), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION);
860 int UtcDaliCubeTransitionCrossEffectStopTransition(void)
862 ToolkitTestApplication application;
863 tet_infoline(" UtcDaliCubeTransitionCrossEffectStopTransition ");
865 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
866 Texture firstTexture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 30, 30);
867 Texture secondTexture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 20, 20);
869 CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New(NUM_ROWS, NUM_COLUMNS);
870 crossEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
871 crossEffect.SetTransitionDuration(TRANSITION_DURATION);
872 crossEffect.SetCubeDisplacement(CUBE_DISPLACEMENT);
873 crossEffect.SetCurrentTexture(firstTexture);
874 crossEffect.SetTargetTexture(secondTexture);
876 application.GetScene().Add(crossEffect);
878 application.SendNotification();
879 application.Render();
881 crossEffect.StartTransition(true);
883 Actor cube0 = crossEffect.GetChildAt(0).GetChildAt(0);
884 Actor cube1 = crossEffect.GetChildAt(0).GetChildAt(1);
886 //check the cube rotation values and color values reset after stop the different transitions in the middle
887 Wait(application, TRANSITION_DURATION * 0.2f);
888 crossEffect.StopTransition();
889 application.SendNotification();
890 application.Render(RENDER_FRAME_INTERVAL);
891 DALI_TEST_EQUALS(cube0.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZERO), FLT_EPISILON, TEST_LOCATION);
892 DALI_TEST_EQUALS(cube1.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZERO), FLT_EPISILON, TEST_LOCATION);
893 DALI_TEST_EQUALS(cube0.GetChildAt(0).GetCurrentProperty<Vector4>(Actor::Property::COLOR), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION);
894 DALI_TEST_EQUALS(cube0.GetChildAt(1).GetCurrentProperty<Vector4>(Actor::Property::COLOR), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION);
896 crossEffect.SetTargetTexture(firstTexture);
897 crossEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
898 Wait(application, TRANSITION_DURATION * 0.4f);
899 crossEffect.StopTransition();
900 application.SendNotification();
901 application.Render(RENDER_FRAME_INTERVAL);
902 DALI_TEST_EQUALS(cube0.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZERO), FLT_EPISILON, TEST_LOCATION);
903 DALI_TEST_EQUALS(cube1.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZERO), FLT_EPISILON, TEST_LOCATION);
904 DALI_TEST_EQUALS(cube0.GetChildAt(0).GetCurrentProperty<Vector4>(Actor::Property::COLOR), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION);
905 DALI_TEST_EQUALS(cube0.GetChildAt(1).GetCurrentProperty<Vector4>(Actor::Property::COLOR), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION);
907 crossEffect.SetTargetTexture(secondTexture);
908 crossEffect.StartTransition(false);
909 Wait(application, TRANSITION_DURATION * 0.6f);
910 crossEffect.StopTransition();
911 application.SendNotification();
912 application.Render(RENDER_FRAME_INTERVAL);
913 DALI_TEST_EQUALS(cube0.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZERO), FLT_EPISILON, TEST_LOCATION);
914 DALI_TEST_EQUALS(cube1.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZERO), FLT_EPISILON, TEST_LOCATION);
915 DALI_TEST_EQUALS(cube0.GetChildAt(0).GetCurrentProperty<Vector4>(Actor::Property::COLOR), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION);
916 DALI_TEST_EQUALS(cube0.GetChildAt(1).GetCurrentProperty<Vector4>(Actor::Property::COLOR), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION);
918 crossEffect.SetTargetTexture(firstTexture);
919 crossEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
920 Wait(application, TRANSITION_DURATION * 0.8f);
921 crossEffect.StopTransition();
922 application.SendNotification();
923 application.Render(RENDER_FRAME_INTERVAL);
924 DALI_TEST_EQUALS(cube1.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION);
925 DALI_TEST_EQUALS(cube0.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION);
926 DALI_TEST_EQUALS(cube0.GetChildAt(0).GetCurrentProperty<Vector4>(Actor::Property::COLOR), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION);
927 DALI_TEST_EQUALS(cube0.GetChildAt(1).GetCurrentProperty<Vector4>(Actor::Property::COLOR), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION);
931 int UtcDaliCubeTransitionFoldEffectStopTransition(void)
933 ToolkitTestApplication application;
934 tet_infoline(" UtcDaliCubeTransitionFoldEffectStopTransition ");
936 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
937 Texture firstTexture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 30, 30);
938 Texture secondTexture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 20, 20);
940 CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New(NUM_ROWS, NUM_COLUMNS);
941 foldEffect.SetProperty(Actor::Property::SIZE, Vector2(VIEW_AREA_SIZE));
942 foldEffect.SetTransitionDuration(TRANSITION_DURATION);
943 foldEffect.SetCurrentTexture(firstTexture);
944 foldEffect.SetTargetTexture(secondTexture);
946 application.GetScene().Add(foldEffect);
948 application.SendNotification();
949 application.Render();
951 foldEffect.StartTransition(true);
953 Actor cube0 = foldEffect.GetChildAt(0).GetChildAt(0);
954 Actor cube1 = foldEffect.GetChildAt(0).GetChildAt(1);
956 //check the cube rotation values and color values after stop the different transitions in the middle
957 Wait(application, TRANSITION_DURATION * 0.2f);
958 foldEffect.StopTransition();
959 application.SendNotification();
960 application.Render(RENDER_FRAME_INTERVAL);
962 DALI_TEST_EQUALS(cube1.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION);
963 DALI_TEST_EQUALS(cube0.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION);
964 DALI_TEST_EQUALS(cube0.GetChildAt(0).GetCurrentProperty<Vector4>(Actor::Property::COLOR), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION);
965 DALI_TEST_EQUALS(cube0.GetChildAt(1).GetCurrentProperty<Vector4>(Actor::Property::COLOR), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION);
967 foldEffect.SetTargetTexture(firstTexture);
968 foldEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
969 Wait(application, TRANSITION_DURATION * 0.4f);
970 foldEffect.StopTransition();
971 application.SendNotification();
972 application.Render(RENDER_FRAME_INTERVAL);
973 DALI_TEST_EQUALS(cube1.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION);
974 DALI_TEST_EQUALS(cube0.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION);
975 DALI_TEST_EQUALS(cube0.GetChildAt(0).GetCurrentProperty<Vector4>(Actor::Property::COLOR), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION);
976 DALI_TEST_EQUALS(cube0.GetChildAt(1).GetCurrentProperty<Vector4>(Actor::Property::COLOR), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION);
978 foldEffect.SetTargetTexture(secondTexture);
979 foldEffect.StartTransition(false);
980 Wait(application, TRANSITION_DURATION * 0.6f);
981 foldEffect.StopTransition();
982 application.SendNotification();
983 application.Render(RENDER_FRAME_INTERVAL);
984 DALI_TEST_EQUALS(cube1.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION);
985 DALI_TEST_EQUALS(cube0.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION);
986 DALI_TEST_EQUALS(cube0.GetChildAt(0).GetCurrentProperty<Vector4>(Actor::Property::COLOR), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION);
987 DALI_TEST_EQUALS(cube0.GetChildAt(1).GetCurrentProperty<Vector4>(Actor::Property::COLOR), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION);
989 foldEffect.SetTargetTexture(firstTexture);
990 foldEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
991 Wait(application, TRANSITION_DURATION * 0.8f);
992 foldEffect.StopTransition();
993 application.SendNotification();
994 application.Render(RENDER_FRAME_INTERVAL);
995 DALI_TEST_EQUALS(cube1.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION);
996 DALI_TEST_EQUALS(cube0.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION);
997 DALI_TEST_EQUALS(cube0.GetChildAt(0).GetCurrentProperty<Vector4>(Actor::Property::COLOR), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION);
998 DALI_TEST_EQUALS(cube0.GetChildAt(1).GetCurrentProperty<Vector4>(Actor::Property::COLOR), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION);