[dali_1.2.28] Merge branch 'devel/master' 53/116453/1
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 24 Feb 2017 09:35:14 +0000 (09:35 +0000)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 24 Feb 2017 09:35:14 +0000 (09:35 +0000)
Change-Id: Icbfadd4e5f5b6aae9e82a566643460999bc2d241

74 files changed:
automated-tests/src/dali-toolkit-internal/CMakeLists.txt
automated-tests/src/dali-toolkit-internal/utc-Dali-ColorConversion.cpp [new file with mode: 0644]
automated-tests/src/dali-toolkit-styling/default-theme.json [new file with mode: 0644]
automated-tests/src/dali-toolkit-styling/utc-Dali-StyleManager.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-compare-types.h [new file with mode: 0644]
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h
automated-tests/src/dali-toolkit/utc-Dali-CheckBoxButton.cpp
automated-tests/src/dali-toolkit/utc-Dali-KeyboardFocusManager.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp
automated-tests/src/dali-toolkit/utc-Dali-TransitionData.cpp
automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp
automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp
dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h
dali-toolkit/devel-api/visuals/visual-properties-devel.h
dali-toolkit/internal/builder/builder-impl.cpp
dali-toolkit/internal/builder/builder-impl.h
dali-toolkit/internal/builder/builder-set-property.cpp
dali-toolkit/internal/builder/dictionary.h
dali-toolkit/internal/builder/style.cpp
dali-toolkit/internal/builder/style.h
dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp
dali-toolkit/internal/controls/slider/slider-impl.cpp
dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp
dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h
dali-toolkit/internal/file.list
dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp
dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h
dali-toolkit/internal/helpers/color-conversion.cpp [new file with mode: 0644]
dali-toolkit/internal/helpers/color-conversion.h [new file with mode: 0644]
dali-toolkit/internal/visuals/border/border-visual.cpp
dali-toolkit/internal/visuals/color/color-visual.cpp
dali-toolkit/internal/visuals/gradient/gradient-visual.cpp
dali-toolkit/internal/visuals/image/image-visual.cpp
dali-toolkit/internal/visuals/mesh/mesh-visual.cpp
dali-toolkit/internal/visuals/npatch/npatch-visual.cpp
dali-toolkit/internal/visuals/primitive/primitive-visual.cpp
dali-toolkit/internal/visuals/text/text-visual.cpp
dali-toolkit/internal/visuals/visual-base-data-impl.cpp
dali-toolkit/internal/visuals/visual-base-data-impl.h
dali-toolkit/internal/visuals/visual-base-impl.cpp
dali-toolkit/internal/visuals/visual-base-impl.h
dali-toolkit/internal/visuals/visual-string-constants.cpp
dali-toolkit/internal/visuals/visual-string-constants.h
dali-toolkit/internal/visuals/wireframe/wireframe-visual.cpp
dali-toolkit/public-api/controls/control-impl.cpp
dali-toolkit/public-api/dali-toolkit-version.cpp
dali-toolkit/public-api/visuals/border-visual-properties.h
dali-toolkit/public-api/visuals/color-visual-properties.h
dali-toolkit/public-api/visuals/gradient-visual-properties.h
dali-toolkit/public-api/visuals/image-visual-properties.h
dali-toolkit/public-api/visuals/mesh-visual-properties.h
dali-toolkit/public-api/visuals/primitive-visual-properties.h
dali-toolkit/public-api/visuals/visual-properties.h
dali-toolkit/styles/1920x1080/dali-toolkit-default-theme.json
dali-toolkit/styles/480x800/dali-toolkit-default-theme.json
dali-toolkit/styles/720x1280/dali-toolkit-default-theme.json
dali-toolkit/styles/images-common/selection-popup-background.9.png [new file with mode: 0644]
dali-toolkit/styles/images-common/selection-popup-border.9.png [new file with mode: 0644]
packaging/dali-addon.spec
packaging/dali-toolkit.spec
plugins/dali-swig/SWIG/dali-gc.i
plugins/dali-swig/SWIG/dali-operator.i
plugins/dali-swig/SWIG/dali-toolkit.i
plugins/dali-swig/SWIG/dali.i
plugins/dali-swig/SWIG/devel-properties.i
plugins/dali-swig/SWIG/events/actor-event.i
plugins/dali-swig/SWIG/rotation.i [new file with mode: 0755]
plugins/dali-swig/examples/hello-world.cs
plugins/dali-swig/examples/scroll-view.cs
plugins/dali-swig/manual/cpp/devel-property-wrap.cpp
plugins/dali-swig/manual/csharp/DaliEnumConstants.cs
plugins/dali-swig/manual/csharp/ManualPINVOKE.cs
plugins/dali-swig/property-wrapper.rb

index f07653b..023d4bc 100755 (executable)
@@ -24,6 +24,7 @@ SET(TC_SOURCES
  utc-Dali-DebugRendering.cpp
  utc-Dali-ItemView-internal.cpp
  utc-Dali-PropertyHelper.cpp
+ utc-Dali-ColorConversion.cpp
 )
 
 # Append list of test harness files (Won't get parsed for test cases)
diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-ColorConversion.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-ColorConversion.cpp
new file mode 100644 (file)
index 0000000..14cef1c
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/internal/helpers/color-conversion.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+void dali_color_conversion_startup(void)
+{
+  test_return_value = TET_UNDEF;
+}
+
+void dali_color_conversion_cleanup(void)
+{
+  test_return_value = TET_PASS;
+}
+
+int UtcDaliPropertyHelperConvertHtmlStringToColor(void)
+{
+  tet_infoline( "Test to check whether An HTML style hex string can be converted" );
+
+  const std::string stringColor( "#FF0000" );
+
+  Vector4 result;
+  DALI_TEST_CHECK( Toolkit::Internal::ConvertStringToColor( stringColor, result ) );
+
+  DALI_TEST_EQUALS( result, Color::RED, TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliPropertyHelperConvertStringPropertyToColor(void)
+{
+  tet_infoline( "Test to check whether A Property value containing a string can be converted" );
+
+  const std::string stringColor( "#00FF00" );
+  Property::Value colorProperty( stringColor );
+
+  Vector4 result;
+  DALI_TEST_CHECK( Toolkit::Internal::ConvertPropertyToColor( colorProperty, result ) );
+
+  DALI_TEST_EQUALS( result, Color::GREEN, TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliPropertyHelperConvertVector4PropertyToColor(void)
+{
+  tet_infoline( "Test to check whether A Property value containing a string can be converted" );
+
+  const Vector4 color( 0.0, 0.0, 1.0, 1.0 );
+  Property::Value colorProperty( color );
+
+  Vector4 result;
+  DALI_TEST_CHECK( Toolkit::Internal::ConvertPropertyToColor( colorProperty, result ) );
+
+  DALI_TEST_EQUALS( result, Color::BLUE, TEST_LOCATION );
+
+  END_TEST;
+}
diff --git a/automated-tests/src/dali-toolkit-styling/default-theme.json b/automated-tests/src/dali-toolkit-styling/default-theme.json
new file mode 100644 (file)
index 0000000..aea0422
--- /dev/null
@@ -0,0 +1,338 @@
+{
+  "constants":
+  {
+    "CONFIG_SCRIPT_LOG_LEVEL":"NoLogging"
+  },
+  "styles":
+  {
+    "textlabel":
+    {
+      "pointSize":18
+    },
+
+    "textlabelFontSize0":
+    {
+      "pointSize":8
+    },
+    "textlabelFontSize1":
+    {
+      "pointSize":10
+    },
+    "textlabelFontSize2":
+    {
+      "pointSize":15
+    },
+    "textlabelFontSize3":
+    {
+      "pointSize":19
+    },
+    "textlabelFontSize4":
+    {
+      "pointSize":25
+    },
+
+    "textfield":
+    {
+      "pointSize":18,
+      "primaryCursorColor":[0.0,0.72,0.9,1.0],
+      "secondaryCursorColor":[0.0,0.72,0.9,1.0],
+      "cursorWidth":3,
+      "selectionHighlightColor":[0.75,0.96,1.0,1.0],
+      "grabHandleImage" : "{DALI_STYLE_IMAGE_DIR}cursor_handler_drop_center.png",
+      "selectionHandleImageLeft" : {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png" },
+      "selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
+    },
+
+    "textfieldFontSize0":
+    {
+      "pointSize":10
+    },
+    "textfieldFontSize1":
+    {
+      "pointSize":10
+    },
+    "textfieldFontSize2":
+    {
+      "pointSize":10
+    },
+    "textfieldFontSize3":
+    {
+      "pointSize":10
+    },
+    "textfieldFontSize4":
+    {
+      "pointSize":10
+    },
+    "textselectionpopup":
+    {
+      "popupMaxSize":[656,72],
+      "optionDividerSize":[2,0],
+      "popupDividerColor":[0.23,0.72,0.8,0.11],
+      "popupIconColor":[1.0,1.0,1.0,1.0],
+      "popupPressedColor":[0.24,0.72,0.8,0.11],
+      "background": {
+        "rendererType": "nPatch",
+        "imageUrl": "{DALI_IMAGE_DIR}selection-popup-bg.9.png"
+        },
+      "popupFadeInDuration":0.25,
+      "popupFadeOutDuration":0.25
+    },
+    "textselectionpopupbutton":
+    {
+      "label":
+      {
+        "pointSize":8,
+        "fontStyle": { "weight":"light" }
+      }
+    },
+    "textselectiontoolbar":
+    {
+      "enableOvershoot":true,
+      "scrollView":
+      {
+        "overshootAnimationSpeed":360.0,
+        "overshootSize":[720.0,130.0]
+      }
+    },
+    "scrollview":
+    {
+      "overshootEffectColor":"B018",
+      "overshootAnimationSpeed":360.0,
+      "overshootSize":[720.0,130.0]
+    },
+    "itemview":
+    {
+      "overshootEffectColor":"B018",
+      "overshootAnimationSpeed":360.0,
+      "overshootSize":[720.0,130.0]
+    },
+    "texteditor":
+    {
+      "pointSize":18,
+      "primaryCursorColor":[0.0,0.72,0.9,1.0],
+      "secondaryCursorColor":[0.0,0.72,0.9,1.0],
+      "cursorWidth":3,
+      "selectionHighlightColor":[0.75,0.96,1.0,1.0],
+      "grabHandleImage" : "{DALI_STYLE_IMAGE_DIR}cursor_handler_drop_center.png",
+      "selectionHandleImageLeft" : {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png" },
+      "selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
+    },
+    "ComplexControl":
+    {
+      "states":
+      {
+        "NORMAL":
+        {
+          "states":
+          {
+            "SELECTED":
+            {
+              "visuals":
+              {
+                "foregroundVisual":
+                {
+                  "visualType":"GRADIENT",
+                  "startPosition": [-1, -1],
+                  "endPosition": [1, 1],
+                  "spreadMethod": "REPEAT",
+                  "stopOffset": [0.2, 0.8],
+                  "stopColor": [ [ 1,0,0,1], [0,1,0,1] ]
+                }
+              }
+            },
+            "UNSELECTED":
+            {
+              "visuals":
+              {
+                "foregroundVisual":
+                {
+                  "visualType":"COLOR",
+                  "mixColor": [ 1,0,0,1]
+                }
+              }
+            }
+          },
+          "transitions":
+          {
+            "visualName":"*",
+            "effect":"CROSSFADE",
+            "animator":
+            {
+              "alphaFunction":"EASE_IN_OUT",
+              "duration":0.3
+            }
+          }
+        },
+        "FOCUSED":
+        {
+          "visuals":
+          {
+            "foregroundVisual":
+            {
+              "visualType":"GRADIENT",
+              "startPosition": [-1, -1],
+              "endPosition": [1, 1],
+              "spreadMethod": "REPEAT",
+              "stopOffset": [0.3, 0.9],
+              "stopColor": [ [ 0,0,1,1], [0,1,1,1] ]
+            },
+            "focusVisual":
+            {
+              "visualType":"IMAGE",
+              "url": "focus.png"
+            }
+          },
+          "entryTransition":
+          {
+            "target":"focusVisual",
+            "property":"mixColor",
+            "initialValue":[0,0,0,0],
+            "targetValue":[1,1,1,1],
+            "animator":
+            {
+              "alphaFunction":"EASE_IN_OUT_SINE",
+              "timePeriod":
+              {
+                "duration":0.5,
+                "delay":0
+              }
+            }
+          },
+          "exitTransition":
+          {
+            "target":"focusVisual",
+            "property":"mixColor",
+            "initialValue":[1,1,1,1],
+            "targetValue":[0,0,0,0],
+            "animator":
+            {
+              "alphaFunction":"EASE_IN_OUT_SINE",
+              "timePeriod":
+              {
+                "duration":0.5,
+                "delay":0
+              }
+            }
+          }
+        },
+        "DISABLED":
+        {
+          "visuals":
+          {
+            "foregroundVisual":
+            {
+              "visualType":"COLOR",
+              "mixColor": [1,0,0,1]
+            }
+          }
+        }
+      },
+      "transitions":
+      [
+        {
+          "effect":"CROSSFADE",
+          "animator":
+          {
+            "alphaFunction":"EASE_IN_OUT",
+            "duration":0.3
+          }
+        }
+      ]
+    },
+    "BasicControl":
+    {
+      "states":
+      {
+        "NORMAL":
+        {
+          "visuals":
+          {
+            "foregroundVisual":
+            {
+              "visualType":"GRADIENT",
+              "startPosition": [-1, -1],
+              "endPosition": [1, 1],
+              "spreadMethod": "REPEAT",
+              "stopOffset": [0.2, 0.8],
+              "stopColor": [ [ 1,0,0,1], [0,1,0,1] ]
+            }
+          }
+        },
+        "FOCUSED":
+        {
+          "visuals":
+          {
+            "foregroundVisual":
+            {
+              "visualType":"GRADIENT",
+              "startPosition": [-1, -1],
+              "endPosition": [1, 1],
+              "spreadMethod": "REPEAT",
+              "stopOffset": [0.3, 0.9],
+              "stopColor": [ [ 0,0,1,1], [0,1,1,1] ]
+            },
+            "focusVisual":
+            {
+              "visualType":"IMAGE",
+              "url": "focus.png"
+            }
+          },
+          "entryTransition":
+          {
+            "target":"focusVisual",
+            "property":"mixColor",
+            "initialValue":[0,0,0,0],
+            "targetValue":[1,1,1,1],
+            "animator":
+            {
+              "alphaFunction":"EASE_IN_OUT_SINE",
+              "timePeriod":
+              {
+                "duration":0.5,
+                "delay":0
+              }
+            }
+          },
+          "exitTransition":
+          {
+            "target":"focusVisual",
+            "property":"mixColor",
+            "initialValue":[1,1,1,1],
+            "targetValue":[0,0,0,0],
+            "animator":
+            {
+              "alphaFunction":"EASE_IN_OUT_SINE",
+              "timePeriod":
+              {
+                "duration":0.5,
+                "delay":0
+              }
+            }
+          }
+        },
+        "DISABLED":
+        {
+          "visuals":
+          {
+            "foregroundVisual":
+            {
+              "visualType":"COLOR",
+              "mixColor": [1,0,0,1]
+            }
+          }
+        }
+      },
+      "transitions":
+      [
+        {
+          "effect":"CROSSFADE",
+          "animator":
+          {
+            "alphaFunction":"EASE_IN_OUT",
+            "duration":0.3
+          }
+        }
+      ]
+    }
+  }
+}
index 6fe0fde..34f604a 100644 (file)
@@ -17,6 +17,8 @@
 #include <dali/devel-api/adaptor-framework/style-monitor.h>
 
 #include <iostream>
+#include <fstream>
+#include <sstream>
 #include <stdlib.h>
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/dali-toolkit.h>
@@ -34,345 +36,7 @@ using namespace Dali::Toolkit;
 
 namespace
 {
-const char* defaultTheme =
-"{\n"
-"  \"constants\":\n"
-"  {\n"
-"    \"CONFIG_SCRIPT_LOG_LEVEL\":\"NoLogging\"\n"
-"  },\n"
-"  \"styles\":\n"
-"  {\n"
-"    \"textlabel\":\n"
-"    {\n"
-"      \"pointSize\":18\n"
-"    },\n"
-"\n"
-"    \"textlabelFontSize0\":\n"
-"    {\n"
-"      \"pointSize\":8\n"
-"    },\n"
-"    \"textlabelFontSize1\":\n"
-"    {\n"
-"      \"pointSize\":10\n"
-"    },\n"
-"    \"textlabelFontSize2\":\n"
-"    {\n"
-"      \"pointSize\":15\n"
-"    },\n"
-"    \"textlabelFontSize3\":\n"
-"    {\n"
-"      \"pointSize\":19\n"
-"    },\n"
-"    \"textlabelFontSize4\":\n"
-"    {\n"
-"      \"pointSize\":25\n"
-"    },\n"
-"\n"
-"    \"textfield\":\n"
-"    {\n"
-"      \"pointSize\":18,\n"
-"      \"primaryCursorColor\":[0.0,0.72,0.9,1.0],\n"
-"      \"secondaryCursorColor\":[0.0,0.72,0.9,1.0],\n"
-"      \"cursorWidth\":3,\n"
-"      \"selectionHighlightColor\":[0.75,0.96,1.0,1.0],\n"
-"      \"grabHandleImage\" : \"{DALI_STYLE_IMAGE_DIR}cursor_handler_drop_center.png\",\n"
-"      \"selectionHandleImageLeft\" : {\"filename\":\"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png\" },\n"
-"      \"selectionHandleImageRight\": {\"filename\":\"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png\" }\n"
-"    },\n"
-"\n"
-"    \"textfieldFontSize0\":\n"
-"    {\n"
-"      \"pointSize\":10\n"
-"    },\n"
-"    \"textfieldFontSize1\":\n"
-"    {\n"
-"      \"pointSize\":10\n"
-"    },\n"
-"    \"textfieldFontSize2\":\n"
-"    {\n"
-"      \"pointSize\":10\n"
-"    },\n"
-"    \"textfieldFontSize3\":\n"
-"    {\n"
-"      \"pointSize\":10\n"
-"    },\n"
-"    \"textfieldFontSize4\":\n"
-"    {\n"
-"      \"pointSize\":10\n"
-"    },\n"
-"    \"textselectionpopup\":\n"
-"    {\n"
-"      \"popupMaxSize\":[656,72],\n"
-"      \"optionDividerSize\":[2,0],\n"
-"      \"popupDividerColor\":[0.23,0.72,0.8,0.11],\n"
-"      \"popupIconColor\":[1.0,1.0,1.0,1.0],\n"
-"      \"popupPressedColor\":[0.24,0.72,0.8,0.11],\n"
-"      \"background\": {\n"
-"        \"rendererType\": \"nPatch\",\n"
-"        \"imageUrl\": \"{DALI_IMAGE_DIR}selection-popup-bg.9.png\"\n"
-"        },\n"
-"      \"popupFadeInDuration\":0.25,\n"
-"      \"popupFadeOutDuration\":0.25\n"
-"    },\n"
-"    \"textselectionpopupbutton\":\n"
-"    {\n"
-"      \"label\":\n"
-"      {\n"
-"        \"pointSize\":8,\n"
-"        \"fontStyle\":\"{\\\\""weight\\\\"":\\\\""light\\\\""}\"\n"
-"      }\n"
-"    },\n"
-"    \"textselectiontoolbar\":\n"
-"    {\n"
-"      \"enableOvershoot\":true,\n"
-"      \"scrollView\":\n"
-"      {\n"
-"        \"overshootAnimationSpeed\":360.0,\n"
-"        \"overshootSize\":[720.0,130.0]\n"
-"      }\n"
-"    },\n"
-"    \"scrollview\":\n"
-"    {\n"
-"      \"overshootEffectColor\":\"B018\",\n"
-"      \"overshootAnimationSpeed\":360.0,\n"
-"      \"overshootSize\":[720.0,130.0]\n"
-"    },\n"
-"    \"itemview\":\n"
-"    {\n"
-"      \"overshootEffectColor\":\"B018\",\n"
-"      \"overshootAnimationSpeed\":360.0,\n"
-"      \"overshootSize\":[720.0,130.0]\n"
-"    },\n"
-"    \"texteditor\":\n"
-"    {\n"
-"      \"pointSize\":18,\n"
-"      \"primaryCursorColor\":[0.0,0.72,0.9,1.0],\n"
-"      \"secondaryCursorColor\":[0.0,0.72,0.9,1.0],\n"
-"      \"cursorWidth\":3,\n"
-"      \"selectionHighlightColor\":[0.75,0.96,1.0,1.0],\n"
-"      \"grabHandleImage\" : \"{DALI_STYLE_IMAGE_DIR}cursor_handler_drop_center.png\",\n"
-"      \"selectionHandleImageLeft\" : {\"filename\":\"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png\" },\n"
-"      \"selectionHandleImageRight\": {\"filename\":\"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png\" }\n"
-"    },\n"
-"    \"ComplexControl\":\n"
-"    {\n"
-"      \"states\":\n"
-"      {\n"
-"        \"NORMAL\":\n"
-"        {\n"
-"          \"states\":\n"
-"          {\n"
-"            \"SELECTED\":\n"
-"            {\n"
-"              \"visuals\":\n"
-"              {\n"
-"                \"foregroundVisual\":\n"
-"                {\n"
-"                  \"visualType\":\"GRADIENT\",\n"
-"                  \"startPosition\": [-1, -1],\n"
-"                  \"endPosition\": [1, 1],\n"
-"                  \"spreadMethod\": \"REPEAT\",\n"
-"                  \"stopOffset\": [0.2, 0.8],\n"
-"                  \"stopColor\": [ [ 1,0,0,1], [0,1,0,1] ]\n"
-"                }\n"
-"              }\n"
-"            },\n"
-"            \"UNSELECTED\":\n"
-"            {\n"
-"              \"visuals\":\n"
-"              {\n"
-"                \"foregroundVisual\":\n"
-"                {\n"
-"                  \"visualType\":\"COLOR\",\n"
-"                  \"mixColor\": [ 1,0,0,1]\n"
-"                }\n"
-"              }\n"
-"            }\n"
-"          },\n"
-"          \"transitions\":\n"
-"          {\n"
-"            \"visualName\":\"*\",\n"
-"            \"effect\":\"CROSSFADE\",\n"
-"            \"animator\":\n"
-"            {\n"
-"              \"alphaFunction\":\"EASE_IN_OUT\",\n"
-"              \"duration\":0.3\n"
-"            }\n"
-"          }\n"
-"        },\n"
-"        \"FOCUSED\":\n"
-"        {\n"
-"          \"visuals\":\n"
-"          {\n"
-"            \"foregroundVisual\":\n"
-"            {\n"
-"              \"visualType\":\"GRADIENT\",\n"
-"              \"startPosition\": [-1, -1],\n"
-"              \"endPosition\": [1, 1],\n"
-"              \"spreadMethod\": \"REPEAT\",\n"
-"              \"stopOffset\": [0.3, 0.9],\n"
-"              \"stopColor\": [ [ 0,0,1,1], [0,1,1,1] ]\n"
-"            },\n"
-"            \"focusVisual\":\n"
-"            {\n"
-"              \"visualType\":\"IMAGE\",\n"
-"              \"url\": \"focus.png\"\n"
-"            }\n"
-"          },\n"
-"          \"entryTransition\":\n"
-"          {\n"
-"            \"target\":\"focusVisual\",\n"
-"            \"property\":\"mixColor\",\n"
-"            \"initialValue\":[0,0,0,0],\n"
-"            \"targetValue\":[1,1,1,1],\n"
-"            \"animator\":\n"
-"            {\n"
-"              \"alphaFunction\":\"EASE_IN_OUT_SINE\",\n"
-"              \"timePeriod\": \n"
-"              {\n"
-"                \"duration\":0.5,\n"
-"                \"delay\":0\n"
-"              }\n"
-"            }\n"
-"          },\n"
-"          \"exitTransition\":\n"
-"          {\n"
-"            \"target\":\"focusVisual\",\n"
-"            \"property\":\"mixColor\",\n"
-"            \"initialValue\":[1,1,1,1],\n"
-"            \"targetValue\":[0,0,0,0],\n"
-"            \"animator\":\n"
-"            {\n"
-"              \"alphaFunction\":\"EASE_IN_OUT_SINE\",\n"
-"              \"timePeriod\": \n"
-"              {\n"
-"                \"duration\":0.5,\n"
-"                \"delay\":0\n"
-"              }\n"
-"            }\n"
-"          }\n"
-"        },\n"
-"        \"DISABLED\":\n"
-"        {\n"
-"          \"visuals\":\n"
-"          {\n"
-"            \"foregroundVisual\":\n"
-"            {\n"
-"              \"visualType\":\"COLOR\",\n"
-"              \"mixColor\": [1,0,0,1]\n"
-"            }\n"
-"          }\n"
-"        }\n"
-"      },\n"
-"      \"transitions\":\n"
-"      [\n"
-"        {\n"
-"          \"effect\":\"CROSSFADE\",\n"
-"          \"animator\":\n"
-"          {\n"
-"            \"alphaFunction\":\"EASE_IN_OUT\",\n"
-"            \"duration\":0.3\n"
-"          }\n"
-"        }\n"
-"      ]\n"
-"    },\n"
-"    \"BasicControl\":\n"
-"    {\n"
-"      \"states\":\n"
-"      {\n"
-"        \"NORMAL\":\n"
-"        {\n"
-"          \"visuals\":\n"
-"          {\n"
-"            \"foregroundVisual\":\n"
-"            {\n"
-"              \"visualType\":\"GRADIENT\",\n"
-"              \"startPosition\": [-1, -1],\n"
-"              \"endPosition\": [1, 1],\n"
-"              \"spreadMethod\": \"REPEAT\",\n"
-"              \"stopOffset\": [0.2, 0.8],\n"
-"              \"stopColor\": [ [ 1,0,0,1], [0,1,0,1] ]\n"
-"            }\n"
-"          }\n"
-"        },\n"
-"        \"FOCUSED\":\n"
-"        {\n"
-"          \"visuals\":\n"
-"          {\n"
-"            \"foregroundVisual\":\n"
-"            {\n"
-"              \"visualType\":\"GRADIENT\",\n"
-"              \"startPosition\": [-1, -1],\n"
-"              \"endPosition\": [1, 1],\n"
-"              \"spreadMethod\": \"REPEAT\",\n"
-"              \"stopOffset\": [0.3, 0.9],\n"
-"              \"stopColor\": [ [ 0,0,1,1], [0,1,1,1] ]\n"
-"            },\n"
-"            \"focusVisual\":\n"
-"            {\n"
-"              \"visualType\":\"IMAGE\",\n"
-"              \"url\": \"focus.png\"\n"
-"            }\n"
-"          },\n"
-"          \"entryTransition\":\n"
-"          {\n"
-"            \"target\":\"focusVisual\",\n"
-"            \"property\":\"mixColor\",\n"
-"            \"initialValue\":[0,0,0,0],\n"
-"            \"targetValue\":[1,1,1,1],\n"
-"            \"animator\":\n"
-"            {\n"
-"              \"alphaFunction\":\"EASE_IN_OUT_SINE\",\n"
-"              \"timePeriod\": \n"
-"              {\n"
-"                \"duration\":0.5,\n"
-"                \"delay\":0\n"
-"              }\n"
-"            }\n"
-"          },\n"
-"          \"exitTransition\":\n"
-"          {\n"
-"            \"target\":\"focusVisual\",\n"
-"            \"property\":\"mixColor\",\n"
-"            \"initialValue\":[1,1,1,1],\n"
-"            \"targetValue\":[0,0,0,0],\n"
-"            \"animator\":\n"
-"            {\n"
-"              \"alphaFunction\":\"EASE_IN_OUT_SINE\",\n"
-"              \"timePeriod\": \n"
-"              {\n"
-"                \"duration\":0.5,\n"
-"                \"delay\":0\n"
-"              }\n"
-"            }\n"
-"          }\n"
-"        },\n"
-"        \"DISABLED\":\n"
-"        {\n"
-"          \"visuals\":\n"
-"          {\n"
-"            \"foregroundVisual\":\n"
-"            {\n"
-"              \"visualType\":\"COLOR\",\n"
-"              \"mixColor\": [1,0,0,1]\n"
-"            }\n"
-"          }\n"
-"        }\n"
-"      },\n"
-"      \"transitions\":\n"
-"      [\n"
-"        {\n"
-"          \"effect\":\"CROSSFADE\",\n"
-"          \"animator\":\n"
-"          {\n"
-"            \"alphaFunction\":\"EASE_IN_OUT\",\n"
-"            \"duration\":0.3\n"
-"          }\n"
-"        }\n"
-"      ]\n"
-"    }\n"
-"  }\n"
-"}\n";
+std::string defaultTheme;
 
 } // anonymous namespace
 
@@ -382,6 +46,9 @@ const char* defaultTheme =
 void dali_style_manager_startup(void)
 {
   test_return_value = TET_UNDEF;
+
+  std::ifstream t("src/dali-toolkit-styling/default-theme.json");
+  defaultTheme = std::string((std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>());
 }
 
 void dali_style_manager_cleanup(void)
@@ -1200,7 +867,7 @@ int UtcDaliStyleManagerStyleChangedSignalFontSizeTextEditor(void)
 }
 
 
-int UtcDaliStyleManagerVisualTransitionParsing(void)
+int UtcDaliStyleManagerSetState01(void)
 {
   tet_infoline("Instantiate dummy control and test state/visual/transition capture" );
   Test::StyleMonitor::SetThemeFileOutput( DALI_STYLE_DIR "dali-toolkit-default-theme.json",
@@ -1244,8 +911,7 @@ int UtcDaliStyleManagerVisualTransitionParsing(void)
   END_TEST;
 }
 
-
-int UtcDaliStyleManagerVisualTransitionParsing02(void)
+int UtcDaliStyleManagerSetState02(void)
 {
   tet_infoline("Instantiate dummy control and test state/visual/transition capture" );
   Test::StyleMonitor::SetThemeFileOutput( DALI_STYLE_DIR "dali-toolkit-default-theme.json",
@@ -1258,25 +924,130 @@ int UtcDaliStyleManagerVisualTransitionParsing02(void)
   StyleManager styleManager = StyleManager::Get();
 
   DummyControl actor = DummyControl::New(true);
-  actor.SetProperty(DevelControl::Property::STATE, "FOCUSED");
-
-  actor.SetStyleName("ComplexControl");
+  actor.SetStyleName("BasicControl");
   Stage::GetCurrent().Add(actor);
 
   Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
 
+  int state = actor.GetProperty<int>( DevelControl::Property::STATE );
+  DALI_TEST_EQUALS( state, (int) DevelControl::NORMAL, TEST_LOCATION );
+
   DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOREGROUND_VISUAL), true, TEST_LOCATION);
   Visual::Base visual1 = dummyImpl.GetVisual(DummyControl::Property::FOREGROUND_VISUAL);
+
+  actor.SetProperty( DevelControl::Property::STATE,
+                     Property::Map().Add( "state", "FOCUSED" ).Add("withTransitions", false));
+
+  state = actor.GetProperty<int>( DevelControl::Property::STATE );
+  DALI_TEST_EQUALS( state, (int) DevelControl::FOCUSED, TEST_LOCATION );
+
+  DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOREGROUND_VISUAL), true, TEST_LOCATION);
+  DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOCUS_VISUAL), true, TEST_LOCATION);
+
+  Visual::Base visual2 = dummyImpl.GetVisual(DummyControl::Property::FOREGROUND_VISUAL);
+  DALI_TEST_CHECK( visual1 != visual2 );
+
+  actor.SetProperty( DevelControl::Property::STATE,
+                     Property::Map().Add( "state", "DISABLED" ).Add("withTransitions", false));
+
+  state = actor.GetProperty<int>( DevelControl::Property::STATE );
+  DALI_TEST_EQUALS( state, (int) DevelControl::DISABLED, TEST_LOCATION );
+
+  DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOREGROUND_VISUAL), true, TEST_LOCATION);
+
+  Visual::Base visual3 = dummyImpl.GetVisual(DummyControl::Property::FOREGROUND_VISUAL);
+  Visual::Base focusVisual = dummyImpl.GetVisual(DummyControl::Property::FOCUS_VISUAL);
+  DALI_TEST_CHECK( !focusVisual );
+  DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOCUS_VISUAL), false, TEST_LOCATION);
+
+  DALI_TEST_CHECK( visual1 != visual3 );
+  DALI_TEST_CHECK( visual2 != visual3 );
+
+  actor.SetProperty( DevelControl::Property::STATE,
+                     Property::Map().Add( "state", "NORMAL" ).Add("withTransitions", false));
+
+  state = actor.GetProperty<int>( DevelControl::Property::STATE );
+  DALI_TEST_EQUALS( state, (int) DevelControl::NORMAL, TEST_LOCATION );
+
+  DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOREGROUND_VISUAL), true, TEST_LOCATION);
+
+  visual1 = dummyImpl.GetVisual(DummyControl::Property::FOREGROUND_VISUAL);
   DALI_TEST_CHECK( visual1 );
-  Property::Map map;
-  visual1.CreatePropertyMap( map );
-  Property::Value* value = map.Find( Visual::Property::TYPE );
-  DALI_TEST_CHECK( value );
 
-  int visualType;
-  value->Get( visualType );
+  focusVisual = dummyImpl.GetVisual(DummyControl::Property::FOCUS_VISUAL);
+  DALI_TEST_CHECK( !focusVisual );
+  DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOCUS_VISUAL), false, TEST_LOCATION);
+
+
+  END_TEST;
+}
+
+
+int UtcDaliStyleManagerSetSubState(void)
+{
+  tet_infoline("Instantiate dummy control and test state/visual/transition capture" );
+  Test::StyleMonitor::SetThemeFileOutput( DALI_STYLE_DIR "dali-toolkit-default-theme.json",
+                                          defaultTheme );
+
+  ToolkitTestApplication application;
+
+  StyleChangedSignalChecker styleChangedSignalHandler;
+  Dali::StyleMonitor styleMonitor = Dali::StyleMonitor::Get();
+  StyleManager styleManager = StyleManager::Get();
+
+  DummyControl actor = DummyControl::New(true);
+  actor.SetProperty(DevelControl::Property::STATE, "NORMAL");
+  actor.SetProperty(DevelControl::Property::SUB_STATE, "SELECTED");
+  actor.SetStyleName("ComplexControl");
+  Stage::GetCurrent().Add(actor);
+
+  Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
+
+  {
+    DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOREGROUND_VISUAL), true, TEST_LOCATION);
+    Visual::Base visual = dummyImpl.GetVisual(DummyControl::Property::FOREGROUND_VISUAL);
+    DALI_TEST_CHECK( visual );
+    Property::Map map;
+    visual.CreatePropertyMap( map );
+    Property::Value* value = map.Find( Visual::Property::TYPE );
+    DALI_TEST_CHECK( value );
+
+    int visualType;
+    value->Get( visualType );
+    DALI_TEST_EQUALS( visualType, (int)Toolkit::Visual::GRADIENT, TEST_LOCATION );
+  }
+
+  actor.SetProperty(DevelControl::Property::SUB_STATE, "UNSELECTED");
+
+  {
+    DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOREGROUND_VISUAL), true, TEST_LOCATION);
+    Visual::Base visual = dummyImpl.GetVisual(DummyControl::Property::FOREGROUND_VISUAL);
+    DALI_TEST_CHECK( visual );
+    Property::Map map;
+    visual.CreatePropertyMap( map );
+    Property::Value* value = map.Find( Visual::Property::TYPE );
+    DALI_TEST_CHECK( value );
+
+    int visualType;
+    value->Get( visualType );
+    DALI_TEST_EQUALS( visualType, (int)Toolkit::Visual::COLOR, TEST_LOCATION );
+  }
 
-  DALI_TEST_EQUALS( visualType, (int)Toolkit::Visual::GRADIENT, TEST_LOCATION );
+  actor.SetProperty(DevelControl::Property::SUB_STATE, "SELECTED");
 
+  {
+    Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
+    DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOREGROUND_VISUAL), true, TEST_LOCATION);
+    Visual::Base visual = dummyImpl.GetVisual(DummyControl::Property::FOREGROUND_VISUAL);
+    DALI_TEST_CHECK( visual );
+    Property::Map map;
+    visual.CreatePropertyMap( map );
+    Property::Value* value = map.Find( Visual::Property::TYPE );
+    DALI_TEST_CHECK( value );
+
+    int visualType;
+    value->Get( visualType );
+    DALI_TEST_EQUALS( visualType, (int)Toolkit::Visual::GRADIENT, TEST_LOCATION );
+  }
   END_TEST;
 }
index 79d422b..03c788c 100644 (file)
 
 // EXTERNAL INCLUDES
 #include <cstdarg>
+#include <cstdio>
 #include <iostream>
+#include <cstring>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/dali-core.h>
+#include <test-compare-types.h>
 
 void tet_infoline(const char*str);
 void tet_printf(const char *format, ...);
@@ -73,176 +76,6 @@ else
   throw("TET_FAIL");                                                                      \
 }
 
-template <typename Type>
-inline bool CompareType(Type value1, Type value2, float epsilon);
-
-/**
- * A helper for fuzzy-comparing Vector2 objects
- * @param[in] vector1 the first object
- * @param[in] vector2 the second object
- * @param[in] epsilon difference threshold
- * @returns true if difference is smaller than epsilon threshold, false otherwise
- */
-template <>
-inline bool CompareType<float>(float value1, float value2, float epsilon)
-{
-  return fabsf(value1 - value2) < epsilon;
-}
-
-/**
- * A helper for fuzzy-comparing Vector2 objects
- * @param[in] vector1 the first object
- * @param[in] vector2 the second object
- * @param[in] epsilon difference threshold
- * @returns true if difference is smaller than epsilon threshold, false otherwise
- */
-template <>
-inline bool CompareType<Vector2>(Vector2 vector1, Vector2 vector2, float epsilon)
-{
-  return fabsf(vector1.x - vector2.x)<epsilon && fabsf(vector1.y - vector2.y)<epsilon;
-}
-
-/**
- * A helper for fuzzy-comparing Vector3 objects
- * @param[in] vector1 the first object
- * @param[in] vector2 the second object
- * @param[in] epsilon difference threshold
- * @returns true if difference is smaller than epsilon threshold, false otherwise
- */
-template <>
-inline bool CompareType<Vector3>(Vector3 vector1, Vector3 vector2, float epsilon)
-{
-  return fabsf(vector1.x - vector2.x)<epsilon &&
-         fabsf(vector1.y - vector2.y)<epsilon &&
-         fabsf(vector1.z - vector2.z)<epsilon;
-}
-
-
-/**
- * A helper for fuzzy-comparing Vector4 objects
- * @param[in] vector1 the first object
- * @param[in] vector2 the second object
- * @param[in] epsilon difference threshold
- * @returns true if difference is smaller than epsilon threshold, false otherwise
- */
-template <>
-inline bool CompareType<Vector4>(Vector4 vector1, Vector4 vector2, float epsilon)
-{
-  return fabsf(vector1.x - vector2.x)<epsilon &&
-         fabsf(vector1.y - vector2.y)<epsilon &&
-         fabsf(vector1.z - vector2.z)<epsilon &&
-         fabsf(vector1.w - vector2.w)<epsilon;
-}
-
-template <>
-inline bool CompareType<Quaternion>(Quaternion q1, Quaternion q2, float epsilon)
-{
-  Quaternion q2N = -q2; // These quaternions represent the same rotation
-  return CompareType<Vector4>(q1.mVector, q2.mVector, epsilon) || CompareType<Vector4>(q1.mVector, q2N.mVector, epsilon);
-}
-
-template <>
-inline bool CompareType<Radian>(Radian q1, Radian q2, float epsilon)
-{
-  return CompareType<float>(q1.radian, q2.radian, epsilon);
-}
-
-template <>
-inline bool CompareType<Degree>(Degree q1, Degree q2, float epsilon)
-{
-  return CompareType<float>(q1.degree, q2.degree, epsilon);
-}
-
-template <>
-inline bool CompareType<Property::Value>(Property::Value q1, Property::Value q2, float epsilon)
-{
-  Property::Type type = q1.GetType();
-  if( type != q2.GetType() )
-  {
-    return false;
-  }
-
-  bool result = false;
-  switch(type)
-  {
-    case Property::BOOLEAN:
-    {
-      bool a, b;
-      q1.Get(a);
-      q2.Get(b);
-      result =  a == b;
-      break;
-    }
-    case Property::INTEGER:
-    {
-      int a, b;
-      q1.Get(a);
-      q2.Get(b);
-      result =  a == b;
-      break;
-    }
-    case Property::FLOAT:
-    {
-      float a, b;
-      q1.Get(a);
-      q2.Get(b);
-      result =  CompareType<float>(a, b, epsilon);
-      break;
-    }
-    case Property::VECTOR2:
-    {
-      Vector2 a, b;
-      q1.Get(a);
-      q2.Get(b);
-      result = CompareType<Vector2>(a, b, epsilon);
-      break;
-    }
-    case Property::VECTOR3:
-    {
-      Vector3 a, b;
-      q1.Get(a);
-      q2.Get(b);
-      result = CompareType<Vector3>(a, b, epsilon);
-      break;
-    }
-    case Property::RECTANGLE:
-    case Property::VECTOR4:
-    {
-      Vector4 a, b;
-      q1.Get(a);
-      q2.Get(b);
-      result = CompareType<Vector4>(a, b, epsilon);
-      break;
-    }
-    case Property::ROTATION:
-    {
-      Quaternion a, b;
-      q1.Get(a);
-      q2.Get(b);
-      result = CompareType<Quaternion>(a, b, epsilon);
-      break;
-    }
-    case Property::MATRIX:
-    case Property::MATRIX3:
-    case Property::STRING:
-    case Property::ARRAY:
-    case Property::MAP:
-    {
-      //TODO: Implement this?
-      DALI_ASSERT_ALWAYS( 0 && "Not implemented");
-      result = false;
-      break;
-    }
-    case Property::NONE:
-    {
-      result = false;
-      break;
-    }
-  }
-
-  return result;
-}
-
 
 bool operator==(TimePeriod a, TimePeriod b);
 std::ostream& operator<<( std::ostream& ostream, TimePeriod value );
@@ -258,7 +91,7 @@ std::ostream& operator<<( std::ostream& ostream, Degree angle );
 template<typename Type>
 inline void DALI_TEST_EQUALS(Type value1, Type value2, const char* location)
 {
-  if (!(value1 == value2))
+  if( !CompareType<Type>(value1, value2, 0.01f) )
   {
     std::ostringstream o;
     o << value1 << " == " << value2 << std::endl;
@@ -514,6 +347,7 @@ struct DefaultFunctionCoverage
 BufferImage CreateBufferImage();
 BufferImage CreateBufferImage(int width, int height, const Vector4& color);
 
+
 // Prepare a resource image to be loaded. Should be called before creating the ResourceImage
 void PrepareResourceImage( TestApplication& application, unsigned int imageWidth, unsigned int imageHeight, Pixel::Format pixelFormat );
 
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-compare-types.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-compare-types.h
new file mode 100644 (file)
index 0000000..248276e
--- /dev/null
@@ -0,0 +1,199 @@
+#ifndef DALI_TEST_COMPARE_TYPES_H
+#define DALI_TEST_COMPARE_TYPES_H
+
+/*
+ * Copyright (c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <dali/public-api/dali-core.h>
+using namespace Dali;
+
+
+template <typename Type>
+inline bool CompareType(Type value1, Type value2, float epsilon)
+{
+  return value1 == value2;
+}
+
+/**
+ * A helper for fuzzy-comparing Vector2 objects
+ * @param[in] vector1 the first object
+ * @param[in] vector2 the second object
+ * @param[in] epsilon difference threshold
+ * @returns true if difference is smaller than epsilon threshold, false otherwise
+ */
+template <>
+inline bool CompareType<float>(float value1, float value2, float epsilon)
+{
+  return fabsf(value1 - value2) < epsilon;
+}
+
+/**
+ * A helper for fuzzy-comparing Vector2 objects
+ * @param[in] vector1 the first object
+ * @param[in] vector2 the second object
+ * @param[in] epsilon difference threshold
+ * @returns true if difference is smaller than epsilon threshold, false otherwise
+ */
+template <>
+inline bool CompareType<Vector2>(Vector2 vector1, Vector2 vector2, float epsilon)
+{
+  return fabsf(vector1.x - vector2.x)<epsilon && fabsf(vector1.y - vector2.y)<epsilon;
+}
+
+/**
+ * A helper for fuzzy-comparing Vector3 objects
+ * @param[in] vector1 the first object
+ * @param[in] vector2 the second object
+ * @param[in] epsilon difference threshold
+ * @returns true if difference is smaller than epsilon threshold, false otherwise
+ */
+template <>
+inline bool CompareType<Vector3>(Vector3 vector1, Vector3 vector2, float epsilon)
+{
+  return fabsf(vector1.x - vector2.x)<epsilon &&
+         fabsf(vector1.y - vector2.y)<epsilon &&
+         fabsf(vector1.z - vector2.z)<epsilon;
+}
+
+
+/**
+ * A helper for fuzzy-comparing Vector4 objects
+ * @param[in] vector1 the first object
+ * @param[in] vector2 the second object
+ * @param[in] epsilon difference threshold
+ * @returns true if difference is smaller than epsilon threshold, false otherwise
+ */
+template <>
+inline bool CompareType<Vector4>(Vector4 vector1, Vector4 vector2, float epsilon)
+{
+  return fabsf(vector1.x - vector2.x)<epsilon &&
+         fabsf(vector1.y - vector2.y)<epsilon &&
+         fabsf(vector1.z - vector2.z)<epsilon &&
+         fabsf(vector1.w - vector2.w)<epsilon;
+}
+
+template <>
+inline bool CompareType<Quaternion>(Quaternion q1, Quaternion q2, float epsilon)
+{
+  Quaternion q2N = -q2; // These quaternions represent the same rotation
+  return CompareType<Vector4>(q1.mVector, q2.mVector, epsilon) || CompareType<Vector4>(q1.mVector, q2N.mVector, epsilon);
+}
+
+template <>
+inline bool CompareType<Radian>(Radian q1, Radian q2, float epsilon)
+{
+  return CompareType<float>(q1.radian, q2.radian, epsilon);
+}
+
+template <>
+inline bool CompareType<Degree>(Degree q1, Degree q2, float epsilon)
+{
+  return CompareType<float>(q1.degree, q2.degree, epsilon);
+}
+
+template <>
+inline bool CompareType<Property::Value>(Property::Value q1, Property::Value q2, float epsilon)
+{
+  Property::Type type = q1.GetType();
+  if( type != q2.GetType() )
+  {
+    return false;
+  }
+
+  bool result = false;
+  switch(type)
+  {
+    case Property::BOOLEAN:
+    {
+      bool a, b;
+      q1.Get(a);
+      q2.Get(b);
+      result =  a == b;
+      break;
+    }
+    case Property::INTEGER:
+    {
+      int a, b;
+      q1.Get(a);
+      q2.Get(b);
+      result =  a == b;
+      break;
+    }
+    case Property::FLOAT:
+    {
+      float a, b;
+      q1.Get(a);
+      q2.Get(b);
+      result =  CompareType<float>(a, b, epsilon);
+      break;
+    }
+    case Property::VECTOR2:
+    {
+      Vector2 a, b;
+      q1.Get(a);
+      q2.Get(b);
+      result = CompareType<Vector2>(a, b, epsilon);
+      break;
+    }
+    case Property::VECTOR3:
+    {
+      Vector3 a, b;
+      q1.Get(a);
+      q2.Get(b);
+      result = CompareType<Vector3>(a, b, epsilon);
+      break;
+    }
+    case Property::RECTANGLE:
+    case Property::VECTOR4:
+    {
+      Vector4 a, b;
+      q1.Get(a);
+      q2.Get(b);
+      result = CompareType<Vector4>(a, b, epsilon);
+      break;
+    }
+    case Property::ROTATION:
+    {
+      Quaternion a, b;
+      q1.Get(a);
+      q2.Get(b);
+      result = CompareType<Quaternion>(a, b, epsilon);
+      break;
+    }
+    case Property::MATRIX:
+    case Property::MATRIX3:
+    case Property::STRING:
+    case Property::ARRAY:
+    case Property::MAP:
+    {
+      //TODO: Implement this?
+      DALI_ASSERT_ALWAYS( 0 && "Not implemented");
+      result = false;
+      break;
+    }
+    case Property::NONE:
+    {
+      result = false;
+      break;
+    }
+  }
+
+  return result;
+}
+
+
+
+#endif
index 9bed832..1613bb5 100644 (file)
 #include <map>
 #include <cstdio>
 #include <cstring> // for strcmp
+#include <typeinfo>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/dali-core.h>
 #include <dali/integration-api/core.h>
 #include <dali/integration-api/gl-abstraction.h>
 #include <dali/integration-api/gl-defines.h>
-#include "test-trace-call-stack.h"
+#include <test-trace-call-stack.h>
+#include <test-compare-types.h>
 
 namespace Dali
 {
@@ -2132,7 +2134,7 @@ private:
       T uniformValue;
       if ( GetUniformValue( program, uniform, uniformValue ) )
       {
-        return value == uniformValue;
+        return CompareType<T>(value, uniformValue, Math::MACHINE_EPSILON_10);
       }
 
       return false;
@@ -2176,6 +2178,9 @@ private:
   ProgramUniformValue<Matrix> mProgramUniformsMat4;
   ProgramUniformValue<Matrix3> mProgramUniformsMat3;
 
+
+
+
   inline const ProgramUniformValue<int>& GetProgramUniformsForType( const int ) const
   {
     return mProgramUniforms1i;
index c67b2ae..1606d71 100644 (file)
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/dali-toolkit.h>
-
+#include <test-application.h>
 #include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
 #include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
 #include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
index a480204..d32b7ff 100644 (file)
@@ -609,6 +609,10 @@ int UtcDaliKeyboardFocusManagerSignalFocusedActorActivated(void)
 
   Integration::KeyEvent returnEvent("Return", "", 0, 0, 0, Integration::KeyEvent::Up);
 
+  // Press Any key to notice physical keyboard event is comming to KeyboardFocusManager
+  // It makes mIsFocusIndicatorEnabled true
+  application.ProcessEvent(returnEvent);
+
   // Create the first button and add it to the stage
   PushButton firstPushButton = PushButton::New();
   firstPushButton.SetKeyboardFocusable(true);
@@ -664,6 +668,10 @@ int UtcDaliKeyboardFocusManagerSignalFocusGroupChanged(void)
   Integration::KeyEvent tabEvent("Tab", "", 0, 0, 0, Integration::KeyEvent::Down);
   Integration::KeyEvent shiftTabEvent("Tab", "", 0, 1, 0, Integration::KeyEvent::Down);
 
+  // Press Any key to notice physical keyboard event is comming to KeyboardFocusManager
+  // It makes mIsFocusIndicatorEnabled true
+  application.ProcessEvent(tabEvent);
+
   // Send the tab event to change focus group in the forward direction
   application.ProcessEvent(tabEvent);
   DALI_TEST_CHECK(focusGroupChangedCallback.mSignalVerified);
@@ -787,6 +795,10 @@ int UtcDaliKeyboardFocusManagerChangeFocusDirectionByKeyEvents(void)
   Integration::KeyEvent pageUpEvent("Prior", "", 0, 0, 0, Integration::KeyEvent::Down);
   Integration::KeyEvent pageDownEvent("Next", "", 0, 0, 0, Integration::KeyEvent::Down);
 
+  // Press Any key to notice physical keyboard event is comming to KeyboardFocusManager
+  // It makes mIsFocusIndicatorEnabled true
+  application.ProcessEvent(leftEvent);
+
   // Create a 2x2 table view and try to move focus inside it
   TableView tableView = TableView::New( 2, 2 );
   Stage::GetCurrent().Add(tableView);
@@ -952,7 +964,7 @@ int UtcDaliKeyboardFocusManagerMoveFocusTestStateChange(void)
   DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
   DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == Actor());
   DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
-  DALI_TEST_EQUALS(first.GetProperty<std::string>(DevelControl::Property::STATE), "FOCUSED", TEST_LOCATION );
+  DALI_TEST_EQUALS(first.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::FOCUSED, TEST_LOCATION );
   focusChangedCallback.Reset();
 
   // Move the focus towards right
@@ -971,8 +983,8 @@ int UtcDaliKeyboardFocusManagerMoveFocusTestStateChange(void)
   DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
   DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first);
   DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == second);
-  DALI_TEST_EQUALS(first.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
-  DALI_TEST_EQUALS(second.GetProperty<std::string>(DevelControl::Property::STATE), "FOCUSED", TEST_LOCATION );
+  DALI_TEST_EQUALS(first.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
+  DALI_TEST_EQUALS(second.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::FOCUSED, TEST_LOCATION );
   focusChangedCallback.Reset();
 
   // Move the focus towards up
@@ -1011,8 +1023,8 @@ int UtcDaliKeyboardFocusManagerMoveFocusTestStateChange(void)
   DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == second);
   DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
 
-  DALI_TEST_EQUALS(first.GetProperty<std::string>(DevelControl::Property::STATE), "FOCUSED", TEST_LOCATION );
-  DALI_TEST_EQUALS(second.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+  DALI_TEST_EQUALS(first.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::FOCUSED, TEST_LOCATION );
+  DALI_TEST_EQUALS(second.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
 
   focusChangedCallback.Reset();
 
@@ -1022,8 +1034,8 @@ int UtcDaliKeyboardFocusManagerMoveFocusTestStateChange(void)
   DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
   DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first);
   DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == second);
-  DALI_TEST_EQUALS(first.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
-  DALI_TEST_EQUALS(second.GetProperty<std::string>(DevelControl::Property::STATE), "FOCUSED", TEST_LOCATION );
+  DALI_TEST_EQUALS(first.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
+  DALI_TEST_EQUALS(second.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::FOCUSED, TEST_LOCATION );
 
   focusChangedCallback.Reset();
 
@@ -1034,10 +1046,10 @@ int UtcDaliKeyboardFocusManagerMoveFocusTestStateChange(void)
   DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == second);
   DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == fourth);
 
-  DALI_TEST_EQUALS(first.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
-  DALI_TEST_EQUALS(second.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
-  DALI_TEST_EQUALS(third.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
-  DALI_TEST_EQUALS(fourth.GetProperty<std::string>(DevelControl::Property::STATE), "FOCUSED", TEST_LOCATION );
+  DALI_TEST_EQUALS(first.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
+  DALI_TEST_EQUALS(second.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
+  DALI_TEST_EQUALS(third.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
+  DALI_TEST_EQUALS(fourth.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::FOCUSED, TEST_LOCATION );
 
   focusChangedCallback.Reset();
 
@@ -1048,10 +1060,10 @@ int UtcDaliKeyboardFocusManagerMoveFocusTestStateChange(void)
   DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == fourth);
   DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == third);
 
-  DALI_TEST_EQUALS(first.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
-  DALI_TEST_EQUALS(second.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
-  DALI_TEST_EQUALS(third.GetProperty<std::string>(DevelControl::Property::STATE), "FOCUSED", TEST_LOCATION );
-  DALI_TEST_EQUALS(fourth.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+  DALI_TEST_EQUALS(first.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
+  DALI_TEST_EQUALS(second.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
+  DALI_TEST_EQUALS(third.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::FOCUSED, TEST_LOCATION );
+  DALI_TEST_EQUALS(fourth.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
 
   focusChangedCallback.Reset();
 
@@ -1061,10 +1073,10 @@ int UtcDaliKeyboardFocusManagerMoveFocusTestStateChange(void)
   DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
   DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == third);
   DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
-  DALI_TEST_EQUALS(first.GetProperty<std::string>(DevelControl::Property::STATE), "FOCUSED", TEST_LOCATION );
-  DALI_TEST_EQUALS(second.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
-  DALI_TEST_EQUALS(third.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
-  DALI_TEST_EQUALS(fourth.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+  DALI_TEST_EQUALS(first.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::FOCUSED, TEST_LOCATION );
+  DALI_TEST_EQUALS(second.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
+  DALI_TEST_EQUALS(third.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
+  DALI_TEST_EQUALS(fourth.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
   focusChangedCallback.Reset();
 
   // Move the focus towards left. The focus move will fail as no way to move it upwards
@@ -1074,10 +1086,10 @@ int UtcDaliKeyboardFocusManagerMoveFocusTestStateChange(void)
   DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == first);
   DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
   DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::KeyboardFocus::LEFT);
-  DALI_TEST_EQUALS(first.GetProperty<std::string>(DevelControl::Property::STATE), "FOCUSED", TEST_LOCATION );
-  DALI_TEST_EQUALS(second.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
-  DALI_TEST_EQUALS(third.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
-  DALI_TEST_EQUALS(fourth.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+  DALI_TEST_EQUALS(first.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::FOCUSED, TEST_LOCATION );
+  DALI_TEST_EQUALS(second.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
+  DALI_TEST_EQUALS(third.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
+  DALI_TEST_EQUALS(fourth.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
 
   preFocusChangeCallback.Reset();
   DALI_TEST_CHECK(!focusChangedCallback.mSignalVerified);
@@ -1093,19 +1105,19 @@ int UtcDaliKeyboardFocusManagerMoveFocusTestStateChange(void)
   DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first);
   DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == fourth);
 
-  DALI_TEST_EQUALS(first.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
-  DALI_TEST_EQUALS(second.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
-  DALI_TEST_EQUALS(third.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
-  DALI_TEST_EQUALS(fourth.GetProperty<std::string>(DevelControl::Property::STATE), "FOCUSED", TEST_LOCATION );
+  DALI_TEST_EQUALS(first.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
+  DALI_TEST_EQUALS(second.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
+  DALI_TEST_EQUALS(third.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
+  DALI_TEST_EQUALS(fourth.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::FOCUSED, TEST_LOCATION );
 
   focusChangedCallback.Reset();
 
   // Clear the focus
   manager.ClearFocus();
-  DALI_TEST_EQUALS(first.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
-  DALI_TEST_EQUALS(second.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
-  DALI_TEST_EQUALS(third.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
-  DALI_TEST_EQUALS(fourth.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+  DALI_TEST_EQUALS(first.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
+  DALI_TEST_EQUALS(second.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
+  DALI_TEST_EQUALS(third.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
+  DALI_TEST_EQUALS(fourth.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
 
 
   END_TEST;
index b1d76da..9b7c6fc 100644 (file)
 using namespace Dali;
 using namespace Toolkit;
 
+namespace
+{
+
+const char* TEST_IMAGE_FILE_NAME = "selection-popup-border.9.png";
+
+}
+
 void dali_textselectionpopup_startup(void)
 {
   test_return_value = TET_UNDEF;
@@ -107,6 +114,33 @@ int UtcDaliToolkitTextSelectionPopupDownCastP(void)
   END_TEST;
 }
 
+int UtcDaliToolkitTextSelectionPopupBackgroundBorderP(void)
+{
+  ToolkitTestApplication application;
+  TextSelectionPopup textSelectionPopup;
+  textSelectionPopup = TextSelectionPopup::New( NULL );
+
+  textSelectionPopup.SetProperty( TextSelectionPopup::Property::BACKGROUND_BORDER,
+                                  Property::Map().Add( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME ) );
+
+  Property::Value value = textSelectionPopup.GetProperty( TextSelectionPopup::Property::BACKGROUND_BORDER );
+
+  Property::Map map;
+  value.Get( map );
+
+  Property::Value* returnValue = map.Find( Dali::Toolkit::ImageVisual::Property::URL );
+  DALI_TEST_CHECK( NULL != returnValue );
+
+  if( returnValue )
+  {
+    std::string url;
+    returnValue->Get( url );
+    DALI_TEST_EQUALS( TEST_IMAGE_FILE_NAME, url, TEST_LOCATION );
+  }
+
+  END_TEST;
+}
+
 // TextSelectionToolBar is used TextSelectionPopup, below tests it individually
 
 int UtcDaliToolkitTextSelectionToolBarP(void)
index 5ca2b17..de4c4dd 100644 (file)
@@ -22,6 +22,7 @@
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali-toolkit/devel-api/visual-factory/transition-data.h>
 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
 #include "dummy-control.h"
 
 using namespace Dali;
@@ -254,10 +255,12 @@ int UtcDaliTransitionDataMap1P(void)
 
   Renderer renderer = actor.GetRendererAt(0);
   Property::Index mixColorIndex = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
+  Property::Index opacityIndex = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::OPACITY );
   application.SendNotification();
   application.Render(0);
 
-  DALI_TEST_EQUALS( renderer.GetProperty<Vector4>(mixColorIndex), Color::MAGENTA, TEST_LOCATION);
+  DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION);
+  DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 1.0f, 0.001f, TEST_LOCATION );
 
   anim.Play();
 
@@ -265,15 +268,19 @@ int UtcDaliTransitionDataMap1P(void)
   application.Render(500); // Start animation
   application.Render(500); // Halfway thru anim
   application.SendNotification();
-  DALI_TEST_EQUALS( renderer.GetProperty<Vector4>(mixColorIndex), (Color::MAGENTA+Color::RED)*0.5f, TEST_LOCATION);
+  DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA+Color::RED)*0.5f, TEST_LOCATION);
+  DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 1.0f, 0.001f, TEST_LOCATION );
 
   application.Render(500); // End of anim
   application.SendNotification();
-  DALI_TEST_EQUALS( renderer.GetProperty<Vector4>(mixColorIndex), Color::RED, TEST_LOCATION );
+  DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::RED), TEST_LOCATION );
+  DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 1.0f, 0.001f, TEST_LOCATION );
 
   END_TEST;
 }
 
+
+
 int UtcDaliTransitionDataMap2P(void)
 {
   TestApplication application;
@@ -282,7 +289,6 @@ int UtcDaliTransitionDataMap2P(void)
 
   Property::Map map;
   map["target"] = "visual1";
-  //Control::CONTROL_PROPERTY_END_INDEX + 1
   map["property"] = ColorVisual::Property::MIX_COLOR;
   map["initialValue"] = Color::MAGENTA;
   map["targetValue"] = Color::RED;
@@ -316,10 +322,83 @@ int UtcDaliTransitionDataMap2P(void)
 
   Renderer renderer = actor.GetRendererAt(0);
   Property::Index mixColorIndex = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
+  Property::Index opacityIndex = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::OPACITY );
+  application.SendNotification();
+  application.Render(0);
+
+  DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION);
+  DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 1.0f, 0.001f, TEST_LOCATION);
+
+  anim.Play();
+
+  application.SendNotification();
+  application.Render(0);
+  application.Render(500); // Start animation
+  application.Render(500); // Halfway thru anim
+  application.SendNotification();
+  DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA+Color::RED)*0.5f, TEST_LOCATION);
+  DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 1.0f, 0.001f, TEST_LOCATION);
+
+  application.Render(500); // End of anim
+  application.SendNotification();
+  DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::RED), TEST_LOCATION );
+  DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 1.0f, 0.001f, TEST_LOCATION);
+
+  END_TEST;
+}
+
+
+int UtcDaliTransitionDataMap2Pb(void)
+{
+  TestApplication application;
+
+  tet_printf("Testing animation of a visual property using programmatic maps\n");
+
+  Property::Map map;
+  map["target"] = "visual1";
+  map["property"] = PrimitiveVisual::Property::MIX_COLOR;
+  map["initialValue"] = Color::MAGENTA;
+  map["targetValue"] = Color::RED;
+  map["animator"] = Property::Map()
+    .Add("alphaFunction", "LINEAR")
+    .Add("timePeriod", Property::Map()
+         .Add("delay", 0.5f)
+         .Add("duration", 1.0f));
+
+  Dali::Toolkit::TransitionData transition = TransitionData::New( map );
+
+  DummyControl actor = DummyControl::New();
+  actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
+  actor.SetName("Actor1");
+  actor.SetColor(Color::CYAN);
+  Stage::GetCurrent().Add(actor);
+
+  DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+
+  Property::Map visualMap;
+  visualMap[Visual::Property::TYPE] = Visual::PRIMITIVE;
+  visualMap[PrimitiveVisual::Property::MIX_COLOR] = Color::MAGENTA;
+  visualMap[ PrimitiveVisual::Property::SHAPE  ] = PrimitiveVisual::Shape::SPHERE;
+  visualMap[ PrimitiveVisual::Property::SLICES ] = 10;
+  visualMap[ PrimitiveVisual::Property::STACKS ] = 10;
+
+  Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
+  visual.SetName( "visual1" );
+
+  Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
+  dummyImpl.RegisterVisual( visualIndex, visual );
+
+  Animation anim = dummyImpl.CreateTransition( transition );
+  DALI_TEST_CHECK( anim );
+
+  Renderer renderer = actor.GetRendererAt(0);
+  Property::Index mixColorIndex = DevelHandle::GetPropertyIndex( renderer, PrimitiveVisual::Property::MIX_COLOR );
+  Property::Index opacityIndex = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::OPACITY );
   application.SendNotification();
   application.Render(0);
 
-  DALI_TEST_EQUALS( renderer.GetProperty<Vector4>(mixColorIndex), Color::MAGENTA, TEST_LOCATION);
+  DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION);
+  DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 1.0f, 0.001f, TEST_LOCATION);
 
   anim.Play();
 
@@ -328,15 +407,18 @@ int UtcDaliTransitionDataMap2P(void)
   application.Render(500); // Start animation
   application.Render(500); // Halfway thru anim
   application.SendNotification();
-  DALI_TEST_EQUALS( renderer.GetProperty<Vector4>(mixColorIndex), (Color::MAGENTA+Color::RED)*0.5f, TEST_LOCATION);
+  DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA+Color::RED)*0.5f, TEST_LOCATION);
+  DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 1.0f, 0.001f, TEST_LOCATION);
 
   application.Render(500); // End of anim
   application.SendNotification();
-  DALI_TEST_EQUALS( renderer.GetProperty<Vector4>(mixColorIndex), Color::RED, TEST_LOCATION );
+  DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::RED), TEST_LOCATION );
+  DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 1.0f, 0.001f, TEST_LOCATION);
 
   END_TEST;
 }
 
+
 int UtcDaliTransitionDataMap3P(void)
 {
   TestApplication application;
@@ -464,6 +546,146 @@ int UtcDaliTransitionDataMap4P(void)
   END_TEST;
 }
 
+int UtcDaliTransitionDataMap5P(void)
+{
+  TestApplication application;
+
+  tet_printf("Testing animation visual opacity using stylesheet equivalent maps\n");
+
+  Property::Map map;
+  map["target"] = "visual1";
+  map["property"] = "opacity";
+  map["initialValue"] = 0.0f;
+  map["targetValue"] = 1.0f;
+  map["animator"] = Property::Map()
+    .Add("alphaFunction", "EASE_IN_OUT")
+    .Add("timePeriod", Property::Map()
+         .Add("delay", 0.5f)
+         .Add("duration", 1.0f));
+
+  Dali::Toolkit::TransitionData transition = TransitionData::New( map );
+
+  DummyControl actor = DummyControl::New();
+  actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
+  actor.SetName("Actor1");
+  actor.SetColor(Color::CYAN);
+  Stage::GetCurrent().Add(actor);
+
+  DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+
+  Property::Map visualMap;
+  visualMap[Visual::Property::TYPE] = Visual::COLOR;
+  visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA;
+  Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
+  visual.SetName( "visual1" );
+
+  Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
+  dummyImpl.RegisterVisual( visualIndex, visual );
+
+  Animation anim = dummyImpl.CreateTransition( transition );
+  DALI_TEST_CHECK( anim );
+
+  Renderer renderer = actor.GetRendererAt(0);
+  Property::Index mixColorIndex = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
+  Property::Index opacityIndex = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::OPACITY );
+  application.SendNotification();
+  application.Render(0);
+
+  DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION);
+  DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 0.0f, 0.001f, TEST_LOCATION );
+  DALI_TEST_EQUALS( renderer.GetProperty<int>(Renderer::Property::BLEND_MODE), (int)BlendMode::ON, TEST_LOCATION );
+
+  anim.Play();
+
+  application.SendNotification();
+  application.Render(500); // Start animation
+  application.Render(500); // Halfway thru anim
+  application.SendNotification();
+  DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION);
+  DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 0.5f, 0.001f, TEST_LOCATION );
+  DALI_TEST_EQUALS( renderer.GetProperty<int>(Renderer::Property::BLEND_MODE), (int)BlendMode::ON, TEST_LOCATION );
+
+  application.Render(501); // End of anim
+  application.SendNotification();
+  DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION );
+  DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 1.0f, 0.001f, TEST_LOCATION );
+  DALI_TEST_EQUALS( renderer.GetProperty<int>(Renderer::Property::BLEND_MODE), (int)BlendMode::AUTO, TEST_LOCATION );
+
+  END_TEST;
+}
+
+
+int UtcDaliTransitionDataMap6P(void)
+{
+  TestApplication application;
+
+  tet_printf("Testing animation visual opacity using stylesheet equivalent maps\n");
+
+  Property::Map map;
+  map["target"] = "visual1";
+  map["property"] = "opacity";
+  map["targetValue"] = 0.0f;
+  map["animator"] = Property::Map()
+    .Add("alphaFunction", "EASE_IN_OUT")
+    .Add("timePeriod", Property::Map()
+         .Add("delay", 0.5f)
+         .Add("duration", 1.0f));
+
+  Dali::Toolkit::TransitionData transition = TransitionData::New( map );
+
+  DummyControl actor = DummyControl::New();
+  actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
+  actor.SetName("Actor1");
+  actor.SetColor(Color::CYAN);
+  Stage::GetCurrent().Add(actor);
+
+  DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+
+  Property::Map visualMap;
+  visualMap[Visual::Property::TYPE] = Visual::COLOR;
+  visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA;
+  Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
+  visual.SetName( "visual1" );
+
+  Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
+  dummyImpl.RegisterVisual( visualIndex, visual );
+
+  Animation anim = dummyImpl.CreateTransition( transition );
+  DALI_TEST_CHECK( anim );
+
+  Renderer renderer = actor.GetRendererAt(0);
+  Property::Index mixColorIndex = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
+  Property::Index opacityIndex = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::OPACITY );
+  application.SendNotification();
+  application.Render(0);
+
+  DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION);
+  DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 1.0f, 0.001f, TEST_LOCATION );
+
+  // Note, This should be testing for AUTO
+  // this is the same problem as C# target value being set before Play is called.
+  // @todo How was this solved?
+  DALI_TEST_EQUALS( renderer.GetProperty<int>(Renderer::Property::BLEND_MODE), (int)BlendMode::ON, TEST_LOCATION );
+
+  anim.Play();
+
+  application.SendNotification();
+  application.Render(500); // Start animation
+  application.Render(500); // Halfway thru anim
+  application.SendNotification();
+  DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION);
+  DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 0.5f, 0.001f, TEST_LOCATION );
+  DALI_TEST_EQUALS( renderer.GetProperty<int>(Renderer::Property::BLEND_MODE), (int)BlendMode::ON, TEST_LOCATION );
+
+  application.Render(500); // End of anim
+  application.SendNotification();
+  DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION );
+  DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 0.0f, 0.001f, TEST_LOCATION );
+  DALI_TEST_EQUALS( renderer.GetProperty<int>(Renderer::Property::BLEND_MODE), (int)BlendMode::ON, TEST_LOCATION );
+
+  END_TEST;
+}
+
 
 int UtcDaliTransitionDataMap1N(void)
 {
@@ -506,8 +728,8 @@ int UtcDaliTransitionDataMapN3(void)
   Property::Map map;
   map["target"] = "visual1";
   map["property"] = "mixColor";
-  map["initialValue"] = Color::MAGENTA;
-  map["targetValue"] = Color::RED;
+  map["initialValue"] = Vector3(Color::MAGENTA);
+  map["targetValue"] = Vector3(Color::RED);
   map["animator"] = Property::Map()
     .Add("alphaFunction", "EASE_OUT_BACK")
     .Add("timePeriod", Property::Map()
@@ -526,7 +748,7 @@ int UtcDaliTransitionDataMapN3(void)
   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
   Property::Map visualMap;
   visualMap[Visual::Property::TYPE] = Visual::COLOR;
-  visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA;
+  visualMap[ColorVisual::Property::MIX_COLOR] = Vector3(Color::MAGENTA);
   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
   visual.SetName( "visual1" );
 
@@ -548,8 +770,8 @@ int UtcDaliTransitionDataMapN4(void)
   Property::Map map;
   map["target"] = "visual1";
   map["property"] = "mixColor";
-  map["initialValue"] = Color::MAGENTA;
-  map["targetValue"] = Color::RED;
+  map["initialValue"] = Vector3(Color::MAGENTA);
+  map["targetValue"] = Vector3(Color::RED);
   map["animator"] = Property::Map()
     .Add("alphaFunction", Vector3(.1f,1.0f,0.5f))
     .Add("timePeriod", Property::Map()
@@ -583,9 +805,11 @@ int UtcDaliTransitionDataMapN4(void)
 
   Renderer renderer = actor.GetRendererAt(0);
   Property::Index mixColorIdx = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
+  Property::Index opacityIdx = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::OPACITY );
 
   tet_printf( "Test that the property has been set to target value\n");
-  DALI_TEST_EQUALS(renderer.GetProperty<Vector4>(mixColorIdx), Color::RED, 0.001, TEST_LOCATION);
+  DALI_TEST_EQUALS(renderer.GetProperty<Vector3>(mixColorIdx), Vector3(Color::RED), 0.001, TEST_LOCATION);
+  DALI_TEST_EQUALS(renderer.GetProperty<float>(opacityIdx), 1.0f, 0.001, TEST_LOCATION);
 
   END_TEST;
 }
@@ -636,7 +860,7 @@ int UtcDaliTransitionDataMapN5(void)
   Property::Index mixColorIdx = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
 
   tet_printf( "Test that the property has been set to target value\n");
-  DALI_TEST_EQUALS(renderer.GetProperty<Vector4>(mixColorIdx), Color::RED, 0.001, TEST_LOCATION);
+  DALI_TEST_EQUALS(renderer.GetProperty<Vector3>(mixColorIdx), Vector3(Color::RED), 0.001, TEST_LOCATION);
 
   END_TEST;
 }
@@ -685,9 +909,11 @@ int UtcDaliTransitionDataMapN6(void)
 
   Renderer renderer = actor.GetRendererAt(0);
   Property::Index mixColorIdx = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
+  Property::Index opacityIdx = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::OPACITY );
 
   tet_printf( "Test that the property has been set to target value\n");
-  DALI_TEST_EQUALS(renderer.GetProperty<Vector4>(mixColorIdx), Color::RED, 0.001, TEST_LOCATION);
+  DALI_TEST_EQUALS(renderer.GetProperty<Vector3>(mixColorIdx), Vector3(Color::RED), 0.001, TEST_LOCATION);
+  DALI_TEST_EQUALS(renderer.GetProperty<float>(opacityIdx), 1.0f, 0.001, TEST_LOCATION);
 
   END_TEST;
 }
@@ -852,7 +1078,8 @@ int UtcDaliTransitionDataGetAnimatorP(void)
 
   Property::Map map8;
   map8["target"] = "Visual1";
-  map8["property"] = "colorAlpha";
+  map8["property"] = "opacity";
+  map8["initialValue"] = 0.0f;
   map8["targetValue"] = 1.0f;
   map8["animator"] = Property::Map()
     .Add("alphaFunction", "EASE_IN")
index f399d4d..fc94130 100644 (file)
@@ -119,9 +119,21 @@ static void TestMixColor( Visual::Base visual, Property::Index mixColorIndex, co
   visual.CreatePropertyMap(map);
   Property::Value* value = map.Find( mixColorIndex );
   DALI_TEST_CHECK( value );
-  Vector4 mixColor;
-  DALI_TEST_CHECK( value->Get( mixColor ) );
-  DALI_TEST_EQUALS( mixColor, testColor, 0.001, TEST_LOCATION );
+  Vector3 mixColor1;
+  DALI_TEST_CHECK( value->Get( mixColor1 ) );
+  DALI_TEST_EQUALS( mixColor1, Vector3(testColor), 0.001, TEST_LOCATION );
+
+  value = map.Find( DevelVisual::Property::MIX_COLOR );
+  DALI_TEST_CHECK( value );
+  Vector4 mixColor2;
+  DALI_TEST_CHECK( value->Get( mixColor2 ) );
+  DALI_TEST_EQUALS( mixColor2, testColor, 0.001, TEST_LOCATION );
+
+  value = map.Find( DevelVisual::Property::OPACITY );
+  DALI_TEST_CHECK( value );
+  float opacity;
+  DALI_TEST_CHECK( value->Get( opacity ) );
+  DALI_TEST_EQUALS( opacity, testColor.a, 0.001, TEST_LOCATION );
 }
 
 
@@ -1119,12 +1131,13 @@ int UtcDaliVisualAnimateBorderVisual01(void)
   DALI_TEST_EQUALS( color, testColor, TEST_LOCATION );
   DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("borderColor", testColor ), true, TEST_LOCATION );
 
-  color = renderer.GetProperty<Vector4>( mixColorIndex );
+  color = renderer.GetProperty<Vector3>( mixColorIndex );
   testColor = Vector4( 1,1,1,0.4f );
-  DALI_TEST_EQUALS( color, testColor, 0.0001f, TEST_LOCATION );
-  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("mixColor", testColor ), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( Vector3(color), Vector3(testColor), 0.0001f, TEST_LOCATION );
+  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(testColor) ), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", testColor.a ) , true, TEST_LOCATION );
 
-  application.Render(2000u); // halfway point between blue and white
+  application.Render(2000u);
 
   color = renderer.GetProperty<Vector4>( borderColorIndex );
   DALI_TEST_EQUALS( color, Color::WHITE, TEST_LOCATION );
@@ -1133,7 +1146,8 @@ int UtcDaliVisualAnimateBorderVisual01(void)
   color = renderer.GetProperty<Vector4>( mixColorIndex );
   testColor = Vector4(1,1,1,0);
   DALI_TEST_EQUALS( color, testColor, TEST_LOCATION );
-  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("mixColor", testColor ), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(testColor) ), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", testColor.a ), true, TEST_LOCATION );
 
   END_TEST;
 }
@@ -1205,31 +1219,31 @@ int UtcDaliVisualAnimateColorVisual(void)
   DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
 
   Renderer renderer = actor.GetRendererAt(0);
-  Property::Index index = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
+  Property::Index mixColorIndex = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
 
   Property::Value blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
   DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::AUTO, TEST_LOCATION );
 
   Animation animation = Animation::New(4.0f);
-  animation.AnimateTo( Property(renderer, index), Color::WHITE );
+  animation.AnimateTo( Property(renderer, mixColorIndex), Vector3(Color::WHITE) );
   animation.Play();
 
   application.SendNotification();
   application.Render(0);
   application.Render(2000u); // halfway point
 
-  Vector4 color = renderer.GetProperty<Vector4>( index );
-  Vector4 testColor = (Color::BLUE + Color::WHITE)*0.5f;
+  Vector3 color = renderer.GetProperty<Vector3>( mixColorIndex );
+  Vector3 testColor = Vector3(Color::BLUE + Color::WHITE)*0.5f;
   DALI_TEST_EQUALS( color, testColor, TEST_LOCATION );
 
-  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("mixColor", testColor ), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", testColor ), true, TEST_LOCATION );
 
   application.Render(2000u); // halfway point between blue and white
 
-  color = renderer.GetProperty<Vector4>( index );
-  DALI_TEST_EQUALS( color, Color::WHITE, TEST_LOCATION );
+  color = renderer.GetProperty<Vector3>( mixColorIndex );
+  DALI_TEST_EQUALS( color, Vector3(Color::WHITE), TEST_LOCATION );
 
-  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("mixColor", Color::WHITE ), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(Color::WHITE) ), true, TEST_LOCATION );
 
   blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
   DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::AUTO, TEST_LOCATION );
@@ -1297,14 +1311,16 @@ int UtcDaliVisualAnimatePrimitiveVisual(void)
     DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Vector4(0.5f, 0.5f, 0.5f, 1.0f )), true, TEST_LOCATION );
 
     Vector4 halfwayColor = (INITIAL_MIX_COLOR + TARGET_MIX_COLOR)*0.5;
-    DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("mixColor", halfwayColor ), true, TEST_LOCATION );
+    DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(halfwayColor) ), true, TEST_LOCATION );
+    DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", halfwayColor.a ), true, TEST_LOCATION );
 
     application.Render(2001u); // go past end
     application.SendNotification(); // Trigger signals
 
     DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
     DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Color::WHITE ), true, TEST_LOCATION );
-    DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("mixColor", TARGET_MIX_COLOR ), true, TEST_LOCATION );
+    DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(TARGET_MIX_COLOR) ), true, TEST_LOCATION );
+    DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", TARGET_MIX_COLOR.a ), true, TEST_LOCATION );
 
     blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
     DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::AUTO, TEST_LOCATION );
@@ -1375,15 +1391,18 @@ int UtcDaliVisualAnimateImageVisualMixColor(void)
   application.SendNotification();
   application.Render(0);
   application.Render(2000u); // halfway point
+  Vector4 testColor(1.0f, 0.0f, 0.5f, 0.75f );
 
   DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Vector4(0.5f, 0.5f, 0.5f, 1.0f )), true, TEST_LOCATION );
-  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("mixColor", Vector4(1.0f, 0.0f, 0.5f, 0.75f )), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(testColor)), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", testColor.a), true, TEST_LOCATION );
 
   application.Render(2000u); // halfway point between blue and white
 
   DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
   DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Color::WHITE ), true, TEST_LOCATION );
-  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("mixColor", TARGET_MIX_COLOR), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(TARGET_MIX_COLOR)), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", TARGET_MIX_COLOR.a), true, TEST_LOCATION );
 
   TestMixColor( visual, DevelVisual::Property::MIX_COLOR, TARGET_MIX_COLOR );
 
@@ -1393,6 +1412,116 @@ int UtcDaliVisualAnimateImageVisualMixColor(void)
   END_TEST;
 }
 
+
+int UtcDaliVisualAnimateImageVisualOpacity(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "UtcDaliAnimateImageVisual mix color" );
+
+  application.GetPlatform().SetClosestImageSize( Vector2(100, 100) );
+
+  VisualFactory factory = VisualFactory::Get();
+  Property::Map propertyMap;
+  propertyMap.Insert(Visual::Property::TYPE,  Visual::IMAGE);
+  propertyMap.Insert(ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+  propertyMap.Insert("opacity", 0.5f);
+  propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true);
+  Visual::Base visual = factory.CreateVisual( propertyMap );
+
+  DummyControl actor = DummyControl::New(true);
+  Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
+  dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
+
+  actor.SetSize(2000, 2000);
+  actor.SetParentOrigin(ParentOrigin::CENTER);
+  actor.SetColor(Color::BLACK);
+  Stage::GetCurrent().Add(actor);
+
+  DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
+
+  Renderer renderer = actor.GetRendererAt(0);
+  tet_infoline("Test that the renderer has the opacity property");
+  Property::Index index = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::OPACITY );
+  DALI_TEST_CHECK( index != Property::INVALID_INDEX );
+
+
+  Property::Value blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
+  DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
+
+  {
+    tet_infoline( "Test that the opacity can be increased to full via animation, and that the blend mode is set appropriately at the start and end of the animation." );
+
+    Property::Map map;
+    map["target"] = "testVisual";
+    map["property"] = "opacity";
+    map["targetValue"] = 1.0f;
+    map["animator"] = Property::Map()
+      .Add("alphaFunction", "LINEAR")
+      .Add("timePeriod", Property::Map()
+           .Add("delay", 0.0f)
+           .Add("duration", 4.0f));
+
+    Dali::Toolkit::TransitionData transition = TransitionData::New( map );
+    Animation animation = dummyImpl.CreateTransition( transition );
+    animation.Play();
+
+    application.SendNotification();
+    application.Render(0);
+    application.Render(2000u); // halfway point
+    application.SendNotification();
+
+    DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", 0.75f), true, TEST_LOCATION );
+
+    application.Render(2001u); // end
+    application.SendNotification();
+
+    DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", 1.0f), true, TEST_LOCATION );
+
+    blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
+    DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::AUTO, TEST_LOCATION );
+  }
+
+
+  {
+    tet_infoline( "Test that the opacity can be reduced via animation, and that the blend mode is set appropriately at the start and end of the animation." );
+
+    Property::Map map;
+    map["target"] = "testVisual";
+    map["property"] = DevelVisual::Property::OPACITY;
+    map["targetValue"] = 0.1f;
+    map["animator"] = Property::Map()
+      .Add("alphaFunction", "LINEAR")
+      .Add("timePeriod", Property::Map()
+           .Add("delay", 0.0f)
+           .Add("duration", 4.0f));
+
+    Dali::Toolkit::TransitionData transition = TransitionData::New( map );
+    Animation animation = dummyImpl.CreateTransition( transition );
+    animation.Play();
+
+    blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
+    DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
+
+    application.SendNotification();
+    application.Render(0);
+    application.Render(2000u); // halfway point
+    application.SendNotification();
+
+    DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", 0.55f), true, TEST_LOCATION );
+
+    application.Render(2016u); // end
+    application.SendNotification();
+
+    DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", 0.1f), true, TEST_LOCATION );
+
+    blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
+    DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
+  }
+
+
+  END_TEST;
+}
+
 int UtcDaliVisualAnimateImageVisualPixelArea(void)
 {
   ToolkitTestApplication application;
index 2eb6262..ab0f0cd 100644 (file)
@@ -330,10 +330,13 @@ int UtcDaliVisualFactoryGetColorVisual1(void)
   DummyControl actor = DummyControl::New();
   TestVisualRender( application, actor, visual );
 
-  Vector4 actualValue(Vector4::ZERO);
+  Vector3 actualValue(Vector4::ZERO);
+  float opacity=0.0f;
   TestGlAbstraction& gl = application.GetGlAbstraction();
-  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "mixColor", actualValue ) );
-  DALI_TEST_EQUALS( actualValue, testColor, TEST_LOCATION );
+  DALI_TEST_CHECK( gl.GetUniformValue<Vector3>( "mixColor", actualValue ) );
+  DALI_TEST_CHECK( gl.GetUniformValue<float>( "opacity", opacity ) );
+  DALI_TEST_EQUALS( actualValue, Vector3(testColor), TEST_LOCATION );
+  DALI_TEST_EQUALS( opacity, testColor.a, TEST_LOCATION );
 
   END_TEST;
 }
@@ -356,10 +359,13 @@ int UtcDaliVisualFactoryGetColorVisual2(void)
   DummyControl actor = DummyControl::New();
   TestVisualRender( application, actor, visual );
 
-  Vector4 actualValue(Vector4::ZERO);
+  Vector3 actualValue;
+  float opacity;
   TestGlAbstraction& gl = application.GetGlAbstraction();
-  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "mixColor", actualValue ) );
-  DALI_TEST_EQUALS( actualValue, testColor, TEST_LOCATION );
+  DALI_TEST_CHECK( gl.GetUniformValue<Vector3>( "mixColor", actualValue ) );
+  DALI_TEST_CHECK( gl.GetUniformValue<float>( "opacity", opacity ) );
+  DALI_TEST_EQUALS( actualValue, Vector3(testColor), TEST_LOCATION );
+  DALI_TEST_EQUALS( opacity, testColor.a, TEST_LOCATION );
 
   Stage::GetCurrent().Remove(actor);
   DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
index 5201c08..31cf939 100644 (file)
@@ -75,23 +75,114 @@ public:
   {
     enum
     {
-      POPUP_MAX_SIZE =  PROPERTY_START_INDEX,   ///< name "popupMaxSize",                  maximum size the Popup can be,                  type VECTOR2
-      POPUP_MIN_SIZE,                           ///< name "popupMinSize",                  minimum size the Popup can be,                  type VECTOR2
-      OPTION_MAX_SIZE,                          ///< name "optionMaxSize",                 maximum size an option can be,                  type VECTOR2
-      OPTION_MIN_SIZE,                          ///< name "optionMinSize",                 minimum size an option can be,                  type VECTOR2
-      OPTION_DIVIDER_SIZE,                      ///< name "optionDividerSize",             size of the divider between options             type VECTOR2
-      POPUP_CLIPBOARD_BUTTON_ICON_IMAGE,        ///< name "popupClipboardButtonImage",     The image to use as the popup clipboard icon,   type STRING
-      POPUP_CUT_BUTTON_ICON_IMAGE,              ///< name "popupCutButtonImage",           The image to use as the popup cut icon,         type STRING
-      POPUP_COPY_BUTTON_ICON_IMAGE,             ///< name "popupCopyButtonImage",          The image to use as the popup copy icon,        type STRING
-      POPUP_PASTE_BUTTON_ICON_IMAGE,            ///< name "popupPasteButtonImage",         The image to use as the popup paste icon,       type STRING
-      POPUP_SELECT_BUTTON_ICON_IMAGE,           ///< name "popupSelectButtonImage",        The image to use as the popup select icon,      type STRING
-      POPUP_SELECT_ALL_BUTTON_ICON_IMAGE,       ///< name "popupSelectAllButtonImage",     The image to use as the popup select all icon,  type STRING
-      POPUP_DIVIDER_COLOR,                      ///< name "popupDividerColor",             The color of the divider between options,       type VECTOR4
-      POPUP_ICON_COLOR,                         ///< name "popupIconColor",                The color of the icons (if supplied),           type VECTOR4
-      POPUP_PRESSED_COLOR,                      ///< name "popupPressedColor",             The color of the option when pressed,           type VECTOR4
-      POPUP_PRESSED_IMAGE,                      ///< name "popupPressedImage",             The image to use for the option when pressed,   type STRING
-      POPUP_FADE_IN_DURATION,                   ///< name "popupFadeInDuration",           The duration of the fade-in animation,          type FLOAT
-      POPUP_FADE_OUT_DURATION,                  ///< name "popupFadeOutDuration",          The duration of the fade-out animation,         type FLOAT
+      /**
+       * @brief The maximum size the Popup can be.
+       * @details Name "popupMaxSize", type Vector2.
+       */
+      POPUP_MAX_SIZE =  PROPERTY_START_INDEX,
+
+      /**
+       * @brief The minimum size the Popup can be.
+       * @details Name "popupMinSize", type Vector2.
+       */
+      POPUP_MIN_SIZE,
+
+      /**
+       * @brief The maximum size an option can be.
+       * @details Name "optionMaxSize", type Vector2.
+       */
+      OPTION_MAX_SIZE,
+
+      /**
+       * @brief The minimum size an option can be.
+       * @details Name "optionMinSize", type Vector2.
+       */
+      OPTION_MIN_SIZE,
+
+      /**
+       * @brief The size of the divider between options.
+       * @details Name "optionDividerSize", type Vector2.
+       */
+      OPTION_DIVIDER_SIZE,
+
+      /**
+       * @brief The image to use as the popup clipboard icon.
+       * @details Name "popupClipboardButtonImage", type string.
+       */
+      POPUP_CLIPBOARD_BUTTON_ICON_IMAGE,
+
+      /**
+       * @brief The image to use as the popup cut icon.
+       * @details Name "popupCutButtonImage", type string.
+       */
+      POPUP_CUT_BUTTON_ICON_IMAGE,
+
+      /**
+       * @brief The image to use as the popup copy icon.
+       * @details Name "popupCopyButtonImage", type string.
+       */
+      POPUP_COPY_BUTTON_ICON_IMAGE,
+
+      /**
+       * @brief The image to use as the popup paste icon.
+       * @details Name "popupPasteButtonImage", type string.
+       */
+      POPUP_PASTE_BUTTON_ICON_IMAGE,
+
+      /**
+       * @brief The image to use as the popup select icon.
+       * @details Name "popupSelectButtonImage", type string.
+       */
+      POPUP_SELECT_BUTTON_ICON_IMAGE,
+
+      /**
+       * @brief The image to use as the popup select all icon.
+       * @details Name "popupSelectAllButtonImage", type string.
+       */
+      POPUP_SELECT_ALL_BUTTON_ICON_IMAGE,
+
+      /**
+       * @brief The color of the divider between options.
+       * @details Name "popupDividerColor", type Vector4.
+       */
+      POPUP_DIVIDER_COLOR,
+
+      /**
+       * @brief The color of the icons (if supplied).
+       * @details Name "popupIconColor", type Vector4.
+       */
+      POPUP_ICON_COLOR,
+
+      /**
+       * @brief The color of the option when pressed.
+       * @details Name "popupPressedColor", type Vector4.
+       */
+      POPUP_PRESSED_COLOR,
+
+      /**
+       * @brief The image to use for the option when pressed.
+       * @details Name "popupPressedImage", type string.
+       */
+      POPUP_PRESSED_IMAGE,
+
+      /**
+       * @brief The duration of the fade-in animation.
+       * @details Name "popupFadeInDuration", type float.
+       */
+      POPUP_FADE_IN_DURATION,
+
+      /**
+       * @brief The duration of the fade-out animation.
+       * @details Name "popupFadeOutDuration", type float.
+       */
+      POPUP_FADE_OUT_DURATION,
+
+      /**
+       * @brief The popup background can have a separate border with a different color.
+       * @details Name "backgroundBorder", type Property::Map.
+       * @note Optional.
+       */
+      BACKGROUND_BORDER
     };
   };
 
index 9c9a628..b70d254 100644 (file)
@@ -76,11 +76,19 @@ enum Type
 
   /**
    * @brief Mix color is a blend color for any visual.
-   * @details Name "mixColor", type Property::VECTOR4
+   * @details Name "mixColor", type Property::VECTOR3 or Property::VECTOR4
    *
    * @note Optional
    */
   MIX_COLOR = SHADER + 3,
+
+  /**
+   * @brief Opacity is the alpha component of the mixColor, above.
+   * @details Name "opacity", type Property::FLOAT
+   *
+   * @note Optional
+   */
+  OPACITY = SHADER + 4
 };
 
 } //namespace Property
index ac5ea3e..48d2e2b 100644 (file)
@@ -345,7 +345,7 @@ bool Builder::LookupStyleName( const std::string& styleName )
 
 const StylePtr Builder::GetStyle( const std::string& styleName )
 {
-  const StylePtr* style = mStyles.FindCaseInsensitiveC( styleName );
+  const StylePtr* style = mStyles.FindConst( styleName );
 
   if( style==NULL )
   {
@@ -1092,7 +1092,7 @@ void Builder::ApplyAllStyleProperties( const TreeNode& root, const TreeNode& nod
   StylePtr* matchedStyle = NULL;
   if( styleName )
   {
-    matchedStyle = mStyles.FindCaseInsensitive( styleName );
+    matchedStyle = mStyles.Find( styleName );
     if( ! matchedStyle )
     {
       OptionalChild styleNodes = IsChild(root, KEYNAME_STYLES);
@@ -1180,7 +1180,7 @@ void Builder::RecordStyle( StylePtr           style,
           continue;
         }
 
-        StylePtr* stylePtr = style->subStates.FindCaseInsensitive( stateName );
+        StylePtr* stylePtr = style->subStates.Find( stateName );
         if( stylePtr )
         {
           StylePtr style(*stylePtr);
@@ -1203,12 +1203,12 @@ void Builder::RecordStyle( StylePtr           style,
         Dali::Property::Value property(Property::MAP);
         if( DeterminePropertyFromNode( visual.second, Property::MAP, property, replacements ) )
         {
-          Property::Map* mapPtr = style->visuals.FindCaseInsensitive( visual.first );
+          Property::Map* mapPtr = style->visuals.Find( visual.first );
           if( mapPtr )
           {
             // Override existing visuals
             mapPtr->Clear();
-            mapPtr->Merge(*property.GetMap());
+            mapPtr->Merge( *property.GetMap() );
           }
           else
           {
@@ -1219,47 +1219,15 @@ void Builder::RecordStyle( StylePtr           style,
     }
     else if( key == KEYNAME_ENTRY_TRANSITION )
     {
-      Dali::Property::Value property(Property::MAP);
-      if( DeterminePropertyFromNode( keyValue.second, Property::MAP, property, replacements ) )
-      {
-        style->entryTransition = Toolkit::TransitionData::New( *property.GetMap() );
-      }
+      RecordTransitionData( keyValue, style->entryTransition, replacements );
     }
     else if( key == KEYNAME_EXIT_TRANSITION )
     {
-      Dali::Property::Value property(Property::MAP);
-      if( DeterminePropertyFromNode( keyValue.second, Property::MAP, property, replacements ) )
-      {
-        style->exitTransition = Toolkit::TransitionData::New( *property.GetMap() );
-      }
+      RecordTransitionData( keyValue, style->exitTransition, replacements );
     }
     else if( key == KEYNAME_TRANSITIONS )
     {
-      //@todo add new transitions to style.transitions
-      //      override existing transitions. A transition matches on target & property name
-      const TreeNode& node = keyValue.second;
-      if( node.GetType() == TreeNode::ARRAY )
-      {
-        Dali::Property::Value property(Property::ARRAY);
-        if( DeterminePropertyFromNode( node, Property::ARRAY, property, replacements ) )
-        {
-          style->transitions = *property.GetArray();
-        }
-      }
-      else if( node.GetType() == TreeNode::OBJECT )
-      {
-        Dali::Property::Value property(Property::MAP);
-        if( DeterminePropertyFromNode( node, Property::MAP, property, replacements ) )
-        {
-          Property::Array propertyArray;
-          propertyArray.Add( property );
-          style->transitions = propertyArray;
-        }
-      }
-      else
-      {
-        DALI_LOG_WARNING( "RecordStyle() Node \"%s\" is not a JSON array or object\n", key.c_str() );
-      }
+      RecordTransitions( keyValue, style->transitions, replacements );
     }
     else if( key == KEYNAME_TYPE ||
              key == KEYNAME_ACTORS ||
@@ -1290,6 +1258,63 @@ void Builder::RecordStyle( StylePtr           style,
   }
 }
 
+void Builder::RecordTransitions(
+  const TreeNode::KeyNodePair& keyValue,
+  Property::Array& value,
+  const Replacement& replacements )
+{
+  //@todo add new transitions to style.transitions
+  //      override existing transitions. A transition matches on target & property name
+  const TreeNode& node = keyValue.second;
+  if( node.GetType() == TreeNode::ARRAY )
+  {
+    Dali::Property::Value property(Property::ARRAY);
+    if( DeterminePropertyFromNode( node, Property::ARRAY, property, replacements ) )
+    {
+      value = *property.GetArray();
+    }
+  }
+  else if( node.GetType() == TreeNode::OBJECT )
+  {
+    Dali::Property::Value property(Property::MAP);
+    if( DeterminePropertyFromNode( node, Property::MAP, property, replacements ) )
+    {
+      Property::Array propertyArray;
+      propertyArray.Add( property );
+      value = propertyArray;
+    }
+  }
+  else
+  {
+    DALI_LOG_WARNING( "RecordStyle() Node \"%s\" is not a JSON array or object\n", keyValue.first );
+  }
+}
+
+void Builder::RecordTransitionData(
+  const TreeNode::KeyNodePair& keyValue,
+  Toolkit::TransitionData& transitionData,
+  const Replacement& replacements )
+{
+  const TreeNode& node = keyValue.second;
+  if( node.GetType() == TreeNode::ARRAY )
+  {
+    Dali::Property::Value property(Property::ARRAY);
+    if( DeterminePropertyFromNode( keyValue.second, Property::ARRAY, property, replacements ) )
+    {
+      transitionData = Toolkit::TransitionData::New( *property.GetArray() );
+    }
+  }
+  else if( node.GetType() == TreeNode::OBJECT )
+  {
+    Dali::Property::Value property(Property::MAP);
+    if( DeterminePropertyFromNode( keyValue.second, Property::MAP, property, replacements ) )
+    {
+      transitionData = Toolkit::TransitionData::New( *property.GetMap() );
+    }
+  }
+}
+
+
 // Set properties from node on handle.
 void Builder::ApplyProperties( const TreeNode& root, const TreeNode& node,
                                Dali::Handle& handle, const Replacement& constant )
index b6db52d..ea0b635 100644 (file)
@@ -292,6 +292,14 @@ private:
                     Dali::Handle&      handle,
                     const Replacement& replacements );
 
+  void RecordTransitions( const TreeNode::KeyNodePair& keyValue,
+                          Property::Array& transitions,
+                          const Replacement& replacements );
+
+  void RecordTransitionData( const TreeNode::KeyNodePair& keyNode,
+                             Toolkit::TransitionData& transitionData,
+                             const Replacement& replacements );
+
   void ApplyProperties( const TreeNode&    root,
                         const TreeNode&    node,
                         Dali::Handle&      handle,
index d64a04c..93a1fbe 100644 (file)
 #include <sstream>
 #include <dali/public-api/object/property-array.h>
 #include <dali/public-api/object/property-map.h>
-#include <dali/devel-api/adaptor-framework/color-controller.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/builder/builder-impl.h>
 #include <dali-toolkit/internal/builder/builder-get-is.inl.h>
 #include <dali-toolkit/internal/builder/replacement.h>
 #include <dali-toolkit/internal/builder/builder-set-property.h>
+#include <dali-toolkit/internal/helpers/color-conversion.h>
 
 namespace Dali
 {
@@ -36,29 +36,6 @@ namespace Toolkit
 namespace Internal
 {
 
-
-namespace
-{
-
-/**
- * Converts a HTML style 'color' hex string ("#FF0000" for bright red) to a Vector4.
- * The Vector4 alpha component will be set to 1.0f
- * @param hexString The HTML style hex string
- * @return a Vector4 containing the new color value
- */
-Vector4 HexStringToVector4( const char* s )
-{
-  unsigned int value(0u);
-  std::istringstream( s ) >> std::hex >> value;
-  return Vector4( ((value >> 16 ) & 0xff ) / 255.0f,
-                  ((value >> 8 ) & 0xff ) / 255.0f,
-                  (value & 0xff ) / 255.0f,
-                  1.0f );
-}
-
-} // anon namespace
-
-
 /**
  * A property value type can be forced when its unknown by a disambiguation convention in the json
  * ie  "myarray": [1,2,3,4] ; would be a vector but
@@ -194,17 +171,9 @@ bool DeterminePropertyFromNode( const TreeNode& node, Property::Type type, Prope
       }
       else if( OptionalString s = replacer.IsString(node) )
       {
-        if( (*s)[0] == '#' && 7 == (*s).size() )
-        {
-          value = HexStringToVector4( &(*s)[1] );
-          done = true;
-        }
-        else if( Dali::ColorController::Get() )
-        {
-          Vector4 color;
-          done = Dali::ColorController::Get().RetrieveColor( *s, color );
-          value = color;
-        }
+        Vector4 color;
+        done = ConvertStringToColor( *s, color );
+        value = color;
       }
       else if( TreeNode::OBJECT == node.GetType() )
       {
index 22d2afe..ccccf2c 100644 (file)
@@ -106,45 +106,9 @@ public:
 
   /**
    * Find the element in the dictionary pointed at by key, and
-   * return a pointer to it, or NULL.
-   */
-  EntryType* Find( const std::string& key ) const
-  {
-    EntryType* result=NULL;
-
-    if( ! key.empty() )
-    {
-      for( typename Elements::iterator iter = container.begin(); iter != container.end(); ++iter )
-      {
-        if( iter->key == key )
-        {
-          result = &(iter->entry);
-          break;
-        }
-      }
-    }
-    return result;
-  }
-
-  /**
-   * Find the element in the dictionary pointed at by key, and
-   * return a pointer to it, or NULL
-   */
-  EntryType* Find( const char* key ) const
-  {
-    if( key != NULL )
-    {
-      std::string theKey(key);
-      return Find(theKey);
-    }
-    return NULL;
-  }
-
-  /**
-   * Find the element in the dictionary pointed at by key using a case
    * insensitive search, and return a const pointer to it, or NULL
    */
-  const EntryType* FindCaseInsensitiveC( const std::string& key ) const
+  const EntryType* FindConst( const std::string& key ) const
   {
     if( ! key.empty() )
     {
@@ -164,7 +128,7 @@ public:
    * Find the element in the dictionary pointed at by key using a case
    * insensitive search, and return a non-const pointer to it, or NULL
    */
-  EntryType* FindCaseInsensitive( const std::string& key ) const
+  EntryType* Find( const std::string& key ) const
   {
     EntryType* result = NULL;
     if( ! key.empty() )
@@ -185,12 +149,12 @@ public:
    * Find the element in the dictionary pointed at by key using a case
    * insensitive search, and return a const pointer to it, or NULL
    */
-  const EntryType* FindCaseInsensitiveC( const char* key ) const
+  const EntryType* FindConst( const char* key ) const
   {
     if( key != NULL )
     {
       std::string theKey(key);
-      return FindCaseInsensitiveC( theKey );
+      return FindConst( theKey );
     }
     return NULL;
   }
@@ -199,16 +163,15 @@ public:
    * Find the element in the dictionary pointed at by key using a case
    * insensitive search, and return a non-const pointer to it, or NULL
    */
-  EntryType* FindCaseInsensitive( const char* key ) const
+  EntryType* Find( const char* key ) const
   {
     if( key != NULL )
     {
       std::string theKey(key);
-      return FindCaseInsensitive( theKey );
+      return Find( theKey );
     }
     return NULL;
   }
-
   /**
    * Return an iterator pointing at the first entry in the dictionary
    */
index eaf59dc..515ddd9 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 #include <dali/public-api/object/handle.h>
+#include <dali/devel-api/scripting/scripting.h>
 #include <dali-toolkit/public-api/controls/control.h>
 #include <dali-toolkit/devel-api/controls/control-devel.h>
 #include <dali-toolkit/internal/builder/style.h>
@@ -23,9 +24,13 @@ namespace Dali
 {
 namespace Toolkit
 {
+
 namespace Internal
 {
 
+extern const Dali::Scripting::StringEnum ControlStateTable[];
+extern const unsigned int ControlStateTableCount;
+
 StylePtr Style::New()
 {
   StylePtr stylePtr( new Style() );
@@ -40,12 +45,15 @@ void Style::ApplyVisualsAndPropertiesRecursively( Handle handle ) const
   Toolkit::Control control = Toolkit::Control::DownCast(handle);
   if( control )
   {
-    Property::Value value = control.GetProperty(DevelControl::Property::STATE);
     std::string stateName;
-    if( value.Get( stateName ) )
+    Property::Value value = control.GetProperty(DevelControl::Property::STATE);
+    Dali::Toolkit::DevelControl::State state = static_cast<Dali::Toolkit::DevelControl::State>(value.Get<int>());
+    stateName = Scripting::GetEnumerationName< Toolkit::DevelControl::State >( state, ControlStateTable, ControlStateTableCount );
+
+    if( ! stateName.empty() )
     {
       // Look up state in states table:
-      const StylePtr* stylePtr = subStates.FindCaseInsensitiveC( stateName );
+      const StylePtr* stylePtr = subStates.FindConst( stateName );
       if( stylePtr )
       {
         const StylePtr statePtr(*stylePtr);
@@ -59,7 +67,7 @@ void Style::ApplyVisualsAndPropertiesRecursively( Handle handle ) const
         std::string subStateName;
         if( value.Get( subStateName ) && ! subStateName.empty() )
         {
-          const StylePtr* stylePtr = statePtr->subStates.FindCaseInsensitiveC( subStateName );
+          const StylePtr* stylePtr = statePtr->subStates.FindConst( subStateName );
           if( stylePtr )
           {
             const StylePtr subStatePtr(*stylePtr);
@@ -103,7 +111,6 @@ void Style::ApplyProperties( Handle handle ) const
 Style::Style()
 {
 }
-
 Style::~Style()
 {
 }
index 2fb4e83..bd26a6d 100644 (file)
@@ -58,8 +58,6 @@ public:
    */
   void ApplyVisualsAndPropertiesRecursively( Handle handle ) const;
 
-
-private:
   /**
    * Apply the visuals of the style to the control pointed at by
    * handle.
index 8b84088..6794590 100755 (executable)
@@ -1189,10 +1189,12 @@ void ItemView::OnPan( const PanGesture& gesture )
         mScrollAnimation.AnimateTo( Property(self, Toolkit::ItemView::Property::SCROLL_SPEED), 0.0f, AlphaFunction::EASE_OUT );
 
         mIsFlicking = true;
+
         // Check whether it has already scrolled to the end
-        if(fabs(currentLayoutPosition - firstItemScrollPosition) > Math::MACHINE_EPSILON_0)
+        if( fabs(currentLayoutPosition - firstItemScrollPosition) < Math::MACHINE_EPSILON_0 )
         {
-          AnimateScrollOvershoot(0.0f);
+          AnimateScrollOvershoot( 0.0f );
+          RemoveAnimation( mScrollAnimation );
         }
       }
 
index f322618..213818a 100755 (executable)
@@ -25,7 +25,7 @@
 #include <dali/public-api/events/touch-data.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/public-api/object/type-registry-helper.h>
-#include <dali/public-api/images/resource-image.h>
+#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control-impl.h>
@@ -520,8 +520,9 @@ void Slider::CreatePopupImage( const std::string& filename )
 {
   if( mPopup && ( filename.size() > 0 ) )
   {
-    Image image = ResourceImage::New( filename );
-    mPopup.SetImage( image );
+    Property::Map map;
+    map[Toolkit::ImageVisual::Property::URL] = filename;
+    mPopup.SetProperty( Toolkit::ImageView::Property::IMAGE, map );
   }
 }
 
@@ -557,8 +558,9 @@ void Slider::CreatePopupArrowImage( const std::string& filename )
 {
   if( mPopupArrow && ( filename.size() > 0 ) )
   {
-    Image image = ResourceImage::New( filename );
-    mPopupArrow.SetImage( image );
+    Property::Map map;
+    map[Toolkit::ImageVisual::Property::URL] = filename;
+    mPopupArrow.SetProperty( Toolkit::ImageView::Property::IMAGE, map );
   }
 }
 
index 459e534..6d95ac2 100644 (file)
@@ -36,6 +36,8 @@
 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
 #include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
 #include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
+#include <dali-toolkit/internal/helpers/color-conversion.h>
+#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
 
 namespace Dali
 {
@@ -48,7 +50,7 @@ namespace Internal
 
 namespace
 {
-// todo Move this to adaptor??
+
 #define GET_LOCALE_TEXT(string) dgettext("dali-toolkit", string)
 
 const std::string TEXT_SELECTION_POPUP_BUTTON_STYLE_NAME( "TextSelectionPopupButton" );
@@ -111,6 +113,7 @@ DALI_PROPERTY_REGISTRATION( Toolkit, TextSelectionPopup, "popupPressedColor", VE
 DALI_PROPERTY_REGISTRATION( Toolkit, TextSelectionPopup, "popupPressedImage", STRING, POPUP_PRESSED_IMAGE )
 DALI_PROPERTY_REGISTRATION( Toolkit, TextSelectionPopup, "popupFadeInDuration", FLOAT, POPUP_FADE_IN_DURATION )
 DALI_PROPERTY_REGISTRATION( Toolkit, TextSelectionPopup, "popupFadeOutDuration", FLOAT, POPUP_FADE_OUT_DURATION )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextSelectionPopup, "backgroundBorder", MAP, BACKGROUND_BORDER )
 
 DALI_TYPE_REGISTRATION_END()
 
@@ -230,6 +233,12 @@ void TextSelectionPopup::SetProperty( BaseObject* object, Property::Index index,
         impl.mFadeOutDuration = value.Get < float >();
         break;
       }
+      case Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER:
+      {
+        Property::Map map = value.Get<Property::Map>();
+        impl.CreateBackgroundBorder( map );
+        break;
+      }
     } // switch
   } // TextSelectionPopup
 }
@@ -335,6 +344,17 @@ Property::Value TextSelectionPopup::GetProperty( BaseObject* object, Property::I
         value = impl.mFadeOutDuration;
         break;
       }
+      case Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER:
+      {
+        Property::Map map;
+        Toolkit::Visual::Base visual = impl.GetVisual( Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER );
+        if( visual )
+        {
+          visual.CreatePropertyMap( map );
+        }
+        value = map;
+        break;
+      }
     } // switch
   }
   return value;
@@ -796,6 +816,23 @@ std::string TextSelectionPopup::GetPressedImage() const
    }
  }
 
+void TextSelectionPopup::CreateBackgroundBorder( Property::Map& propertyMap )
+{
+  // Removes previous image if necessary
+  UnregisterVisual( Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER );
+
+  if( ! propertyMap.Empty() )
+  {
+    Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual( propertyMap );
+
+    if( visual )
+    {
+      RegisterVisual( Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER, visual );
+      visual.SetDepthIndex( DepthIndex::CONTENT );
+    }
+  }
+}
+
 TextSelectionPopup::TextSelectionPopup( TextSelectionPopupCallbackInterface* callbackInterface )
 : Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ),
   mToolbar(),
index 419720f..c437361 100644 (file)
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control-impl.h>
 #include <dali-toolkit/public-api/controls/buttons/push-button.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
 #include <dali-toolkit/public-api/controls/table-view/table-view.h>
 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h>
 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-toolbar.h>
 
 // EXTERNAL INCLUDES
 #include <dali/public-api/actors/layer.h>
+#include <dali/public-api/object/property-map.h>
 
 namespace Dali
 {
@@ -242,6 +244,13 @@ private: // Implementation
   void AddPopupOptionsToToolbar(  bool showIcons, bool showCaptions );
 
   /**
+   * Creates the background-border image
+   *
+   * @param[in] propertyMap The properties describing the background-border
+   */
+  void CreateBackgroundBorder( Property::Map& propertyMap );
+
+  /**
    * Construct a new TextField.
    */
   TextSelectionPopup( TextSelectionPopupCallbackInterface* callbackInterface );
index 6ec0d0c..b787acd 100755 (executable)
@@ -88,6 +88,7 @@ toolkit_src_files = \
    \
    $(toolkit_src_dir)/focus-manager/keyboard-focus-manager-impl.cpp \
    $(toolkit_src_dir)/focus-manager/keyinput-focus-manager-impl.cpp \
+   $(toolkit_src_dir)/helpers/color-conversion.cpp \
    $(toolkit_src_dir)/helpers/property-helper.cpp \
    $(toolkit_src_dir)/filters/blur-two-pass-filter.cpp \
    $(toolkit_src_dir)/filters/emboss-filter.cpp \
index 989997b..28d305d 100644 (file)
@@ -118,17 +118,14 @@ KeyboardFocusManager::KeyboardFocusManager()
   mCurrentFocusActor( 0 ),
   mFocusIndicatorActor(),
   mFocusGroupLoopEnabled( false ),
-  mIsKeyboardFocusEnabled( false ),
   mIsFocusIndicatorEnabled( false ),
   mIsWaitingKeyboardFocusChangeCommit( false ),
   mFocusHistory(),
   mSlotDelegate( this )
 {
-  OnPhysicalKeyboardStatusChanged(PhysicalKeyboard::Get());
-
+  // TODO: Get FocusIndicatorEnable constant from stylesheet to set mIsFocusIndicatorEnabled.
   Toolkit::KeyInputFocusManager::Get().UnhandledKeyEventSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnKeyEvent);
   Stage::GetCurrent().TouchSignal().Connect( mSlotDelegate, &KeyboardFocusManager::OnTouch );
-  PhysicalKeyboard::Get().StatusChangedSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnPhysicalKeyboardStatusChanged);
 }
 
 KeyboardFocusManager::~KeyboardFocusManager()
@@ -156,9 +153,7 @@ bool KeyboardFocusManager::DoSetCurrentFocusActor( const unsigned int actorID )
   // Check whether the actor is in the stage and is keyboard focusable.
   if( actor && actor.IsKeyboardFocusable() )
   {
-    mIsFocusIndicatorEnabled = true;
-    // Draw the focus indicator upon the focused actor when PhysicalKeyboard is attached
-    if( mIsKeyboardFocusEnabled )
+    if( mIsFocusIndicatorEnabled )
     {
       actor.Add( GetFocusIndicatorActor() );
     }
@@ -529,39 +524,8 @@ Actor KeyboardFocusManager::GetFocusIndicatorActor()
   return mFocusIndicatorActor;
 }
 
-void KeyboardFocusManager::OnPhysicalKeyboardStatusChanged(PhysicalKeyboard keyboard)
-{
-  mIsKeyboardFocusEnabled = keyboard.IsAttached();
-
-  if(mIsKeyboardFocusEnabled)
-  {
-    // Show indicator when keyboard focus turned on if there is focused actor.
-    Actor actor = GetCurrentFocusActor();
-    if(actor)
-    {
-      actor.Add( GetFocusIndicatorActor() );
-    }
-    mIsFocusIndicatorEnabled = true;
-  }
-  else
-  {
-    // Hide indicator when keyboard focus turned off
-    Actor actor = GetCurrentFocusActor();
-    if( actor && mFocusIndicatorActor )
-    {
-      actor.Remove( mFocusIndicatorActor );
-    }
-    mIsFocusIndicatorEnabled = false;
-  }
-}
-
 void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event)
 {
-  if(!mIsKeyboardFocusEnabled)
-  {
-    return;
-  }
-
   AccessibilityAdaptor accessibilityAdaptor = AccessibilityAdaptor::Get();
   bool isAccessibilityEnabled = accessibilityAdaptor.IsEnabled();
 
index 1ece0b1..fd46678 100644 (file)
@@ -19,8 +19,6 @@
  */
 
 // EXTERNAL INCLUDES
-#include <string>
-#include <dali/devel-api/adaptor-framework/physical-keyboard.h>
 #include <dali/public-api/object/base-object.h>
 
 // INTERNAL INCLUDES
@@ -228,12 +226,6 @@ private:
    */
   void OnTouch( const TouchData& touch );
 
-  /**
-   * Change the keyboard focus status when keyboard focus feature turned on or off.
-   * @return Whether the status is changed or not.
-   */
-  void OnPhysicalKeyboardStatusChanged(PhysicalKeyboard keyboard);
-
 private:
 
   // Undefined
@@ -254,8 +246,6 @@ private:
 
   bool mFocusGroupLoopEnabled:1; ///< Whether the focus movement is looped within the same focus group
 
-  bool mIsKeyboardFocusEnabled:1; ///< Whether keyboard focus feature turned on/off
-
   bool mIsFocusIndicatorEnabled:1; ///< Whether indicator should be shown / hidden. It could be enabled when keyboard focus feature enabled and navigation keys or 'Tab' key pressed.
 
   bool mIsWaitingKeyboardFocusChangeCommit:1; /// A flag to indicate PreFocusChangeSignal emitted but the proposed focus actor is not commited by the application yet.
diff --git a/dali-toolkit/internal/helpers/color-conversion.cpp b/dali-toolkit/internal/helpers/color-conversion.cpp
new file mode 100644 (file)
index 0000000..6789cee
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/internal/helpers/color-conversion.h>
+
+// EXTERNAL INCLUDES
+#include <sstream>
+#include <dali/public-api/math/vector4.h>
+#include <dali/devel-api/adaptor-framework/color-controller.h>
+
+using Dali::Vector4;
+
+namespace
+{
+
+/**
+ * Converts a HTML style 'color' hex string ("#FF0000" for bright red) to a Vector4.
+ * The Vector4 alpha component will be set to 1.0f
+ * @param hexString The HTML style hex string
+ * @return a Vector4 containing the new color value
+ */
+Vector4 HexStringToVector4( const char* s )
+{
+  unsigned int value(0u);
+  std::istringstream( s ) >> std::hex >> value;
+  return Vector4( ((value >> 16 ) & 0xff ) / 255.0f,
+                  ((value >> 8 ) & 0xff ) / 255.0f,
+                  (value & 0xff ) / 255.0f,
+                  1.0f );
+}
+
+} // unnamed namespace
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Internal
+{
+
+bool ConvertStringToColor( const std::string& colorString, Vector4& outColor )
+{
+  bool success( false );
+
+  if( ( '#' == colorString[0] ) &&
+      (  7  == colorString.size() ) )
+  {
+    const char* cString = colorString.c_str();
+    outColor = HexStringToVector4( &cString[1] );
+    success = true;
+  }
+  else
+  {
+    Dali::ColorController controller = Dali::ColorController::Get();
+
+    if( controller )
+    {
+      success = controller.RetrieveColor( colorString, outColor );
+    }
+  }
+
+  return success;
+}
+
+bool ConvertPropertyToColor( const Property::Value& colorValue, Vector4& outColor )
+{
+  bool success( false );
+
+  if( Property::VECTOR4 == colorValue.GetType() )
+  {
+    success = colorValue.Get( outColor );
+  }
+  else if( Property::STRING == colorValue.GetType() )
+  {
+    std::string colorString;
+    if( colorValue.Get( colorString ) )
+    {
+      success = ConvertStringToColor( colorString, outColor );
+    }
+  }
+
+  return success;
+}
+
+} // Internal
+} // Toolkit
+} // Dali
diff --git a/dali-toolkit/internal/helpers/color-conversion.h b/dali-toolkit/internal/helpers/color-conversion.h
new file mode 100644 (file)
index 0000000..dcd51bd
--- /dev/null
@@ -0,0 +1,61 @@
+#ifndef DALI_TOOLKIT_INTERNAL_COLOR_CONVERSION_H
+#define DALI_TOOLKIT_INTERNAL_COLOR_CONVERSION_H
+
+/*
+ * Copyright (c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+#include <dali/public-api/object/property.h>
+
+namespace Dali
+{
+
+class Vector4;
+
+namespace Toolkit
+{
+namespace Internal
+{
+
+/*
+ * @brief Convert the string representation of a color into a Vector4.
+ *
+ * The supported string formats are:
+ * 1) An HTML style 'color' hex string ("#FF0000" for bright red).
+ * 2) An ID referring to the color palette of the current theme e.g. "B018"
+ *
+ * @param[in] colorString The color in string format.
+ * @param[out] outColor The color if found.
+ * @return True if the conversion was successful.
+ */
+bool ConvertStringToColor( const std::string& colorString, Vector4& outColor );
+
+/*
+ * @brief Convert a variety of different color representations into a Vector4.
+ *
+ * @param[in] colorValue The color in Vector4 or string format.
+ * @param[out] outColor The color if found.
+ * @return True if the conversion was successful.
+ */
+bool ConvertPropertyToColor( const Property::Value& colorValue, Vector4& outColor );
+
+} // Internal
+} // Toolkit
+} // Dali
+
+
+#endif // DALI_TOOLKIT_INTERNAL_COLOR_CONVERSION_H
index 05fa234..13b8633 100644 (file)
@@ -82,11 +82,12 @@ const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
 const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
   uniform lowp vec4 uColor;\n
   uniform lowp vec4 borderColor;\n
-  uniform lowp vec4 mixColor;\n
+  uniform lowp vec3 mixColor;\n
+  uniform lowp float opacity;\n
   \n
   void main()\n
   {\n
-    gl_FragColor = mixColor*borderColor*uColor;\n
+    gl_FragColor = vec4(mixColor, opacity)*borderColor*uColor;\n
   }\n
 );
 
@@ -109,13 +110,14 @@ const char* VERTEX_SHADER_ANTI_ALIASING = DALI_COMPOSE_SHADER(
 const char* FRAGMENT_SHADER_ANTI_ALIASING = DALI_COMPOSE_SHADER(
   uniform lowp vec4 uColor;\n
   uniform lowp vec4 borderColor;\n
-  uniform lowp vec4 mixColor;\n
+  uniform lowp vec3 mixColor;\n
+  uniform lowp float opacity;\n
   uniform mediump float borderSize;\n
   varying mediump float vAlpha;\n
   \n
   void main()\n
   {\n
-    gl_FragColor = mixColor*borderColor*uColor;\n
+    gl_FragColor = vec4(mixColor, opacity)*borderColor*uColor;\n
     gl_FragColor.a *= smoothstep(0.0, 1.5, vAlpha)*smoothstep( borderSize+1.5, borderSize, vAlpha );\n
   }\n
 );
index 6313211..0ac80d6 100644 (file)
@@ -70,11 +70,12 @@ const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
 
 const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
   uniform lowp vec4 uColor;\n
-  uniform lowp vec4 mixColor;\n
+  uniform lowp vec3 mixColor;\n
+  uniform lowp float opacity;\n
   \n
   void main()\n
   {\n
-    gl_FragColor = mixColor*uColor;\n
+    gl_FragColor = vec4(mixColor, opacity)*uColor;\n
   }\n
 );
 }
@@ -105,7 +106,16 @@ void ColorVisual::DoSetProperties( const Property::Map& propertyMap )
     Vector4 color;
     if( colorValue->Get( color ) )
     {
-      SetMixColor( color );
+      Property::Type type = colorValue->GetType();
+      if( type == Property::VECTOR4 )
+      {
+        SetMixColor( color );
+      }
+      else if( type == Property::VECTOR3 )
+      {
+        Vector3 color3(color);
+        SetMixColor( color3 );
+      }
     }
     else
     {
@@ -152,7 +162,8 @@ void ColorVisual::InitializeRenderer()
   // ColorVisual has it's own index key for mix color - use this instead
   // of using the new base index to avoid changing existing applications
   // String keys will get to this property.
-  mImpl->mMixColorIndex = DevelHandle::RegisterProperty( mImpl->mRenderer, Toolkit::ColorVisual::Property::MIX_COLOR, MIX_COLOR, mImpl->mMixColor );
+  mImpl->mMixColorIndex = DevelHandle::RegisterProperty( mImpl->mRenderer, Toolkit::ColorVisual::Property::MIX_COLOR, MIX_COLOR, Vector3(mImpl->mMixColor) );
+
   if( mImpl->mMixColor.a < 1.f )
   {
     mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
index 7f58d66..4ea6a28 100644 (file)
@@ -172,12 +172,13 @@ const char* FRAGMENT_SHADER[] =
 DALI_COMPOSE_SHADER(
   uniform sampler2D sTexture;\n // sampler1D?
   uniform lowp vec4 uColor;\n
-  uniform lowp vec4 mixColor;\n
+  uniform lowp vec3 mixColor;\n
+  uniform lowp float opacity;\n
   varying mediump vec2 vTexCoord;\n
   \n
   void main()\n
   {\n
-      gl_FragColor = texture2D( sTexture, vec2( vTexCoord.y, 0.5 ) ) * vec4(mixColor.rgb*mixColor.a, mixColor.a) * uColor;\n
+    gl_FragColor = texture2D( sTexture, vec2( vTexCoord.y, 0.5 ) ) * vec4(mixColor*opacity, opacity) * uColor;\n
   }\n
 ),
 
@@ -185,12 +186,13 @@ DALI_COMPOSE_SHADER(
 DALI_COMPOSE_SHADER(
   uniform sampler2D sTexture;\n // sampler1D?
   uniform lowp vec4 uColor;\n
-  uniform lowp vec4 mixColor;\n
+  uniform lowp vec3 mixColor;\n
+  uniform lowp float opacity;\n
   varying mediump vec2 vTexCoord;\n
   \n
   void main()\n
   {\n
-    gl_FragColor = texture2D( sTexture, vec2( length(vTexCoord), 0.5 ) ) * vec4(mixColor.rgb*mixColor.a, mixColor.a) * uColor;\n
+    gl_FragColor = texture2D( sTexture, vec2( length(vTexCoord), 0.5 ) ) * vec4(mixColor*opacity, opacity) * uColor;\n
   }\n
 )
 };
index a0197cd..f6e2a9f 100644 (file)
@@ -125,12 +125,13 @@ const char* FRAGMENT_SHADER_NO_ATLAS = DALI_COMPOSE_SHADER(
   varying mediump vec2 vTexCoord;\n
   uniform sampler2D sTexture;\n
   uniform lowp vec4 uColor;\n
-  uniform lowp vec4 mixColor;\n
+  uniform lowp vec3 mixColor;\n
+  uniform lowp float opacity;\n
   uniform lowp float preMultipliedAlpha;\n
   \n
   lowp vec4 visualMixColor()\n
   {\n
-    return vec4( mixColor.rgb * mix( 1.0, mixColor.a, preMultipliedAlpha ), mixColor.a );\n
+    return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
   }\n
   void main()\n
   {\n
@@ -143,12 +144,13 @@ const char* FRAGMENT_SHADER_ATLAS_CLAMP = DALI_COMPOSE_SHADER(
     uniform sampler2D sTexture;\n
     uniform mediump vec4 uAtlasRect;\n
     uniform lowp vec4 uColor;\n
-    uniform lowp vec4 mixColor;\n
+    uniform lowp vec3 mixColor;\n
+    uniform lowp float opacity;\n
     uniform lowp float preMultipliedAlpha;\n
     \n
     lowp vec4 visualMixColor()\n
     {\n
-        return vec4( mixColor.rgb * mix( 1.0, mixColor.a, preMultipliedAlpha ), mixColor.a );\n
+        return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
     }\n
     \n
     void main()\n
@@ -165,7 +167,8 @@ const char* FRAGMENT_SHADER_ATLAS_VARIOUS_WRAP = DALI_COMPOSE_SHADER(
     // WrapMode -- 0: CLAMP; 1: REPEAT; 2: REFLECT;
     uniform lowp vec2 wrapMode;\n
     uniform lowp vec4 uColor;\n
-    uniform lowp vec4 mixColor;\n
+    uniform lowp vec3 mixColor;\n
+    uniform lowp float opacity;\n
     uniform lowp float preMultipliedAlpha;\n
     \n
     mediump float wrapCoordinate( mediump vec2 range, mediump float coordinate, lowp float wrap )\n
@@ -180,7 +183,7 @@ const char* FRAGMENT_SHADER_ATLAS_VARIOUS_WRAP = DALI_COMPOSE_SHADER(
     \n
     lowp vec4 visualMixColor()\n
     {\n
-      return vec4( mixColor.rgb * mix( 1.0, mixColor.a, preMultipliedAlpha ), mixColor.a );\n
+      return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
     }\n
     \n
     void main()\n
index 73140cf..051dfa3 100644 (file)
@@ -164,12 +164,13 @@ const char* SIMPLE_FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
   precision mediump float;\n
   varying mediump vec3 vIllumination;\n
   uniform lowp vec4 uColor;\n
-  uniform lowp vec4 mixColor;\n
+  uniform lowp vec3 mixColor;\n
+  uniform lowp float opacity;\n
   uniform lowp float preMultipliedAlpha;\n
 
   lowp vec4 visualMixColor()\n
   {\n
-    return vec4( mixColor.rgb * mix( 1.0, mixColor.a, preMultipliedAlpha ), mixColor.a );\n
+    return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
   }\n
   void main()\n
   {\n
@@ -247,12 +248,13 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
   varying mediump float vSpecular;\n
   uniform sampler2D sDiffuse;\n
   uniform lowp vec4 uColor;\n
-  uniform lowp vec4 mixColor;\n
+  uniform lowp vec3 mixColor;\n
+  uniform lowp float opacity;\n
   uniform lowp float preMultipliedAlpha;\n
 
   lowp vec4 visualMixColor()\n
   {\n
-    return vec4( mixColor.rgb * mix( 1.0, mixColor.a, preMultipliedAlpha ), mixColor.a );\n
+    return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
   }\n
   void main()\n
   {\n
@@ -339,12 +341,13 @@ const char* NORMAL_MAP_FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
   uniform sampler2D sNormal;\n
   uniform sampler2D sGloss;\n
   uniform lowp vec4 uColor;\n
-  uniform lowp vec4 mixColor;\n
+  uniform lowp vec3 mixColor;\n
+  uniform lowp float opacity;\n
   uniform lowp float preMultipliedAlpha;\n
 
   lowp vec4 visualMixColor()\n
   {\n
-    return vec4( mixColor.rgb * mix( 1.0, mixColor.a, preMultipliedAlpha ), mixColor.a );\n
+    return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
   }\n
   void main()\n
   {\n
index b2f0cbb..6ecb818 100644 (file)
@@ -132,11 +132,12 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
   varying mediump vec2 vTexCoord;\n
   uniform sampler2D sTexture;\n
   uniform lowp vec4 uColor;\n
-  uniform lowp vec4 mixColor;\n
+  uniform lowp vec3 mixColor;\n
+  uniform lowp float opacity;\n
   uniform lowp float preMultipliedAlpha;\n
   lowp vec4 visualMixColor()\n
   {\n
-    return vec4( mixColor.rgb * mix( 1.0, mixColor.a, preMultipliedAlpha ), mixColor.a );\n
+    return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
   }\n
   void main()\n
   {\n
index 78f4c88..748564e 100644 (file)
@@ -166,11 +166,11 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
   precision mediump float;\n
   varying   mediump vec3  vIllumination;\n
   uniform   lowp    vec4  uColor;\n
-  uniform   lowp    vec4  mixColor;\n
-
+  uniform   lowp    vec3  mixColor;\n
+  uniform   lowp    float opacity;\n
   void main()\n
   {\n
-    vec4 baseColor = mixColor * uColor;\n
+      vec4 baseColor = vec4(mixColor, opacity) * uColor;\n
     gl_FragColor = vec4( vIllumination.rgb * baseColor.rgb, baseColor.a );\n
   }\n
 );
@@ -225,7 +225,16 @@ void PrimitiveVisual::DoSetProperties( const Property::Map& propertyMap )
     Vector4 color;
     if( colorValue->Get( color ) )
     {
-      SetMixColor( color );
+      Property::Type type = colorValue->GetType();
+      if( type == Property::VECTOR4 )
+      {
+        SetMixColor( color );
+      }
+      else if( type == Property::VECTOR3 )
+      {
+        Vector3 color3(color);
+        SetMixColor( color3 );
+      }
     }
   }
 
@@ -455,7 +464,7 @@ void PrimitiveVisual::InitializeRenderer()
   // Register transform properties
   mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
 
-  mImpl->mMixColorIndex = DevelHandle::RegisterProperty( mImpl->mRenderer, Toolkit::PrimitiveVisual::Property::MIX_COLOR, MIX_COLOR, mImpl->mMixColor );
+  mImpl->mMixColorIndex = DevelHandle::RegisterProperty( mImpl->mRenderer, Toolkit::PrimitiveVisual::Property::MIX_COLOR, MIX_COLOR, Vector3(mImpl->mMixColor) );
 }
 
 void PrimitiveVisual::UpdateShaderUniforms()
index 280fac2..55b1478 100644 (file)
@@ -128,12 +128,13 @@ const char* FRAGMENT_SHADER_ATLAS_CLAMP = DALI_COMPOSE_SHADER(
     uniform sampler2D sTexture;\n
     uniform mediump vec4 uAtlasRect;\n
     uniform lowp vec4 uColor;\n
-    uniform lowp vec4 mixColor;\n
+    uniform lowp vec3 mixColor;\n
+    uniform lowp float opacity;\n
     \n
     void main()\n
     {\n
       mediump vec2 texCoord = clamp( mix( uAtlasRect.xy, uAtlasRect.zw, vTexCoord ), uAtlasRect.xy, uAtlasRect.zw );\n
-      gl_FragColor = texture2D( sTexture, texCoord ) * uColor * mixColor;\n
+      gl_FragColor = texture2D( sTexture, texCoord ) * uColor * vec4( mixColor, opacity );\n
     }\n
 );
 
index 8990c9a..19c2c74 100644 (file)
@@ -90,6 +90,7 @@ Internal::Visual::Base::Impl::Impl()
   mControlSize( Vector2::ZERO ),
   mDepthIndex( 0.0f ),
   mMixColorIndex( Property::INVALID_INDEX ),
+  mOpacityIndex( Property::INVALID_INDEX ),
   mFlags( 0 )
 {
 }
index 999b41c..347cf7d 100644 (file)
@@ -122,6 +122,7 @@ struct Base::Impl
   Size            mControlSize;
   float           mDepthIndex;
   Property::Index mMixColorIndex;
+  Property::Index mOpacityIndex;
   int             mFlags;
 };
 
index 701da0e..0d2b050 100644 (file)
@@ -24,6 +24,8 @@
 #include <dali/integration-api/debug.h>
 
 //INTERNAL HEARDER
+#include <dali-toolkit/public-api/visuals/color-visual-properties.h>
+#include <dali-toolkit/public-api/visuals/primitive-visual-properties.h>
 #include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
 #include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
 #include <dali-toolkit/internal/visuals/visual-string-constants.h>
@@ -94,6 +96,10 @@ void Visual::Base::SetProperties( const Property::Map& propertyMap )
       {
         matchKey = Property::Key( DevelVisual::Property::MIX_COLOR );
       }
+      else if( matchKey == OPACITY )
+      {
+        matchKey = Property::Key( DevelVisual::Property::OPACITY );
+      }
     }
 
     switch( matchKey.indexKey )
@@ -133,7 +139,25 @@ void Visual::Base::SetProperties( const Property::Map& propertyMap )
         Vector4 mixColor;
         if( value.Get( mixColor ) )
         {
-          SetMixColor( mixColor );
+          if( value.GetType() == Property::VECTOR4 )
+          {
+            SetMixColor( mixColor );
+          }
+          else
+          {
+            Vector3 mixColor3(mixColor);
+            SetMixColor( mixColor3 );
+          }
+        }
+        break;
+      }
+      case DevelVisual::Property::OPACITY:
+      {
+        float opacity;
+        if( value.Get( opacity ) )
+        {
+          mImpl->mMixColor.a = opacity;
+          SetMixColor( mImpl->mMixColor );
         }
         break;
       }
@@ -236,6 +260,7 @@ void Visual::Base::SetOffStage( Actor& actor )
   {
     DoSetOffStage( actor );
     mImpl->mMixColorIndex = Property::INVALID_INDEX;
+    mImpl->mOpacityIndex = Property::INVALID_INDEX;
     mImpl->mFlags &= ~Impl::IS_ON_STAGE;
   }
 }
@@ -258,7 +283,8 @@ void Visual::Base::CreatePropertyMap( Property::Map& map ) const
 
   // Note, Color and Primitive will also insert their own mix color into the map
   // which is ok, because they have a different key value range.
-  map.Insert( DevelVisual::Property::MIX_COLOR, GetMixColor() );
+  map.Insert( DevelVisual::Property::MIX_COLOR, mImpl->mMixColor ); // vec4
+  map.Insert( DevelVisual::Property::OPACITY, mImpl->mMixColor.a );
 }
 
 void Visual::Base::EnablePreMultipliedAlpha( bool preMultipled )
@@ -309,20 +335,29 @@ void Visual::Base::RegisterMixColor()
       mImpl->mRenderer,
       Toolkit::DevelVisual::Property::MIX_COLOR,
       MIX_COLOR,
-      mImpl->mMixColor );
+      Vector3(mImpl->mMixColor) );
+  }
 
-    if( mImpl->mMixColor.a < 1.f )
-    {
-      mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
-    }
+  if( mImpl->mMixColor.a < 1.f )
+  {
+    mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
+  }
 
-    float preMultipliedAlpha = 0.0f;
-    if( IsPreMultipliedAlphaEnabled() )
-    {
-      preMultipliedAlpha = 1.0f;
-    }
-    mImpl->mRenderer.RegisterProperty( "preMultipliedAlpha", preMultipliedAlpha );
+  if( mImpl->mOpacityIndex == Property::INVALID_INDEX )
+  {
+    mImpl->mOpacityIndex = DevelHandle::RegisterProperty(
+      mImpl->mRenderer,
+      Toolkit::DevelVisual::Property::OPACITY,
+      OPACITY,
+      mImpl->mMixColor.a );
   }
+
+  float preMultipliedAlpha = 0.0f;
+  if( IsPreMultipliedAlphaEnabled() )
+  {
+    preMultipliedAlpha = 1.0f;
+  }
+  mImpl->mRenderer.RegisterProperty( "preMultipliedAlpha", preMultipliedAlpha );
 }
 
 void Visual::Base::SetMixColor( const Vector4& color )
@@ -331,7 +366,8 @@ void Visual::Base::SetMixColor( const Vector4& color )
 
   if( mImpl->mRenderer )
   {
-    mImpl->mRenderer.SetProperty( mImpl->mMixColorIndex, color );
+    mImpl->mRenderer.SetProperty( mImpl->mMixColorIndex, Vector3(color) );
+    mImpl->mRenderer.SetProperty( mImpl->mOpacityIndex, color.a );
     if( color.a < 1.f )
     {
       mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
@@ -339,6 +375,18 @@ void Visual::Base::SetMixColor( const Vector4& color )
   }
 }
 
+void Visual::Base::SetMixColor( const Vector3& color )
+{
+  mImpl->mMixColor.r = color.r;
+  mImpl->mMixColor.g = color.g;
+  mImpl->mMixColor.b = color.b;
+
+  if( mImpl->mRenderer )
+  {
+    mImpl->mRenderer.SetProperty( mImpl->mMixColorIndex, color );
+  }
+}
+
 const Vector4& Visual::Base::GetMixColor() const
 {
   return mImpl->mMixColor;
@@ -349,7 +397,6 @@ Renderer Visual::Base::GetRenderer()
   return mImpl->mRenderer;
 }
 
-
 Property::Index Visual::Base::GetPropertyIndex( Property::Key key )
 {
   Property::Index index = DevelHandle::GetPropertyIndex( mImpl->mRenderer, key );
@@ -385,7 +432,9 @@ Property::Index Visual::Base::GetPropertyIndex( Property::Key key )
 void Visual::Base::SetupTransition(
   Dali::Animation& transition,
   Internal::TransitionData::Animator& animator,
-  Property::Index index )
+  Property::Index index,
+  Property::Value& initialValue,
+  Property::Value& targetValue )
 {
   if( index != Property::INVALID_INDEX )
   {
@@ -393,13 +442,13 @@ void Visual::Base::SetupTransition(
     {
       if( animator.animate == false )
       {
-        mImpl->mRenderer.SetProperty( index, animator.targetValue );
+        mImpl->mRenderer.SetProperty( index, targetValue );
       }
       else
       {
         if( animator.initialValue.GetType() != Property::NONE )
         {
-          mImpl->mRenderer.SetProperty( index, animator.initialValue );
+          mImpl->mRenderer.SetProperty( index, initialValue );
         }
 
         if( ! transition )
@@ -408,7 +457,7 @@ void Visual::Base::SetupTransition(
         }
 
         transition.AnimateTo( Property( mImpl->mRenderer, index ),
-                              animator.targetValue,
+                              targetValue,
                               animator.alphaFunction,
                               TimePeriod( animator.timePeriodDelay,
                                           animator.timePeriodDuration ) );
@@ -429,44 +478,70 @@ void Visual::Base::AnimateProperty(
   }
 #endif
 
-  Property::Index index = Property::INVALID_INDEX;
-
-  bool isMixColor = false;
-  bool isMixColorOpaque = true;
+  Property::Map map;
+  DoCreatePropertyMap( map );
+  Property::Value* valuePtr = map.Find( Toolkit::DevelVisual::Property::TYPE );
+  int visualType;
+  valuePtr->Get(visualType);
 
-  // Get the property index
   if( animator.propertyKey == Toolkit::DevelVisual::Property::MIX_COLOR ||
-      animator.propertyKey == MIX_COLOR )
+      animator.propertyKey == MIX_COLOR ||
+      ( visualType == Toolkit::Visual::COLOR &&
+        animator.propertyKey == ColorVisual::Property::MIX_COLOR ) ||
+      ( visualType == Toolkit::Visual::PRIMITIVE &&
+        animator.propertyKey == PrimitiveVisual::Property::MIX_COLOR ) )
   {
-    isMixColor = true;
-    index = mImpl->mMixColorIndex;
-
-    Vector4 initialColor;
-    if( animator.initialValue.Get(initialColor) ) // if there is an initial color, test it
-    {
-      isMixColorOpaque = initialColor.a >= 1.0f;
-    }
-    else
-    {
-      isMixColorOpaque = mImpl->mMixColor.a >= 1.0f; // otherwise, test the current color
-    }
+    AnimateMixColorProperty( transition, animator );
+  }
+  else if(animator.propertyKey == Toolkit::DevelVisual::Property::OPACITY ||
+          animator.propertyKey == OPACITY )
+  {
+    AnimateOpacityProperty( transition, animator );
   }
   else if( mImpl->mRenderer )
   {
-    index = GetPropertyIndex( animator.propertyKey );
+    AnimateRendererProperty(transition, animator);
   }
+}
 
-  // Set target value into data store
-  if( animator.targetValue.GetType() != Property::NONE )
+void Visual::Base::AnimateOpacityProperty(
+  Dali::Animation& transition,
+  Internal::TransitionData::Animator& animator )
+{
+  Property::Index index = mImpl->mOpacityIndex;
+
+  bool isOpaque = mImpl->mMixColor.a >= 1.0f;
+
+  if( index != Property::INVALID_INDEX )
   {
-    if( isMixColor )
+    float initialOpacity;
+    if( animator.initialValue.Get( initialOpacity ) )
+    {
+      isOpaque = (initialOpacity >= 1.0f);
+    }
+
+    float targetOpacity;
+    if( animator.targetValue.Get( targetOpacity ) )
     {
-      animator.targetValue.Get( mImpl->mMixColor );
+      mImpl->mMixColor.a = targetOpacity;
     }
-    else
+
+    SetupTransition( transition, animator, index, animator.initialValue, animator.targetValue );
+    SetupBlendMode( transition, isOpaque, animator.animate );
+  }
+}
+
+void Visual::Base::AnimateRendererProperty(
+  Dali::Animation& transition,
+  Internal::TransitionData::Animator& animator )
+{
+  Property::Index index = GetPropertyIndex( animator.propertyKey );
+  if( index != Property::INVALID_INDEX )
+  {
+    if( animator.targetValue.GetType() != Property::NONE )
     {
-      // Note: there may be several of these calls if more than one
-      // transform property is animated.
+      // Try writing target value into transform property map
+      // if it's not a valid key, then it won't alter mTransform
       Property::Map map;
       if( animator.propertyKey.type == Property::Key::INDEX )
       {
@@ -479,28 +554,82 @@ void Visual::Base::AnimateProperty(
 
       mImpl->mTransform.UpdatePropertyMap( map );
     }
+
+    SetupTransition( transition, animator, index, animator.initialValue, animator.targetValue );
   }
+}
+
+void Visual::Base::AnimateMixColorProperty(
+  Dali::Animation& transition,
+  Internal::TransitionData::Animator& animator )
+{
+  Property::Index index = mImpl->mMixColorIndex;
+  bool animateOpacity = false;
+  bool isOpaque = true;
+
+  Property::Value initialOpacity;
+  Property::Value targetOpacity;
+  Property::Value initialMixColor;
+  Property::Value targetMixColor;
 
   if( index != Property::INVALID_INDEX )
   {
-    SetupTransition( transition, animator, index );
+    Vector4 initialColor;
+    if( animator.initialValue.Get(initialColor) )
+    {
+      if( animator.initialValue.GetType() == Property::VECTOR4 )
+      {
+        // if there is an initial color specifying alpha, test it
+        isOpaque = initialColor.a >= 1.0f;
+        initialOpacity = initialColor.a;
+      }
+      initialMixColor = Vector3( initialColor );
+    }
 
-    // For mix color, ensure the blend mode is on if the initial or final values are not opaque,
-    // and that it is turned off after the animation ends if the final value is opaque
-    if( isMixColor && (!isMixColorOpaque || mImpl->mMixColor.a < 1.0f) )
+    // Set target value into data store
+    if( animator.targetValue.GetType() != Property::NONE )
     {
-      mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
+      Vector4 mixColor;
+      animator.targetValue.Get(mixColor);
+      if( animator.targetValue.GetType() == Property::VECTOR4 )
+      {
+        mImpl->mMixColor.a = mixColor.a;
+        targetOpacity = mixColor.a;
+        animateOpacity = true;
+      }
 
-      if( animator.animate == true && mImpl->mMixColor.a >= 1.0f )
+      mImpl->mMixColor.r = mixColor.r;
+      mImpl->mMixColor.g = mixColor.g;
+      mImpl->mMixColor.b = mixColor.b;
+      targetMixColor = Vector3(mixColor);
+    }
+
+    SetupTransition( transition, animator, index, initialMixColor, targetMixColor );
+    if( animateOpacity )
+    {
+      SetupTransition( transition, animator, mImpl->mOpacityIndex, initialOpacity, targetOpacity );
+      SetupBlendMode( transition, isOpaque, animator.animate );
+    }
+  }
+}
+
+void Visual::Base::SetupBlendMode( Animation& transition, bool isInitialOpaque, bool animating )
+{
+  // Ensure the blend mode is turned on if we are animating opacity, and
+  // turned off after the animation ends if the final value is opaque
+  if( ! isInitialOpaque || mImpl->mMixColor.a < 1.0f )
+  {
+    mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
+
+    if( animating == true && mImpl->mMixColor.a >= 1.0f )
+    {
+      // When it becomes opaque, set the blend mode back to automatically
+      if( ! mImpl->mBlendSlotDelegate )
       {
-        // When it becomes opaque, set the blend mode back to automatically
-        if( ! mImpl->mBlendSlotDelegate )
-        {
-          mImpl->mBlendSlotDelegate = new SlotDelegate<Visual::Base>(this);
-        }
-        transition.FinishedSignal().Connect( *(mImpl->mBlendSlotDelegate),
-                                             &Visual::Base::OnMixColorFinished );
+        mImpl->mBlendSlotDelegate = new SlotDelegate<Visual::Base>(this);
       }
+      transition.FinishedSignal().Connect( *(mImpl->mBlendSlotDelegate),
+                                           &Visual::Base::OnMixColorFinished );
     }
   }
 }
index 1722964..e7d8ddd 100644 (file)
@@ -166,12 +166,18 @@ public:
   Renderer GetRenderer();
 
   /**
-   * Sets the mix color of the visual.
+   * Sets the mix color ( including opacity )  of the visual.
    * @param[in] mixColor The new mix color
    */
   void SetMixColor( const Vector4& color );
 
   /**
+   * Sets the mix color of the visual.
+   * @param[in] mixColor The new mix color
+   */
+  void SetMixColor( const Vector3& color );
+
+  /**
    * Gets the mix color of the visual.
    * @return The mix color
    */
@@ -285,10 +291,62 @@ private:
    * @param[in] transition The transition to use or set up.
    * @param[in] animator The animation data to use
    * @param[in] index The property index on the renderer to animate
+   * @param[in] initialValue The optional initial value
+   * @param[in] targetValue The target value to use
    */
   void SetupTransition( Dali::Animation& transition,
                         Internal::TransitionData::Animator& animator,
-                        Property::Index index );
+                        Property::Index index,
+                        Property::Value& initialValue,
+                        Property::Value& targetValue );
+
+  /**
+   * Animate the opacity property - Special handling to
+   * ensure that the blend mode is set to ON whilst animating,
+   * and set back to AUTO if it's opaque at the end of the
+   * animation.
+   *
+   * @param[in] transition The transition to use or set up.
+   * @param[in] animator The animation data to use
+   */
+  void AnimateOpacityProperty( Dali::Animation& transition,
+                               Internal::TransitionData::Animator& animator );
+
+  /**
+   * Animate the renderer property - no special handling
+   *
+   * @param[in] transition The transition to use or set up.
+   * @param[in] animator The animation data to use
+   */
+  void AnimateRendererProperty( Dali::Animation& transition,
+                                Internal::TransitionData::Animator& animator );
+
+  /**
+   * Animate the mix color property.
+   *
+   * If the animator is a vec3, then it only animates the color
+   * channels without animating the opacity.  If it's a vec4, then it
+   * runs 2 animators, one for the the vec3 mixColor, and one for the
+   * opacity. (They are separate uniforms in the shader )
+   *
+   * @param[in] transition The transition to use or set up.
+   * @param[in] animator The animation data to use
+   */
+  void AnimateMixColorProperty( Dali::Animation& transition,
+                                Internal::TransitionData::Animator& animator );
+
+  /**
+   * Set up the right blend mode if the opacity is being animated.
+   * Also ensure that when the animation finishes, the blend mode is
+   * set to the appropriate value. It also uses the target value as
+   * set into mMixColor.
+   *
+   * @param[in] transition The transition to listen to
+   * @param[in] isInitialOpaque Whether the initial value is opaque
+   * @param[in] animating If the transition animates the value.
+   */
+  void SetupBlendMode( Dali::Animation& transition,
+                       bool isInitialOpaque, bool animating );
 
   /**
    * When a mix color animation has finished, ensure the blend mode is set back
index 864227e..c57a8cf 100644 (file)
@@ -66,6 +66,7 @@ const char * const PREMULTIPLIED_ALPHA( "premultipliedAlpha" );
 
 // Mix color
 const char * const MIX_COLOR( "mixColor" );
+const char * const OPACITY( "opacity" );
 
 // Image visual
 const char * const IMAGE_URL_NAME( "url" );
index 8079d34..1a8df73 100644 (file)
@@ -56,6 +56,7 @@ extern const char * const PREMULTIPLIED_ALPHA;
 
 // Mix color
 extern const char * const MIX_COLOR;
+extern const char * const OPACITY;
 
 // Image visual
 extern const char * const IMAGE_URL_NAME;
index 0a5221d..764ba27 100644 (file)
@@ -67,12 +67,13 @@ void main()\n
 );
 
 const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(\n
-uniform lowp vec4 uColor;\n
-uniform lowp vec4 mixColor;\n
+  uniform lowp vec4 uColor;\n
+  uniform lowp vec3 mixColor;\n
+  uniform lowp float opacity;\n
 \n
 void main()\n
 {\n
-  gl_FragColor = uColor*mixColor;\n
+  gl_FragColor = uColor * vec4( mixColor, opacity );\n
 }\n
 );
 
index 3f58064..e77c28b 100644 (file)
@@ -59,6 +59,22 @@ extern bool CaseInsensitiveStringCompare( const std::string& a, const std::strin
 namespace Toolkit
 {
 
+namespace Internal
+{
+
+extern const Dali::Scripting::StringEnum ControlStateTable[];
+extern const unsigned int ControlStateTableCount;
+
+
+// Not static or anonymous - shared with other translation units
+const Scripting::StringEnum ControlStateTable[] = {
+  { "NORMAL",   Toolkit::DevelControl::NORMAL   },
+  { "FOCUSED",  Toolkit::DevelControl::FOCUSED  },
+  { "DISABLED", Toolkit::DevelControl::DISABLED },
+}; const unsigned int ControlStateTableCount = sizeof( ControlStateTable ) / sizeof( ControlStateTable[0] );
+
+} // Internal namespace
+
 namespace
 {
 
@@ -218,12 +234,6 @@ static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tra
   return connected;
 }
 
-const Scripting::StringEnum ControlStateTable[] = {
-  { "NORMAL",   Toolkit::DevelControl::NORMAL   },
-  { "FOCUSED",  Toolkit::DevelControl::FOCUSED  },
-  { "DISABLED", Toolkit::DevelControl::DISABLED },
-}; const unsigned int ControlStateTableCount = sizeof( ControlStateTable ) / sizeof( ControlStateTable[0] );
-
 // Setup signals and actions using the type-registry.
 DALI_TYPE_REGISTRATION_BEGIN( Control, CustomActor, Create );
 
@@ -254,7 +264,7 @@ public:
   Impl(Control& controlImpl)
   : mControlImpl( controlImpl ),
     mState( Toolkit::DevelControl::NORMAL ),
-    mSubState(""),
+    mSubStateName(""),
     mStyleName(""),
     mBackgroundColor(Color::TRANSPARENT),
     mStartingPinchScale( NULL ),
@@ -323,11 +333,27 @@ public:
 
         case Toolkit::DevelControl::Property::STATE:
         {
-          Toolkit::DevelControl::State state( controlImpl.mImpl->mState );
+          bool withTransitions=true;
+          const Property::Value* valuePtr=&value;
+          Property::Map* map = value.GetMap();
+          if(map)
+          {
+            Property::Value* value2 = map->Find("withTransitions");
+            if( value2 )
+            {
+              withTransitions = value2->Get<bool>();
+            }
+
+            valuePtr = map->Find("state");
+          }
 
-          if( Scripting::GetEnumerationProperty< Toolkit::DevelControl::State >( value, ControlStateTable, ControlStateTableCount, state ) )
+          if( valuePtr )
           {
-            controlImpl.mImpl->SetState( state );
+            Toolkit::DevelControl::State state( controlImpl.mImpl->mState );
+            if( Scripting::GetEnumerationProperty< Toolkit::DevelControl::State >( *valuePtr, ControlStateTable, ControlStateTableCount, state ) )
+            {
+              controlImpl.mImpl->SetState( state, withTransitions );
+            }
           }
         }
         break;
@@ -443,7 +469,13 @@ public:
 
         case Toolkit::DevelControl::Property::STATE:
         {
-          value = Scripting::GetEnumerationName< Toolkit::DevelControl::State >( controlImpl.mImpl->mState, ControlStateTable, ControlStateTableCount );
+          value = controlImpl.mImpl->mState;
+          break;
+        }
+
+        case Toolkit::DevelControl::Property::SUB_STATE:
+        {
+          value = controlImpl.mImpl->mSubStateName;
           break;
         }
 
@@ -503,7 +535,7 @@ public:
     return value;
   }
 
-  void SetState( DevelControl::State state )
+  void SetState( DevelControl::State state, bool withTransitions=true )
   {
     if( mState != state )
     {
@@ -531,13 +563,57 @@ public:
     }
   }
 
-  void SetSubState( const std::string& state )
+  void SetSubState( const std::string& subStateName, bool withTransitions=true )
   {
-    if( mSubState != state )
+    if( mSubStateName != subStateName )
     {
-      mSubState = state;
-      // Trigger transitions
+      // Get existing sub-state visuals, and unregister them
+      Dali::CustomActor handle( mControlImpl.GetOwner() );
+
+      Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
+      if( styleManager )
+      {
+        const StylePtr stylePtr = GetImpl( styleManager ).GetRecordedStyle( Toolkit::Control( mControlImpl.GetOwner() ) );
+        if( stylePtr )
+        {
+          // Stringify state
+          std::string stateName = Scripting::GetEnumerationName< Toolkit::DevelControl::State >( mState, ControlStateTable, ControlStateTableCount );
+
+          const StylePtr* state = stylePtr->subStates.Find( stateName );
+          if( state )
+          {
+            StylePtr stateStyle(*state);
+
+            // Unregister existing visuals of this substate
+            const StylePtr* subState = stateStyle->subStates.Find( mSubStateName );
+            if( subState )
+            {
+              StylePtr subStateStyle(*subState);
+
+              for( Dictionary<Property::Map>::iterator iter = subStateStyle->visuals.Begin(); iter != subStateStyle->visuals.End(); ++iter )
+              {
+                const std::string& visualName = (*iter).key;
+                Dali::Property::Index index = handle.GetPropertyIndex( visualName );
+                if( index != Property::INVALID_INDEX )
+                {
+                  mControlImpl.UnregisterVisual( index );
+                }
+              }
+            }
+
+            // Register visuals of the new substate
+            const StylePtr* newSubState = stateStyle->subStates.Find( subStateName );
+            if( newSubState )
+            {
+              StylePtr newSubStateStyle(*newSubState);
+              newSubStateStyle->ApplyVisuals( handle );
+              newSubStateStyle->ApplyProperties( handle );
+            }
+          }
+        }
+      }
 
+      mSubStateName = subStateName;
     }
   }
 
@@ -545,7 +621,7 @@ public:
 
   Control& mControlImpl;
   DevelControl::State mState;
-  std::string mSubState;
+  std::string mSubStateName;
 
   RegisteredVisualContainer mVisuals; // Stores visuals needed by the control, non trivial type so std::vector used.
   std::string mStyleName;
index 6ebc98e..99eb453 100644 (file)
@@ -31,7 +31,7 @@ namespace Toolkit
 
 const unsigned int TOOLKIT_MAJOR_VERSION = 1;
 const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 27;
+const unsigned int TOOLKIT_MICRO_VERSION = 28;
 const char * const TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index f6f2361..84470a9 100644 (file)
@@ -32,12 +32,24 @@ namespace Toolkit
  * @{
  */
 
+/**
+ * @brief BorderVisual is to render a solid color as an internal border to the control's quad.
+ * @SINCE_1_1.45
+ */
 namespace BorderVisual
 {
 
+/**
+ * @brief BorderVisual Property
+ * @SINCE_1_1.45
+ */
 namespace Property
 {
 
+/**
+ * @brief BorderVisual Property
+ * @SINCE_1_1.45
+ */
 enum
 {
   /**
index 5a23abc..fb87e54 100644 (file)
@@ -32,12 +32,24 @@ namespace Toolkit
  * @{
  */
 
+/**
+ * @brief ColorVisual is to render a solid color to the control's quad.
+ * @SINCE_1_1.45
+ */
 namespace ColorVisual
 {
 
+/**
+ * @brief ColorVisual Property
+ * @SINCE_1_1.45
+ */
 namespace Property
 {
 
+/**
+ * @brief ColorVisual Property
+ * @SINCE_1_1.45
+ */
 enum
 {
   /**
index 9c3929f..ae895ca 100644 (file)
@@ -32,12 +32,24 @@ namespace Toolkit
  * @{
  */
 
+/**
+ * @brief GradientVisual is to render a smooth transition of colors to the control's quad.
+ * @SINCE_1_1.45
+ */
 namespace GradientVisual
 {
 
+/**
+ * @brief GradientVisual Property
+ * @SINCE_1_1.45
+ */
 namespace Property
 {
 
+/**
+ * @brief GradientVisual Property
+ * @SINCE_1_1.45
+ */
 enum
 {
   /**
@@ -109,6 +121,14 @@ enum
 
 } // namespace Property
 
+/**
+ * @brief The type of coordinate system for certain attributes of the points in a gradient.
+ *
+ * This applies to the:
+ * - Start (x1, y1) and End (x2 and y2) points of a line if using a linear gradient.
+ * - Center point (cx, cy) and radius (r) of a circle if using a radial gradient.
+ * @SINCE_1_1.45
+ */
 namespace Units
 {
 
@@ -118,6 +138,7 @@ namespace Units
  * This applies to the:
  * - Start (x1, y1) and End (x2 and y2) points of a line if using a linear gradient.
  * - Center point (cx, cy) and radius (r) of a circle if using a radial gradient.
+ * @SINCE_1_1.45
  */
 enum Type
 {
@@ -127,11 +148,16 @@ enum Type
 
 } // namespace Units
 
+/**
+ * @brief Policies that define what happens if the gradient starts or ends inside the bounds of the target rectangle.
+ * @SINCE_1_1.45
+ */
 namespace SpreadMethod
 {
 
 /**
  * @brief Policies that define what happens if the gradient starts or ends inside the bounds of the target rectangle.
+ * @SINCE_1_1.45
  */
 enum Type
 {
index fd08176..edd94cc 100644 (file)
@@ -32,12 +32,24 @@ namespace Toolkit
  * @{
  */
 
+/**
+ * @brief ImageVisual is to render an image into the control's quad.
+ * @SINCE_1_1.45
+ */
 namespace ImageVisual
 {
 
+/**
+ * @brief ImageVisual Property
+ * @SINCE_1_1.45
+ */
 namespace Property
 {
 
+/**
+ * @brief ImageVisual Property
+ * @SINCE_1_1.45
+ */
 enum
 {
   /**
index d9b7348..765fce7 100644 (file)
@@ -32,12 +32,24 @@ namespace Toolkit
  * @{
  */
 
+/**
+ * @brief MeshVisual is to render a mesh using a .obj file, optionally with textures provided by a mtl file.
+ * @SINCE_1_1.45
+ */
 namespace MeshVisual
 {
 
+/**
+ * @brief MeshVisual Property
+ * @SINCE_1_1.45
+ */
 namespace Property
 {
 
+/**
+ * @brief MeshVisual Property
+ * @SINCE_1_1.45
+ */
 enum
 {
   /**
@@ -103,9 +115,17 @@ enum
 
 } // namespace Property
 
+/**
+ * @brief The shading mode used by MeshVisual.
+ * @SINCE_1_1.45
+ */
 namespace ShadingMode
 {
 
+/**
+ * @brief The shading mode used by MeshVisual.
+ * @SINCE_1_1.45
+ */
 enum Value
 {
   TEXTURELESS_WITH_DIFFUSE_LIGHTING, ///< *Simplest*. One color that is lit by ambient and diffuse lighting. @SINCE_1_1.45
index 4b31dc6..12f56e5 100644 (file)
@@ -32,12 +32,24 @@ namespace Toolkit
  * @{
  */
 
+/**
+ * @brief PrimitiveVisual is to render a simple 3D shape, such as a cube or sphere.
+ * @SINCE_1_1.45
+ */
 namespace PrimitiveVisual
 {
 
+/**
+ * @brief PrimitiveVisual Property
+ * @SINCE_1_1.45
+ */
 namespace Property
 {
 
+/**
+ * @brief PrimitiveVisual Property
+ * @SINCE_1_1.45
+ */
 enum
 {
   /**
@@ -182,11 +194,16 @@ enum
 
 } // namespace Property
 
+/**
+ * @brief The primitive shape to render as a PrimitiveVisual.
+ * @SINCE_1_1.45
+ */
 namespace Shape
 {
 
 /**
- * @brief The primitive shape to render.
+ * @brief The primitive shape to render as a PrimitiveVisual.
+ * @SINCE_1_1.45
  */
 enum Type
 {
index 65d452a..ee24889 100644 (file)
@@ -32,6 +32,10 @@ namespace Toolkit
  * @{
  */
 
+/**
+ * @brief All the visual types
+ * @SINCE_1_1.45
+ */
 namespace Visual
 {
 
@@ -50,9 +54,17 @@ enum Type
   WIREFRAME ///< Renders a simple wire-frame outlining a quad. @SINCE_1_2_2
 };
 
+/**
+ * @brief Visual Property
+ * @SINCE_1_1.45
+ */
 namespace Property
 {
 
+/**
+ * @brief Visual Property
+ * @SINCE_1_1.45
+ */
 enum
 {
   /**
@@ -77,12 +89,24 @@ enum
 
 } // namespace Property
 
+/**
+ * @brief Shader for Visuals
+ * @SINCE_1_1.45
+ */
 namespace Shader
 {
 
+/**
+ * @brief Shader Property
+ * @SINCE_1_1.45
+ */
 namespace Property
 {
 
+/**
+ * @brief The type of Shader
+ * @SINCE_1_1.45
+ */
 enum
 {
   /**
index 6aeaded..ff865b0 100644 (file)
       "popupPressedColor":[0.24,0.72,0.8,0.11],
       "background": {
         "rendererType": "image",
-        "url": "{DALI_IMAGE_DIR}selection-popup-bg.9.png"
+        "url": "{DALI_IMAGE_DIR}selection-popup-background.9.png"
+        },
+      "backgroundBorder": {
+        "visualType": "IMAGE",
+        "url": "{DALI_IMAGE_DIR}selection-popup-border.9.png",
+        "mixColor":[0.24,0.72,0.8,1.0]
         },
       "popupFadeInDuration":0.25,
       "popupFadeOutDuration":0.25
         "overshootSize":[1920.0,130.0]
       }
     },
+    "TextSelectionScrollBar":
+    {
+      "indicatorShowDuration":0.25,
+      "indicatorHideDuration":0.25
+    },
+    "TextSelectionScrollIndicator":
+    {
+      "image":
+      {
+        "visualType":"IMAGE",
+        "url":"{DALI_IMAGE_DIR}text_selection_scroll_indicator.9.png"
+      },
+      "color":[0.0,0.72,0.9,0.7]
+    },
     "ScrollView":
     {
       "overshootEffectColor":"B018",
index 23af0f7..105b87b 100644 (file)
       "popupPressedColor":[0.24,0.72,0.8,0.11],
       "background": {
         "visualType": "IMAGE",
-        "url": "{DALI_IMAGE_DIR}selection-popup-bg.9.png"
+        "url": "{DALI_IMAGE_DIR}selection-popup-background.9.png"
+        },
+      "backgroundBorder": {
+        "visualType": "IMAGE",
+        "url": "{DALI_IMAGE_DIR}selection-popup-border.9.png",
+        "mixColor":[0.24,0.72,0.8,1.0]
         },
       "popupFadeInDuration":0.25,
       "popupFadeOutDuration":0.25
       "image":
       {
         "visualType":"IMAGE",
-        "url":"{DALI_IMAGE_DIR}text_selection_scroll_indicator.9.png"
+        "url":"{DALI_IMAGE_DIR}text_selection_scroll_indicator.9.png" // designed for HD resolution
       },
-      "color":[0.0,0.72,0.9,0.7]
+      "color":[0.0,0.72,0.9,0.7],
+      "scale":[0.625,1.0,1.0] // Note: This reduces height for WVGA resolution
     },
     "ScrollView":
     {
index d846c0f..db96431 100644 (file)
       "popupPressedColor":[0.24,0.72,0.8,0.11],
       "background": {
         "visualType": "IMAGE",
-        "url": "{DALI_IMAGE_DIR}selection-popup-bg.9.png"
+        "url": "{DALI_IMAGE_DIR}selection-popup-background.9.png"
+        },
+      "backgroundBorder": {
+        "visualType": "IMAGE",
+        "url": "{DALI_IMAGE_DIR}selection-popup-border.9.png",
+        "mixColor":[0.24,0.72,0.8,1.0]
         },
       "popupFadeInDuration":0.25,
       "popupFadeOutDuration":0.25
         "overshootSize":[720.0,130.0]
       }
     },
+    "TextSelectionScrollBar":
+    {
+      "indicatorShowDuration":0.25,
+      "indicatorHideDuration":0.25
+    },
+    "TextSelectionScrollIndicator":
+    {
+      "image":
+      {
+        "visualType":"IMAGE",
+        "url":"{DALI_IMAGE_DIR}text_selection_scroll_indicator.9.png"
+      },
+      "color":[0.0,0.72,0.9,0.7]
+    },
     "ScrollView":
     {
       "overshootEffectColor":"B018",
diff --git a/dali-toolkit/styles/images-common/selection-popup-background.9.png b/dali-toolkit/styles/images-common/selection-popup-background.9.png
new file mode 100644 (file)
index 0000000..0b59668
Binary files /dev/null and b/dali-toolkit/styles/images-common/selection-popup-background.9.png differ
diff --git a/dali-toolkit/styles/images-common/selection-popup-border.9.png b/dali-toolkit/styles/images-common/selection-popup-border.9.png
new file mode 100644 (file)
index 0000000..d7454f5
Binary files /dev/null and b/dali-toolkit/styles/images-common/selection-popup-border.9.png differ
index 6f95ef9..e7ceeab 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali-addon
 Summary:    DALi module for Node.JS
-Version:    1.2.27
+Version:    1.2.28
 Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
index 674104f..c1a14e9 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali-toolkit
 Summary:    The OpenGLES Canvas Core Library Toolkit
-Version:    1.2.27
+Version:    1.2.28
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-2-Clause and MIT
@@ -22,7 +22,7 @@ BuildRequires:  dali-adaptor-devel
 
 #need libtzplatform-config for directory if tizen version is 3.x
 
-%if "%{tizen_version_major}" == "3"
+%if 0%{?tizen_version_major} >= 3
 BuildRequires:  pkgconfig(libtzplatform-config)
 %endif
 
index 808cd07..8017ecc 100644 (file)
@@ -290,8 +290,8 @@ DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, RelayoutContainer );
 DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Radian );
 DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, Radian );
 
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Quaternion );
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, Quaternion );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Quaternion, Rotation );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Quaternion, Rotation );
 DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Matrix );
 DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, Matrix );
 DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Matrix3 );
index 894b34f..29ed172 100644 (file)
 %}
 
 %typemap(cscode) Dali::Quaternion %{
-  public static Quaternion operator+(Quaternion arg1, Quaternion arg2) {
+  public static Rotation operator+(Rotation arg1, Rotation arg2) {
     return arg1.Add(arg2);
   }
 
-  public static Quaternion operator-(Quaternion arg1, Quaternion arg2) {
+  public static Rotation operator-(Rotation arg1, Rotation arg2) {
     return arg1.Subtract(arg2);
   }
 
-  public static Quaternion operator-(Quaternion arg1) {
+  public static Rotation operator-(Rotation arg1) {
     return arg1.Subtract();
   }
 
-  public static Quaternion operator*(Quaternion arg1, Quaternion arg2) {
+  public static Rotation operator*(Rotation arg1, Rotation arg2) {
     return arg1.Multiply(arg2);
   }
 
-  public static Vector3 operator*(Quaternion arg1, Vector3 arg2) {
+  public static Vector3 operator*(Rotation arg1, Vector3 arg2) {
     return arg1.Multiply(arg2);
   }
 
-  public static Quaternion operator*(Quaternion arg1, float arg2) {
+  public static Rotation operator*(Rotation arg1, float arg2) {
     return arg1.Multiply(arg2);
   }
 
-  public static Quaternion operator/(Quaternion arg1, Quaternion arg2) {
+  public static Rotation operator/(Rotation arg1, Rotation arg2) {
     return arg1.Divide(arg2);
   }
 
-  public static Quaternion operator/(Quaternion arg1, float arg2) {
+  public static Rotation operator/(Rotation arg1, float arg2) {
     return arg1.Divide(arg2);
   }
 %}
index 946a250..d70cc93 100755 (executable)
 %rename(ExceedPolicyType) Dali::Toolkit::TextField::ExceedPolicy;
 %rename(ToolkitPropertyRange) Dali::Toolkit::PropertyRanges;
 %rename(TooltipPositionType) Dali::Toolkit::Tooltip::Position::Type;
+%rename(DirectionType) Dali::Toolkit::Direction::Type;
+%rename(AlignType) Dali::Toolkit::Align::Type;
 %rename(VisualType) Dali::Toolkit::Visual::Type;
 %rename(VisualTransformPropertyType) Dali::Toolkit::DevelVisual::Transform::Property::Type;
 %rename(VISUAL_SHADER_VERTEX) Dali::Toolkit::Visual::Shader::Property::VERTEX_SHADER;
 %csconstvalue("1 << 5") REQUIRES_KEYBOARD_NAVIGATION_SUPPORT;
 %csconstvalue("1 << 6") DISABLE_STYLE_CHANGE_SIGNALS;
 
+%typemap(csclassmodifiers) Dali::Toolkit::Alignment "internal class"
+
 typedef unsigned int ItemId;
 typedef std::vector<ItemId> ItemIdContainer;
 typedef std::pair<ItemId, Actor> Item;
@@ -285,6 +289,8 @@ typedef Dali::IntrusivePtr<Dali::Toolkit::Ruler> RulerPtr;
 %include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-portrait-view.h>
 %include <dali-toolkit/devel-api/controls/buttons/toggle-button.h>
 
+%include <dali-toolkit/devel-api/align-enums.h>
+
 %include <dali-toolkit/devel-api/visual-factory/visual-base.h>
 %include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
 
index aeb8558..4473091 100755 (executable)
@@ -283,6 +283,7 @@ using namespace Dali::Toolkit;
 %include events/videoview-event.i
 
 %include alphafunction.i
+%include rotation.i
 %include name-changed.i
 %include property-value.i
 %include dali-operator.i
index 4d277de..2b24a7c 100755 (executable)
@@ -28,6 +28,7 @@
 
 %typemap(cscode) Dali::Actor::Property %{
   public static readonly int SIBLING_ORDER = NDalicManualPINVOKE.Actor_Property_SIBLING_ORDER_get();
+  public static readonly int OPACITY = NDalicManualPINVOKE.Actor_Property_OPACITY_get();
 %}
 
 %typemap(cscode) Dali::Toolkit::Control::Property %{
index 138120a..f4d6d1c 100755 (executable)
        return (IntPtr)swigCPtr;
     }
 
+    public Position CurrentPosition
+    {
+      get
+      {
+        return GetCurrentPosition();
+      }
+    }
+
+    public Size3D CurrentSize
+    {
+      get
+      {
+        return GetCurrentSize();
+      }
+    }
+
     public Actor Parent
     {
       get
       {
         return IsVisible();
       }
-    }
+   }
 
-   public float Opacity
-   {
-      set
+    public float Opacity
+    {
+      get
       {
-        SetOpacity(value);
+        float temp = 0;
+        GetProperty( Actor.Property.OPACITY ).Get( ref temp );
+        return temp;
       }
-      get
+      set
       {
-        return GetCurrentOpacity();
+        SetProperty( Actor.Property.OPACITY, new Dali.Property.Value( value ) );
       }
-   }
+    }
 
     public bool StateFocusEnable
     {
       get
       {
         int temp = 0;
-        GetProperty( Actor.Property.SIBLING_ORDER).Get( ref temp );
+        GetProperty( Actor.Property.SIBLING_ORDER ).Get( ref temp );
         return temp;
       }
       set
diff --git a/plugins/dali-swig/SWIG/rotation.i b/plugins/dali-swig/SWIG/rotation.i
new file mode 100755 (executable)
index 0000000..f243b99
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%rename(Rotation) Dali::Quaternion;
+%rename(GetAxisAngle) Dali::Quaternion::ToAxisAngle;
+
+%ignore Dali::Quaternion::Quaternion( Radian pitch, Radian yaw, Radian roll );
+%ignore Dali::Quaternion::Quaternion(const Matrix& matrix);
+%ignore Dali::Quaternion::Quaternion( const Vector4& vector );
+%ignore Dali::Quaternion::Quaternion( const Vector3& v0, const Vector3& v1 );
+%ignore Dali::Quaternion::Quaternion( const Vector3& xAxis, const Vector3& yAxis, const Vector3& zAxis );
+%ignore Dali::Quaternion::Quaternion( float cosThetaBy2, float iBySineTheta, float jBySineTheta, float kBySineTheta );
+%ignore Dali::Quaternion::SetEuler( Radian pitch, Radian yaw, Radian roll );
+%ignore Dali::Quaternion::EulerAngles() const;
+%ignore Dali::Quaternion::AsVector() const;
+%ignore Dali::Quaternion::Rotate( const Vector4& vector ) const;
+%ignore Dali::Quaternion::Rotate( const Vector3& vector ) const;
+%ignore Dali::Quaternion::mVector;
+
+%csmethodmodifiers Dali::Quaternion::operator+ "private";
+%csmethodmodifiers Dali::Quaternion::operator- "private";
+%csmethodmodifiers Dali::Quaternion::operator* "private";
+%csmethodmodifiers Dali::Quaternion::operator/ "private";
+%csmethodmodifiers Dali::Quaternion::operator+= "private";
+%csmethodmodifiers Dali::Quaternion::operator-= "private";
+%csmethodmodifiers Dali::Quaternion::operator*= "private";
+%csmethodmodifiers Dali::Quaternion::operator/= "private";
+%csmethodmodifiers Dali::Quaternion::operator== "private";
+%csmethodmodifiers Dali::Quaternion::operator!= "private";
index 314c9a8..a392996 100755 (executable)
@@ -81,14 +81,14 @@ namespace MyCSharpExample
           StartTime = 0,
           EndTime = 500,
           TargetProperty = "Orientation",
-          Destination = new Quaternion( new Radian( new Degree( 180.0f ) ), Vect3.Xaxis)
+          Destination = new Rotation( new Radian( new Degree( 180.0f ) ), Vect3.Xaxis)
         };
         _animation.AnimateTo(_text);
 
         _animation.StartTime = 500;
         _animation.EndTime = 1000;
         _animation.TargetProperty = "Orientation";
-        _animation.Destination = new Quaternion( new Radian( new Degree( 0.0f ) ), Vect3.Xaxis );
+        _animation.Destination = new Rotation( new Radian( new Degree( 0.0f ) ), Vect3.Xaxis );
         _animation.AnimateTo(_text);
 
         _animation.StartTime = 1000;
index 834c4bd..cc42168 100755 (executable)
@@ -115,7 +115,7 @@ namespace MyCSharpExample
       _scrollBar.AnchorPoint = NDalic.AnchorPointTopLeft;
       _scrollBar.SetResizePolicy(ResizePolicyType.FIT_TO_CHILDREN, DimensionType.WIDTH);
       _scrollBar.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.HEIGHT);
-      _scrollBar.Orientation = new Quaternion( new Radian( new Degree( 270.0f ) ), Vector3.ZAXIS );
+      _scrollBar.Orientation = new Rotation( new Radian( new Degree( 270.0f ) ), Vector3.ZAXIS );
       _scrollBar.SetScrollDirection(ScrollBar.Direction.Horizontal);
       _scrollView.Add(_scrollBar);
 
@@ -165,8 +165,8 @@ namespace MyCSharpExample
 
         _animation = new Animation(1.0f); // 1 second of duration
 
-        _animation.AnimateTo(new Property(_text, Actor.Property.ORIENTATION), new Property.Value(new Quaternion( new Radian( new Degree( 180.0f ) ), Vector3.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.Linear), new TimePeriod(0.0f, 0.5f));
-        _animation.AnimateTo(new Property(_text, Actor.Property.ORIENTATION), new Property.Value(new Quaternion( new Radian( new Degree( 0.0f ) ), Vector3.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.Linear), new TimePeriod(0.5f, 0.5f));
+        _animation.AnimateTo(new Property(_text, Actor.Property.ORIENTATION), new Property.Value(new Rotation( new Radian( new Degree( 180.0f ) ), Vector3.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.Linear), new TimePeriod(0.0f, 0.5f));
+        _animation.AnimateTo(new Property(_text, Actor.Property.ORIENTATION), new Property.Value(new Rotation( new Radian( new Degree( 0.0f ) ), Vector3.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.Linear), new TimePeriod(0.5f, 0.5f));
 
         // Connect the signal callback for animaiton finished signal
         _animation.Finished += AnimationFinished;
index bbadec9..4e96f02 100755 (executable)
@@ -42,6 +42,15 @@ SWIGEXPORT int SWIGSTDCALL CSharp_Actor_Property_SIBLING_ORDER_get() {
   return jresult;
 }
 
+SWIGEXPORT float SWIGSTDCALL CSharp_Actor_Property_OPACITY_get() {
+  int jresult ;
+  int result;
+
+  result = (float)Dali::DevelActor::Property::OPACITY;
+  jresult = (int)result;
+  return jresult;
+}
+
 SWIGEXPORT int SWIGSTDCALL CSharp_View_Property_TOOLTIP_get() {
   int jresult ;
   int result;
index 4b5d1f5..885070c 100755 (executable)
@@ -19,7 +19,6 @@ namespace Dali
 {
   namespace Constants
   {
-
     public enum TextureType
     {
       Texture2D     = Dali.TextureType.TEXTURE_2D,   ///< One 2D image                            @SINCE_1_1.43
@@ -95,6 +94,31 @@ namespace Dali
       public static readonly Dali.Vector3 Zero = Dali.Vector3.ZERO;
     }
 
+    public struct Direction
+    {
+      public enum Type
+      {
+        LeftToRight = Dali.DirectionType.LEFT_TO_RIGHT,
+        RightToLeft = Dali.DirectionType.RIGHT_TO_LEFT
+      }
+    }
+
+    public struct Align
+    {
+      public enum Type
+      {
+        TopBegin = Dali.AlignType.TOP_BEGIN,
+        TopCenter = Dali.AlignType.TOP_CENTER,
+        TopEnd = Dali.AlignType.TOP_END,
+        CenterBegin = Dali.AlignType.CENTER_BEGIN,
+        Center = Dali.AlignType.CENTER,
+        CenterEnd = Dali.AlignType.CENTER_END,
+        BottomBegin = Dali.AlignType.BOTTOM_BEGIN,
+        BottomCenter = Dali.AlignType.BOTTOM_CENTER,
+        BottomEnd = Dali.AlignType.BOTTOM_END
+      }
+    }
+
     public struct Visual
     {
       public enum Type
@@ -115,7 +139,7 @@ namespace Dali
         public static readonly int Shader = NDalic.VISUAL_PROPERTY_SHADER;
         public static readonly int Transform = NDalic.VISUAL_PROPERTY_TRANSFORM;
         public static readonly int PremultipliedAlpha = NDalic.VISUAL_PROPERTY_PREMULTIPLIED_ALPHA;
-        public static readonly int MixCOlor = NDalic.VISUAL_PROPERTY_MIX_COLOR;
+        public static readonly int MixColor = NDalic.VISUAL_PROPERTY_MIX_COLOR;
       }
 
       public struct ShaderProperty
@@ -234,6 +258,5 @@ namespace Dali
         public static readonly int BelowVisual = NDalic.TOOLTIP_TAIL_BELOW_VISUAL;
       }
     }
-
   } // namespace Constants
 } // namesapce Dali
index 82c2f2f..ea80496 100755 (executable)
@@ -190,6 +190,9 @@ namespace Dali
         [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Actor_Property_SIBLING_ORDER_get")]
         public static extern int Actor_Property_SIBLING_ORDER_get();
 
+        [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Actor_Property_OPACITY_get")]
+        public static extern int Actor_Property_OPACITY_get();
+
         [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_View_Property_TOOLTIP_get")]
         public static extern int View_Property_TOOLTIP_get();
 
index 9d6ea2d..78cb1f2 100755 (executable)
@@ -20,8 +20,8 @@ $typeTable =  [
         ["VECTOR4",     "Vector4",          "",     "Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);"],
         ["MATRIX3",     "Matrix3",          "",     "Matrix3 temp = new Matrix3();"],
         ["MATRIX",      "Matrix",           "",     "Matrix temp = new Matrix();"  ],
-        ["RECTANGLE",   "Rectangle",      "",     "Rectangle temp = new Rectangle(0,0,0,0);"],
-        ["ROTATION",    "Quaternion",       "",    "Quaternion temp = new Quaternion();"],
+        ["RECTANGLE",   "Rectangle",        "",     "Rectangle temp = new Rectangle(0,0,0,0);"],
+        ["ROTATION",    "Rotation",       "",     "Rotation temp = new Rotation();"],
         ["STRING",      "string",           "out",  "string temp;"],
         ["ARRAY",       "Dali.Property.Array",   "",     "Dali.Property.Array temp = new Dali.Property.Array();"],
         ["MAP",         "Dali.Property.Map",     "",     "Dali.Property.Map temp = new Dali.Property.Map();"],