Merge "(Automated Tests) Increase line coverage of Builder" into devel/master
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-Builder.cpp
index 653325c..32946a0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2014-2016 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,6 +20,9 @@
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/devel-api/builder/builder.h>
 #include <dali/integration-api/events/touch-event-integ.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <test-button.h>
+#include <test-animation-data.h>
 
 #define STRINGIFY(A)#A
 
@@ -75,12 +78,15 @@ int UtcDaliBuilderQuitSignal(void)
       "{"
          "\"stage\":"
          "[{"
-           "\"type\": \"Actor\","
+           "\"type\": \"Layer\","
            "\"size\": [100,100,1],"
            "\"parentOrigin\": \"TOP_LEFT\","
            "\"anchorPoint\": \"TOP_LEFT\","
+           "\"maximumSize\": [100,100],"
+           "\"orientation\": [10,10,10,10],"
+           "\"clippingBox\": [10,10,10,10],"
            "\"signals\": [{"
-             "\"name\": \"touched\","
+             "\"name\": \"touch\","
              "\"action\": \"quit\""
            "}]"
          "}]"
@@ -100,7 +106,10 @@ int UtcDaliBuilderQuitSignal(void)
 
   // Emit touch event and check that our quit method is called
   Integration::TouchEvent touchEvent;
-  touchEvent.points.push_back( TouchPoint ( 0, TouchPoint::Down, 10.0f, 10.0f ) );
+  Integration::Point point;
+  point.SetState( PointState::DOWN );
+  point.SetScreenPosition( Vector2( 10.0f, 10.0f ) );
+  touchEvent.points.push_back( point );
   application.ProcessEvent( touchEvent );
   DALI_TEST_CHECK( functorCalled );
 
@@ -237,7 +246,7 @@ int UtcDaliBuilderAnimationP(void)
         "    \"size\": [200, 200, 1],"
         "    \"orientation\": [0, 0, 30],"
         "    \"signals\": [{"
-        "      \"name\": \"touched\","
+        "      \"name\": \"touch\","
         "      \"action\": \"play\","
         "      \"animation\": \"animate\""
         "    }]"
@@ -265,7 +274,10 @@ int UtcDaliBuilderAnimationP(void)
   // trigger play
   // Emit touch event and check that our quit method is called
   Integration::TouchEvent touchEvent;
-  touchEvent.points.push_back( TouchPoint ( 0, TouchPoint::Down, 10.0f, 10.0f ) );
+  Integration::Point point;
+  point.SetState( PointState::DOWN );
+  point.SetScreenPosition( Vector2( 10.0f, 10.0f ) );
+  touchEvent.points.push_back( point );
   application.ProcessEvent( touchEvent );
 
   // Render and notify
@@ -358,7 +370,7 @@ int UtcDaliBuilderAnimationN(void)
         "    \"size\": [200, 200, 1],"
         "    \"orientation\": [0, 0, 30],"
         "    \"signals\": [{"
-        "      \"name\": \"touched\","
+        "      \"name\": \"touch\","
         "      \"action\": \"play\","
         "      \"animation\": \"animate\""
         "    }]"
@@ -422,16 +434,16 @@ int UtcDaliBuilderConstantsP(void)
       "},"
       "\"stage\":"
       "[{"
-      "  \"type\": \"ImageActor\","
+      "  \"type\": \"ImageView\","
       "  \"name\": \"{NAME}\","
       "  \"size\": [100,100,1],"
       "  \"parentOrigin\": \"TOP_LEFT\","
       "  \"anchorPoint\": \"{ANCHOR}\","
       "  \"padding\": \"{PADDING}\","
-      "  \"image\": { \"filename\": \"dir/{IMAGE_PATH}\" },"
+      "  \"image\": { \"url\": \"dir/{IMAGE_PATH}\" },"
       "  \"sizeWidth\": \"{WIDTH}\","
       "  \"signals\": [{"
-      "    \"name\": \"touched\","
+      "    \"name\": \"touch\","
       "    \"action\": \"quit\""
       "  }]"
       "}]"
@@ -484,26 +496,41 @@ int UtcDaliBuilderTemplatesAndStylesP(void)
       "    \"color\": [1,0,0,1],\n"
       "    \"actors\": {\n"
       "      \"childImage\": {\n"
-      "        \"color\": [0,1,0,1]\n"
+      "        \"color\": \"34\"\n"
       "      }\n"
       "    }\n"
       "  }\n"
       "},\n"
       "\"templates\":\n"
       "{\n"
+      "  \"imageViewTemplate\": { \n"
+      "    \"type\": \"ImageView\",\n"
+      "    \"styles\": [\"imageStyle\"]\n"
+      "  },\n"
       "  \"imageTree\": { \n"
-      "    \"type\": \"ImageActor\",\n"
+      "    \"type\": \"ImageView\",\n"
       "    \"styles\": [\"imageStyle\"],\n"
       "    \"name\": \"image\",\n"
       "    \"size\": \"{SIZE}\",\n"
       "    \"signals\": [{\n"
-      "      \"name\": \"touched\",\n"
+      "      \"name\": \"touch\",\n"
       "      \"action\": \"quit\"\n"
       "    }],\n"
       "    \"actors\": [\n"
       "      {\n"
-      "        \"type\":\"ImageActor\",\n"
-      "        \"name\":\"childImage\" \n"
+      "        \"type\":\"ImageView\",\n"
+      "        \"name\":\"childImage\", \n"
+      "        \"color\": \n"
+      "          {\n"
+      "            \"r\": 10,\n"
+      "            \"g\": 10,\n"
+      "            \"b\": 10,\n"
+      "            \"a\": 100\n"
+      "          }\n"
+      "      },\n"
+      "      {\n"
+      "        \"type\":\"imageViewTemplate\",\n"
+      "        \"name\":\"childImage2\"\n"
       "      }\n"
       "    ]\n"
       "  }\n"
@@ -521,7 +548,7 @@ int UtcDaliBuilderTemplatesAndStylesP(void)
     " \"color\": [1,0,0,1],\n"
     " \"actors\": {\n"
     "   \"childImage\": {\n"
-    "     \"color\": [0,1,0,1]\n"
+    "     \"color\": \"#344353\"\n"
     "   }\n"
     " }\n"
     "}\n"
@@ -529,17 +556,17 @@ int UtcDaliBuilderTemplatesAndStylesP(void)
 
   std::string templatejson(
     "{ \n"
-    "  \"type\": \"ImageActor\",\n"
+    "  \"type\": \"ImageView\",\n"
     "  \"styles\": [\"imageStyle\"],\n"
     "  \"name\": \"image\",\n"
     "  \"size\": \"{SIZE}\",\n"
     "  \"signals\": [{\n"
-    "    \"name\": \"touched\",\n"
+    "    \"name\": \"touch\",\n"
     "    \"action\": \"quit\"\n"
     "  }],\n"
     "  \"actors\": [\n"
     "    {\n"
-    "      \"type\":\"ImageActor\",\n"
+    "      \"type\":\"ImageView\",\n"
     "      \"name\":\"childImage\" \n"
     "    }\n"
     "  ]\n"
@@ -549,16 +576,16 @@ int UtcDaliBuilderTemplatesAndStylesP(void)
   Builder builder = Builder::New();
   builder.LoadFromString( json );
 
-  ImageActor actor = ImageActor::DownCast( builder.Create( "imageTree" ) );
+  ImageView actor = ImageView::DownCast( builder.Create( "imageTree" ) );
   DALI_TEST_CHECK( actor );
 
   Dali::Property::Map map;
   map["SIZE"] = Vector3(100,100,1);
-  actor = ImageActor::DownCast( builder.Create( "imageTree",  map ) );
+  actor = ImageView::DownCast( builder.Create( "imageTree",  map ) );
   DALI_TEST_CHECK( actor );
 
   // create from json snippet
-  actor = ImageActor::DownCast( builder.CreateFromJson( templatejson ) );
+  actor = ImageView::DownCast( builder.CreateFromJson( templatejson ) );
   DALI_TEST_CHECK( actor );
 
 
@@ -589,19 +616,19 @@ int UtcDaliBuilderRenderTasksP(void)
       "[\n"
       "  { \n"
       "    \"type\": \"CameraActor\",\n"
-      "    \"name\": \"image\"\n"
+      "    \"name\": \"camera\"\n"
       "  }, \n"
       "  { \n"
-      "    \"type\": \"ImageActor\",\n"
+      "    \"type\": \"ImageView\",\n"
       "    \"name\": \"image\",\n"
       "    \"size\": [100,100,1],\n"
       "    \"signals\": [{\n"
-      "      \"name\": \"touched\",\n"
+      "      \"name\": \"touch\",\n"
       "      \"action\": \"quit\"\n"
       "    }],\n"
       "    \"actors\": [\n"
       "      {\n"
-      "        \"type\":\"ImageActor\",\n"
+      "        \"type\":\"ImageView\",\n"
       "        \"name\":\"childImage\" \n"
       "      }\n"
       "    ]\n"
@@ -643,7 +670,7 @@ int UtcDaliBuilderChildActionP(void)
       "      \"name\": \"subActor\"\n"
       "    }],\n"
       "    \"signals\": [{\n"
-      "      \"name\": \"touched\",\n"
+      "      \"name\": \"touch\",\n"
       "      \"action\": \"hide\",\n"
       "      \"actor\": \"actor\",\n"
       "      \"childActor\": \"subActor\"\n"
@@ -662,7 +689,10 @@ int UtcDaliBuilderChildActionP(void)
 
   // Emit touch event and check that our quit method is called
   Integration::TouchEvent touchEvent;
-  touchEvent.points.push_back( TouchPoint ( 0, TouchPoint::Down, 10.0f, 10.0f ) );
+  Integration::Point point;
+  point.SetState( PointState::DOWN );
+  point.SetScreenPosition( Vector2( 10.0f, 10.0f ) );
+  touchEvent.points.push_back( point );
   application.ProcessEvent( touchEvent );
 
   // Render and notify
@@ -696,7 +726,7 @@ int UtcDaliBuilderSetPropertyActionP(void)
       "      \"name\": \"subActor\"\n"
       "    }],\n"
       "    \"signals\": [{\n"
-      "      \"name\": \"touched\",\n"
+      "      \"name\": \"touch\",\n"
       "      \"action\": \"set\",\n"
       "      \"actor\": \"subActor\",\n"
       "      \"property\": \"visible\",\n"
@@ -716,7 +746,10 @@ int UtcDaliBuilderSetPropertyActionP(void)
 
   // Emit touch event and check that our quit method is called
   Integration::TouchEvent touchEvent;
-  touchEvent.points.push_back( TouchPoint ( 0, TouchPoint::Down, 10.0f, 10.0f ) );
+  Integration::Point point;
+  point.SetState( PointState::DOWN );
+  point.SetScreenPosition( Vector2( 10.0f, 10.0f ) );
+  touchEvent.points.push_back( point );
   application.ProcessEvent( touchEvent );
 
   // Render and notify
@@ -750,7 +783,7 @@ int UtcDaliBuilderGenericActionP(void)
       "      \"name\": \"subActor\"\n"
       "    }],\n"
       "    \"signals\": [{\n"
-      "      \"name\": \"touched\",\n"
+      "      \"name\": \"touch\",\n"
       "      \"action\": \"hide\"\n"
       "    }]\n"
       "  }]\n"
@@ -767,7 +800,10 @@ int UtcDaliBuilderGenericActionP(void)
 
   // Emit touch event and check that our quit method is called
   Integration::TouchEvent touchEvent;
-  touchEvent.points.push_back( TouchPoint ( 0, TouchPoint::Down, 10.0f, 10.0f ) );
+  Integration::Point point;
+  point.SetState( PointState::DOWN );
+  point.SetScreenPosition( Vector2( 10.0f, 10.0f ) );
+  touchEvent.points.push_back( point );
   application.ProcessEvent( touchEvent );
 
   // Render and notify
@@ -801,7 +837,7 @@ int UtcDaliBuilderPropertyNotificationP(void)
       "      \"name\": \"subActor\"\n"
       "    }],\n"
       "    \"signals\": [{\n"
-      "      \"name\": \"touched\",\n"
+      "      \"name\": \"touch\",\n"
       "      \"action\": \"hide\"\n"
       "    }],\n"
       "    \"notifications\": [{\n"
@@ -823,7 +859,10 @@ int UtcDaliBuilderPropertyNotificationP(void)
 
   // Emit touch event and check that our quit method is called
   Integration::TouchEvent touchEvent;
-  touchEvent.points.push_back( TouchPoint ( 0, TouchPoint::Down, 10.0f, 10.0f ) );
+  Integration::Point point;
+  point.SetState( PointState::DOWN );
+  point.SetScreenPosition( Vector2( 10.0f, 10.0f ) );
+  touchEvent.points.push_back( point );
   application.ProcessEvent( touchEvent );
 
   // Render and notify
@@ -852,19 +891,22 @@ int UtcDaliBuilderCustomPropertyP(void)
       "\"templates\":\n"
       "{\n"
       "  \"imageTree\": { \n"
-      "    \"type\": \"ImageActor\",\n"
+      "    \"type\": \"ImageView\",\n"
       "    \"name\": \"image\",\n"
       "    \"size\": [100,100,1],\n"
       "    \"signals\": [{\n"
-      "      \"name\": \"touched\",\n"
+      "      \"name\": \"touch\",\n"
       "      \"action\": \"quit\"\n"
       "    }],\n"
-      "    \"customProperties\": {\n"
+      "    \"properties\": {\n"
       "      \"newproperty\": true\n"
       "    },\n"
+      "    \"animatableProperties\": {\n"
+      "      \"newAnimatableproperty\": 3\n"
+      "    },\n"
       "    \"actors\": [\n"
       "      {\n"
-      "        \"type\":\"ImageActor\",\n"
+      "        \"type\":\"ImageView\",\n"
       "        \"name\":\"childImage\" \n"
       "      }\n"
       "    ]\n"
@@ -876,7 +918,7 @@ int UtcDaliBuilderCustomPropertyP(void)
   Builder builder = Builder::New();
   builder.LoadFromString( json );
 
-  ImageActor actor = ImageActor::DownCast( builder.Create( "imageTree" ) );
+  ImageView actor = ImageView::DownCast( builder.Create( "imageTree" ) );
   DALI_TEST_CHECK( actor );
 
   // NB: already applied in create
@@ -885,10 +927,15 @@ int UtcDaliBuilderCustomPropertyP(void)
   Property::Value value = actor.GetProperty(index);
   DALI_TEST_CHECK( value.Get<bool>() == true );
 
+  index = actor.GetPropertyIndex("newAnimatableproperty");
+  DALI_TEST_CHECK( Property::INVALID_INDEX != index );
+  value = actor.GetProperty(index);
+  DALI_TEST_CHECK( value.Get<int>() == 3 );
+
   END_TEST;
 }
 
-int UtcDaliBuilderShaderEffectP(void)
+int UtcDaliBuilderCustomShaderP(void)
 {
   ToolkitTestApplication application;
 
@@ -897,7 +944,7 @@ int UtcDaliBuilderShaderEffectP(void)
     "{\n"
     "  \"stage\": [\n"
     "    {\n"
-    "      \"type\": \"ImageActor\",\n"
+    "      \"type\": \"ImageView\",\n"
     "      \"name\": \"Image1\",\n"
     "      \"position\": [\n"
     "        0.40461349487305,\n"
@@ -908,11 +955,16 @@ int UtcDaliBuilderShaderEffectP(void)
     "      \"size\": [200, 200, 0],\n"
     "      \"effect\": \"Ripple2D\",\n"
     "      \"image\": {\n"
-    "        \"filename\": \"{DALI_IMAGE_DIR}gallery-medium-25.jpg\",\n"
-    "        \"width\": 200,\n"
-    "        \"height\": 80,\n"
-    "        \"loadPolicy\": \"IMMEDIATE\",\n"
-    "        \"releasePolicy\": \"NEVER\"\n"
+    "        \"url\": \"{DALI_IMAGE_DIR}gallery-medium-25.jpg\",\n"
+    "        \"desiredWidth\": 200,\n"
+    "        \"desiredHeight\": 80,\n"
+    "        \"shader\": {\n"
+    "           \"fragmentShader\": \"precision mediump float;\\nuniform sampler2D sTexture;\\nuniform vec4 uColor;\\nuniform float uAmplitude;\\nuniform float uTime;\\nvarying vec2 vTexCoord;\\nvoid main()\\n{\\n  highp vec2 pos = -1.0 + 2.0 * vTexCoord;\\n  highp float len = length(pos);\\n  highp vec2 texCoord = vTexCoord + pos/len * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude;\\n  gl_FragColor = texture2D(sTexture, texCoord) * uColor;}\\n\\n\"\n"
+    "        }\n"
+    "      },\n"
+    "      \"customAnimatableProperties\": {\n"
+    "         \"uAmplitude\": 0.02,\n"
+    "         \"uTime\": 0.0\n"
     "      },\n"
     "      \"signals\": [\n"
     "        {\n"
@@ -923,7 +975,6 @@ int UtcDaliBuilderShaderEffectP(void)
     "      ]\n"
     "    }\n"
     "  ],\n"
-    "  \"paths\": {},\n"
     "  \"animations\": {\n"
     "    \"Animation_1\": {\n"
     "      \"loop\":true,\n"
@@ -936,27 +987,10 @@ int UtcDaliBuilderShaderEffectP(void)
     "          \"timePeriod\": {\n"
     "            \"delay\": 0,\n"
     "            \"duration\": 10.0\n"
-    "          },\n"
-    "          \"gui-builder-timeline-color\": \"#8dc0da\"\n"
+    "          }\n"
     "        }\n"
     "      ]\n"
     "    }\n"
-    "  },\n"
-    "  \"shaderEffects\": {\n"
-    "    \"Ripple2D\": {\n"
-    "      \"program\": {\n"
-    "        \"vertexPrefix\": \"\",\n"
-    "        \"vertex\": \"void main(void)\\n{\\n  gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\\n  vTexCoord = aTexCoord;\\n}\\n\\n\",\n"
-    "        \"fragmentPrefix\": \"\",\n"
-    "        \"fragment\": \"precision mediump float;\\nuniform float uAmplitude; // 0.02; (< 1)\\nuniform float uTime;\\nvoid main()\\n{\\n  highp vec2 textureSize = sTextureRect.zw - sTextureRect.xy;\\n  highp vec2 pos = -1.0 + 2.0 * vTexCoord.st/textureSize;\\n  highp float len = length(pos);\\n  highp vec2 texCoord = vTexCoord.st/textureSize + pos/len * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude; \\n  gl_FragColor = texture2D(sTexture, texCoord) * uColor;\\n}\\n\\n\\n\",\n"
-    "        \"geometryType\": \"GEOMETRY_TYPE_IMAGE\"\n"
-    "      },\n"
-    "      \"geometryHints\": \"HINT_NONE\",\n"
-    "      \"gridDensity\": 0,\n"
-    "      \"loop\": true,\n"
-    "      \"uAmplitude\": 0.02,\n"
-    "      \"uTime\": 0.0\n"
-    "    }\n"
     "  }\n"
     "}\n"
 
@@ -965,10 +999,16 @@ int UtcDaliBuilderShaderEffectP(void)
   Builder builder = Builder::New();
   builder.LoadFromString( json );
 
-  ShaderEffect effect = builder.GetShaderEffect("Ripple2D");
+  builder.AddActors ( "stage", Stage::GetCurrent().GetRootLayer() );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  Actor actor = Stage::GetCurrent().GetRootLayer().FindChildByName("Image1");
 
   // coverage
-  DALI_TEST_CHECK( effect );
+  DALI_TEST_CHECK( actor );
 
   END_TEST;
 }
@@ -988,7 +1028,7 @@ int UtcDaliBuilderLoadFromStringN(void)
            "\"parentOrigin\": \"TOP_LEFT\","
            "\"anchorPoint\": \"TOP_LEFT\","
            "\"signals\": [{"
-             "\"name\": \"touched\","
+             "\"name\": \"touch\","
              "\"action\": \"quit\""
            "}]"
          "}]"
@@ -1014,80 +1054,6 @@ int UtcDaliBuilderLoadFromStringN(void)
   END_TEST;
 }
 
-int UtcDaliBuilderShaderEffect2P(void)
-{
-  ToolkitTestApplication application;
-
-  // JSON with a quit event when the actor is touched
-  std::string json(
-    "{\n"
-    "\"templates\":\n"
-    "{\n"
-    "  \"imageTree\": { \n"
-    "    \"type\": \"ImageActor\",\n"
-    "    \"size\": [100,100,1],\n"
-    "    \"parentOrigin\": [0.5, 0.5, 0.5],\n"
-    "    \"position\": [\n"
-    "      0.40461349487305,\n"
-    "      0.9150390625,\n"
-    "      0.0\n"
-    "    ],\n"
-    "    \"signals\": [{\n"
-    "      \"name\": \"touched\",\n"
-    "      \"action\": \"quit\"\n"
-    "    }],\n"
-    "    \"actors\": [\n"
-    "      {\n"
-    "        \"type\":\"ImageActor\",\n"
-    "        \"name\":\"childImage\" \n"
-    "      }\n"
-    "    ]\n"
-    "  }\n"
-    "},\n"
-    "  \"stage\": [\n"
-    "    {\n"
-    "      \"type\": \"imageTree\",\n"
-    "      \"name\": \"Image1\",\n"
-    "      \"effect\": \"Ripple2D\",\n"
-    "      \"image\": \"offscreen\""
-    "    }\n"
-    "  ],\n"
-    "  \"shaderEffects\": {\n"
-    "    \"Ripple2D\": {\n"
-    "      \"program\": {\n"
-    "        \"vertexPrefix\": \"\",\n"
-    "        \"vertex\": \"void main(void)\\n{\\n  gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\\n  vTexCoord = aTexCoord;\\n}\\n\\n\",\n"
-    "        \"fragmentPrefix\": \"\",\n"
-    "        \"fragment\": \"precision mediump float;\\nuniform float uAmplitude; // 0.02; (< 1)\\nuniform float uTime;\\nvoid main()\\n{\\n  highp vec2 textureSize = sTextureRect.zw - sTextureRect.xy;\\n  highp vec2 pos = -1.0 + 2.0 * vTexCoord.st/textureSize;\\n  highp float len = length(pos);\\n  highp vec2 texCoord = vTexCoord.st/textureSize + pos/len * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude; \\n  gl_FragColor = texture2D(sTexture, texCoord) * uColor;\\n}\\n\\n\\n\",\n"
-    "        \"geometryType\": \"GEOMETRY_TYPE_IMAGE\"\n"
-    "      },\n"
-    "      \"geometryHints\": \"HINT_NONE\",\n"
-    "      \"gridDensity\": 0,\n"
-    "      \"loop\": true,\n"
-    "      \"uAmplitude\": 0.02,\n"
-    "      \"uTime\": 0.0\n"
-    "    }\n"
-    "  },\n"
-    "  \"frameBufferImages\": {\n"
-    "    \"offscreen\": {\n"
-    "      \"type\": \"FrameBufferImage\","
-    "      \"pixelFormat\":\"RGBA8888\","
-    "      \"width\": 400,"
-    "      \"height\": 400"
-    "    }"
-    "   }"
-    "}\n"
-
-  );
-
-  Builder builder = Builder::New();
-  builder.LoadFromString( json );
-
-  // coverage
-  DALI_TEST_CHECK( true );
-
-  END_TEST;
-}
 
 int UtcDaliBuilderAddActorsP(void)
 {
@@ -1109,7 +1075,7 @@ int UtcDaliBuilderAddActorsP(void)
       "      \"visible\": false\n"
       "    }],\n"
       "    \"signals\": [{\n"
-      "      \"name\": \"touched\",\n"
+      "      \"name\": \"touch\",\n"
       "      \"action\": \"hide\",\n"
       "      \"actor\": \"actor\",\n"
       "      \"childActor\": \"subActor\"\n"
@@ -1150,7 +1116,7 @@ int UtcDaliBuilderFrameBufferP(void)
     "  },\n"
     "  \"stage\": [\n"
     "    {\n"
-    "      \"type\": \"ImageActor\",\n"
+    "      \"type\": \"ImageView\",\n"
     "      \"name\": \"fbOnStage\",\n"
     "      \"position\": [\n"
     "        0.40461349487305,\n"
@@ -1163,17 +1129,13 @@ int UtcDaliBuilderFrameBufferP(void)
     "      \"clearColor\": [1,0,0,1]\n"
     "    },\n"
     "    {\n"
-    "      \"type\": \"ImageActor\",\n"
+    "      \"type\": \"ImageView\",\n"
     "      \"name\": \"Image1\",\n"
     "      \"size\": [200, 200, 0],\n"
     "      \"parentOrigin\": [0.5, 0.5, 0.5],\n"
     "      \"effect\": \"Ripple2D\",\n"
     "      \"image\": {\n"
-    "        \"filename\": \"{DALI_IMAGE_DIR}gallery-medium-25.jpg\",\n"
-    "        \"width\": 200,\n"
-    "        \"height\": 80,\n"
-    "        \"loadPolicy\": \"IMMEDIATE\",\n"
-    "        \"releasePolicy\": \"NEVER\"\n"
+    "        \"url\": \"{DALI_IMAGE_DIR}gallery-medium-25.jpg\"\n"
     "      },\n"
     "      \"signals\": [\n"
     "        {\n"
@@ -1290,17 +1252,13 @@ int UtcDaliBuilderPathConstraintsP(void)
     "  },\n"
     "  \"stage\": [\n"
     "    {\n"
-    "      \"type\": \"ImageActor\",\n"
+    "      \"type\": \"ImageView\",\n"
     "      \"name\": \"Image1\",\n"
     "      \"size\": [200, 200, 0],\n"
     "      \"parentOrigin\": [0.5, 0.5, 0.5],\n"
     "      \"effect\": \"Ripple2D\",\n"
     "      \"image\": {\n"
-    "        \"filename\": \"{DALI_IMAGE_DIR}gallery-medium-25.jpg\",\n"
-    "        \"width\": 200,\n"
-    "        \"height\": 80,\n"
-    "        \"loadPolicy\": \"IMMEDIATE\",\n"
-    "        \"releasePolicy\": \"NEVER\"\n"
+    "        \"url\": \"{DALI_IMAGE_DIR}gallery-medium-25.jpg\"\n"
     "      },\n"
     "      \"signals\": [\n"
     "        {\n"
@@ -1455,3 +1413,194 @@ int UtcDaliBuilderPathConstraintsP(void)
 
   END_TEST;
 }
+
+#define CHECK_MAP_ELEMENT( xMap, xKey, xType, xPropType, xExpected, xLocation ) \
+  {                                                                       \
+    Property::Value* value = xMap->Find( xKey );                          \
+    DALI_TEST_EQUALS( value==NULL, false, xLocation);                     \
+    if( value != NULL )                                                   \
+    {                                                                     \
+      DALI_TEST_EQUALS( value->GetType(), xPropType, xLocation );         \
+      xType result;                                                       \
+      value->Get(result);                                                 \
+      DALI_TEST_EQUALS( result, xExpected, TEST_LOCATION );               \
+      std::ostringstream oss;                                             \
+      oss << "Animation element " << xKey << "= " << result << std::endl; \
+      tet_printf( oss.str().c_str() );                                    \
+    }                                                                     \
+    else                                                                  \
+    {                                                                     \
+      tet_printf("Can't find map element " xKey "\n");                    \
+    }                                                                     \
+  }
+
+
+int UtcDaliBuilderMapping01(void)
+{
+  ToolkitTestApplication application;
+
+  const char* json =
+    "{\n"
+    "  \"mappings\":\n"
+    "  {\n"
+    "    \"buttonPressFadeOut\":{\n"
+    "      \"alphaFunction\":\"EASE_OUT\",\n"
+    "      \"timePeriod\":{\n"
+    "        \"delay\":0.0,\n"
+    "        \"duration\":0.4\n"
+    "      }\n"
+    "    },\n"
+    "    \"buttonPressFadeIn\":{\n"
+    "      \"alphaFunction\":\"EASE_IN\",\n"
+    "      \"timePeriod\":{\n"
+    "        \"delay\":0.4,\n"
+    "        \"duration\":0.5\n"
+    "      }\n"
+    "    },\n"
+    "    \"transition:buttonPressed\":\n"
+    "    [\n"
+    "      {\n"
+    "        \"target\": \"unselectedBackgroundRenderer\",\n"
+    "        \"property\": \"opacity\",\n"
+    "        \"value\": 0,\n"
+    "        \"animator\":\"<buttonPressFadeOut>\"\n"
+    "      }\n"
+    "    ],\n"
+    "    \"transition:buttonReleased\":\n"
+    "    [\n"
+    "      {\n"
+    "        \"target\": \"unselectedBackgroundRenderer\",\n"
+    "        \"property\": \"opacity\",\n"
+    "        \"value\": 1,\n"
+    "        \"animator\":\"<buttonPressFadeIn>\"\n"
+    "      },\n"
+    "      {\n"
+    "        \"target\": \"unselectedForegroundRenderer\",\n"
+    "        \"property\": \"scale\",\n"
+    "        \"value\": [ 1, 1, 1 ],\n"
+    "        \"animator\":\"<buttonPressFadeIn>\"\n"
+    "      },\n"
+    "      {\n"
+    "        \"target\": \"selectedBackgroundRenderer\",\n"
+    "        \"property\": \"opacity\",\n"
+    "        \"value\": 0,\n"
+    "        \"animator\": \"<buttonPressFadeOut>\"\n"
+    "      },\n"
+    "      {\n"
+    "        \"target\": \"selectedForegroundRenderer\",\n"
+    "        \"property\": \"scale\",\n"
+    "        \"value\": [ 0, 0, 0 ],\n"
+    "        \"animator\":\"<buttonPressFadeOut>\"\n"
+    "      }\n"
+    "    ]\n"
+    "  },\n"
+    "  \"styles\":\n"
+    "  {\n"
+    "    \"testbutton\":\n"
+    "    {\n"
+    "      \"pressTransition\":\"<transition:buttonPressed>\",\n"
+    "      \"releaseTransition\":\"<transition:buttonReleased>\"\n"
+    "    }\n"
+    "  }\n"
+    "}\n";
+
+  Builder builder = Builder::New();
+  builder.LoadFromString( json );
+
+  Test::TestButton testButton = Test::TestButton::New();
+  Stage::GetCurrent().Add( testButton );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_CHECK( builder.ApplyStyle( "testbutton", testButton ) );
+
+  // Now check that it has loaded the transition correctly:
+  Property::Value transition = testButton.GetProperty(Test::TestButton::Property::PRESS_TRANSITION);
+  DALI_TEST_EQUALS( transition.GetType(), Property::ARRAY, TEST_LOCATION );
+  Property::Array* array = transition.GetArray();
+
+  DALI_TEST_EQUALS( array->Size(), 1, TEST_LOCATION );
+  Property::Value element = array->GetElementAt(0);
+  DALI_TEST_CHECK( element.GetType() == Property::MAP );
+  Property::Map* map = element.GetMap();
+
+  CHECK_MAP_ELEMENT(map, "target", std::string, Property::STRING, "unselectedBackgroundRenderer", TEST_LOCATION);
+  CHECK_MAP_ELEMENT(map, "property", std::string, Property::STRING, "opacity", TEST_LOCATION);
+  CHECK_MAP_ELEMENT(map, "alphaFunction", int, Property::INTEGER, (int)Dali::AlphaFunction::EASE_OUT, TEST_LOCATION);
+  CHECK_MAP_ELEMENT(map, "timePeriodDelay", float, Property::FLOAT, 0.0f, TEST_LOCATION);
+  CHECK_MAP_ELEMENT(map, "timePeriodDuration", float, Property::FLOAT, 0.4f, TEST_LOCATION);
+
+  END_TEST;
+}
+
+
+int UtcDaliBuilderMappingCycleCheck(void)
+{
+  ToolkitTestApplication application;
+
+  std::string json(
+    "{\n"
+    "  \"mappings\":\n"
+    "  {\n"
+    "    \"cyclicKey1\":\"<cyclicKey1>\",\n"
+    "    \"cyclicKey2\":\"<cyclicKey3>\",\n"
+    "    \"cyclicKey3\":\"<cyclicKey2>\",\n"
+    "    \"FadeOut\":{\n"
+    "      \"alphaFunction\":\"EASE_IN\",\n"
+    "      \"timePeriod\":{\n"
+    "        \"delay\":\"<cyclicKey3>\",\n"
+    "        \"duration\":0.6\n"
+    "      }\n"
+    "    },\n"
+    "    \"transition:buttonPressed\":\n"
+    "    [\n"
+    "      {\n"
+    "        \"target\": \"<cyclicKey1>\",\n"
+    "        \"property\": \"<cyclicKey2>\",\n"
+    "        \"value\": 0,\n"
+    "        \"animator\":\"<FadeOut>\"\n"
+    "      }\n"
+    "    ]\n"
+    "  },\n"
+    "  \"styles\":\n"
+    "  {\n"
+    "    \"testbutton\":\n"
+    "    {\n"
+    "      \"pressTransition\":\"<transition:buttonPressed>\",\n"
+    "      \"releaseTransition\":\"<cyclicKey2>\",\n"
+    "      \"disabledTransition\":\"<cyclicKey3>\",\n"
+    "      \"enabledTransition\":\"<unknownKey>\"\n"
+    "    }\n"
+    "  }\n"
+    "}\n");
+
+  Builder builder = Builder::New();
+  builder.LoadFromString( json );
+
+  Test::TestButton testButton = Test::TestButton::New();
+  Stage::GetCurrent().Add( testButton );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_CHECK( builder.ApplyStyle( "testbutton", testButton ) );
+
+  // Now check that it has loaded the transition correctly:
+  Property::Value transition = testButton.GetProperty(Test::TestButton::Property::PRESS_TRANSITION);
+  DALI_TEST_EQUALS( transition.GetType(), Property::ARRAY, TEST_LOCATION );
+  Property::Array* array = transition.GetArray();
+
+  DALI_TEST_EQUALS( array->Size(), 1, TEST_LOCATION );
+  Property::Value element = array->GetElementAt(0);
+  DALI_TEST_CHECK( element.GetType() == Property::MAP );
+  Property::Map* map = element.GetMap();
+
+  CHECK_MAP_ELEMENT(map, "target", std::string, Property::STRING, "", TEST_LOCATION);
+  CHECK_MAP_ELEMENT(map, "property", std::string, Property::STRING, "", TEST_LOCATION);
+  CHECK_MAP_ELEMENT(map, "timePeriodDuration", float, Property::FLOAT, 0.6f, TEST_LOCATION);
+
+  END_TEST;
+}