Removed GeometryType from ShaderEffect and ShaderSubType
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-ShaderEffect.cpp
index 8361890..7fc9b8e 100644 (file)
@@ -44,10 +44,6 @@ static const char* FragmentSource =
 "This is a custom fragment shader\n"
 "made on purpose to look nothing like a normal fragment shader inside dali\n";
 
-static const char* FragmentSourceUsingExtensions =
-"This is a custom fragment shader using extensions\n"
-"made on purpose to look nothing like a normal fragment shader inside dali\n";
-
 const int GETSOURCE_BUFFER_SIZE = 0x10000;
 
 
@@ -58,9 +54,9 @@ struct TestConstraintToVector3
   {
   }
 
-  Vector3 operator()(const Vector3& current)
+  void operator()( Vector3& current, const PropertyInputContainer& /* inputs */ )
   {
-    return mTarget;
+    current = mTarget;
   }
 
   Vector3 mTarget;
@@ -72,10 +68,9 @@ struct TestConstraintFromPositionToVector3
   {
   }
 
-  Vector3 operator()(const Vector3& current, const PropertyInput& position)
+  void operator()( Vector3& current, const PropertyInputContainer& inputs )
   {
-
-    return position.GetVector3();
+    current = inputs[0]->GetVector3();
   }
 };
 
@@ -86,36 +81,26 @@ struct TestConstraintToVector3Double
   {
   }
 
-  Vector3 operator()(const Vector3& current)
+  void operator()( Vector3& current, const PropertyInputContainer& /* inputs */ )
   {
-    return mTarget * 2.0f;
+    current = mTarget * 2.0f;
   }
 
   Vector3 mTarget;
 };
 
-class ShaderEffectExtension : public ShaderEffect::Extension {};
-
+static const char* TestImageFilename = "icon_wrt.png";
 
-class TestExtension : public ShaderEffect::Extension
+Integration::Bitmap* CreateBitmap( unsigned int imageHeight, unsigned int imageWidth, unsigned int initialColor )
 {
-public:
-  TestExtension( bool& deleted )
-  : mDeleted(deleted)
-  {
-    mDeleted = false;
-  }
-  ~TestExtension()
-  {
-    mDeleted = true;
-  }
-  bool IsAlive() const
-  {
-    return !mDeleted;
-  }
-private:
-  bool& mDeleted;
-};
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+  Integration::PixelBuffer* pixbuffer = bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  imageWidth,imageHeight,imageWidth,imageHeight );
+  unsigned int bytesPerPixel = GetBytesPerPixel(  Pixel::RGBA8888 );
+
+  memset( pixbuffer,  initialColor , imageHeight*imageWidth*bytesPerPixel);
+
+  return bitmap;
+}
 
 } // anon namespace
 
@@ -150,76 +135,12 @@ int UtcDaliShaderEffectMethodNew02(void)
   END_TEST;
 }
 
-int UtcDaliShaderEffectMethodNew04(void)
-{
-  TestApplication application;
-  tet_infoline("Testing prefixed version of Dali::ShaderEffect::New()");
-
-  std::string fragmentShaderPrefix = "#define TEST_FS 1\n#extension GL_OES_standard_derivatives : enable";
-  std::string vertexShaderPrefix = "#define TEST_VS 1";
-
-  try
-  {
-    // Call render to compile default shaders.
-    application.SendNotification();
-    application.Render();
-    application.Render();
-    application.Render();
-
-    GLuint lastShaderCompiledBefore = application.GetGlAbstraction().GetLastShaderCompiled();
-    ShaderEffect effect = ShaderEffect::NewWithPrefix( vertexShaderPrefix, VertexSource,
-                                                       fragmentShaderPrefix, FragmentSourceUsingExtensions,
-                                                       GEOMETRY_TYPE_IMAGE, ShaderEffect::HINT_NONE );
-
-    BitmapImage image = CreateBitmapImage();
-    ImageActor actor = ImageActor::New( image );
-    actor.SetSize( 100.0f, 100.0f );
-    actor.SetName("TestImageFilenameActor");
-    actor.SetShaderEffect(effect);
-    Stage::GetCurrent().Add(actor);
-
-    application.SendNotification();
-    application.Render();
-    GLuint lastShaderCompiledAfter = application.GetGlAbstraction().GetLastShaderCompiled();
-    bool testResult = false;
-
-    // we should have compiled 2 shaders.
-    DALI_TEST_EQUALS( lastShaderCompiledAfter, lastShaderCompiledBefore + 2, TEST_LOCATION );
-
-    char testVertexSourceResult[GETSOURCE_BUFFER_SIZE];
-    char testFragmentSourceResult[GETSOURCE_BUFFER_SIZE];
-
-     // we are interested in the first two.
-    GLuint vertexShaderId = lastShaderCompiledBefore + 1;
-    GLuint fragmentShaderId = lastShaderCompiledBefore + 2;
-
-    GLsizei lengthVertexResult;
-    GLsizei lengthFragmentResult;
-
-    application.GetGlAbstraction().GetShaderSource(vertexShaderId, GETSOURCE_BUFFER_SIZE, &lengthVertexResult, testVertexSourceResult);
-    application.GetGlAbstraction().GetShaderSource(fragmentShaderId, GETSOURCE_BUFFER_SIZE, &lengthFragmentResult, testFragmentSourceResult);
-
-    int vertexShaderHasPrefix = strncmp(testVertexSourceResult, "#define ", strlen("#define "));
-    int fragmentShaderHasPrefix = strncmp(testFragmentSourceResult, "#define ", strlen("#define "));
-    testResult = (vertexShaderHasPrefix == 0) && (fragmentShaderHasPrefix == 0);
-
-    DALI_TEST_CHECK(testResult);
-  }
-  catch(Dali::DaliException& e)
-  {
-    DALI_TEST_PRINT_ASSERT( e );
-    tet_result( TET_FAIL );
-  }
-  END_TEST;
-}
-
 int UtcDaliShaderEffectMethodNew05(void)
 {
   TestApplication application;
 
   // heap constructor / destructor
   DefaultFunctionCoverage<ShaderEffect> shaderEffect;
-  DefaultFunctionCoverage<ShaderEffectExtension> shaderEffectExtension;
 
   END_TEST;
 }
@@ -288,7 +209,7 @@ int UtcDaliShaderEffectMethodSetUniformFloat(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   effect.SetUniform( "uFloat", 1.0f );
 
@@ -314,7 +235,7 @@ int UtcDaliShaderEffectMethodSetUniformVector2(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   effect.SetUniform( "uVec2", Vector2( 2.0f, 3.0f ) );
 
@@ -340,7 +261,7 @@ int UtcDaliShaderEffectMethodSetUniformVector3(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   effect.SetUniform( "uVec3", Vector3( 4.0f, 5.0f, 6.0f ) );
 
@@ -366,7 +287,7 @@ int UtcDaliShaderEffectMethodSetUniformVector4(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   effect.SetUniform( "uVec4", Vector4( 7.0f, 8.0f, 9.0f, 10.0f ) );
 
@@ -392,7 +313,7 @@ int UtcDaliShaderEffectMethodSetUniformMatrix(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   effect.SetUniform( "uModelView", Matrix::IDENTITY );
 
@@ -418,7 +339,7 @@ int UtcDaliShaderEffectMethodSetUniformMatrix3(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   Matrix3 matIdentity(1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f);
   effect.SetUniform( "uMatrix3", matIdentity );
@@ -443,7 +364,7 @@ int UtcDaliShaderEffectMethodSetUniformViewport(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   ImageActor actor = ImageActor::New( image );
   actor.SetSize( 100.0f, 100.0f );
@@ -488,7 +409,7 @@ int UtcDaliShaderEffectMethodSetEffectImage(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   effect.SetEffectImage(image);
 
@@ -517,7 +438,7 @@ int UtcDaliShaderEffectMethodSetEffectImageAndDelete(void)
 
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
 
-  BitmapImage effectImage = CreateBitmapImage();
+  BufferImage effectImage = CreateBufferImage();
   effect.SetEffectImage(effectImage);
 
   ImageActor actor = ImageActor::New();
@@ -585,7 +506,7 @@ int UtcDaliShaderEffectMethodApplyConstraint(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   effect.SetUniform( "uVec3", Vector3( 1.0f, 2.0f, 3.0f ) );
 
@@ -605,10 +526,8 @@ int UtcDaliShaderEffectMethodApplyConstraint(void)
       application.GetGlAbstraction().CheckUniformValue(
           "uVec3", Vector3( 1.0f, 2.0f, 3.0f ) ) );
 
-  Constraint constraint = Constraint::New<Vector3>( uVecProperty,
-                                                    TestConstraintToVector3(Vector3(4.0f, 9.0f, 16.0f)) );
-
-  effect.ApplyConstraint(constraint);
+  Constraint constraint = Constraint::New<Vector3>( effect, uVecProperty, TestConstraintToVector3(Vector3(4.0f, 9.0f, 16.0f)) );
+  constraint.Apply();
 
   application.SendNotification();
   application.Render();
@@ -631,7 +550,7 @@ int UtcDaliShaderEffectMethodApplyConstraintFromActor(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   effect.SetUniform( "uVec3", Vector3( 50.0f, 25.0f, 0.0f ) );
 
@@ -644,11 +563,9 @@ int UtcDaliShaderEffectMethodApplyConstraintFromActor(void)
 
   Property::Index uVecProperty = effect.GetPropertyIndex("uVec3");
 
-  Constraint constraint = Constraint::New<Vector3>( uVecProperty,
-                                                    Source(actor, Actor::POSITION),
-                                                    TestConstraintFromPositionToVector3() );
-
-  effect.ApplyConstraint(constraint);
+  Constraint constraint = Constraint::New<Vector3>( effect, uVecProperty, TestConstraintFromPositionToVector3() );
+  constraint.AddSource( Source( actor, Actor::Property::POSITION ) );
+  constraint.Apply();
 
   application.SendNotification();
   application.Render();
@@ -671,7 +588,7 @@ int UtcDaliShaderEffectMethodApplyConstraintFromActor2(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   effect.SetUniform( "uVec3", Vector3( 50.0f, 25.0f, 0.0f ) );
 
@@ -684,16 +601,12 @@ int UtcDaliShaderEffectMethodApplyConstraintFromActor2(void)
 
   Property::Index uVecProperty = effect.GetPropertyIndex("uVec3");
 
-  Constraint shaderConstraint = Constraint::New<Vector3>( uVecProperty,
-                                                    Source(actor, Actor::POSITION),
-                                                    TestConstraintFromPositionToVector3() );
-
-  effect.ApplyConstraint(shaderConstraint);
-
-  Constraint actorConstraint = Constraint::New<Vector3>( Actor::POSITION,
-                                                         TestConstraintToVector3Double(targetPosition) );
+  Constraint shaderConstraint = Constraint::New<Vector3>( effect, uVecProperty, TestConstraintFromPositionToVector3() );
+  shaderConstraint.AddSource( Source(actor, Actor::Property::POSITION) );
+  shaderConstraint.Apply();
 
-  actor.ApplyConstraint(actorConstraint);
+  Constraint actorConstraint = Constraint::New<Vector3>( actor, Actor::Property::POSITION, TestConstraintToVector3Double(targetPosition) );
+  actorConstraint.Apply();
 
   application.SendNotification();
   application.Render();
@@ -705,78 +618,6 @@ int UtcDaliShaderEffectMethodApplyConstraintFromActor2(void)
   END_TEST;
 }
 
-int UtcDaliShaderEffectMethodApplyConstraintCallback(void)
-{
-  // Test whether Shader's uniform can be constrained to a stationary constraint.
-  TestApplication application;
-
-  ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
-  DALI_TEST_CHECK( effect );
-
-  BitmapImage image = CreateBitmapImage();
-
-  effect.SetUniform( "uVec3", Vector3( 1.0f, 2.0f, 3.0f ) );
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-  actor.SetName("TestImageFilenameActor");
-  actor.SetShaderEffect(effect);
-  Stage::GetCurrent().Add(actor);
-
-  Property::Index uVecProperty = effect.GetPropertyIndex("uVec3");
-
-  application.SendNotification();
-  application.Render();
-
-  // Test effects of SetUniform...
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          "uVec3", Vector3( 1.0f, 2.0f, 3.0f ) ) );
-
-  Constraint constraint = Constraint::New<Vector3>( uVecProperty,
-                                                    TestConstraintToVector3(Vector3(4.0f, 9.0f, 16.0f)) );
-
-  constraint.SetApplyTime( 10.0f );
-
-  bool constraintCheck( false );
-  ConstraintAppliedCheck appliedCheck( constraintCheck );
-
-  // We should receive the "Applied" signal after 10 seconds
-  ActiveConstraint active = effect.ApplyConstraint(constraint);
-  active.AppliedSignal().Connect( &application, appliedCheck );
-
-  application.SendNotification();
-  application.Render(static_cast<unsigned int>(1000.0f)); // 1 elapsed second
-
-  // Check signal has not fired
-  application.SendNotification();
-  appliedCheck.CheckSignalNotReceived();
-
-  application.Render(static_cast<unsigned int>(4000.0f)); // 5 elapsed seconds
-
-  // Check signal has not fired
-  application.SendNotification();
-  appliedCheck.CheckSignalNotReceived();
-
-  application.Render(static_cast<unsigned int>(5000.0f - 1.0f)); // <10 elapsed seconds
-
-  // Check signal has not fired
-  application.SendNotification();
-  appliedCheck.CheckSignalNotReceived();
-
-  application.Render(static_cast<unsigned int>(2.0f)); // >10 elapsed seconds
-
-  // Signal should have fired
-  application.SendNotification();
-  appliedCheck.CheckSignalReceived();
-
-  // Test effects of Constraint.
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          "uVec3", Vector3( 4.0f, 9.0f, 16.0f ) ) );
-  END_TEST;
-}
-
 int UtcDaliShaderEffectMethodRemoveConstraints(void)
 {
   // Test if constrains can be removed before they are ever applyed.
@@ -785,7 +626,7 @@ int UtcDaliShaderEffectMethodRemoveConstraints(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   effect.SetUniform( "uVec3", Vector3( 1.0f, 2.0f, 3.0f ) );
 
@@ -805,10 +646,8 @@ int UtcDaliShaderEffectMethodRemoveConstraints(void)
       application.GetGlAbstraction().CheckUniformValue(
           "uVec3", Vector3( 1.0f, 2.0f, 3.0f ) ) );
 
-  Constraint constraint = Constraint::New<Vector3>( uVecProperty,
-                                                    TestConstraintToVector3(Vector3(4.0f, 9.0f, 16.0f)) );
-
-  effect.ApplyConstraint(constraint);
+  Constraint constraint = Constraint::New<Vector3>( effect, uVecProperty, TestConstraintToVector3(Vector3(4.0f, 9.0f, 16.0f)) );
+  constraint.Apply();
 
   // Remove the constraints
   effect.RemoveConstraints();
@@ -831,7 +670,7 @@ int UtcDaliShaderEffectMethodRemoveConstraints2(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   effect.SetUniform( "uVec3", Vector3( 1.0f, 2.0f, 3.0f ) );
 
@@ -851,10 +690,8 @@ int UtcDaliShaderEffectMethodRemoveConstraints2(void)
       application.GetGlAbstraction().CheckUniformValue(
           "uVec3", Vector3( 1.0f, 2.0f, 3.0f ) ) );
 
-  Constraint constraint = Constraint::New<Vector3>( uVecProperty,
-                                                    TestConstraintToVector3(Vector3(4.0f, 9.0f, 16.0f)) );
-
-  effect.ApplyConstraint(constraint);
+  Constraint constraint = Constraint::New<Vector3>( effect, uVecProperty, TestConstraintToVector3(Vector3(4.0f, 9.0f, 16.0f)) );
+  constraint.Apply();
 
   application.SendNotification();
   application.Render();
@@ -873,91 +710,6 @@ int UtcDaliShaderEffectMethodRemoveConstraints2(void)
   END_TEST;
 }
 
-int UtcDaliShaderEffectMethodCreateExtension(void)
-{
-  // Test creation of a shader extension
-  TestApplication aplication;
-
-  bool deleted;
-  {
-    ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
-    DALI_TEST_CHECK( effect );
-
-    TestExtension* extension = new TestExtension ( deleted );
-
-    effect.AttachExtension( extension );
-
-    DALI_TEST_CHECK( static_cast<TestExtension&>(effect.GetExtension()).IsAlive() );
-  }
-
-  DALI_TEST_CHECK( deleted );
-  END_TEST;
-}
-
-int UtcDaliShaderEffectMethodCreateExtension2(void)
-{
-  // Test creation of a shader extension
-  bool deleted;
-  {
-    TestApplication application;
-
-    ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
-    DALI_TEST_CHECK( effect );
-
-    BitmapImage image = CreateBitmapImage();
-
-    effect.SetUniform( "uFloat", 1.0f );
-
-    ImageActor actor = ImageActor::New( image );
-    actor.SetSize( 100.0f, 100.0f );
-    actor.SetName("TestImageFilenameActor");
-    actor.SetShaderEffect(effect);
-    Stage::GetCurrent().Add(actor);
-
-    application.SendNotification();
-    application.Render();
-
-    TestExtension* extension = new TestExtension ( deleted );
-
-    effect.AttachExtension( extension );
-
-    const ShaderEffect& constEffect(effect);
-    const TestExtension& ext( static_cast<const TestExtension&>(constEffect.GetExtension()) );
-
-    DALI_TEST_CHECK( ext.IsAlive() );
-  }
-
-  DALI_TEST_CHECK( deleted );
-  END_TEST;
-}
-
-int UtcDaliShaderEffectMethodNoExtension(void)
-{
-  TestApplication application;
-
-  ShaderEffect effect;
-
-  try
-  {
-    ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
-    DALI_TEST_CHECK( effect );
-
-    // Don't attach extension
-    ShaderEffect::Extension& extension = effect.GetExtension();
-    (void) extension;
-
-    DALI_TEST_CHECK( false );
-  }
-  catch (Dali::DaliException& e)
-  {
-    // Tests that a negative test of an assertion succeeds
-    DALI_TEST_PRINT_ASSERT( e );
-    DALI_TEST_CHECK( !effect );
-  }
-  END_TEST;
-}
-
-
 int UtcDaliShaderEffectPropertyIndices(void)
 {
   TestApplication application;
@@ -965,8 +717,8 @@ int UtcDaliShaderEffectPropertyIndices(void)
 
   Property::IndexContainer indices;
   effect.GetPropertyIndices( indices );
-  DALI_TEST_CHECK( ! indices.empty() );
-  DALI_TEST_EQUALS( indices.size(), effect.GetPropertyCount(), TEST_LOCATION );
+  DALI_TEST_CHECK( indices.Size() );
+  DALI_TEST_EQUALS( indices.Size(), effect.GetPropertyCount(), TEST_LOCATION );
   END_TEST;
 }
 
@@ -983,7 +735,7 @@ int UtcDaliShaderBinaries(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
   ImageActor actor = ImageActor::New( image );
   actor.SetSize( 100.0f, 100.0f );
   actor.SetName("TestImageFilenameActor");
@@ -1018,3 +770,133 @@ int UtcDaliShaderBinaries(void)
   END_TEST;
 }
 
+int UtcDaliShaderEffectFromProperties01(void)
+{
+  TestApplication application;
+  tet_infoline("UtcDaliShaderEffectFromProperties01()");
+
+  std::string fragmentShaderPrefix = "#define TEST_FS 1\n#extension GL_OES_standard_derivatives : enable";
+  std::string vertexShaderPrefix = "#define TEST_VS 1";
+  std::string vertexShader(VertexSource);
+  std::string fragmentShader(FragmentSource);
+
+  // Call render to compile default shaders.
+  application.SendNotification();
+  application.Render();
+
+  GLuint lastShaderCompiledBefore = application.GetGlAbstraction().GetLastShaderCompiled();
+
+  // create from type registry
+
+  TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( "ShaderEffect" );
+  DALI_TEST_CHECK( typeInfo );
+  ShaderEffect effect = ShaderEffect::DownCast( typeInfo.CreateInstance() );
+  DALI_TEST_CHECK( effect );
+
+  Property::Value programMap = Property::Value(Property::MAP);
+
+  programMap.SetValue("vertex", vertexShader);
+  programMap.SetValue("fragment", fragmentShader);
+
+  programMap.SetValue("vertex-prefix", vertexShaderPrefix);
+  programMap.SetValue("fragment-prefix", fragmentShaderPrefix);
+
+  effect.SetProperty(effect.GetPropertyIndex("program"), programMap);
+
+  Property::Value imageMap = Property::Value(Property::MAP);
+  imageMap.SetValue("filename", Property::Value(TestImageFilename));
+  effect.SetProperty(effect.GetPropertyIndex("image"), imageMap);
+
+  // do a update & render to get the image request
+  application.SendNotification();
+  application.Render();
+
+  Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
+  // create the image
+  Integration::Bitmap* bitmap = CreateBitmap( 10, 10, 0xFF );
+  Integration::ResourcePointer resourcePtr(bitmap);
+  TestPlatformAbstraction& platform = application.GetPlatform();
+  platform.SetResourceLoaded(request->GetId(), request->GetType()->id, resourcePtr);
+
+  BufferImage image(CreateBufferImage());
+  ImageActor actor = ImageActor::New( image );
+  actor.SetSize( 100.0f, 100.0f );
+  actor.SetName("TestImageFilenameActor");
+  actor.SetShaderEffect(effect);
+  Stage::GetCurrent().Add(actor);
+
+  application.SendNotification();
+  application.Render();
+  GLuint lastShaderCompiledAfter = application.GetGlAbstraction().GetLastShaderCompiled();
+
+  // we should have compiled 2 shaders.
+  DALI_TEST_EQUALS(lastShaderCompiledAfter, lastShaderCompiledBefore + 2, TEST_LOCATION );
+
+  std::string actualVertexShader = application.GetGlAbstraction().GetShaderSource( lastShaderCompiledBefore + 1 );
+  DALI_TEST_EQUALS( vertexShaderPrefix, actualVertexShader.substr( 0, vertexShaderPrefix.length() ), TEST_LOCATION );
+  DALI_TEST_EQUALS( vertexShader, actualVertexShader.substr( actualVertexShader.length() - vertexShader.length() ), TEST_LOCATION );
+
+  std::string actualFragmentShader = application.GetGlAbstraction().GetShaderSource( lastShaderCompiledBefore + 2 );
+  DALI_TEST_EQUALS( fragmentShaderPrefix, actualFragmentShader.substr( 0, fragmentShaderPrefix.length() ), TEST_LOCATION );
+  DALI_TEST_EQUALS( fragmentShader, actualFragmentShader.substr( actualFragmentShader.length() - fragmentShader.length() ), TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliShaderEffectFromProperties02(void)
+{
+  TestApplication application;
+  tet_infoline("UtcDaliShaderEffectFromProperties02()");
+
+    // Call render to compile default shaders.
+    application.SendNotification();
+    application.Render();
+    application.Render();
+    application.Render();
+
+    // create from type registry (currently only way to get ShaderEffect with no shader setup in constructor
+    TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( "ShaderEffect" );
+    DALI_TEST_CHECK( typeInfo );
+    ShaderEffect effect = ShaderEffect::DownCast( typeInfo.CreateInstance() );
+    DALI_TEST_CHECK( effect );
+
+    Property::Value programMap = Property::Value(Property::MAP);
+
+    programMap.SetValue("vertex",   std::string(VertexSource));
+    programMap.SetValue("fragment", std::string(FragmentSource));
+
+  effect.SetProperty(effect.GetPropertyIndex("program"), programMap);
+
+  END_TEST;
+}
+
+int UtcDaliShaderEffectFromProperties03(void)
+{
+  try
+  {
+    TestApplication application;
+    tet_infoline("UtcDaliShaderEffectFromProperties03()");
+
+    // Call render to compile default shaders.
+    application.SendNotification();
+    application.Render();
+    application.Render();
+    application.Render();
+
+    // create from type registry (currently only way to get ShaderEffect with no shader setup in constructor
+    TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( "ShaderEffect" );
+    DALI_TEST_CHECK( typeInfo );
+    ShaderEffect effect = ShaderEffect::DownCast( typeInfo.CreateInstance() );
+    DALI_TEST_CHECK( effect );
+
+    // dont set unknown
+    effect.SetProperty( effect.GetPropertyIndex("geometry-hints"), "HINT_2" );
+
+    tet_result( TET_FAIL );
+  }
+  catch(Dali::DaliException& e)
+  {
+    DALI_TEST_PRINT_ASSERT( e );
+  }
+  END_TEST;
+}