int UtcDaliVideoViewProperty4(void) { ToolkitTestApplication application; tet_infoline(" UtcDaliVideoViewProperty4"); Toolkit::VideoView view = Toolkit::VideoView::New(); DALI_TEST_CHECK( view ); float left, right; left = right = 0.f; Property::Map map; map.Insert( VOLUME_LEFT, 1.0f ); map.Insert( VOLUME_RIGHT, 0.5f ); Property::Map map2; view.SetProperty( VideoView::Property::VOLUME, map ); Property::Value val4 = view.GetProperty( VideoView::Property::VOLUME ); DALI_TEST_CHECK( val4.Get( map2 ) ); Property::Value* volumeLeft = map.Find( VOLUME_LEFT ); Property::Value* volumeRight = map.Find( VOLUME_RIGHT ); DALI_TEST_CHECK( volumeLeft && volumeLeft->Get( left ) ); DALI_TEST_CHECK( volumeRight && volumeRight->Get( right ) ); DALI_TEST_CHECK( left == 1.0f ); DALI_TEST_CHECK( right == 0.5f ); END_TEST; }
void ImageView::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value ) { Toolkit::ImageView imageView = Toolkit::ImageView::DownCast( Dali::BaseHandle( object ) ); if ( imageView ) { switch ( index ) { case Toolkit::ImageView::Property::IMAGE: { std::string imageUrl; if( value.Get( imageUrl ) ) { ImageView& impl = GetImpl( imageView ); impl.SetImage( imageUrl ); } // if its not a string then get a Property::Map from the property if possible. Property::Map map; if( value.Get( map ) ) { ImageView& impl = GetImpl( imageView ); impl.SetImage( map ); } break; } } } }
void PathConstrainer::SetDefaultProperty( Property::Index index, const Property::Value& propertyValue ) { if( index == Dali::PathConstrainer::Property::FORWARD ) { propertyValue.Get(mForward); } else if( index == Dali::PathConstrainer::Property::POINTS ) { const Property::Array* array = propertyValue.GetArray(); mPath->ClearPoints(); if( array ) { for( Property::Array::SizeType i = 0, count = array->Count(); i < count; ++i ) { Vector3 point; array->GetElementAt( i ).Get( point ); mPath->AddPoint( point ); } } } else if( index == Dali::PathConstrainer::Property::CONTROL_POINTS ) { const Property::Array* array = propertyValue.GetArray(); mPath->ClearControlPoints(); if( array ) { for( Property::Array::SizeType i = 0, count = array->Count(); i < count; ++i ) { Vector3 point; array->GetElementAt( i ).Get( point ); mPath->AddControlPoint( point ); } } } }
int UtcDaliVideoViewProperty3(void) { ToolkitTestApplication application; tet_infoline(" UtcDaliVideoViewProperty3"); Toolkit::VideoView view = Toolkit::VideoView::New(); DALI_TEST_CHECK( view ); bool muted; Property::Value val = view.GetProperty( VideoView::Property::MUTED ); DALI_TEST_CHECK( val.Get( muted ) ); DALI_TEST_CHECK( !muted ); view.SetProperty( VideoView::Property::MUTED, true ); val = view.GetProperty( VideoView::Property::MUTED ); DALI_TEST_CHECK( val.Get( muted ) ); DALI_TEST_CHECK( muted ); END_TEST; }
int UtcDaliVideoViewProperty2(void) { ToolkitTestApplication application; tet_infoline(" UtcDaliVideoViewProperty2"); Toolkit::VideoView view = Toolkit::VideoView::New(); DALI_TEST_CHECK( view ); bool looping; Property::Value val = view.GetProperty( VideoView::Property::LOOPING ); DALI_TEST_CHECK( val.Get( looping ) ); DALI_TEST_CHECK( !looping ); view.SetProperty( VideoView::Property::LOOPING, true ); val = view.GetProperty( VideoView::Property::LOOPING ); DALI_TEST_CHECK( val.Get( looping ) ); DALI_TEST_CHECK( looping ); END_TEST; }
// Positive test case for a method int UtcDaliVideoViewProperty1(void) { ToolkitTestApplication application; tet_infoline(" UtcDaliVideoViewProperty1"); Toolkit::VideoView view = Toolkit::VideoView::New(); DALI_TEST_CHECK( view ); std::string file; view.SetProperty( VideoView::Property::VIDEO, TEST_FILE ); Property::Value val = view.GetProperty( VideoView::Property::VIDEO ); DALI_TEST_CHECK( val.Get( file ) ); DALI_TEST_CHECK( file == TEST_FILE ); END_TEST; }
void RendererFactory::ResetRenderer( Toolkit::ControlRenderer& renderer, Actor& actor, const Property::Map& propertyMap ) { if( renderer ) { Property::Value* type = propertyMap.Find( RENDERER_TYPE_NAME ); std::string typeValue ; if( type && type->Get( typeValue )) { //If there's been a renderer type change then we have to return a new shader if( typeValue == COLOR_RENDERER && typeid( renderer ) != typeid( ColorRenderer ) ) { renderer = GetControlRenderer( propertyMap ); return; } else if( typeValue == GRADIENT_RENDERER && typeid( renderer ) != typeid( GradientRenderer ) ) { renderer = GetControlRenderer( propertyMap ); return; } else if( typeValue == IMAGE_RENDERER && typeid( renderer ) != typeid( ImageRenderer ) ) { renderer = GetControlRenderer( propertyMap ); return; } else if( typeValue == N_PATCH_RENDERER && typeid( renderer ) != typeid( NPatchRenderer ) ) { renderer = GetControlRenderer( propertyMap ); return; } else if( typeValue == BORDER_RENDERER && typeid( renderer ) != typeid( BorderRenderer ) ) { renderer = GetControlRenderer( propertyMap ); return; } } GetImplementation( renderer ).Initialize( actor, propertyMap ); } else { renderer = GetControlRenderer( propertyMap ); } }
void ControlRenderer::Initialize( Actor& actor, const Property::Map& propertyMap ) { if( mImpl->mCustomShader ) { mImpl->mCustomShader->SetPropertyMap( propertyMap ); } else { Property::Value* customShaderValue = propertyMap.Find( CUSTOM_SHADER ); if( customShaderValue ) { Property::Map customShader; if( customShaderValue->Get( customShader ) ) { mImpl->mCustomShader = new Impl::CustomShader( propertyMap ); } } } DoInitialize( actor, propertyMap ); }