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.
18 #include <dali-toolkit-test-suite-utils.h>
19 #include <dali-toolkit/dali-toolkit.h>
20 #include <dali-toolkit/devel-api/controls/video-view/video-view-devel.h>
21 #include <dali-toolkit/public-api/controls/video-view/video-view.h>
22 #include <dali/devel-api/adaptor-framework/video-sync-mode.h>
23 #include <dali/devel-api/adaptor-framework/window-devel.h>
28 using namespace Dali::Toolkit;
32 const char* const TEST_FILE("test.mp4");
33 const char* const VOLUME_LEFT("volumeLeft");
34 const char* const VOLUME_RIGHT("volumeRight");
35 const char* const RENDERING_TYPE("renderingTarget");
36 const char* const DUMMY_STRING("dummy string");
39 const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
40 attribute mediump vec2 aPosition;\n
41 varying mediump vec2 vTexCoord;\n
42 uniform mediump mat4 uMvpMatrix;\n
43 uniform mediump vec3 uSize;\n
47 mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n
48 vertexPosition.xyz *= uSize;\n
49 vertexPosition = uMvpMatrix * vertexPosition;\n
50 vTexCoord = aPosition + vec2(0.5);\n
51 gl_Position = vertexPosition;\n
54 const char* fragmentShaderPrefix("#extension GL_OES_EGL_image_external:require\n");
55 const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
56 varying mediump vec2 vTexCoord;\n
57 uniform samplerExternalOES sTexture;\n
58 uniform lowp vec4 uColor;\n
62 gl_FragColor = texture2D(sTexture, vTexCoord) * uColor;\n
69 void video_view_startup(void)
71 test_return_value = TET_UNDEF;
74 void video_view_cleanup(void)
76 test_return_value = TET_PASS;
79 // Negative test case for a method
80 int UtcDaliVideoViewUninitialized(void)
82 ToolkitTestApplication application;
83 tet_infoline(" UtcDaliVideoViewUninitialized");
85 Toolkit::VideoView view;
89 // New() must be called to create a VideoView or it wont be valid.
90 Actor a = Actor::New();
92 DALI_TEST_CHECK(false);
94 catch(Dali::DaliException& e)
96 // Tests that a negative test of an assertion succeeds
97 DALI_TEST_PRINT_ASSERT(e);
98 DALI_TEST_CHECK(!view);
103 // Positive test case for a method
104 int UtcDaliVideoViewNew(void)
106 ToolkitTestApplication application;
107 tet_infoline(" UtcDaliVideoViewNew");
109 Toolkit::VideoView view = Toolkit::VideoView::New();
110 DALI_TEST_CHECK(view);
112 const std::string url(DUMMY_STRING);
113 Toolkit::VideoView view2 = Toolkit::VideoView::New(url);
114 DALI_TEST_CHECK(view2);
118 // Positive test case for a method
119 int UtcDaliVideoViewDownCast(void)
121 ToolkitTestApplication application;
122 tet_infoline(" UtcDaliVideoViewDownCast");
124 Toolkit::VideoView view = Toolkit::VideoView::New();
125 BaseHandle handle(view);
127 Toolkit::VideoView view2 = Toolkit::VideoView::DownCast(handle);
128 DALI_TEST_CHECK(view);
129 DALI_TEST_CHECK(view2);
130 DALI_TEST_CHECK(view == view2);
134 // Positive test case for a method
135 int UtcDaliVideoViewProperty1(void)
137 ToolkitTestApplication application;
138 tet_infoline(" UtcDaliVideoViewProperty1");
140 Toolkit::VideoView view = Toolkit::VideoView::New();
141 DALI_TEST_CHECK(view);
144 view.SetProperty(VideoView::Property::VIDEO, TEST_FILE);
145 Property::Value val = view.GetProperty(VideoView::Property::VIDEO);
146 DALI_TEST_CHECK(val.Get(file));
147 DALI_TEST_CHECK(file == TEST_FILE);
151 // Positive test case for a method
152 int UtcDaliVideoViewProperty1b(void)
154 ToolkitTestApplication application;
155 tet_infoline(" UtcDaliVideoViewProperty1");
157 Toolkit::VideoView view = Toolkit::VideoView::New();
158 DALI_TEST_CHECK(view);
159 Integration::Scene stage = application.GetScene();
164 view.SetProperty(VideoView::Property::VIDEO,
166 .Add("rendererType", "IMAGE")
167 .Add("url", "video.mpg") // Note, videoView doesn't use this url
168 .Add("RENDERING_TARGET", "windowSurfaceTarget")
170 .Add("height", 100));
174 Property::Value val = view.GetProperty(VideoView::Property::VIDEO);
175 Property::Map* resultMap = val.GetMap();
177 DALI_TEST_CHECK(resultMap);
178 Property::Value* value = resultMap->Find("url");
179 DALI_TEST_CHECK(value);
180 DALI_TEST_EQUALS(value->Get<std::string>(), "video.mpg", TEST_LOCATION);
187 int UtcDaliVideoViewProperty2(void)
189 ToolkitTestApplication application;
190 tet_infoline(" UtcDaliVideoViewProperty2");
192 Toolkit::VideoView view = Toolkit::VideoView::New();
193 DALI_TEST_CHECK(view);
196 Property::Value val = view.GetProperty(VideoView::Property::LOOPING);
197 DALI_TEST_CHECK(val.Get(looping));
198 DALI_TEST_CHECK(!looping);
200 view.SetProperty(VideoView::Property::LOOPING, true);
201 val = view.GetProperty(VideoView::Property::LOOPING);
202 DALI_TEST_CHECK(val.Get(looping));
203 DALI_TEST_CHECK(looping);
207 int UtcDaliVideoViewProperty3(void)
209 ToolkitTestApplication application;
210 tet_infoline(" UtcDaliVideoViewProperty3");
212 Toolkit::VideoView view = Toolkit::VideoView::New();
213 DALI_TEST_CHECK(view);
216 Property::Value val = view.GetProperty(VideoView::Property::MUTED);
217 DALI_TEST_CHECK(val.Get(muted));
218 DALI_TEST_CHECK(!muted);
220 view.SetProperty(VideoView::Property::MUTED, true);
221 val = view.GetProperty(VideoView::Property::MUTED);
222 DALI_TEST_CHECK(val.Get(muted));
223 DALI_TEST_CHECK(muted);
228 int UtcDaliVideoViewProperty4(void)
230 ToolkitTestApplication application;
231 tet_infoline(" UtcDaliVideoViewProperty4");
233 Toolkit::VideoView view = Toolkit::VideoView::New();
234 DALI_TEST_CHECK(view);
240 map.Insert(VOLUME_LEFT, 0.5f);
241 map.Insert(VOLUME_RIGHT, 0.5f);
243 view.SetProperty(VideoView::Property::VOLUME, map);
244 Property::Value val = view.GetProperty(VideoView::Property::VOLUME);
247 DALI_TEST_CHECK(val.Get(map2));
249 Property::Value* volumeLeft = map2.Find(VOLUME_LEFT);
250 Property::Value* volumeRight = map2.Find(VOLUME_RIGHT);
252 DALI_TEST_CHECK(volumeLeft && volumeLeft->Get(left));
253 DALI_TEST_CHECK(volumeRight && volumeRight->Get(right));
254 DALI_TEST_CHECK(left == 0.5f);
255 DALI_TEST_CHECK(right == 0.5f);
260 int UtcDaliVideoViewCopyAndAssignment(void)
262 ToolkitTestApplication application;
264 VideoView view = Toolkit::VideoView::New();
265 DALI_TEST_CHECK(view);
267 VideoView copy(view);
268 DALI_TEST_CHECK(view == copy);
271 DALI_TEST_CHECK(!assign);
274 DALI_TEST_CHECK(assign == view);
279 int UtcDaliVideoViewMoveConstructor(void)
281 ToolkitTestApplication application;
283 VideoView view = Toolkit::VideoView::New();
284 DALI_TEST_EQUALS(1, view.GetBaseObject().ReferenceCount(), TEST_LOCATION);
285 view.SetProperty(VideoView::Property::LOOPING, true);
286 DALI_TEST_CHECK(view.GetProperty<bool>(VideoView::Property::LOOPING));
288 VideoView moved = std::move(view);
289 DALI_TEST_CHECK(moved);
290 DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
291 DALI_TEST_CHECK(moved.GetProperty<bool>(VideoView::Property::LOOPING));
292 DALI_TEST_CHECK(!view);
297 int UtcDaliVideoViewMoveAssignment(void)
299 ToolkitTestApplication application;
301 VideoView view = Toolkit::VideoView::New();
302 DALI_TEST_EQUALS(1, view.GetBaseObject().ReferenceCount(), TEST_LOCATION);
303 view.SetProperty(VideoView::Property::LOOPING, true);
304 DALI_TEST_CHECK(view.GetProperty<bool>(VideoView::Property::LOOPING));
307 moved = std::move(view);
308 DALI_TEST_CHECK(moved);
309 DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
310 DALI_TEST_CHECK(moved.GetProperty<bool>(VideoView::Property::LOOPING));
311 DALI_TEST_CHECK(!view);
316 int UtcDaliVideoViewTypeRegistry(void)
318 ToolkitTestApplication application;
320 TypeRegistry typeRegistry = TypeRegistry::Get();
321 DALI_TEST_CHECK(typeRegistry);
323 TypeInfo typeInfo = typeRegistry.GetTypeInfo("VideoView");
324 DALI_TEST_CHECK(typeInfo);
326 BaseHandle handle = typeInfo.CreateInstance();
327 DALI_TEST_CHECK(handle);
329 VideoView view = VideoView::DownCast(handle);
330 DALI_TEST_CHECK(view);
335 int UtcDaliVideoViewMethodsForCoverage(void)
337 ToolkitTestApplication application;
339 VideoView videoView = VideoView::New();
340 DALI_TEST_CHECK(videoView);
345 videoView.Forward(10);
346 videoView.Backward(10);
348 Toolkit::DevelVideoView::GetMediaPlayer(videoView);
350 VideoView::VideoViewSignalType& signal = videoView.FinishedSignal();
351 DALI_TEST_EQUALS(0, signal.GetConnectionCount(), TEST_LOCATION);
356 int UtcDaliVideoViewMethodsForRenderType(void)
358 ToolkitTestApplication application;
359 VideoView videoView = VideoView::New();
360 DALI_TEST_CHECK(videoView);
362 Property::Map windowSurfaceTarget;
363 Property::Map nativeImageTarget;
365 windowSurfaceTarget.Insert(RENDERING_TYPE, "windowSurfaceTarget");
366 nativeImageTarget.Insert(RENDERING_TYPE, "nativeImageTarget");
369 Property::Value value;
370 videoView.SetProperty(VideoView::Property::VIDEO, windowSurfaceTarget);
372 value = videoView.GetProperty(VideoView::Property::VIDEO);
373 DALI_TEST_CHECK(value.Get(map));
375 Property::Value* type = map.Find(RENDERING_TYPE);
376 DALI_TEST_CHECK(type);
377 DALI_TEST_EQUALS("windowSurfaceTarget", type->Get<std::string>(), TEST_LOCATION);
379 videoView.SetProperty(VideoView::Property::VIDEO, nativeImageTarget);
381 value = videoView.GetProperty(VideoView::Property::VIDEO);
382 DALI_TEST_CHECK(value.Get(map));
383 type = map.Find(RENDERING_TYPE);
385 DALI_TEST_CHECK(type);
386 DALI_TEST_EQUALS("nativeImageTarget", type->Get<std::string>(), TEST_LOCATION);
391 int UtcDaliVideoViewCustomShaderForCoverage(void)
393 ToolkitTestApplication application;
394 VideoView videoView = VideoView::New();
395 DALI_TEST_CHECK(videoView);
397 ToolkitApplication::DECODED_IMAGES_SUPPORTED = true;
399 videoView.SetProperty(Toolkit::VideoView::Property::UNDERLAY, false);
400 bool isUnderlay = videoView.GetProperty(Toolkit::VideoView::Property::UNDERLAY).Get<bool>();
401 DALI_TEST_CHECK(!isUnderlay);
403 application.GetScene().Add(videoView);
404 videoView.SetProperty(VideoView::Property::VIDEO, "testvideo");
406 Property::Map customShader;
407 customShader.Insert("vertexShader", VERTEX_SHADER);
408 customShader.Insert("fragmentShader", FRAGMENT_SHADER);
411 map.Insert("shader", customShader);
413 videoView.SetProperty(VideoView::Property::VIDEO, map);
416 Property::Value value = videoView.GetProperty(VideoView::Property::VIDEO);
418 DALI_TEST_CHECK(!value.Get(map2));
422 int UtcDaliVideoViewMethodsForCoverage2(void)
424 ToolkitTestApplication application;
425 VideoView videoView = VideoView::New();
426 DALI_TEST_CHECK(videoView);
428 Property::Map windowSurfaceTarget;
430 windowSurfaceTarget.Insert(RENDERING_TYPE, "windowSurfaceTarget");
432 application.GetScene().Add(videoView);
434 application.SendNotification();
435 application.Render();
438 Property::Value value;
439 videoView.SetProperty(VideoView::Property::VIDEO, windowSurfaceTarget);
441 value = videoView.GetProperty(VideoView::Property::VIDEO);
442 DALI_TEST_CHECK(value.Get(map));
444 Property::Value* type = map.Find(RENDERING_TYPE);
445 DALI_TEST_CHECK(type);
446 DALI_TEST_EQUALS("windowSurfaceTarget", type->Get<std::string>(), TEST_LOCATION);
448 Vector3 vector(100.0f, 100.0f, 0.0f);
450 DALI_TEST_CHECK(vector != videoView.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
451 videoView.SetProperty(Actor::Property::SIZE, vector);
453 application.SendNotification();
454 application.Render();
456 // Check the size in the new frame
457 DALI_TEST_CHECK(vector == videoView.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
462 int UtcDaliVideoViewCustomShaderForCoverage3(void)
464 ToolkitTestApplication application;
465 VideoView videoView = VideoView::New();
466 DALI_TEST_CHECK(videoView);
468 ToolkitApplication::DECODED_IMAGES_SUPPORTED = true;
470 videoView.SetProperty(Toolkit::VideoView::Property::UNDERLAY, false);
471 bool isUnderlay = videoView.GetProperty(Toolkit::VideoView::Property::UNDERLAY).Get<bool>();
472 DALI_TEST_CHECK(!isUnderlay);
474 application.GetScene().Add(videoView);
475 videoView.SetProperty(VideoView::Property::VIDEO, "testvideo");
477 Property::Map customShader;
478 customShader.Insert("vertexShader", VERTEX_SHADER);
481 map.Insert("shader", customShader);
483 videoView.SetProperty(VideoView::Property::VIDEO, map);
486 Property::Value value = videoView.GetProperty(VideoView::Property::VIDEO);
488 DALI_TEST_CHECK(!value.Get(map2));
492 int UtcDaliVideoViewPropertyUnderlay(void)
494 ToolkitTestApplication application;
495 tet_infoline("UtcDaliVideoViewPropertyUnderlay");
496 ToolkitApplication::DECODED_IMAGES_SUPPORTED = true;
498 VideoView view = VideoView::New();
499 DALI_TEST_CHECK(view);
501 application.GetScene().Add(view);
504 application.SendNotification();
505 application.Render();
507 bool isUnderlay = view.GetProperty(Toolkit::VideoView::Property::UNDERLAY).Get<bool>();
508 DALI_TEST_CHECK(isUnderlay);
511 view.SetProperty(Toolkit::VideoView::Property::UNDERLAY, false);
512 isUnderlay = view.GetProperty(Toolkit::VideoView::Property::UNDERLAY).Get<bool>();
513 DALI_TEST_CHECK(!isUnderlay);
516 view.SetProperty(Toolkit::VideoView::Property::UNDERLAY, true);
517 isUnderlay = view.GetProperty(Toolkit::VideoView::Property::UNDERLAY).Get<bool>();
518 DALI_TEST_CHECK(isUnderlay);
520 // If platform api doesn't provide any API or feature for decoded images of video,
521 // UNDERLAY should be true
522 ToolkitApplication::DECODED_IMAGES_SUPPORTED = false;
524 view.SetProperty(Toolkit::VideoView::Property::UNDERLAY, false);
525 isUnderlay = view.GetProperty(Toolkit::VideoView::Property::UNDERLAY).Get<bool>();
526 DALI_TEST_CHECK(isUnderlay);
529 ToolkitApplication::DECODED_IMAGES_SUPPORTED = true;
531 view.SetProperty(Toolkit::VideoView::Property::UNDERLAY, true);
532 view.SetProperty(Toolkit::VideoView::Property::UNDERLAY, false);
533 isUnderlay = view.GetProperty(Toolkit::VideoView::Property::UNDERLAY).Get<bool>();
534 DALI_TEST_CHECK(!isUnderlay);
541 int UtcDaliVideoViewPropertyPlayPosition(void)
543 ToolkitTestApplication application;
544 tet_infoline("UtcDaliVideoViewPropertyPlayPosition");
546 VideoView view = VideoView::New();
547 DALI_TEST_CHECK(view);
549 application.GetScene().Add(view);
552 application.SendNotification();
553 application.Render();
555 int playPos = view.GetProperty(Toolkit::VideoView::Property::PLAY_POSITION).Get<int>();
556 DALI_TEST_CHECK(playPos == 0);
558 view.SetProperty(Toolkit::VideoView::Property::PLAY_POSITION, 10);
559 playPos = view.GetProperty(Toolkit::VideoView::Property::PLAY_POSITION).Get<int>();
560 // Actually setting play position will be async
561 // Actual platform result may be different.
562 DALI_TEST_CHECK(playPos == 10);
568 int UtcDaliVideoViewNew2(void)
570 ToolkitTestApplication application;
571 tet_infoline("UtcDaliVideoViewNew2");
573 VideoView view = VideoView::New(true);
574 DALI_TEST_CHECK(view);
576 application.GetScene().Add(view);
579 application.SendNotification();
580 application.Render();
582 VideoView view2 = VideoView::New("", false);
583 DALI_TEST_CHECK(view2);
585 application.GetScene().Add(view2);
588 application.SendNotification();
589 application.Render();
594 int UtcDaliVideoViewRaiseAboveLowerBelow(void)
596 ToolkitTestApplication application;
597 tet_infoline("UtcDaliVideoViewRaiseAboveLowerBelow");
599 VideoView view = VideoView::New(true);
600 DALI_TEST_CHECK(view);
602 application.GetScene().Add(view);
605 application.SendNotification();
606 application.Render();
608 VideoView view2 = VideoView::New("", false);
609 DALI_TEST_CHECK(view2);
611 application.GetScene().Add(view2);
614 application.SendNotification();
615 application.Render();
617 view.RaiseAbove(view2);
618 view.LowerBelow(view2);
623 int UtcDaliVideoViewRaiseTopLowerBottom(void)
625 ToolkitTestApplication application;
626 tet_infoline("UtcDaliVideoViewRaiseTopLowerBottom");
628 VideoView view = VideoView::New(true);
629 DALI_TEST_CHECK(view);
631 application.GetScene().Add(view);
634 application.SendNotification();
635 application.Render();
637 VideoView view2 = VideoView::New("", false);
638 DALI_TEST_CHECK(view2);
640 application.GetScene().Add(view2);
643 application.SendNotification();
644 application.Render();
647 view.LowerToBottom();
652 int UtcDaliVideoViewPropertyDisplayMode(void)
654 ToolkitTestApplication application;
655 tet_infoline("UtcDaliVideoViewPropertyDisplayMode");
657 VideoView view = VideoView::New();
658 DALI_TEST_CHECK(view);
660 application.GetScene().Add(view);
663 application.SendNotification();
664 application.Render();
666 view.SetProperty(Toolkit::VideoView::Property::DISPLAY_MODE, Toolkit::VideoView::DisplayMode::DST_ROI);
667 int displayMode = view.GetProperty(Toolkit::VideoView::Property::DISPLAY_MODE).Get<int>();
668 DALI_TEST_CHECK(displayMode == Toolkit::VideoView::DisplayMode::DST_ROI);
673 int UtcDaliVideoViewCustomShader(void)
675 ToolkitTestApplication application;
676 tet_infoline("VideoView with custom shader");
678 VideoView view = VideoView::New(false);
679 DALI_TEST_CHECK(view);
681 ToolkitApplication::DECODED_IMAGES_SUPPORTED = true;
683 view.SetProperty(Toolkit::VideoView::Property::UNDERLAY, false);
684 bool isUnderlay = view.GetProperty(Toolkit::VideoView::Property::UNDERLAY).Get<bool>();
685 DALI_TEST_CHECK(!isUnderlay);
687 application.GetScene().Add(view);
688 view.SetProperty(VideoView::Property::VIDEO, "testvideo");
690 /* insert custom shader */
691 Property::Map customShader;
692 std::string fragmentShaderString;
693 fragmentShaderString.reserve(strlen(fragmentShaderPrefix) + strlen(FRAGMENT_SHADER));
694 fragmentShaderString.append(fragmentShaderPrefix);
695 fragmentShaderString.append(FRAGMENT_SHADER);
696 customShader.Insert("vertexShader", VERTEX_SHADER);
697 customShader.Insert("fragmentShader", fragmentShaderString);
700 map.Insert("shader", customShader);
702 view.SetProperty(VideoView::Property::VIDEO, map);
704 /* do render for check custom shader */
705 application.GetScene().Add(view);
708 application.SendNotification();
709 application.Render();
712 DALI_TEST_CHECK(view.GetRendererCount() == 1u);
713 Renderer renderer = view.GetRendererAt(0);
714 Shader shader = renderer.GetShader();
715 DALI_TEST_CHECK(shader);
717 Property::Value value = shader.GetProperty(Shader::Property::PROGRAM);
718 Property::Map* shaderMap = value.GetMap();
719 DALI_TEST_CHECK(shaderMap);
721 Property::Value* fragment = shaderMap->Find("fragment"); // fragment key name from shader-impl.cpp
722 DALI_TEST_EQUALS(fragmentShaderString, fragment->Get<std::string>(), TEST_LOCATION);
724 Property::Value* vertex = shaderMap->Find("vertex"); // vertex key name from shader-impl.cpp
725 DALI_TEST_EQUALS(VERTEX_SHADER, vertex->Get<std::string>(), TEST_LOCATION);
730 // Functor to test whether a Finish signal is emitted
731 struct AnimationFinishCheck
733 AnimationFinishCheck(bool& signalReceived)
734 : mSignalReceived(signalReceived)
738 void operator()(Animation& animation)
740 mSignalReceived = true;
745 mSignalReceived = false;
748 void CheckSignalReceived()
752 tet_printf("Expected Finish signal was not received\n");
753 tet_result(TET_FAIL);
757 tet_result(TET_PASS);
761 void CheckSignalNotReceived()
765 tet_printf("Unexpected Finish signal was received\n");
766 tet_result(TET_FAIL);
770 tet_result(TET_PASS);
774 bool& mSignalReceived; // owned by individual tests
777 int UtcDaliVideoViewSyncAniamtionForCoverage(void)
779 ToolkitTestApplication application;
781 VideoView videoView = DevelVideoView::New(Dali::VideoSyncMode::ENABLED);
782 DALI_TEST_CHECK(videoView);
784 application.GetScene().Add(videoView);
786 // Build the animation
787 float durationSeconds(1.0f);
788 Animation animation = Animation::New(durationSeconds);
790 // Start the animation
791 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
792 animation.AnimateTo(Property(videoView, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
793 DevelVideoView::PlayAnimation(videoView, animation);
795 bool signalReceived(false);
796 AnimationFinishCheck finishCheck(signalReceived);
797 animation.FinishedSignal().Connect(&application, finishCheck);
799 application.SendNotification();
800 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
802 // We didn't expect the animation to finish yet
803 application.SendNotification();
804 finishCheck.CheckSignalNotReceived();
806 application.Render(2u /*just beyond the animation duration*/);
808 // We did expect the animation to finish
809 application.SendNotification();
810 finishCheck.CheckSignalReceived();
811 DALI_TEST_EQUALS(targetPosition, videoView.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
813 // Restart the animation, with a different duration
819 int UtcDaliVideoViewASyncAniamtionForCoverage(void)
821 ToolkitTestApplication application;
823 VideoView videoView = DevelVideoView::New(Dali::VideoSyncMode::DISABLED);
824 DALI_TEST_CHECK(videoView);
826 application.GetScene().Add(videoView);
828 // Build the animation
829 float durationSeconds(1.0f);
830 Animation animation = Animation::New(durationSeconds);
832 // Start the animation
833 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
834 animation.AnimateTo(Property(videoView, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
835 DevelVideoView::PlayAnimation(videoView, animation);
837 bool signalReceived(false);
838 AnimationFinishCheck finishCheck(signalReceived);
839 animation.FinishedSignal().Connect(&application, finishCheck);
841 application.SendNotification();
842 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
844 // We didn't expect the animation to finish yet
845 application.SendNotification();
846 finishCheck.CheckSignalNotReceived();
848 application.Render(2u /*just beyond the animation duration*/);
850 // We did expect the animation to finish
851 application.SendNotification();
852 finishCheck.CheckSignalReceived();
853 DALI_TEST_EQUALS(targetPosition, videoView.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
855 // Restart the animation, with a different duration
861 int UtcDaliVideoViewResizeWithSynchronization(void)
863 ToolkitTestApplication application;
864 VideoView videoView = DevelVideoView::New(Dali::VideoSyncMode::ENABLED);
865 DALI_TEST_CHECK(videoView);
867 application.GetScene().Add(videoView);
869 Vector3 vector(50.0f, 200.0f, 0.0f);
870 videoView.SetProperty(Actor::Property::SIZE, vector);
872 application.SendNotification();
873 application.Render();
875 DALI_TEST_CHECK(vector == videoView.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
881 int UtcDaliVideoViewSynchronizationForWindowRotation(void)
883 ToolkitTestApplication application;
884 tet_infoline("UtcDaliVideoViewSynchronizationForWindowRotation");
886 Window window = Window::New(PositionSize(0, 0, 100, 100), "", false);
887 DALI_TEST_CHECK(window);
889 VideoView view = VideoView::New(true);
890 DALI_TEST_CHECK(view);
896 DevelWindow::SetPositionSize(window, PositionSize(0, 0, 480, 240));
898 application.SendNotification();
899 application.Render();