X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-VideoView.cpp;h=884efc455f8b1551cee96ea39398426c2ebe9de6;hb=723acb540264b5f3bfc98ec3284891aa58d765c4;hp=983ac7762643600635b1b00fc9dd065862483e3f;hpb=d375dceca213569317d81d17cd2d2a4b45122cda;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/utc-Dali-VideoView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-VideoView.cpp index 983ac77..884efc4 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-VideoView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-VideoView.cpp @@ -31,6 +31,34 @@ const char* const VOLUME_LEFT( "volumeLeft" ); const char* const VOLUME_RIGHT( "volumeRight" ); const char* const RENDERING_TYPE( "renderingTarget" ); +const char* VERTEX_SHADER = DALI_COMPOSE_SHADER( + attribute mediump vec2 aPosition;\n + varying mediump vec2 vTexCoord;\n + uniform mediump mat4 uMvpMatrix;\n + uniform mediump vec3 uSize;\n + \n + void main()\n + {\n + mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n + vertexPosition.xyz *= uSize;\n + vertexPosition = uMvpMatrix * vertexPosition;\n + \n + vTexCoord = aPosition + vec2(0.5);\n + gl_Position = vertexPosition;\n + }\n +); + +const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( + varying mediump vec2 vTexCoord;\n + uniform sampler2D sTexture;\n + uniform lowp vec4 uColor;\n + \n + void main()\n + {\n + gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n + }\n +); + } void video_view_startup(void) @@ -312,3 +340,68 @@ int UtcDaliVideoViewMethodsForRenderType(void) END_TEST; } + +int UtcDaliVideoViewCustomShaderForCoverage(void) +{ + ToolkitTestApplication application; + VideoView videoView = VideoView::New(); + DALI_TEST_CHECK( videoView ); + + Stage::GetCurrent().Add( videoView ); + videoView.SetProperty( VideoView::Property::VIDEO, "testvideo" ); + + Property::Map customShader; + customShader.Insert( "vertexShader", VERTEX_SHADER ); + customShader.Insert( "fragmentShader", FRAGMENT_SHADER ); + + Property::Map map; + map.Insert( "shader", customShader ); + + videoView.SetProperty( VideoView::Property::VIDEO, map ); + + Property::Map map2; + Property::Value value = videoView.GetProperty( VideoView::Property::VIDEO ); + + DALI_TEST_CHECK( !value.Get( map2 ) ); + END_TEST; +} + +int UtcDaliVideoViewMethodsForCoverage2(void) +{ + ToolkitTestApplication application; + VideoView videoView = VideoView::New(); + DALI_TEST_CHECK( videoView ); + + Property::Map windowSurfaceTarget; + + windowSurfaceTarget.Insert( RENDERING_TYPE, "windowSurfaceTarget" ); + + Stage::GetCurrent().Add( videoView ); + + application.SendNotification(); + application.Render(); + + Property::Map map; + Property::Value value; + videoView.SetProperty( VideoView::Property::VIDEO, windowSurfaceTarget ); + + value = videoView.GetProperty( VideoView::Property::VIDEO ); + DALI_TEST_CHECK( value.Get( map ) ); + + Property::Value* type = map.Find( RENDERING_TYPE ); + DALI_TEST_CHECK( type ); + DALI_TEST_EQUALS( "windowSurfaceTarget", type->Get(), TEST_LOCATION ); + + Vector3 vector(100.0f, 100.0f, 0.0f); + + DALI_TEST_CHECK(vector != videoView.GetCurrentSize()); + videoView.SetSize( vector ); + + application.SendNotification(); + application.Render(); + + // Check the size in the new frame + DALI_TEST_CHECK(vector == videoView.GetCurrentSize()); + + END_TEST; +}