[dali_1.1.40] Merge branch 'devel/master' 57/76557/1
authorVictor Cebollada <v.cebollada@samsung.com>
Fri, 24 Jun 2016 07:51:18 +0000 (08:51 +0100)
committerVictor Cebollada <v.cebollada@samsung.com>
Fri, 24 Jun 2016 07:53:04 +0000 (08:53 +0100)
Change-Id: I8597bf4b7fda1590b350a530d7f91fcd9a72faee

59 files changed:
automated-tests/resources/Cube.obj [new file with mode: 0644]
automated-tests/resources/TB-gloss.png [new file with mode: 0644]
automated-tests/resources/ToyRobot-Metal-Simple.mtl [new file with mode: 0644]
automated-tests/resources/ToyRobot-Metal.mtl [new file with mode: 0644]
automated-tests/resources/tb-norm.png [new file with mode: 0644]
automated-tests/resources/tbcol.png [new file with mode: 0644]
automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-Text-MultiLanguage.cpp
automated-tests/src/dali-toolkit-third-party/facebook-flexbox/layout-test-utils.h
automated-tests/src/dali-toolkit/CMakeLists.txt
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-actor-utils.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.h
automated-tests/src/dali-toolkit/utc-Dali-ControlRenderer.cpp
automated-tests/src/dali-toolkit/utc-Dali-FlexContainer.cpp
automated-tests/src/dali-toolkit/utc-Dali-ImageAtlas.cpp
automated-tests/src/dali-toolkit/utc-Dali-ImageView.cpp
automated-tests/src/dali-toolkit/utc-Dali-RendererFactory.cpp
automated-tests/src/dali-toolkit/utc-Dali-Slider.cpp
build/tizen/Makefile.am
build/tizen/dali-toolkit/Makefile.am
dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h
dali-toolkit/internal/controls/flex-container/flex-container-impl.h
dali-toolkit/internal/controls/model3d-view/model3d-view-impl.cpp
dali-toolkit/internal/controls/model3d-view/model3d-view-impl.h
dali-toolkit/internal/controls/model3d-view/obj-loader.cpp
dali-toolkit/internal/controls/model3d-view/obj-loader.h
dali-toolkit/internal/controls/renderers/mesh/mesh-renderer.cpp [new file with mode: 0644]
dali-toolkit/internal/controls/renderers/mesh/mesh-renderer.h [new file with mode: 0644]
dali-toolkit/internal/controls/renderers/renderer-factory-impl.cpp
dali-toolkit/internal/controls/renderers/renderer-factory-impl.h
dali-toolkit/internal/controls/renderers/renderer-string-constants.cpp
dali-toolkit/internal/controls/renderers/renderer-string-constants.h
dali-toolkit/internal/controls/renderers/svg/svg-rasterize-thread.cpp
dali-toolkit/internal/controls/renderers/svg/svg-renderer.cpp
dali-toolkit/internal/file.list
dali-toolkit/internal/text/decorator/text-decorator.cpp
dali-toolkit/internal/text/logical-model-impl.cpp
dali-toolkit/internal/text/multi-language-helper-functions.cpp
dali-toolkit/internal/text/multi-language-helper-functions.h
dali-toolkit/internal/text/multi-language-support-impl.cpp
dali-toolkit/internal/text/multi-language-support-impl.h
dali-toolkit/internal/text/text-controller-impl.cpp
dali-toolkit/internal/text/text-controller-impl.h
dali-toolkit/internal/text/text-controller.cpp
dali-toolkit/internal/text/text-controller.h
dali-toolkit/public-api/controls/model3d-view/model3d-view.h
dali-toolkit/public-api/dali-toolkit-version.cpp
dali-toolkit/third-party/facebook-flexbox/layout.c [moved from dali-toolkit/internal/controls/flex-container/layout.c with 100% similarity]
dali-toolkit/third-party/facebook-flexbox/layout.h [moved from dali-toolkit/internal/controls/flex-container/layout.h with 100% similarity]
dali-toolkit/third-party/file.list [new file with mode: 0644]
dali-toolkit/third-party/nanosvg/nanosvg.cc [moved from dali-toolkit/internal/controls/renderers/svg/nanosvg/nanosvg.cc with 100% similarity]
dali-toolkit/third-party/nanosvg/nanosvg.h [moved from dali-toolkit/internal/controls/renderers/svg/nanosvg/nanosvg.h with 100% similarity]
dali-toolkit/third-party/nanosvg/nanosvgrast.cc [moved from dali-toolkit/internal/controls/renderers/svg/nanosvg/nanosvgrast.cc with 100% similarity]
dali-toolkit/third-party/nanosvg/nanosvgrast.h [moved from dali-toolkit/internal/controls/renderers/svg/nanosvg/nanosvgrast.h with 100% similarity]
docs/content/images/renderers/mesh-renderer.png [new file with mode: 0644]
docs/content/shared-javascript-and-cpp-documentation/control-renderers.md
packaging/dali-toolkit.spec

diff --git a/automated-tests/resources/Cube.obj b/automated-tests/resources/Cube.obj
new file mode 100644 (file)
index 0000000..e9bc9b4
--- /dev/null
@@ -0,0 +1,42 @@
+# cube.obj
+#
+
+g cube
+
+v  0.0  0.0  0.0
+v  0.0  0.0  1.0
+v  0.0  1.0  0.0
+v  0.0  1.0  1.0
+v  1.0  0.0  0.0
+v  1.0  0.0  1.0
+v  1.0  1.0  0.0
+v  1.0  1.0  1.0
+
+vt  0.0  0.0
+vt  0.3  0.3
+vt  0.0  1.0
+vt  0.3  0.7
+vt  1.0  0.0
+vt  0.7  0.3
+vt  1.0  1.0
+vt  0.7  0.7
+
+vn  0.0  0.0  1.0
+vn  0.0  0.0 -1.0
+vn  0.0  1.0  0.0
+vn  0.0 -1.0  0.0
+vn  1.0  0.0  0.0
+vn -1.0  0.0  0.0
+
+f  1/1/2  7/7/2  5/5/2
+f  1/1/2  3/3/2  7/7/2
+f  1/1/6  4/4/6  3/3/6
+f  1/1/6  2/2/6  4/4/6
+f  3/3/3  8/8/3  7/7/3
+f  3/3/3  4/4/3  8/8/3
+f  5/5/5  7/7/5  8/8/5
+f  5/5/5  8/8/5  6/6/5
+f  1/1/4  5/5/4  6/6/4
+f  1/1/4  6/6/4  2/2/4
+f  2/2/1  6/6/1  8/8/1
+f  2/2/1  8/8/1  4/4/1
diff --git a/automated-tests/resources/TB-gloss.png b/automated-tests/resources/TB-gloss.png
new file mode 100644 (file)
index 0000000..9ed4b6c
Binary files /dev/null and b/automated-tests/resources/TB-gloss.png differ
diff --git a/automated-tests/resources/ToyRobot-Metal-Simple.mtl b/automated-tests/resources/ToyRobot-Metal-Simple.mtl
new file mode 100644 (file)
index 0000000..f699daf
--- /dev/null
@@ -0,0 +1,9 @@
+newmtl lambert3SG
+illum 4
+Kd 0.00 0.00 0.00
+Ka 0.00 0.00 0.00
+Tf 1.00 1.00 1.00
+map_Kd tbcol.png
+Ni 1.00
+Ks 0.00 0.00 0.00
+Ns 3.66
diff --git a/automated-tests/resources/ToyRobot-Metal.mtl b/automated-tests/resources/ToyRobot-Metal.mtl
new file mode 100644 (file)
index 0000000..cab3ae2
--- /dev/null
@@ -0,0 +1,11 @@
+newmtl lambert3SG
+illum 4
+Kd 0.00 0.00 0.00
+Ka 0.00 0.00 0.00
+Tf 1.00 1.00 1.00
+map_Kd tbcol.png
+bump tb-norm.png -bm 0.05
+Ni 1.00
+Ks 0.00 0.00 0.00
+map_Ks TB-gloss.png
+Ns 3.66
diff --git a/automated-tests/resources/tb-norm.png b/automated-tests/resources/tb-norm.png
new file mode 100644 (file)
index 0000000..884cc90
Binary files /dev/null and b/automated-tests/resources/tb-norm.png differ
diff --git a/automated-tests/resources/tbcol.png b/automated-tests/resources/tbcol.png
new file mode 100644 (file)
index 0000000..93d98cd
Binary files /dev/null and b/automated-tests/resources/tbcol.png differ
index 219fba1..7164972 100644 (file)
@@ -1014,7 +1014,7 @@ int UtcDaliTextLayoutMultilineText02(void)
     0.f, -13.f, 10.f,  -9.f, 18.f,  -9.f, 30.f,  -9.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f,  -0.f,
     1.f, -10.f,  9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 32.f, -2.f, 35.f, -11.f,
     1.f, -10.f, 12.f, -13.f, 19.f, -10.f, 24.f, -10.f, 32.f, -0.f, 37.f, -10.f, 45.f, -10.f, 50.f, -13.f, 58.f, -10.f, 66.f,  -0.f,
-    1.f, -13.f, 10.f,  -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f,  -0.f, 38.f,  -9.f, 49.f,  -9.f, 59.f,  -9.f, 65.f, -13.f, 68.f, -13.f, 77.f, -0.f,
+    1.f, -13.f, 10.f,  -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f,  -0.f, 39.f,  -9.f, 50.f,  -9.f, 60.f,  -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
     0.f, -13.f, 10.f,  -9.f, 18.f,  -9.f, 30.f,  -9.f, 39.f, -3.f,
   };
   struct LineRun line0 =
@@ -1069,10 +1069,10 @@ int UtcDaliTextLayoutMultilineText02(void)
   {
     { 38u, 12u },
     { 38u, 12u },
-    79.f,
+    80.f,
     15.f,
     -5.f,
-    3.f,
+    4.f,
     0.f,
     false,
     false
@@ -1660,16 +1660,16 @@ int UtcDaliTextUpdateLayout01(void)
     0.f, -9.f, 11.f, -9.f, 21.f, -9.f, 27.f, -13.f, 30.f, -13.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
     1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 30.f, -0.f,
     1.f, -10.f, 12.f, -13.f, 19.f, -10.f, 24.f, -10.f, 32.f, -0.f, 37.f, -10.f, 45.f, -10.f, 50.f, -13.f, 58.f, -10.f, 66.f, -0.f,
-    1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 38.f, -9.f, 49.f, -9.f, 59.f, -9.f, 65.f, -13.f, 68.f, -13.f, 77.f, -0.f,
-    0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -3.f, 42.f, -12.f,
-    1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 38.f, -9.f, 49.f, -9.f, 59.f, -9.f, 65.f, -13.f, 68.f, -13.f, 77.f, -0.f,
+    1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
+    0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -3.f, 42.f, -11.f,
+    1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
     0.f, -8.f, 7.f, -6.f, 12.f, -7.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 37.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f, 59.f, -10.f, 70.f, -13.f, 77.f, -10.f, 82.f, -10.f, 90.f, -0.f,
     1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 30.f, -0.f,
-    1.f, -12.f, 12.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 51.f, -9.f, 61.f, -9.f, 67.f, -13.f, 70.f, -13.f, 79.f, -0.f,
-    0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
+    1.f, -12.f, 12.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 41.f, -9.f, 52.f, -9.f, 62.f, -9.f, 68.f, -13.f, 71.f, -13.f, 80.f, -0.f,
+    0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 45.f, -10.f, 56.f, -13.f, 63.f, -10.f, 68.f, -10.f, 76.f, -0.f,
     1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 32.f, -2.f, 35.f, -11.f,
     1.f, -10.f, 12.f, -13.f, 19.f, -10.f, 24.f, -10.f, 32.f, -0.f, 37.f, -10.f, 45.f, -10.f, 50.f, -13.f, 58.f, -10.f, 66.f, -0.f,
-    1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 38.f, -9.f, 49.f, -9.f, 59.f, -9.f, 65.f, -13.f, 68.f, -13.f, 77.f, -0.f,
+    1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
     0.f, -8.f, 7.f, -6.f, 12.f, -7.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 37.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f,
   };
   struct LineRun line01 =
@@ -1715,7 +1715,7 @@ int UtcDaliTextUpdateLayout01(void)
     92.f,
     15.f,
     -5.f,
-    4.f,
+    5.f,
     0.f,
     false,
     false
@@ -1760,10 +1760,10 @@ int UtcDaliTextUpdateLayout01(void)
   {
     { 74u, 12u },
     { 74u, 12u },
-    79.f,
+    80.f,
     15.f,
     -5.f,
-    3.f,
+    4.f,
     0.f,
     false,
     false
@@ -1784,10 +1784,10 @@ int UtcDaliTextUpdateLayout01(void)
   {
     { 92u, 12u },
     { 92u, 12u },
-    78.f,
+    79.f,
     15.f,
     -5.f,
-    4.f,
+    5.f,
     0.f,
     false,
     false
@@ -1820,10 +1820,10 @@ int UtcDaliTextUpdateLayout01(void)
   {
     { 128u, 12u },
     { 128u, 12u },
-    81.f,
+    82.f,
     15.f,
     -5.f,
-    3.f,
+    4.f,
     0.f,
     false,
     false
@@ -1832,7 +1832,7 @@ int UtcDaliTextUpdateLayout01(void)
   {
     { 140u, 10u },
     { 140u, 10u },
-    76.f,
+    77.f,
     15.f,
     -5.f,
     4.f,
@@ -1868,7 +1868,7 @@ int UtcDaliTextUpdateLayout01(void)
   {
     { 166u, 12u },
     { 166u, 12u },
-    79.f,
+    80.f,
     15.f,
     -5.f,
     4.f,
@@ -2187,16 +2187,16 @@ int UtcDaliTextUpdateLayout02(void)
     0.f, -9.f, 11.f, -9.f, 21.f, -9.f, 27.f, -13.f, 30.f, -13.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
     1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 30.f, -0.f,
     1.f, -10.f, 12.f, -13.f, 19.f, -10.f, 24.f, -10.f, 32.f, -0.f, 37.f, -10.f, 45.f, -10.f, 50.f, -13.f, 58.f, -10.f, 66.f, -0.f,
-    1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 38.f, -9.f, 49.f, -9.f, 59.f, -9.f, 65.f, -13.f, 68.f, -13.f, 77.f, -0.f,
-    0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -3.f, 42.f, -12.f,
-    1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 38.f, -9.f, 49.f, -9.f, 59.f, -9.f, 65.f, -13.f, 68.f, -13.f, 77.f, -0.f,
+    1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
+    0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -3.f, 42.f, -11.f,
+    1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
     0.f, -8.f, 7.f, -6.f, 12.f, -7.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 37.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f, 59.f, -10.f, 70.f, -13.f, 77.f, -10.f, 82.f, -10.f, 90.f, -0.f,
     1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 30.f, -0.f,
-    1.f, -12.f, 12.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 51.f, -9.f, 61.f, -9.f, 67.f, -13.f, 70.f, -13.f, 79.f, -0.f,
-    0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
+    1.f, -12.f, 12.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 41.f, -9.f, 52.f, -9.f, 62.f, -9.f, 68.f, -13.f, 71.f, -13.f, 80.f, -0.f,
+    0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 45.f, -10.f, 56.f, -13.f, 63.f, -10.f, 68.f, -10.f, 76.f, -0.f,
     1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 32.f, -2.f, 35.f, -11.f,
     1.f, -10.f, 12.f, -13.f, 19.f, -10.f, 24.f, -10.f, 32.f, -0.f, 37.f, -10.f, 45.f, -10.f, 50.f, -13.f, 58.f, -10.f, 66.f, -0.f,
-    1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 38.f, -9.f, 49.f, -9.f, 59.f, -9.f, 65.f, -13.f, 68.f, -13.f, 77.f, -0.f,
+    1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
     0.f, -8.f, 7.f, -6.f, 12.f, -7.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 37.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f,
   };
   struct LineRun line01 =
@@ -2242,7 +2242,7 @@ int UtcDaliTextUpdateLayout02(void)
     92.f,
     15.f,
     -5.f,
-    4.f,
+    5.f,
     0.f,
     false,
     false
@@ -2287,10 +2287,10 @@ int UtcDaliTextUpdateLayout02(void)
   {
     { 74u, 12u },
     { 74u, 12u },
-    79.f,
+    80.f,
     15.f,
     -5.f,
-    3.f,
+    4.f,
     0.f,
     false,
     false
@@ -2311,10 +2311,10 @@ int UtcDaliTextUpdateLayout02(void)
   {
     { 92u, 12u },
     { 92u, 12u },
-    78.f,
+    79.f,
     15.f,
     -5.f,
-    4.f,
+    5.f,
     0.f,
     false,
     false
@@ -2347,10 +2347,10 @@ int UtcDaliTextUpdateLayout02(void)
   {
     { 128u, 12u },
     { 128u, 12u },
-    81.f,
+    82.f,
     15.f,
     -5.f,
-    3.f,
+    4.f,
     0.f,
     false,
     false
@@ -2359,7 +2359,7 @@ int UtcDaliTextUpdateLayout02(void)
   {
     { 140u, 10u },
     { 140u, 10u },
-    76.f,
+    77.f,
     15.f,
     -5.f,
     4.f,
@@ -2395,7 +2395,7 @@ int UtcDaliTextUpdateLayout02(void)
   {
     { 166u, 12u },
     { 166u, 12u },
-    79.f,
+    80.f,
     15.f,
     -5.f,
     4.f,
@@ -2714,16 +2714,16 @@ int UtcDaliTextUpdateLayout03(void)
     0.f, -9.f, 11.f, -9.f, 21.f, -9.f, 27.f, -13.f, 30.f, -13.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
     1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 30.f, -0.f,
     1.f, -10.f, 12.f, -13.f, 19.f, -10.f, 24.f, -10.f, 32.f, -0.f, 37.f, -10.f, 45.f, -10.f, 50.f, -13.f, 58.f, -10.f, 66.f, -0.f,
-    1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 38.f, -9.f, 49.f, -9.f, 59.f, -9.f, 65.f, -13.f, 68.f, -13.f, 77.f, -0.f,
-    0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -3.f, 42.f, -12.f,
-    1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 38.f, -9.f, 49.f, -9.f, 59.f, -9.f, 65.f, -13.f, 68.f, -13.f, 77.f, -0.f,
+    1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
+    0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -3.f, 42.f, -11.f,
+    1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
     0.f, -8.f, 7.f, -6.f, 12.f, -7.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 37.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f, 59.f, -10.f, 70.f, -13.f, 77.f, -10.f, 82.f, -10.f, 90.f, -0.f,
     1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 30.f, -0.f,
-    1.f, -12.f, 12.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 51.f, -9.f, 61.f, -9.f, 67.f, -13.f, 70.f, -13.f, 79.f, -0.f,
-    0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
+    1.f, -12.f, 12.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 41.f, -9.f, 52.f, -9.f, 62.f, -9.f, 68.f, -13.f, 71.f, -13.f, 80.f, -0.f,
+    0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 45.f, -10.f, 56.f, -13.f, 63.f, -10.f, 68.f, -10.f, 76.f, -0.f,
     1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 32.f, -2.f, 35.f, -11.f,
     1.f, -10.f, 12.f, -13.f, 19.f, -10.f, 24.f, -10.f, 32.f, -0.f, 37.f, -10.f, 45.f, -10.f, 50.f, -13.f, 58.f, -10.f, 66.f, -0.f,
-    1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 38.f, -9.f, 49.f, -9.f, 59.f, -9.f, 65.f, -13.f, 68.f, -13.f, 77.f, -0.f,
+    1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
     0.f, -8.f, 7.f, -6.f, 12.f, -7.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 37.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f,
   };
   struct LineRun line01 =
@@ -2769,7 +2769,7 @@ int UtcDaliTextUpdateLayout03(void)
     92.f,
     15.f,
     -5.f,
-    4.f,
+    5.f,
     0.f,
     false,
     false
@@ -2814,10 +2814,10 @@ int UtcDaliTextUpdateLayout03(void)
   {
     { 74u, 12u },
     { 74u, 12u },
-    79.f,
+    80.f,
     15.f,
     -5.f,
-    3.f,
+    4.f,
     0.f,
     false,
     false
@@ -2838,10 +2838,10 @@ int UtcDaliTextUpdateLayout03(void)
   {
     { 92u, 12u },
     { 92u, 12u },
-    78.f,
+    79.f,
     15.f,
     -5.f,
-    4.f,
+    5.f,
     0.f,
     false,
     false
@@ -2874,10 +2874,10 @@ int UtcDaliTextUpdateLayout03(void)
   {
     { 128u, 12u },
     { 128u, 12u },
-    81.f,
+    82.f,
     15.f,
     -5.f,
-    3.f,
+    4.f,
     0.f,
     false,
     false
@@ -2886,7 +2886,7 @@ int UtcDaliTextUpdateLayout03(void)
   {
     { 140u, 10u },
     { 140u, 10u },
-    76.f,
+    77.f,
     15.f,
     -5.f,
     4.f,
@@ -2922,7 +2922,7 @@ int UtcDaliTextUpdateLayout03(void)
   {
     { 166u, 12u },
     { 166u, 12u },
-    79.f,
+    80.f,
     15.f,
     -5.f,
     4.f,
@@ -2954,6 +2954,7 @@ int UtcDaliTextUpdateLayout03(void)
     false,
     false
   };
+
   Vector<LineRun> lines;
   lines.PushBack( line01 );
   lines.PushBack( line02 );
index eea51a6..db59db3 100644 (file)
@@ -37,6 +37,7 @@ using namespace Text;
 //
 // void MergeFontDescriptions( const Vector<FontDescriptionRun>& fontDescriptions,
 //                             Vector<FontId>& fontIds,
+//                             Vector<bool>& isDefaultFont,
 //                             const TextAbstraction::FontDescription& defaultFontDescription,
 //                             TextAbstraction::PointSize26Dot6 defaultPointSize,
 //                             CharacterIndex startIndex,
@@ -79,6 +80,7 @@ struct MergeFontDescriptionsData
   unsigned int startIndex;                                 ///< The start index.
   unsigned int numberOfCharacters;                         ///< The number of characters.
   Vector<FontId> expectedFontIds;                          ///< The expected font ids.
+  Vector<bool> expectedIsDefault;                          ///< The expected font ids.
 };
 
 struct ScriptsData
@@ -108,9 +110,12 @@ bool MergeFontDescriptionsTest( const MergeFontDescriptionsData& data )
 {
   Vector<FontId> fontIds;
   fontIds.Resize( data.startIndex + data.numberOfCharacters, 0u );
+  Vector<bool> isDefaultFont;
+  isDefaultFont.Resize( data.startIndex + data.numberOfCharacters, true );
 
   MergeFontDescriptions( data.fontDescriptionRuns,
                          fontIds,
+                         isDefaultFont,
                          data.defaultFontDescription,
                          data.defaultPointSize,
                          data.startIndex,
@@ -141,6 +146,12 @@ bool MergeFontDescriptionsTest( const MergeFontDescriptionsData& data )
       std::cout << std::endl;
       return false;
     }
+
+    if( isDefaultFont[index] != data.expectedIsDefault[index] )
+    {
+      std::cout << data.description << " Different 'is font default' at index : " << index << ", is font default : " << isDefaultFont[index] << ", expected : " << data.expectedIsDefault[index] << std::endl;
+      return false;
+    }
   }
 
   return true;
@@ -413,12 +424,16 @@ int UtcDaliTextMergeFontDescriptions(void)
   TextAbstraction::FontDescription defaultFontDescription01;
   Vector<FontDescriptionRun> fontDescriptionRuns01;
   Vector<FontId> expectedFontIds01;
+  Vector<bool> expectedIsFontDefault01;
 
   TextAbstraction::FontDescription defaultFontDescription02;
   Vector<FontDescriptionRun> fontDescriptionRuns02;
   Vector<FontId> expectedFontIds02;
   expectedFontIds02.PushBack( 0u );
   expectedFontIds02.PushBack( 0u );
+  Vector<bool> expectedIsFontDefault02;
+  expectedIsFontDefault02.PushBack( true );
+  expectedIsFontDefault02.PushBack( true );
 
   TextAbstraction::FontDescription defaultFontDescription03;
   defaultFontDescription03.family = "DejaVu Serif";
@@ -532,6 +547,17 @@ int UtcDaliTextMergeFontDescriptions(void)
   expectedFontIds03.PushBack( 3u );
   expectedFontIds03.PushBack( 6u );
   expectedFontIds03.PushBack( 6u );
+  Vector<bool> expectedIsFontDefault03;
+  expectedIsFontDefault03.PushBack( false );
+  expectedIsFontDefault03.PushBack( false );
+  expectedIsFontDefault03.PushBack( false );
+  expectedIsFontDefault03.PushBack( false );
+  expectedIsFontDefault03.PushBack( false );
+  expectedIsFontDefault03.PushBack( false );
+  expectedIsFontDefault03.PushBack( false );
+  expectedIsFontDefault03.PushBack( false );
+  expectedIsFontDefault03.PushBack( false );
+  expectedIsFontDefault03.PushBack( false );
 
   const MergeFontDescriptionsData data[] =
   {
@@ -542,7 +568,8 @@ int UtcDaliTextMergeFontDescriptions(void)
       TextAbstraction::FontClient::DEFAULT_POINT_SIZE,
       0u,
       0u,
-      expectedFontIds01
+      expectedFontIds01,
+      expectedIsFontDefault01
     },
     {
       "No description runs.",
@@ -551,7 +578,8 @@ int UtcDaliTextMergeFontDescriptions(void)
       TextAbstraction::FontClient::DEFAULT_POINT_SIZE,
       0u,
       2u,
-      expectedFontIds02
+      expectedFontIds02,
+      expectedIsFontDefault02
     },
     {
       "Some description runs.",
@@ -560,7 +588,8 @@ int UtcDaliTextMergeFontDescriptions(void)
       TextAbstraction::FontClient::DEFAULT_POINT_SIZE,
       0u,
       10u,
-      expectedFontIds03
+      expectedFontIds03,
+      expectedIsFontDefault03
     }
   };
   const unsigned int numberOfTests = 3u;
index 9c8a903..7513141 100644 (file)
@@ -10,7 +10,7 @@
 #include <stdio.h>
 #include <string.h>
 
-#include <dali-toolkit/internal/controls/flex-container/layout.h>
+#include <dali-toolkit/third-party/facebook-flexbox/layout.h>
 
 void test(const char *name, css_node_t *style, css_node_t *expected_layout);
 bool tests_finished(void);
index 77b2c96..d6aa2fb 100644 (file)
@@ -7,51 +7,51 @@ SET(CAPI_LIB "dali-toolkit")
 
 # List of test case sources (Only these get parsed for test cases)
 SET(TC_SOURCES
-#   utc-Dali-Alignment.cpp
-#   utc-Dali-BloomView.cpp
-#   utc-Dali-BubbleEmitter.cpp
-#   utc-Dali-Builder.cpp
-#   utc-Dali-CheckBoxButton.cpp
-#   utc-Dali-ConfirmationPopup.cpp
-#   utc-Dali-CubeTransitionEffect.cpp
-#   utc-Dali-EffectsView.cpp
-#   utc-Dali-FlexContainer.cpp
-#   utc-Dali-GaussianBlurView.cpp
-#   utc-Dali-ImageView.cpp
-#   utc-Dali-JsonParser.cpp
-#   utc-Dali-KeyInputFocusManager.cpp
-#   utc-Dali-PageTurnView.cpp
-#   utc-Dali-Script.cpp
-#   utc-Dali-ScrollBar.cpp
-#   utc-Dali-ScrollView.cpp
-#   utc-Dali-ShaderEffects.cpp
-#   utc-Dali-ShadowView.cpp
-#   utc-Dali-Slider.cpp
-#   utc-Dali-TableView.cpp
-#   utc-Dali-TextEditor.cpp
-#   utc-Dali-TextField.cpp
-#   utc-Dali-TextLabel.cpp
-#   utc-Dali-TextSelectionPopup.cpp
-#   utc-Dali-ToolBar.cpp
-#   utc-Dali-Button.cpp
-#   utc-Dali-Control.cpp
-#   utc-Dali-ControlImpl.cpp
-#   utc-Dali-AccessibilityManager.cpp
-#   utc-Dali-ItemLayout.cpp
-#   utc-Dali-ItemView.cpp
-#   utc-Dali-KeyboardFocusManager.cpp
-#   utc-Dali-Magnifier.cpp
-#   utc-Dali-Popup.cpp
-#   utc-Dali-PushButton.cpp
-#   utc-Dali-RadioButton.cpp
-#   utc-Dali-ScrollViewEffect.cpp
-#   utc-Dali-SuperBlurView.cpp
-#   utc-Dali-Toolkit.cpp
-#   utc-Dali-Model3dView.cpp
-#   utc-Dali-ControlRenderer.cpp
-#   utc-Dali-RendererFactory.cpp
-#   utc-Dali-DebugRenderer.cpp
-#   utc-Dali-ImageAtlas.cpp
+   utc-Dali-Alignment.cpp
+   utc-Dali-BloomView.cpp
+   utc-Dali-BubbleEmitter.cpp
+   utc-Dali-Builder.cpp
+   utc-Dali-CheckBoxButton.cpp
+   utc-Dali-ConfirmationPopup.cpp
+   utc-Dali-CubeTransitionEffect.cpp
+   utc-Dali-EffectsView.cpp
+   utc-Dali-FlexContainer.cpp
+   utc-Dali-GaussianBlurView.cpp
+   utc-Dali-ImageView.cpp
+   utc-Dali-JsonParser.cpp
+   utc-Dali-KeyInputFocusManager.cpp
+   utc-Dali-PageTurnView.cpp
+   utc-Dali-Script.cpp
+   utc-Dali-ScrollBar.cpp
+   utc-Dali-ScrollView.cpp
+   utc-Dali-ShaderEffects.cpp
+   utc-Dali-ShadowView.cpp
+   utc-Dali-Slider.cpp
+   utc-Dali-TableView.cpp
+   utc-Dali-TextEditor.cpp
+   utc-Dali-TextField.cpp
+   utc-Dali-TextLabel.cpp
+   utc-Dali-TextSelectionPopup.cpp
+   utc-Dali-ToolBar.cpp
+   utc-Dali-Button.cpp
+   utc-Dali-Control.cpp
+   utc-Dali-ControlImpl.cpp
+   utc-Dali-AccessibilityManager.cpp
+   utc-Dali-ItemLayout.cpp
+   utc-Dali-ItemView.cpp
+   utc-Dali-KeyboardFocusManager.cpp
+   utc-Dali-Magnifier.cpp
+   utc-Dali-Popup.cpp
+   utc-Dali-PushButton.cpp
+   utc-Dali-RadioButton.cpp
+   utc-Dali-ScrollViewEffect.cpp
+   utc-Dali-SuperBlurView.cpp
+   utc-Dali-Toolkit.cpp
+   utc-Dali-Model3dView.cpp
+   utc-Dali-ControlRenderer.cpp
+   utc-Dali-RendererFactory.cpp
+   utc-Dali-DebugRenderer.cpp
+   utc-Dali-ImageAtlas.cpp
    utc-Dali-VideoView.cpp
 )
 
index fb50bf5..9be97bc 100644 (file)
@@ -28,8 +28,6 @@ namespace Dali
 
 namespace
 {
-const char * const TEXTURE_UNIFORM_NAME( "sTexture" );
-
 const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
   attribute mediump vec2 aPosition;\n
   uniform mediump mat4 uMvpMatrix;\n
index 1fe97c1..9a93c8e 100644 (file)
@@ -73,7 +73,11 @@ public:
   {
     std::stringstream out;
     out << program << ", " << shader;
-    mShaderTrace.PushCall("AttachShader", out.str());
+
+    TraceCallStack::NamedParams namedParams;
+    namedParams["program"] = ToString(program);
+    namedParams["shader"] = ToString(shader);
+    mShaderTrace.PushCall("AttachShader", out.str(), namedParams);
   }
 
   inline void BindAttribLocation( GLuint program, GLuint index, const char* name )
@@ -141,7 +145,12 @@ public:
 
     std::stringstream out;
     out << target << ", " << texture;
-    mTextureTrace.PushCall("BindTexture", out.str());
+
+    TraceCallStack::NamedParams namedParams;
+    namedParams["target"] = ToString(target);
+    namedParams["texture"] = ToString(texture);
+
+    mTextureTrace.PushCall("BindTexture", out.str(), namedParams);
   }
 
   inline void BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
@@ -278,7 +287,10 @@ public:
   {
     std::stringstream out;
     out << shader;
-    mShaderTrace.PushCall("CompileShader", out.str());
+    TraceCallStack::NamedParams namedParams;
+    namedParams["shader"] = ToString(shader);
+
+    mShaderTrace.PushCall("CompileShader", out.str(), namedParams);
   }
 
   inline void CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)
@@ -310,7 +322,10 @@ public:
   {
     std::stringstream out;
     out << type;
-    mShaderTrace.PushCall("CreateShader", out.str());
+
+    TraceCallStack::NamedParams namedParams;
+    namedParams["type"] = ToString(type);
+    mShaderTrace.PushCall("CreateShader", out.str(), namedParams);
 
     return ++mLastShaderIdUsed;
   }
@@ -319,7 +334,11 @@ public:
   {
     std::stringstream out;
     out << mode;
-    mCullFaceTrace.PushCall("CullFace", out.str());
+
+    TraceCallStack::NamedParams namedParams;
+    namedParams["program"] = ToString(mode);
+
+    mCullFaceTrace.PushCall("CullFace", out.str(), namedParams);
   }
 
   inline void DeleteBuffers(GLsizei n, const GLuint* buffers)
@@ -334,7 +353,11 @@ public:
   {
     std::stringstream out;
     out << program;
-    mShaderTrace.PushCall("DeleteProgram", out.str());
+
+    TraceCallStack::NamedParams namedParams;
+    namedParams["program"] = ToString(program);
+
+    mShaderTrace.PushCall("DeleteProgram", out.str(), namedParams);
   }
 
   inline void DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
@@ -345,7 +368,11 @@ public:
   {
     std::stringstream out;
     out << shader;
-    mShaderTrace.PushCall("DeleteShader", out.str());
+
+    TraceCallStack::NamedParams namedParams;
+    namedParams["shader"] = ToString(shader);
+
+    mShaderTrace.PushCall("DeleteShader", out.str(), namedParams);
   }
 
   inline void DeleteTextures(GLsizei n, const GLuint* textures)
@@ -353,13 +380,19 @@ public:
     std::stringstream out;
     out << n << ", " << textures << " = [";
 
+    TraceCallStack::NamedParams namedParams;
+
     for(GLsizei i=0; i<n; i++)
     {
       out << textures[i] << ", ";
+      std::stringstream paramName;
+      paramName<<"texture["<<i<<"]";
+      namedParams[paramName.str()] = ToString(textures[i]);
       mDeletedTextureIds.push_back(textures[i]);
     }
     out << "]";
-    mTextureTrace.PushCall("DeleteTextures", out.str());
+
+    mTextureTrace.PushCall("DeleteTextures", out.str(), namedParams);
   }
 
   inline bool CheckNoTexturesDeleted()
@@ -389,6 +422,13 @@ public:
 
   inline void DepthFunc(GLenum func)
   {
+    std::stringstream out;
+    out << func;
+
+    TraceCallStack::NamedParams namedParams;
+    namedParams["func"] = ToString(func);
+
+    mDepthFunctionTrace.PushCall("DepthFunc", out.str(), namedParams);
   }
 
   inline void DepthMask(GLboolean flag)
@@ -403,14 +443,19 @@ public:
   {
     std::stringstream out;
     out << program << ", " << shader;
-    mShaderTrace.PushCall("DetachShader", out.str());
+    TraceCallStack::NamedParams namedParams;
+    namedParams["program"] = ToString(program);
+    namedParams["shader"] = ToString(shader);
+    mShaderTrace.PushCall("DetachShader", out.str(), namedParams);
   }
 
   inline void Disable(GLenum cap)
   {
     std::stringstream out;
     out << cap;
-    mEnableDisableTrace.PushCall("Disable", out.str());
+    TraceCallStack::NamedParams namedParams;
+    namedParams["cap"] = ToString(cap);
+    mEnableDisableTrace.PushCall("Disable", out.str(), namedParams);
   }
 
   inline void DisableVertexAttribArray(GLuint index)
@@ -422,21 +467,33 @@ public:
   {
     std::stringstream out;
     out << mode << ", " << first << ", " << count;
-    mDrawTrace.PushCall("DrawArrays", out.str());
+    TraceCallStack::NamedParams namedParams;
+    namedParams["mode"] = ToString(mode);
+    namedParams["first"] = ToString(first);
+    namedParams["count"] = ToString(count);
+    mDrawTrace.PushCall("DrawArrays", out.str(), namedParams);
   }
 
   inline void DrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices)
   {
     std::stringstream out;
     out << mode << ", " << count << ", " << type << ", indices";
-    mDrawTrace.PushCall("DrawElements", out.str());
+
+    TraceCallStack::NamedParams namedParams;
+    namedParams["mode"] = ToString(mode);
+    namedParams["count"] = ToString(count);
+    namedParams["type"] = ToString(type);
+    // Skip void pointers - are they of any use?
+    mDrawTrace.PushCall("DrawElements", out.str(), namedParams);
   }
 
   inline void Enable(GLenum cap)
   {
     std::stringstream out;
     out << cap;
-    mEnableDisableTrace.PushCall("Enable", out.str());
+    TraceCallStack::NamedParams namedParams;
+    namedParams["cap"] = ToString(cap);
+    mEnableDisableTrace.PushCall("Enable", out.str(), namedParams);
   }
 
   inline void EnableVertexAttribArray(GLuint index)
@@ -488,6 +545,12 @@ public:
 
   inline void GenerateMipmap(GLenum target)
   {
+    std::stringstream out;
+    out<<target;
+    TraceCallStack::NamedParams namedParams;
+    namedParams["target"] = ToString(target);
+
+    mTextureTrace.PushCall("GenerateMipmap", out.str(), namedParams);
   }
 
   inline void GenFramebuffers(GLsizei n, GLuint* framebuffers)
@@ -523,9 +586,9 @@ public:
     return mNextTextureIds;
   }
 
-  inline void GenTextures(GLsizei n, GLuint* textures)
+  inline void GenTextures(GLsizei count, GLuint* textures)
   {
-    for( int i=0; i<n; ++i )
+    for( int i=0; i<count; ++i )
     {
       if( !mNextTextureIds.empty() )
       {
@@ -538,16 +601,23 @@ public:
       }
     }
 
+    TraceCallStack::NamedParams namedParams;
+    namedParams["count"] = ToString(count);
+
     std::stringstream out;
-    for(int i=0; i<n; i++)
+    for(int i=0; i<count; i++)
     {
       out << textures[i];
-      if(i<n-1)
+      if(i<count-1)
       {
         out << ", ";
       }
+      std::ostringstream oss;
+      oss<<"indices["<<i<<"]";
+      namedParams[oss.str()] = ToString(textures[i]);
     }
-    mTextureTrace.PushCall("GenTextures", out.str());
+
+    mTextureTrace.PushCall("GenTextures", out.str(), namedParams);
   }
 
   inline void GetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
@@ -779,7 +849,10 @@ public:
   {
     std::stringstream out;
     out << program;
-    mShaderTrace.PushCall("LinkProgram", out.str());
+
+    TraceCallStack::NamedParams namedParams;
+    namedParams["program"] = ToString(program);
+    mShaderTrace.PushCall("LinkProgram", out.str(), namedParams);
 
     mNumberOfActiveUniforms=2;
     GetUniformLocation(program, "sTexture");
@@ -881,43 +954,82 @@ public:
   inline void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels)
   {
     std::stringstream out;
-    out << width << ", " << height;
-    mTextureTrace.PushCall("TexImage2D", out.str());
+    out << target<<", "<<level<<", "<<width << ", " << height;
+
+    TraceCallStack::NamedParams namedParams;
+    namedParams["target"] = ToString(target);
+    namedParams["level"] = ToString(level);
+    namedParams["internalformat"] = ToString(internalformat);
+    namedParams["width"] = ToString(width);
+    namedParams["height"] = ToString(height);
+    namedParams["border"] = ToString(border);
+    namedParams["format"] = ToString(format);
+    namedParams["type"] = ToString(type);
+
+    mTextureTrace.PushCall("TexImage2D", out.str(), namedParams);
   }
 
   inline void TexParameterf(GLenum target, GLenum pname, GLfloat param)
   {
     std::stringstream out;
     out << target << ", " << pname << ", " << param;
-    mTexParamaterTrace.PushCall("TexParameterf", out.str());
+
+    TraceCallStack::NamedParams namedParams;
+    namedParams["target"] = ToString(target);
+    namedParams["pname"] = ToString(pname);
+    namedParams["param"] = ToString(param);
+
+    mTexParamaterTrace.PushCall("TexParameterf", out.str(), namedParams);
   }
 
   inline void TexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
   {
     std::stringstream out;
     out << target << ", " << pname << ", " << params[0];
-    mTexParamaterTrace.PushCall("TexParameterfv", out.str());
+
+    TraceCallStack::NamedParams namedParams;
+    namedParams["target"] = ToString(target);
+    namedParams["pname"] = ToString(pname);
+    namedParams["params[0]"] = ToString(params[0]);
+
+    mTexParamaterTrace.PushCall("TexParameterfv", out.str(), namedParams);
   }
 
   inline void TexParameteri(GLenum target, GLenum pname, GLint param)
   {
     std::stringstream out;
     out << target << ", " << pname << ", " << param;
-    mTexParamaterTrace.PushCall("TexParameteri", out.str());
+    TraceCallStack::NamedParams namedParams;
+    namedParams["target"] = ToString(target);
+    namedParams["pname"] = ToString(pname);
+    namedParams["param"] = ToString(param);
+    mTexParamaterTrace.PushCall("TexParameteri", out.str(), namedParams);
   }
 
   inline void TexParameteriv(GLenum target, GLenum pname, const GLint* params)
   {
     std::stringstream out;
     out << target << ", " << pname << ", " << params[0];
-    mTexParamaterTrace.PushCall("TexParameteriv", out.str());
+    TraceCallStack::NamedParams namedParams;
+    namedParams["target"] = ToString(target);
+    namedParams["pname"] = ToString(pname);
+    namedParams["params[0]"] = ToString(params[0]);
+    mTexParamaterTrace.PushCall("TexParameteriv", out.str(), namedParams);
   }
 
   inline void TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels)
   {
     std::stringstream out;
-    out << xoffset << ", " << yoffset << ", " << width << ", " << height;
-    mTextureTrace.PushCall("TexSubImage2D", out.str());
+    out << target << ", "<<level <<", " << xoffset << ", " << yoffset << ", " << width << ", " << height;
+
+    TraceCallStack::NamedParams namedParams;
+    namedParams["target"] = ToString(target);
+    namedParams["level"] = ToString(level);
+    namedParams["xoffset"] = ToString(xoffset);
+    namedParams["yoffset"] = ToString(yoffset);
+    namedParams["width"] = ToString(width);
+    namedParams["height"] = ToString(height);
+    mTextureTrace.PushCall("TexSubImage2D", out.str(), namedParams);
   }
 
   inline void Uniform1f(GLint location, GLfloat x)
@@ -1634,6 +1746,11 @@ public: // TEST FUNCTIONS
   inline void ResetDrawCallStack() { mDrawTrace.Reset(); }
   inline TraceCallStack& GetDrawTrace() { return mDrawTrace; }
 
+  //Methods for Depth function verification
+  inline void EnableDepthFunctionCallTrace(bool enable) { mDepthFunctionTrace.Enable(enable); }
+  inline void ResetDepthFunctionCallStack() { mDepthFunctionTrace.Reset(); }
+  inline TraceCallStack& GetDepthFunctionTrace() { return mDepthFunctionTrace; }
+
   template <typename T>
   inline bool GetUniformValue( const char* name, T& value ) const
   {
@@ -1850,6 +1967,7 @@ private:
   TraceCallStack mTextureTrace;
   TraceCallStack mTexParamaterTrace;
   TraceCallStack mDrawTrace;
+  TraceCallStack mDepthFunctionTrace;
 
   // Shaders & Uniforms
   GLuint mLastShaderIdUsed;
index bda38d3..3f2e6e5 100644 (file)
  */
 
 #include "test-trace-call-stack.h"
+#include <sstream>
 
 namespace Dali
 {
+
+std::string ToString(int x)
+{
+  std::stringstream out;
+  out << x;
+  return out.str();
+}
+
+std::string ToString(unsigned int x)
+{
+  std::stringstream out;
+  out << x;
+  return out.str();
+}
+
+std::string ToString(float x)
+{
+  std::stringstream out;
+  out << x;
+  return out.str();
+}
+
 /**
  * Constructor
  */
@@ -45,10 +68,17 @@ void TraceCallStack::PushCall(std::string method, std::string params)
 {
   if(mTraceActive)
   {
-    std::vector< std::string > functionCall;
-    functionCall.push_back(method);
-    functionCall.push_back(params);
-    mCallStack.push_back( functionCall );
+    FunctionCall stackFrame(method, params);
+    mCallStack.push_back( stackFrame );
+  }
+}
+
+void TraceCallStack::PushCall(std::string method, std::string params, const TraceCallStack::NamedParams& altParams)
+{
+  if(mTraceActive)
+  {
+    FunctionCall stackFrame(method, params, altParams);
+    mCallStack.push_back( stackFrame );
   }
 }
 
@@ -62,7 +92,7 @@ bool TraceCallStack::FindMethod(std::string method) const
   bool found = false;
   for( size_t i=0; i < mCallStack.size(); i++ )
   {
-    if( 0 == mCallStack[i][0].compare(method) )
+    if( 0 == mCallStack[i].method.compare(method) )
     {
       found = true;
       break;
@@ -76,7 +106,7 @@ int TraceCallStack::CountMethod(std::string method) const
   int numCalls = 0;
   for( size_t i=0; i < mCallStack.size(); i++ )
   {
-    if( 0 == mCallStack[i][0].compare(method) )
+    if( 0 == mCallStack[i].method.compare(method) )
     {
       numCalls++;
     }
@@ -95,6 +125,12 @@ bool TraceCallStack::FindMethodAndParams(std::string method, std::string params)
   return FindIndexFromMethodAndParams( method, params ) > -1;
 }
 
+bool TraceCallStack::FindMethodAndParams(std::string method, const NamedParams& params) const
+{
+  return FindIndexFromMethodAndParams( method, params ) > -1;
+}
+
+
 /**
  * Search for a method in the stack with the given parameter list
  * @param[in] method The name of the method
@@ -106,7 +142,7 @@ int TraceCallStack::FindIndexFromMethodAndParams(std::string method, std::string
   int index = -1;
   for( size_t i=0; i < mCallStack.size(); i++ )
   {
-    if( 0 == mCallStack[i][0].compare(method) && 0 == mCallStack[i][1].compare(params) )
+    if( 0 == mCallStack[i].method.compare(method) && 0 == mCallStack[i].paramList.compare(params) )
     {
       index = i;
       break;
@@ -115,6 +151,35 @@ int TraceCallStack::FindIndexFromMethodAndParams(std::string method, std::string
   return index;
 }
 
+int TraceCallStack::FindIndexFromMethodAndParams(std::string method, const TraceCallStack::NamedParams& params) const
+{
+  int index = -1;
+  for( size_t i=0; i < mCallStack.size(); i++ )
+  {
+    if( 0 == mCallStack[i].method.compare(method) )
+    {
+      // Test each of the passed in parameters:
+      bool match = true;
+      for( NamedParams::const_iterator iter = params.begin() ; iter != params.end() ; ++iter )
+      {
+        NamedParams::const_iterator paramIter = mCallStack[i].namedParams.find(iter->first);
+        if( paramIter == params.end() || paramIter->second.compare(iter->second) != 0 )
+        {
+          match = false;
+          break;
+        }
+      }
+      if( match == true )
+      {
+        index = i;
+        break;
+      }
+    }
+  }
+  return index;
+}
+
+
 /**
  * Test if the given method and parameters are at a given index in the stack
  * @param[in] index Index in the call stack
@@ -123,7 +188,7 @@ int TraceCallStack::FindIndexFromMethodAndParams(std::string method, std::string
  */
 bool TraceCallStack::TestMethodAndParams(int index, std::string method, std::string params) const
 {
-  return ( 0 == mCallStack[index][0].compare(method) && 0 == mCallStack[index][1].compare(params) );
+  return ( 0 == mCallStack[index].method.compare(method) && 0 == mCallStack[index].paramList.compare(params) );
 }
 
 /**
index d319487..32375a6 100644 (file)
 
 #include <string>
 #include <vector>
+#include <map>
 
 namespace Dali
 {
+std::string ToString(int x);
+std::string ToString(unsigned int x);
+std::string ToString(float x);
 
 /**
  * Helper class to track method calls in the abstraction and search for them in test cases
@@ -30,6 +34,9 @@ namespace Dali
 class TraceCallStack
 {
 public:
+  /// Typedef for passing and storing named parameters
+  typedef std::map< std::string, std::string > NamedParams;
+
   /**
    * Constructor
    */
@@ -54,6 +61,13 @@ public:
    */
   void PushCall(std::string method, std::string params);
 
+  /**
+   * Push a call onto the stack if the trace is active
+   * @param[in] method The name of the method
+   * @param[in] params A comma separated list of parameter values
+   * @param[in] altParams A map of named parameter values
+   */
+  void PushCall(std::string method, std::string params, const NamedParams& altParams);
 
   /**
    * Search for a method in the stack
@@ -80,12 +94,28 @@ public:
   /**
    * Search for a method in the stack with the given parameter list
    * @param[in] method The name of the method
+   * @param[in] params A map of named parameters to test for
+   * @return true if the method was in the stack
+   */
+  bool FindMethodAndParams(std::string method, const NamedParams& params) const;
+
+  /**
+   * Search for a method in the stack with the given parameter list
+   * @param[in] method The name of the method
    * @param[in] params A comma separated list of parameter values
    * @return index in the stack where the method was found or -1 otherwise
    */
   int FindIndexFromMethodAndParams(std::string method, std::string params) const;
 
   /**
+   * Search for a method in the stack with the given parameter list
+   * @param[in] method The name of the method
+   * @param[in] params A map of named parameter values to match
+   * @return index in the stack where the method was found or -1 otherwise
+   */
+  int FindIndexFromMethodAndParams(std::string method, const NamedParams& params) const;
+
+  /**
    * Test if the given method and parameters are at a given index in the stack
    * @param[in] index Index in the call stack
    * @param[in] method Name of method to test
@@ -98,15 +128,25 @@ public:
    */
   void Reset();
 
-  /**
-   * Get the call stack
-   * @return The call stack object (Vector of vector[2] of method/paramlist strings)
-   */
-  inline const std::vector< std::vector< std::string > >& GetCallStack() { return mCallStack; }
-
 private:
   bool mTraceActive; ///< True if the trace is active
-  std::vector< std::vector< std::string > > mCallStack; ///< The call stack
+
+  struct FunctionCall
+  {
+    std::string method;
+    std::string paramList;
+    NamedParams namedParams;
+    FunctionCall( const std::string& aMethod, const std::string& aParamList )
+    : method( aMethod ), paramList( aParamList )
+    {
+    }
+    FunctionCall( const std::string& aMethod, const std::string& aParamList, const NamedParams& altParams )
+    : method( aMethod ), paramList( aParamList ), namedParams( altParams )
+    {
+    }
+  };
+
+  std::vector< FunctionCall > mCallStack; ///< The call stack
 };
 
 } // namespace dali
index d524b81..0983366 100644 (file)
@@ -30,6 +30,9 @@ namespace
 const char* TEST_IMAGE_FILE_NAME =  "gallery_image_01.jpg";
 const char* TEST_NPATCH_FILE_NAME =  "gallery_image_01.9.jpg";
 const char* TEST_SVG_FILE_NAME = TEST_RESOURCE_DIR "/svg1.svg";
+const char* TEST_OBJ_FILE_NAME = TEST_RESOURCE_DIR "/Cube.obj";
+const char* TEST_MTL_FILE_NAME = TEST_RESOURCE_DIR "/ToyRobot-Metal.mtl";
+const char* TEST_RESOURCE_LOCATION = TEST_RESOURCE_DIR "/";
 }
 
 void dali_control_renderer_startup(void)
@@ -625,3 +628,46 @@ int UtcDaliControlRendererGetPropertyMap7(void)
 
   END_TEST;
 }
+
+//Mesh renderer
+int UtcDaliControlRendererGetPropertyMap8(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "UtcDaliControlRendererGetPropertyMap8: MeshRenderer" );
+
+  //Request MeshRenderer using a property map.
+  RendererFactory factory = RendererFactory::Get();
+  Property::Map propertyMap;
+  propertyMap.Insert( "rendererType", "mesh" );
+  propertyMap.Insert( "objectUrl", TEST_OBJ_FILE_NAME );
+  propertyMap.Insert( "materialUrl", TEST_MTL_FILE_NAME );
+  propertyMap.Insert( "texturesPath", TEST_RESOURCE_LOCATION );
+  propertyMap.Insert( "shaderType", "textureless" );
+  ControlRenderer meshRenderer = factory.GetControlRenderer( propertyMap );
+
+  Property::Map resultMap;
+  meshRenderer.CreatePropertyMap( resultMap );
+
+  //Check values in the result map are identical to the initial map's values.
+  Property::Value* value = resultMap.Find( "rendererType", Property::STRING );
+  DALI_TEST_CHECK( value );
+  DALI_TEST_CHECK( value->Get<std::string>() == "mesh" );
+
+  value = resultMap.Find( "objectUrl", Property::STRING );
+  DALI_TEST_CHECK( value );
+  DALI_TEST_CHECK( value->Get<std::string>() == TEST_OBJ_FILE_NAME );
+
+  value = resultMap.Find( "materialUrl", Property::STRING );
+  DALI_TEST_CHECK( value );
+  DALI_TEST_CHECK( value->Get<std::string>() == TEST_MTL_FILE_NAME );
+
+  value = resultMap.Find( "texturesPath", Property::STRING );
+  DALI_TEST_CHECK( value );
+  DALI_TEST_CHECK( value->Get<std::string>() == TEST_RESOURCE_LOCATION );
+
+  value = resultMap.Find( "shaderType", Property::STRING );
+  DALI_TEST_CHECK( value );
+  DALI_TEST_CHECK( value->Get<std::string>() == "textureless" );
+
+  END_TEST;
+}
index b92e8e7..f602079 100644 (file)
@@ -186,6 +186,53 @@ int UtcDaliToolkitFlexContainerSetPropertyP(void)
   END_TEST;
 }
 
+
+int UtcDaliToolkitFlexContainerSetPropertyEnumP(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliToolkitFlexContainerSetPropertyEnumP");
+  FlexContainer flexContainer = FlexContainer::New();
+  DALI_TEST_CHECK( flexContainer );
+
+  // Add flex container to the stage
+  Stage::GetCurrent().Add( flexContainer );
+
+  // Create two actors and add them to the container
+  Actor actor1 = Actor::New();
+  Actor actor2 = Actor::New();
+  DALI_TEST_CHECK( actor1 );
+  DALI_TEST_CHECK( actor2 );
+
+  flexContainer.Add(actor1);
+  flexContainer.Add(actor2);
+
+  // Check content direction property.
+  flexContainer.SetProperty( FlexContainer::Property::CONTENT_DIRECTION, "RTL" );
+  DALI_TEST_EQUALS( (FlexContainer::ContentDirection)flexContainer.GetProperty<int>( FlexContainer::Property::CONTENT_DIRECTION ), FlexContainer::RTL, TEST_LOCATION );
+
+  // Check flex direction property.
+  flexContainer.SetProperty( FlexContainer::Property::FLEX_DIRECTION, "columnReverse" );
+  DALI_TEST_EQUALS( (FlexContainer::FlexDirection)flexContainer.GetProperty<int>( FlexContainer::Property::FLEX_DIRECTION ), FlexContainer::COLUMN_REVERSE, TEST_LOCATION );
+
+  // Check flex wrap property.
+  flexContainer.SetProperty( FlexContainer::Property::FLEX_WRAP, "wrap" );
+  DALI_TEST_EQUALS( (FlexContainer::WrapType)flexContainer.GetProperty<int>( FlexContainer::Property::FLEX_WRAP ), FlexContainer::WRAP, TEST_LOCATION );
+
+  // Check justify content property.
+  flexContainer.SetProperty( FlexContainer::Property::JUSTIFY_CONTENT, "spaceBetween" );
+  DALI_TEST_EQUALS( (FlexContainer::Justification)flexContainer.GetProperty<int>( FlexContainer::Property::JUSTIFY_CONTENT ), FlexContainer::JUSTIFY_SPACE_BETWEEN, TEST_LOCATION );
+
+  // Check align items property.
+  flexContainer.SetProperty( FlexContainer::Property::ALIGN_ITEMS, "flexStart" );
+  DALI_TEST_EQUALS( (FlexContainer::Alignment)flexContainer.GetProperty<int>( FlexContainer::Property::ALIGN_ITEMS ), FlexContainer::ALIGN_FLEX_START, TEST_LOCATION );
+
+  // Check align content property.
+  flexContainer.SetProperty( FlexContainer::Property::ALIGN_CONTENT, "stretch" );
+  DALI_TEST_EQUALS( (FlexContainer::Alignment)flexContainer.GetProperty<int>( FlexContainer::Property::ALIGN_CONTENT ), FlexContainer::ALIGN_STRETCH, TEST_LOCATION );
+
+  END_TEST;
+}
+
 int UtcDaliToolkitFlexContainerSetChildPropertyP(void)
 {
   ToolkitTestApplication application;
@@ -217,6 +264,233 @@ int UtcDaliToolkitFlexContainerSetChildPropertyP(void)
   DALI_TEST_EQUALS( actor.GetProperty<Vector4>( FlexContainer::ChildProperty::FLEX_MARGIN ), Vector4( 10.0f, 10.0f, 10.0f, 10.0f ), TEST_LOCATION );
   DALI_TEST_CHECK( actor.GetPropertyIndex( CHILD_PROPERTY_NAME_FLEX_MARGIN ) == FlexContainer::ChildProperty::FLEX_MARGIN );
 
+  application.SendNotification();
+  application.Render();
+
+  END_TEST;
+}
+
+
+
+//Functor to test whether RelayoutSignal is emitted
+class RelayoutSignalHandler : public Dali::ConnectionTracker
+{
+public:
+
+  RelayoutSignalHandler( FlexContainer& actor )
+  : mSignalVerified( false ),
+    mActor( actor )
+  {
+  }
+
+  // callback to be connected to RelayoutSignal
+  void RelayoutCallback( Actor actor  )
+  {
+    if( mActor == actor )
+    {
+      mSignalVerified = true;
+    }
+  }
+
+  void Reset()
+  {
+    mSignalVerified = false;
+  }
+
+  bool   mSignalVerified;
+  Actor& mActor;
+};
+
+int UtcDaliToolkitFlexContainerRemoveChildP(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliToolkitFlexContainerSetPropertyP");
+  FlexContainer flexContainer = FlexContainer::New();
+  DALI_TEST_CHECK( flexContainer );
+
+  // Add flex container to the stage
+  Stage::GetCurrent().Add( flexContainer );
+
+  RelayoutSignalHandler relayoutSignal(flexContainer);
+  flexContainer.OnRelayoutSignal().Connect(&relayoutSignal, &RelayoutSignalHandler::RelayoutCallback );
+
+  // Create two actors and add them to the container
+  Actor actor1 = Actor::New();
+  Actor actor2 = Actor::New();
+  DALI_TEST_CHECK( actor1 );
+  DALI_TEST_CHECK( actor2 );
+
+  flexContainer.Add(actor1);
+  flexContainer.Add(actor2);
+
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( relayoutSignal.mSignalVerified, true, TEST_LOCATION );
+  relayoutSignal.Reset();
+
+  DALI_TEST_CHECK( actor1 );
+  DALI_TEST_CHECK( actor2 );
+
+  flexContainer.Remove(actor1);
+  application.SendNotification();
+  application.Render();
+  DALI_TEST_EQUALS( relayoutSignal.mSignalVerified, true, TEST_LOCATION );
+  relayoutSignal.Reset();
+
+  flexContainer.Remove(actor2);
+  application.SendNotification();
+  application.Render();
+  DALI_TEST_EQUALS( relayoutSignal.mSignalVerified, true, TEST_LOCATION );
+  relayoutSignal.Reset();
+
   END_TEST;
 }
 
+namespace
+{
+
+// Functors to test whether PreFocusChange signal is emitted when the keyboard focus is about to change
+class PreFocusChangeCallback : public Dali::ConnectionTracker
+{
+public:
+  PreFocusChangeCallback(bool& signalReceived, Actor firstFocusActor)
+  : mSignalVerified(signalReceived),
+    mFirstFocusActor(firstFocusActor),
+    mDirection(Control::KeyboardFocus::LEFT)
+  {
+  }
+
+  Actor Callback(Actor currentFocusedActor, Actor proposedActorToFocus, Control::KeyboardFocus::Direction direction)
+  {
+    tet_infoline("Verifying PreFocusChangeCallback()");
+
+    mSignalVerified = true;
+    mDirection = direction;
+    if( ! proposedActorToFocus )
+    {
+      return mFirstFocusActor;
+    }
+    else
+    {
+      return proposedActorToFocus;
+    }
+  }
+
+  void Reset()
+  {
+    mSignalVerified = false;
+    mDirection = Control::KeyboardFocus::LEFT;
+  }
+
+  bool& mSignalVerified;
+  Actor mFirstFocusActor;
+  Control::KeyboardFocus::Direction mDirection;
+};
+
+// Functors to test whether focus changed signal is emitted when the keyboard focus is changed
+class FocusChangedCallback : public Dali::ConnectionTracker
+{
+public:
+  FocusChangedCallback(bool& signalReceived)
+  : mSignalVerified(signalReceived),
+    mOriginalFocusedActor(),
+    mCurrentFocusedActor()
+  {
+  }
+
+  void Callback(Actor originalFocusedActor, Actor currentFocusedActor)
+  {
+    tet_infoline("Verifying FocusChangedCallback()");
+
+    if(originalFocusedActor == mCurrentFocusedActor)
+    {
+      mSignalVerified = true;
+    }
+
+    mOriginalFocusedActor = originalFocusedActor;
+    mCurrentFocusedActor = currentFocusedActor;
+  }
+
+  void Reset()
+  {
+    mSignalVerified = false;
+  }
+
+  bool& mSignalVerified;
+  Actor mOriginalFocusedActor;
+  Actor mCurrentFocusedActor;
+};
+
+} // anonymous namespace
+
+
+int UtcDaliToolkitFlexContainerMoveFocus(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliToolkitFlexContainerSetPropertyP");
+  FlexContainer flexContainer = FlexContainer::New();
+  DALI_TEST_CHECK( flexContainer );
+
+  flexContainer.SetProperty( FlexContainer::Property::FLEX_DIRECTION, FlexContainer::ROW );
+
+  // Add flex container to the stage
+  Stage::GetCurrent().Add( flexContainer );
+  Size stageSize = Stage::GetCurrent().GetSize();
+
+  RelayoutSignalHandler relayoutSignal(flexContainer);
+  flexContainer.OnRelayoutSignal().Connect(&relayoutSignal, &RelayoutSignalHandler::RelayoutCallback );
+  flexContainer.SetSize( stageSize );
+
+  // Create two actors and add them to the container
+  Actor actor1 = Actor::New();
+  Actor actor2 = Actor::New();
+  actor1.SetKeyboardFocusable(true);
+  actor2.SetKeyboardFocusable(true);
+  DALI_TEST_CHECK( actor1 );
+  DALI_TEST_CHECK( actor2 );
+
+  flexContainer.Add(actor1);
+  flexContainer.Add(actor2);
+
+  application.SendNotification();
+  application.Render();
+
+  KeyboardFocusManager manager = KeyboardFocusManager::Get();
+  DALI_TEST_CHECK(manager);
+
+  bool preFocusChangeSignalVerified = false;
+  PreFocusChangeCallback preFocusChangeCallback(preFocusChangeSignalVerified, actor1);
+  manager.PreFocusChangeSignal().Connect( &preFocusChangeCallback, &PreFocusChangeCallback::Callback );
+
+  bool focusChangedSignalVerified = false;
+  FocusChangedCallback focusChangedCallback(focusChangedSignalVerified);
+  manager.FocusChangedSignal().Connect( &focusChangedCallback, &FocusChangedCallback::Callback );
+
+  // Move the focus to the right
+  DALI_TEST_EQUALS(manager.MoveFocus(Control::KeyboardFocus::RIGHT), true, TEST_LOCATION);
+  DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
+  DALI_TEST_EQUALS(manager.GetCurrentFocusActor(), actor1, TEST_LOCATION);
+  preFocusChangeCallback.Reset();
+  DALI_TEST_EQUALS(focusChangedCallback.mCurrentFocusedActor, actor1, TEST_LOCATION);
+  focusChangedCallback.Reset();
+
+  // Move the focus towards right
+  DALI_TEST_EQUALS(manager.MoveFocus(Control::KeyboardFocus::RIGHT), true, TEST_LOCATION);
+  DALI_TEST_EQUALS(preFocusChangeCallback.mSignalVerified, true, TEST_LOCATION);
+  DALI_TEST_EQUALS(manager.GetCurrentFocusActor(), actor2, TEST_LOCATION);
+  DALI_TEST_EQUALS(focusChangedCallback.mSignalVerified, true, TEST_LOCATION);
+  DALI_TEST_EQUALS(focusChangedCallback.mCurrentFocusedActor, actor2, TEST_LOCATION);
+
+  preFocusChangeCallback.Reset();
+  focusChangedCallback.Reset();
+
+  // Move the focus towards left
+  DALI_TEST_EQUALS(manager.MoveFocus(Control::KeyboardFocus::LEFT), true, TEST_LOCATION);
+  DALI_TEST_EQUALS(preFocusChangeCallback.mSignalVerified, true, TEST_LOCATION);
+  DALI_TEST_EQUALS(manager.GetCurrentFocusActor(), actor1, TEST_LOCATION);
+  DALI_TEST_EQUALS(focusChangedCallback.mSignalVerified, true, TEST_LOCATION);
+  DALI_TEST_EQUALS(focusChangedCallback.mCurrentFocusedActor, actor1, TEST_LOCATION);
+
+  END_TEST;
+}
index 0f56e92..a8fa8cc 100644 (file)
@@ -61,7 +61,7 @@ bool IsOverlap( Rect<int> rect1, Rect<int> rect2 )
      && rect2.y < rect1.y+rect1.height;
 }
 
-}
+} // anonymous namespace
 
 void dali_image_atlas_startup(void)
 {
@@ -191,23 +191,33 @@ int UtcDaliImageAtlasUploadP(void)
   Rect<int> pixelArea1 = TextureCoordinateToPixelArea(textureRect1, size);
   DALI_TEST_EQUALS( pixelArea1.width, 34, TEST_LOCATION );
   DALI_TEST_EQUALS( pixelArea1.height, 34, TEST_LOCATION );
-  std::stringstream out;
-  out<<pixelArea1.x<<", "<<pixelArea1.y<<", "<<pixelArea1.width<<", "<<pixelArea1.height;
-  DALI_TEST_CHECK(  callStack.FindMethodAndParams("TexSubImage2D", out.str()) );
+
+  TraceCallStack::NamedParams params;
+  params["width"] = ToString(pixelArea1.width);
+  params["height"] = ToString(pixelArea1.height);
+  params["xoffset"] = ToString(pixelArea1.x);
+  params["yoffset"] = ToString(pixelArea1.y);
+  DALI_TEST_CHECK( callStack.FindMethodAndParams("TexSubImage2D", params ));
 
   Rect<int> pixelArea2 = TextureCoordinateToPixelArea(textureRect2, size);
   DALI_TEST_EQUALS( pixelArea2.width, 50, TEST_LOCATION );
   DALI_TEST_EQUALS( pixelArea2.height, 50, TEST_LOCATION );
-  out.str("");
-  out<<pixelArea2.x<<", "<<pixelArea2.y<<", "<<pixelArea2.width<<", "<<pixelArea2.height;
-  DALI_TEST_CHECK(  callStack.FindMethodAndParams("TexSubImage2D", out.str()) );
+
+  params["width"] = ToString(pixelArea2.width);
+  params["height"] = ToString(pixelArea2.height);
+  params["xoffset"] = ToString(pixelArea2.x);
+  params["yoffset"] = ToString(pixelArea2.y);
+  DALI_TEST_CHECK( callStack.FindMethodAndParams("TexSubImage2D", params ) );
 
   Rect<int> pixelArea3 = TextureCoordinateToPixelArea(textureRect3, size);
   DALI_TEST_EQUALS( pixelArea3.width, 128, TEST_LOCATION );
   DALI_TEST_EQUALS( pixelArea3.height, 128, TEST_LOCATION );
-  out.str("");
-  out<<pixelArea3.x<<", "<<pixelArea3.y<<", "<<pixelArea3.width<<", "<<pixelArea3.height;
-  DALI_TEST_CHECK( callStack.FindMethodAndParams("TexSubImage2D", out.str()) );
+
+  params["width"] = ToString(pixelArea3.width);
+  params["height"] = ToString(pixelArea3.height);
+  params["xoffset"] = ToString(pixelArea3.x);
+  params["yoffset"] = ToString(pixelArea3.y);
+  DALI_TEST_CHECK( callStack.FindMethodAndParams("TexSubImage2D", params ) );
 
   DALI_TEST_CHECK( ! IsOverlap(pixelArea1, pixelArea2) );
   DALI_TEST_CHECK( ! IsOverlap(pixelArea1, pixelArea3) );
@@ -267,8 +277,20 @@ int UtcDaliImageAtlasImageView(void)
 
   callStack.Enable(false);
 
-  DALI_TEST_CHECK(  callStack.FindMethodAndParams("TexSubImage2D", "0, 0, 34, 34" ) );
-  DALI_TEST_CHECK(  callStack.FindMethodAndParams("TexSubImage2D", "0, 34, 50, 50" ) );
+  TraceCallStack::NamedParams params1;
+  params1["width"] = "34";
+  params1["height"] = "34";
+  params1["xoffset"] = "0";
+  params1["yoffset"] = "0";
+
+  TraceCallStack::NamedParams params2;
+  params2["width"] = "50";
+  params2["height"] = "50";
+  params2["xoffset"] = "0";
+  params2["yoffset"] = "34";
+
+  DALI_TEST_EQUALS(  callStack.FindMethodAndParams("TexSubImage2D", params1 ), true, TEST_LOCATION );
+  DALI_TEST_EQUALS(  callStack.FindMethodAndParams("TexSubImage2D", params2 ), true, TEST_LOCATION );
 
   callStack.Reset();
   callStack.Enable(true);
@@ -288,7 +310,14 @@ int UtcDaliImageAtlasImageView(void)
   application.Render(RENDER_FRAME_INTERVAL);
 
   callStack.Enable(false);
-  DALI_TEST_CHECK(  callStack.FindMethodAndParams("TexSubImage2D", "0, 34, 100, 100" ) );
+
+  TraceCallStack::NamedParams params3;
+  params3["width"] = "100";
+  params3["height"] = "100";
+  params3["xoffset"] = "0";
+  params3["yoffset"] = "34";
+
+  DALI_TEST_EQUALS(  callStack.FindMethodAndParams("TexSubImage2D", params3 ), true, TEST_LOCATION );
 
   END_TEST;
 }
index 5955748..bd04f56 100644 (file)
@@ -425,8 +425,10 @@ int UtcDaliImageViewAsyncLoadingWithAltasing(void)
 
   callStack.Enable(false);
 
-  DALI_TEST_CHECK(  callStack.FindMethodAndParams("TexSubImage2D", "0, 0, 34, 34" ) );
-
+  TraceCallStack::NamedParams params;
+  params["width"] = ToString(34);
+  params["height"] = ToString(34);
+  DALI_TEST_EQUALS( callStack.FindMethodAndParams( "TexSubImage2D", params ), true, TEST_LOCATION );
 
   END_TEST;
 }
@@ -475,9 +477,13 @@ int UtcDaliImageViewSyncLoading(void)
     Stage::GetCurrent().Add( imageView );
     application.SendNotification();
     application.Render(16);
-    DALI_TEST_CHECK(  callStack.FindMethodAndParams("TexSubImage2D", "0, 0, 34, 34" ) );
-  }
 
+    TraceCallStack::NamedParams params;
+    params["width"] = ToString(34);
+    params["height"] = ToString(34);
+    DALI_TEST_EQUALS( callStack.FindMethodAndParams( "TexSubImage2D", params ),
+                      true, TEST_LOCATION );
+  }
   END_TEST;
 }
 
@@ -1128,4 +1134,3 @@ int UtcDaliImageViewGetImageN(void)
 
   END_TEST;
 }
-
index 89bc1a1..d813261 100644 (file)
@@ -32,8 +32,10 @@ typedef NinePatchImage::StretchRanges StretchRanges;
 
 const char* TEST_IMAGE_FILE_NAME =  "gallery_image_01.jpg";
 const char* TEST_NPATCH_FILE_NAME =  "gallery_image_01.9.jpg";
-
 const char* TEST_SVG_FILE_NAME = TEST_RESOURCE_DIR "/svg1.svg";
+const char* TEST_OBJ_FILE_NAME = TEST_RESOURCE_DIR "/Cube.obj";
+const char* TEST_MTL_FILE_NAME = TEST_RESOURCE_DIR "/ToyRobot-Metal.mtl";
+const char* TEST_SIMPLE_MTL_FILE_NAME = TEST_RESOURCE_DIR "/ToyRobot-Metal-Simple.mtl";
 
 Integration::Bitmap* CreateBitmap( unsigned int imageWidth, unsigned int imageHeight, unsigned int initialColor, Pixel::Format pixelFormat )
 {
@@ -933,6 +935,381 @@ int UtcDaliRendererFactoryGetSvgRenderer(void)
   END_TEST;
 }
 
+//Test if mesh loads correctly when supplied with only the bare minimum requirements, an object file.
+int UtcDaliRendererFactoryGetMeshRenderer1(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "UtcDaliRendererFactoryGetMeshRenderer1:  Request mesh renderer with a valid object file only" );
+
+  RendererFactory factory = RendererFactory::Get();
+  DALI_TEST_CHECK( factory );
+
+  //Set up renderer properties.
+  Property::Map propertyMap;
+  propertyMap.Insert( "rendererType",  "mesh" );
+  propertyMap.Insert( "objectUrl", TEST_OBJ_FILE_NAME );
+
+  ControlRenderer controlRenderer = factory.GetControlRenderer( propertyMap );
+  DALI_TEST_CHECK( controlRenderer );
+
+  Actor actor = Actor::New();
+  actor.SetSize( 200.f, 200.f );
+  Stage::GetCurrent().Add( actor );
+  controlRenderer.SetSize( Vector2( 200.f, 200.f ) );
+  controlRenderer.SetOnStage( actor );
+
+  application.SendNotification();
+  application.Render( 0 );
+
+  DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
+
+  //Tell the platform abstraction that the required resources have been loaded.
+  TestPlatformAbstraction& platform = application.GetPlatform();
+  platform.SetAllResourceRequestsAsLoaded();
+
+  //Render again to upload the now-loaded textures.
+  application.SendNotification();
+  application.Render( 0 );
+
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+
+  Matrix testScaleMatrix;
+  testScaleMatrix.SetIdentityAndScale( Vector3( 1.0, -1.0, 1.0 ) );
+  Matrix actualScaleMatrix;
+
+  //Test to see if the object has been successfully loaded.
+  DALI_TEST_CHECK( gl.GetUniformValue<Matrix>( "uObjectMatrix", actualScaleMatrix ) );
+  DALI_TEST_EQUALS( actualScaleMatrix, testScaleMatrix, Math::MACHINE_EPSILON_100, TEST_LOCATION );
+
+  controlRenderer.SetOffStage( actor );
+  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
+
+  END_TEST;
+}
+
+//Test if mesh loads correctly when supplied with an object file as well as a blank material file and images directory.
+int UtcDaliRendererFactoryGetMeshRenderer2(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "UtcDaliRendererFactoryGetMeshRenderer2:  Request mesh renderer with blank material file and images directory" );
+
+  RendererFactory factory = RendererFactory::Get();
+  DALI_TEST_CHECK( factory );
+
+  //Set up renderer properties.
+  Property::Map propertyMap;
+  propertyMap.Insert( "rendererType",  "mesh" );
+  propertyMap.Insert( "objectUrl", TEST_OBJ_FILE_NAME );
+  propertyMap.Insert( "materialUrl", "" );
+  propertyMap.Insert( "texturesPath", "" );
+
+  ControlRenderer controlRenderer = factory.GetControlRenderer( propertyMap );
+  DALI_TEST_CHECK( controlRenderer );
+
+  //Add renderer to an actor on stage.
+  Actor actor = Actor::New();
+  actor.SetSize( 200.f, 200.f );
+  Stage::GetCurrent().Add( actor );
+  controlRenderer.SetSize( Vector2( 200.f, 200.f ) );
+  controlRenderer.SetOnStage( actor );
+
+  DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
+
+  //Attempt to render to queue resource load requests.
+  application.SendNotification();
+  application.Render( 0 );
+
+  //Tell the platform abstraction that the required resources have been loaded.
+  TestPlatformAbstraction& platform = application.GetPlatform();
+  platform.SetAllResourceRequestsAsLoaded();
+
+  //Render again to upload the now-loaded textures.
+  application.SendNotification();
+  application.Render( 0 );
+
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+
+  Matrix testScaleMatrix;
+  testScaleMatrix.SetIdentityAndScale( Vector3( 1.0, -1.0, 1.0 ) );
+  Matrix actualScaleMatrix;
+
+  //Test to see if the object has been successfully loaded.
+  DALI_TEST_CHECK( gl.GetUniformValue<Matrix>( "uObjectMatrix", actualScaleMatrix ) );
+  DALI_TEST_EQUALS( actualScaleMatrix, testScaleMatrix, Math::MACHINE_EPSILON_100, TEST_LOCATION );
+
+  controlRenderer.SetOffStage( actor );
+  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
+
+  END_TEST;
+}
+
+//Test if mesh loads correctly when supplied with all parameters, an object file, a material file and a directory location.
+int UtcDaliRendererFactoryGetMeshRenderer3(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "UtcDaliRendererFactoryGetMeshRenderer3:  Request mesh renderer with all parameters correct" );
+
+  RendererFactory factory = RendererFactory::Get();
+  DALI_TEST_CHECK( factory );
+
+  //Set up renderer properties.
+  Property::Map propertyMap;
+  propertyMap.Insert( "rendererType",  "mesh" );
+  propertyMap.Insert( "objectUrl", TEST_OBJ_FILE_NAME );
+  propertyMap.Insert( "materialUrl", TEST_MTL_FILE_NAME );
+  propertyMap.Insert( "texturesPath", TEST_RESOURCE_DIR "/" );
+
+  ControlRenderer controlRenderer = factory.GetControlRenderer( propertyMap );
+  DALI_TEST_CHECK( controlRenderer );
+
+  //Add renderer to an actor on stage.
+  Actor actor = Actor::New();
+  actor.SetSize( 200.f, 200.f );
+  Stage::GetCurrent().Add( actor );
+  controlRenderer.SetSize( Vector2( 200.f, 200.f ) );
+  controlRenderer.SetOnStage( actor );
+
+  DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
+
+  //Attempt to render to queue resource load requests.
+  application.SendNotification();
+  application.Render( 0 );
+
+  //Tell the platform abstraction that the required resources have been loaded.
+  TestPlatformAbstraction& platform = application.GetPlatform();
+  platform.SetAllResourceRequestsAsLoaded();
+
+  //Render again to upload the now-loaded textures.
+  application.SendNotification();
+  application.Render( 0 );
+
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+
+  Matrix testScaleMatrix;
+  testScaleMatrix.SetIdentityAndScale( Vector3( 1.0, -1.0, 1.0 ) );
+  Matrix actualScaleMatrix;
+
+  //Test to see if the object has been successfully loaded.
+  DALI_TEST_CHECK( gl.GetUniformValue<Matrix>( "uObjectMatrix", actualScaleMatrix ) );
+  DALI_TEST_EQUALS( actualScaleMatrix, testScaleMatrix, Math::MACHINE_EPSILON_100, TEST_LOCATION );
+
+  controlRenderer.SetOffStage( actor );
+  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
+
+  END_TEST;
+}
+
+//Test if mesh renderer can load a correctly supplied mesh without a normal map or gloss map in the material file.
+int UtcDaliRendererFactoryGetMeshRenderer4(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "UtcDaliRendererFactoryGetMeshRenderer4:  Request mesh renderer with diffuse texture but not normal or gloss." );
+
+  RendererFactory factory = RendererFactory::Get();
+  DALI_TEST_CHECK( factory );
+
+  //Set up renderer properties.
+  Property::Map propertyMap;
+  propertyMap.Insert( "rendererType",  "mesh" );
+  propertyMap.Insert( "objectUrl", TEST_OBJ_FILE_NAME );
+  propertyMap.Insert( "materialUrl", TEST_SIMPLE_MTL_FILE_NAME );
+  propertyMap.Insert( "texturesPath", TEST_RESOURCE_DIR "/" );
+
+  ControlRenderer controlRenderer = factory.GetControlRenderer( propertyMap );
+  DALI_TEST_CHECK( controlRenderer );
+
+  //Add renderer to an actor on stage.
+  Actor actor = Actor::New();
+  actor.SetSize( 200.f, 200.f );
+  Stage::GetCurrent().Add( actor );
+  controlRenderer.SetSize( Vector2( 200.f, 200.f ) );
+  controlRenderer.SetOnStage( actor );
+
+  DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
+
+  //Attempt to render to queue resource load requests.
+  application.SendNotification();
+  application.Render( 0 );
+
+  //Tell the platform abstraction that the required resources have been loaded.
+  TestPlatformAbstraction& platform = application.GetPlatform();
+  platform.SetAllResourceRequestsAsLoaded();
+
+  //Render again to upload the now-loaded textures.
+  application.SendNotification();
+  application.Render( 0 );
+
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+
+  Matrix testScaleMatrix;
+  testScaleMatrix.SetIdentityAndScale( Vector3( 1.0, -1.0, 1.0 ) );
+  Matrix actualScaleMatrix;
+
+  //Test to see if the object has been successfully loaded.
+  DALI_TEST_CHECK( gl.GetUniformValue<Matrix>( "uObjectMatrix", actualScaleMatrix ) );
+  DALI_TEST_EQUALS( actualScaleMatrix, testScaleMatrix, Math::MACHINE_EPSILON_100, TEST_LOCATION );
+
+  controlRenderer.SetOffStage( actor );
+  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
+
+  END_TEST;
+}
+
+//Test if mesh renderer handles the case of lacking an object file.
+int UtcDaliRendererFactoryGetMeshRendererN1(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "UtcDaliRendererFactoryGetMeshRendererN1:  Request mesh renderer without object file" );
+
+  RendererFactory factory = RendererFactory::Get();
+  DALI_TEST_CHECK( factory );
+
+  //Set up renderer properties.
+  Property::Map propertyMap;
+  propertyMap.Insert( "rendererType",  "mesh" );
+  propertyMap.Insert( "materialUrl", TEST_MTL_FILE_NAME );
+  propertyMap.Insert( "texturesPath", TEST_RESOURCE_DIR "/" );
+
+  ControlRenderer controlRenderer = factory.GetControlRenderer( propertyMap );
+  DALI_TEST_CHECK( controlRenderer );
+
+  //Add renderer to an actor on stage.
+  Actor actor = Actor::New();
+  actor.SetSize( 200.f, 200.f );
+  Stage::GetCurrent().Add( actor );
+  controlRenderer.SetSize( Vector2( 200.f, 200.f ) );
+  controlRenderer.SetOnStage( actor );
+
+  DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
+
+  //Attempt to render to queue resource load requests.
+  application.SendNotification();
+  application.Render( 0 );
+
+  //Tell the platform abstraction that the required resources have been loaded.
+  TestPlatformAbstraction& platform = application.GetPlatform();
+  platform.SetAllResourceRequestsAsLoaded();
+
+  //Render again to upload the now-loaded textures.
+  application.SendNotification();
+  application.Render( 0 );
+
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+
+  //Test to see if the object has not been loaded, as expected.
+  Matrix scaleMatrix;
+  DALI_TEST_CHECK( ! gl.GetUniformValue<Matrix>( "uObjectMatrix", scaleMatrix ) );
+
+  controlRenderer.SetOffStage( actor );
+  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
+
+  END_TEST;
+}
+
+//Test if mesh renderer handles the case of being passed invalid material and images urls.
+int UtcDaliRendererFactoryGetMeshRendererN2(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "UtcDaliRendererFactoryGetMeshRendererN2:  Request mesh renderer with invalid material and images urls" );
+
+  RendererFactory factory = RendererFactory::Get();
+  DALI_TEST_CHECK( factory );
+
+  //Set up renderer properties.
+  Property::Map propertyMap;
+  propertyMap.Insert( "rendererType",  "mesh" );
+  propertyMap.Insert( "objectUrl", TEST_OBJ_FILE_NAME );
+  propertyMap.Insert( "materialUrl", "invalid" );
+  propertyMap.Insert( "texturesPath", "also invalid" );
+
+  ControlRenderer controlRenderer = factory.GetControlRenderer( propertyMap );
+  DALI_TEST_CHECK( controlRenderer );
+
+  //Add renderer to an actor on stage.
+  Actor actor = Actor::New();
+  actor.SetSize( 200.f, 200.f );
+  Stage::GetCurrent().Add( actor );
+  controlRenderer.SetSize( Vector2( 200.f, 200.f ) );
+  controlRenderer.SetOnStage( actor );
+
+  DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
+
+  //Attempt to render to queue resource load requests.
+  application.SendNotification();
+  application.Render( 0 );
+
+  //Tell the platform abstraction that the required resources have been loaded.
+  TestPlatformAbstraction& platform = application.GetPlatform();
+  platform.SetAllResourceRequestsAsLoaded();
+
+  //Render again to upload the now-loaded textures.
+  application.SendNotification();
+  application.Render( 0 );
+
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+
+  //Test to see if the object has not been loaded, as expected.
+  Matrix scaleMatrix;
+  DALI_TEST_CHECK( ! gl.GetUniformValue<Matrix>( "uObjectMatrix", scaleMatrix ) );
+
+  controlRenderer.SetOffStage( actor );
+  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
+
+  END_TEST;
+}
+
+//Test if mesh renderer handles the case of being passed an invalid object url
+int UtcDaliRendererFactoryGetMeshRendererN3(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "UtcDaliRendererFactoryGetMeshRendererN3:  Request mesh renderer with invalid object url" );
+
+  RendererFactory factory = RendererFactory::Get();
+  DALI_TEST_CHECK( factory );
+
+  //Set up renderer properties.
+  Property::Map propertyMap;
+  propertyMap.Insert( "rendererType",  "mesh" );
+  propertyMap.Insert( "objectUrl", "invalid" );
+  propertyMap.Insert( "materialUrl", TEST_MTL_FILE_NAME );
+  propertyMap.Insert( "texturesPath", TEST_RESOURCE_DIR "/" );
+
+  ControlRenderer controlRenderer = factory.GetControlRenderer( propertyMap );
+  DALI_TEST_CHECK( controlRenderer );
+
+  //Add renderer to an actor on stage.
+  Actor actor = Actor::New();
+  actor.SetSize( 200.f, 200.f );
+  Stage::GetCurrent().Add( actor );
+  controlRenderer.SetSize( Vector2( 200.f, 200.f ) );
+  controlRenderer.SetOnStage( actor );
+
+  DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
+
+  //Attempt to render to queue resource load requests.
+  application.SendNotification();
+  application.Render( 0 );
+
+  //Tell the platform abstraction that the required resources have been loaded.
+  TestPlatformAbstraction& platform = application.GetPlatform();
+  platform.SetAllResourceRequestsAsLoaded();
+
+  //Render again to upload the now-loaded textures.
+  application.SendNotification();
+  application.Render( 0 );
+
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+
+  //Test to see if the object has not been loaded, as expected.
+  Matrix scaleMatrix;
+  DALI_TEST_CHECK( ! gl.GetUniformValue<Matrix>( "uObjectMatrix", scaleMatrix ) );
+
+  controlRenderer.SetOffStage( actor );
+  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
+
+  END_TEST;
+}
+
 int UtcDaliRendererFactoryResetRenderer1(void)
 {
   ToolkitTestApplication application;
@@ -1052,3 +1429,84 @@ int UtcDaliRendererFactoryResetRenderer3(void)
 
   END_TEST;
 }
+
+//Test resetting mesh and primitive shape renderers
+int UtcDaliRendererFactoryResetRenderer4(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "UtcDaliRendererFactoryResetRenderer4:  Mesh and primitive renderers" );
+
+  Actor actor = Actor::New();
+  actor.SetSize( 200.f, 200.f );
+  Stage::GetCurrent().Add( actor );
+  RendererFactory factory = RendererFactory::Get();
+  DALI_TEST_CHECK( factory );
+
+  Property::Map map;
+
+  //******
+
+  //Start with basic color renderer
+  ControlRenderer controlRenderer = factory.GetControlRenderer( Color::RED );
+  DALI_TEST_CHECK( controlRenderer );
+
+  TestControlRendererRender( application, actor, controlRenderer );
+
+  DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
+
+  //Ensure set correctly.
+  Vector4 actualValue( Vector4::ZERO );
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "mixColor", actualValue ) );
+  DALI_TEST_EQUALS( actualValue, Color::RED, TEST_LOCATION );
+
+  //******
+
+  //Reset to mesh renderer
+  map.Insert( "rendererType", "mesh" );
+  map.Insert( "objectUrl", TEST_OBJ_FILE_NAME );
+  map.Insert( "materialUrl", TEST_MTL_FILE_NAME );
+  map.Insert( "texturesPath", TEST_RESOURCE_DIR "/" );
+  factory.ResetRenderer( controlRenderer, actor, map );
+  application.SendNotification();
+  application.Render( 0 );
+
+  DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
+
+  //Tell the platform abstraction that the required resources have been loaded.
+  TestPlatformAbstraction& platform = application.GetPlatform();
+  platform.SetAllResourceRequestsAsLoaded();
+
+  //Render again to upload the now-loaded textures.
+  application.SendNotification();
+  application.Render( 0 );
+
+  //Ensure set correctly.
+  controlRenderer.CreatePropertyMap( map );
+  DALI_TEST_EQUALS( map.Find( "objectUrl", Property::STRING )->Get<std::string>(), TEST_OBJ_FILE_NAME, TEST_LOCATION );
+
+  Matrix testScaleMatrix;
+  testScaleMatrix.SetIdentityAndScale( Vector3( 1.0, -1.0, 1.0 ) );
+  Matrix actualScaleMatrix;
+
+  //Test to see if the object has been successfully loaded.
+  DALI_TEST_CHECK( gl.GetUniformValue<Matrix>( "uObjectMatrix", actualScaleMatrix ) );
+  DALI_TEST_EQUALS( actualScaleMatrix, testScaleMatrix, Math::MACHINE_EPSILON_100, TEST_LOCATION );
+
+  //******
+
+  //Reset back to color renderer
+  factory.ResetRenderer( controlRenderer, actor, Color::GREEN );
+  application.SendNotification();
+  application.Render( 0 );
+
+  DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
+
+  //Ensure set correctly.
+  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "mixColor", actualValue ) );
+  DALI_TEST_EQUALS( actualValue, Color::GREEN, TEST_LOCATION );
+
+  //******
+
+  END_TEST;
+}
index 7ec6acf..e96556b 100644 (file)
@@ -20,6 +20,7 @@
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/events/pan-gesture-event.h>
 
 using namespace Dali;
 using namespace Dali::Toolkit;
@@ -114,10 +115,10 @@ static bool OnSliderMark( Slider slider, int value )
   return true;
 }
 
-int UtcDaliSliderSignals(void)
+int UtcDaliSliderSignals1(void)
 {
   ToolkitTestApplication application;  // Exceptions require ToolkitTestApplication
-  tet_infoline(" UtcDaliSliderSignals");
+  tet_infoline(" UtcDaliSliderSignals1");
 
   // Create the Popup actor
   Slider slider = Slider::New();
@@ -178,3 +179,202 @@ int UtcDaliSliderSignals(void)
   DALI_TEST_CHECK(gSliderMarkCallBackCalled);
   END_TEST;
 }
+
+
+namespace
+{
+bool gSliderSignal=false;
+struct SliderSignalFunctor
+{
+  SliderSignalFunctor()
+  {
+  }
+
+  void operator()()
+  {
+    gSliderSignal = true;
+  }
+};
+} // anonymous
+
+
+
+int UtcDaliSliderSignals2(void)
+{
+  ToolkitTestApplication application;  // Exceptions require ToolkitTestApplication
+  tet_infoline(" UtcDaliSliderSignals1");
+
+  // Create the Popup actor
+  Slider slider = Slider::New();
+  Stage::GetCurrent().Add( slider );
+  slider.SetParentOrigin(ParentOrigin::TOP_LEFT);
+  slider.SetAnchorPoint(ParentOrigin::TOP_LEFT);
+  slider.SetSize( Vector2( Stage::GetCurrent().GetSize().x, 20.0f ) );
+  slider.SetPosition( 0.0f, 0.0f );
+
+  const float MIN_BOUND = 0.0f;
+  const float MAX_BOUND = 1.0f;
+  const int NUM_MARKS = 5;
+  Property::Array marks;
+  for( int i = 0; i < NUM_MARKS; ++i )
+  {
+    marks.PushBack( MIN_BOUND + ( static_cast<float>(i) / ( NUM_MARKS - 1) ) * ( MAX_BOUND - MIN_BOUND ) );
+  }
+  slider.SetProperty( Slider::Property::MARKS, marks );
+  slider.SetProperty( Slider::Property::MARK_TOLERANCE, 0.1f );
+
+  gSliderSignal = false;
+  ConnectionTracker* testTracker = new ConnectionTracker();
+  slider.ConnectSignal( testTracker, "valueChanged",   SliderSignalFunctor() );
+
+  application.SendNotification();
+  application.Render();
+
+  gSliderValueChangedCallBackCalled = false;
+  gSliderMarkCallBackCalled = false;
+
+  Dali::Integration::TouchEvent event;
+
+  event = Dali::Integration::TouchEvent();
+
+  Integration::Point pointDown;
+  pointDown.SetState( PointState::DOWN );
+  pointDown.SetScreenPosition( Vector2( 10.0f, 10.0f ) );
+  event.AddPoint( pointDown );
+
+  for( int i = 0; i < 5; ++i )
+  {
+    Integration::Point pointMotion;
+    pointMotion.SetState( PointState::MOTION );
+    pointMotion.SetScreenPosition( Vector2( 10.0f + i * 10.0f, 10.0f ) );
+    event.AddPoint( pointMotion );
+  }
+
+  Integration::Point pointUp;
+  pointUp.SetState( PointState::UP );
+  pointUp.SetScreenPosition( Vector2( 10.0f, 10.0f ) );
+  event.AddPoint( pointUp );
+
+  application.ProcessEvent( event );
+
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_CHECK(gSliderSignal);
+  END_TEST;
+}
+
+int UtcDaliSetPropertyP(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "UtcDaliSetPropertyP" );
+
+  Slider slider = Slider::New();
+  slider.SetParentOrigin(ParentOrigin::TOP_LEFT);
+  slider.SetAnchorPoint(ParentOrigin::TOP_LEFT);
+  slider.SetSize( Vector2( Stage::GetCurrent().GetSize().x, 20.0f ) );
+  slider.SetPosition( 0.0f, 0.0f );
+
+  Stage::GetCurrent().Add(slider);
+  application.SendNotification();
+  application.Render();
+
+  Property::Map map;
+  map["rendererType"] = "image";
+  map["url"] = "url";
+  slider.SetProperty(Slider::Property::LOWER_BOUND,        1.0f);
+  slider.SetProperty(Slider::Property::UPPER_BOUND,        5.0f);
+  slider.SetProperty(Slider::Property::VALUE,              3.0f);
+  slider.SetProperty(Slider::Property::DISABLED_COLOR,     Color::BLACK);
+  slider.SetProperty(Slider::Property::VALUE_PRECISION,    4);
+  slider.SetProperty(Slider::Property::SHOW_POPUP,         true);
+  slider.SetProperty(Slider::Property::SHOW_VALUE,         true);
+  slider.SetProperty(Slider::Property::MARKS,              false);
+  slider.SetProperty(Slider::Property::SNAP_TO_MARKS,      false);
+  slider.SetProperty(Slider::Property::MARK_TOLERANCE,     0.5f);
+
+  float lb = slider.GetProperty<float>(Slider::Property::LOWER_BOUND);
+  DALI_TEST_EQUALS(lb, 1.0f, TEST_LOCATION);
+  float ub = slider.GetProperty<float>(Slider::Property::UPPER_BOUND);
+  DALI_TEST_EQUALS(ub, 5.0f, TEST_LOCATION);
+  float val = slider.GetProperty<float>(Slider::Property::VALUE);
+  DALI_TEST_EQUALS(val, 3.0f, TEST_LOCATION);
+  Vector4 color = slider.GetProperty<Vector4>(Slider::Property::DISABLED_COLOR);
+  DALI_TEST_EQUALS( color, Color::BLACK, TEST_LOCATION );
+  int precision = slider.GetProperty<int>(Slider::Property::VALUE_PRECISION);
+  DALI_TEST_EQUALS( precision, 4, TEST_LOCATION);
+  bool showPopup = slider.GetProperty<bool>(Slider::Property::SHOW_POPUP);
+  DALI_TEST_EQUALS( showPopup, true , TEST_LOCATION);
+  bool showValue = slider.GetProperty<bool>(Slider::Property::SHOW_VALUE);
+  DALI_TEST_EQUALS( showValue, true, TEST_LOCATION );
+  bool marks = slider.GetProperty<bool>(Slider::Property::MARKS);
+  DALI_TEST_EQUALS( marks, false, TEST_LOCATION );
+  bool snapToMarks = slider.GetProperty<bool>(Slider::Property::SNAP_TO_MARKS);
+  DALI_TEST_EQUALS( snapToMarks, false, TEST_LOCATION );
+  float tolerance = slider.GetProperty<float>(Slider::Property::MARK_TOLERANCE);
+  DALI_TEST_EQUALS( tolerance, 0.5f, TEST_LOCATION );
+
+  {
+    map["url"] = "track2.png";
+    slider.SetProperty(Slider::Property::TRACK_VISUAL,       map);
+    map["url"] = "handle2.png";
+    slider.SetProperty(Slider::Property::HANDLE_VISUAL,      map);
+    map["url"] = "progress2.png";
+    slider.SetProperty(Slider::Property::PROGRESS_VISUAL,    map);
+    map["url"] = "popup2.png";
+    slider.SetProperty(Slider::Property::POPUP_VISUAL,       map);
+    map["url"] = "popupArrow2.png";
+    slider.SetProperty(Slider::Property::POPUP_ARROW_VISUAL, map);
+
+    Property::Value value = slider.GetProperty(Slider::Property::TRACK_VISUAL);
+    Property::Map* resultMap = value.GetMap();
+    DALI_TEST_CHECK( resultMap );
+    Property::Value* url = resultMap->Find("url");
+    DALI_TEST_CHECK( url ) ;
+    DALI_TEST_EQUALS( *url, "track2.png", TEST_LOCATION );
+
+    value = slider.GetProperty(Slider::Property::HANDLE_VISUAL);
+    resultMap = value.GetMap();
+    DALI_TEST_CHECK( resultMap );
+    url = resultMap->Find("url");
+    DALI_TEST_CHECK( url ) ;
+    DALI_TEST_EQUALS( *url, "handle2.png", TEST_LOCATION );
+
+    value = slider.GetProperty(Slider::Property::PROGRESS_VISUAL);
+    resultMap = value.GetMap();
+    DALI_TEST_CHECK( resultMap );
+    url = resultMap->Find("url");
+    DALI_TEST_CHECK( url ) ;
+    DALI_TEST_EQUALS( *url, "progress2.png", TEST_LOCATION );
+
+    value = slider.GetProperty(Slider::Property::POPUP_VISUAL);
+    resultMap = value.GetMap();
+    DALI_TEST_CHECK( resultMap );
+    url = resultMap->Find("url");
+    DALI_TEST_CHECK( url ) ;
+    DALI_TEST_EQUALS( *url, "popup2.png", TEST_LOCATION );
+
+    value = slider.GetProperty(Slider::Property::POPUP_ARROW_VISUAL);
+    resultMap = value.GetMap();
+    DALI_TEST_CHECK( resultMap );
+    url = resultMap->Find("url");
+    DALI_TEST_CHECK( url ) ;
+    DALI_TEST_EQUALS( *url, "popupArrow2.png", TEST_LOCATION );
+  }
+
+  END_TEST;
+}
+
+
+// DestroyHandleVisualDisplay
+// CreateValueDisplay
+// SlidingFinishedSignal()
+// UpdateSkin disabled
+// AddPopup
+// RemovePopup
+// SnapToMark
+// HideValueView
+// GetDisabledColor
+// GetShowPopup
+// GetShowVisual
+// DisplayPopup (with set valueText label)
index e116401..a672053 100644 (file)
@@ -55,7 +55,7 @@ cov_data:
        @for i in `find $(COVERAGE_DIR) -name "libdali_toolkit_la-*.gcda" -o -name "libdali_toolkit_la-*.gcno"` ;\
                do mv $$i `echo $$i | sed s/libdali_toolkit_la-//` ; echo $$i ; done
        @cd $(COVERAGE_DIR) ; lcov $(LCOV_OPTS) --base-directory . --directory . -c -o dali.info
-       @cd $(COVERAGE_DIR) ; lcov $(LCOV_OPTS) --remove dali.info "/usr/include/*" "*/dali-env/*" -o dali.info
+       @cd $(COVERAGE_DIR) ; lcov $(LCOV_OPTS) --remove dali.info "/usr/include/*" "*/dali-env/*" "*solid-color-actor*" "*/dali-toolkit/third-party/*"  -o dali.info
        @test -z $(COVERAGE_OUTPUT_DIR) || mkdir -p $(COVERAGE_OUTPUT_DIR)
 
 coverage: cov_data
index 2cc6de7..7383ebe 100644 (file)
 
 # Build the Dali Toolkit library
 
-toolkit_images_dir = ../../../dali-toolkit/styles/images-common
-toolkit_sounds_dir = ../../../dali-toolkit/sounds
-toolkit_src_dir    = ../../../dali-toolkit/internal
-public_api_src_dir = ../../../dali-toolkit/public-api
-devel_api_src_dir  = ../../../dali-toolkit/devel-api
+toolkit_images_dir  = ../../../dali-toolkit/styles/images-common
+toolkit_sounds_dir  = ../../../dali-toolkit/sounds
+toolkit_src_dir     = ../../../dali-toolkit/internal
+public_api_src_dir  = ../../../dali-toolkit/public-api
+devel_api_src_dir   = ../../../dali-toolkit/devel-api
+third_party_src_dir = ../../../dali-toolkit/third-party
 
 toolkit_styles_dir = $(STYLE_DIR)
 toolkit_style_images_dir = $(STYLE_DIR)/images
@@ -31,6 +32,7 @@ include ../../../dali-toolkit/styles/images-common/file.list
 include ../../../dali-toolkit/internal/file.list
 include ../../../dali-toolkit/public-api/file.list
 include ../../../dali-toolkit/devel-api/file.list
+include ../../../dali-toolkit/third-party/file.list
 
 vector_based_text_src_dir = ../../../dali-toolkit/internal/text/rendering/vector-based
 include ../../../dali-toolkit/internal/text/rendering/vector-based/file.list
@@ -56,7 +58,8 @@ lib_LTLIBRARIES = libdali-toolkit.la
 libdali_toolkit_la_SOURCES = \
                      $(toolkit_src_files) \
                      $(public_api_src_files) \
-                     $(devel_api_src_files)
+                     $(devel_api_src_files) \
+                     $(third_party_src_files)
 
 dalistyledir = ${dataReadOnlyDir}/toolkit/styles/
 dalistyle_DATA = ${dali_toolkit_style_files}
index c6fc451..fb52bf3 100644 (file)
@@ -112,7 +112,7 @@ public:
    * else the renderer would be a handle to a newly created internal color renderer.
    *
    * @param[in] renderer The ControlRenderer to reset
-   * @param[in] actor The Actor the renderer is applied to if, empty if the renderer has not been applied to any Actor
+   * @param[in] actor The Actor the renderer is applied to, empty if the renderer has not been applied to any Actor
    * @param[in] color The color to be rendered.
    */
   void ResetRenderer( ControlRenderer& renderer, Actor& actor, const Vector4& color );
@@ -151,7 +151,7 @@ public:
    * else the renderer would be a handle to a newly created internal image renderer.
    *
    * @param[in] renderer The ControlRenderer to reset
-   * @param[in] actor The Actor the renderer is applied to if, empty if the renderer has not been applied to any Actor
+   * @param[in] actor The Actor the renderer is applied to, empty if the renderer has not been applied to any Actor
    * @param[in] image The Image to be rendered.
    */
   void ResetRenderer( ControlRenderer& renderer, Actor& actor, const Image& image );
@@ -173,14 +173,13 @@ public:
    * else the renderer would be a handle to a newly created internal image renderer.
    *
    * @param[in] renderer The ControlRenderer to reset
-   * @param[in] actor The Actor the renderer is applied to if, empty if the renderer has not been applied to any Actor
+   * @param[in] actor The Actor the renderer is applied to, empty if the renderer has not been applied to any Actor
    * @param[in] url The URL to the resource to be rendered.
    * @param[in] size The width and height to fit the loaded image to.
    */
   void ResetRenderer( ControlRenderer& renderer, Actor& actor, const std::string& url,
                       ImageDimensions size = ImageDimensions() );
 
-
   /**
    * @brief Request the current control renderer from the property map, merging the property map with the renderer
    *
@@ -188,7 +187,7 @@ public:
    * else the renderer would be a handle to a newly created internal renderer.
    *
    * @param[in] renderer The ControlRenderer to reset
-   * @param[in] actor The Actor the renderer is applied to if, empty if the renderer has not been applied to any Actor
+   * @param[in] actor The Actor the renderer is applied to, empty if the renderer has not been applied to any Actor
    * @param[in] propertyMap The map contains the properties required by the control renderer
    *            Depends on the content of the map, different kind of renderer would be returned.
    */
index 2005f9c..f89c1f4 100644 (file)
@@ -26,7 +26,7 @@
 #include <dali-toolkit/public-api/controls/flex-container/flex-container.h>
 extern "C"
 {
-#include "layout.h"
+#include <dali-toolkit/third-party/facebook-flexbox/layout.h>
 }
 
 namespace Dali
index d395fb2..eac2d89 100644 (file)
@@ -423,7 +423,7 @@ void Model3dView::OnStageConnection( int depth )
 
   if( mObjLoader.IsSceneLoaded() )
   {
-    mMesh = mObjLoader.CreateGeometry( mIlluminationType );
+    mMesh = mObjLoader.CreateGeometry( GetShaderProperties( mIlluminationType ) );
 
     CreateMaterial();
     LoadTextures();
@@ -462,9 +462,7 @@ void Model3dView::LoadGeometry()
   if (FileLoader::ReadFile(mObjUrl,fileSize,fileContent,FileLoader::TEXT))
   {
     mObjLoader.ClearArrays();
-
-    std::string materialUrl;
-    mObjLoader.Load(fileContent.Begin(), fileSize, materialUrl);
+    mObjLoader.LoadObject(fileContent.Begin(), fileSize);
 
     //Get size information from the obj loaded
     mSceneCenter = mObjLoader.GetCenter();
@@ -520,7 +518,7 @@ void Model3dView::CreateGeometry()
 {
   if( mObjLoader.IsSceneLoaded() )
   {
-    mMesh = mObjLoader.CreateGeometry( mIlluminationType );
+    mMesh = mObjLoader.CreateGeometry( GetShaderProperties( mIlluminationType ) );
 
     if( mRenderer )
     {
@@ -629,6 +627,24 @@ void Model3dView::LoadTextures()
   }
 }
 
+int Model3dView::GetShaderProperties( Toolkit::Model3dView::IlluminationType illuminationType )
+{
+  int objectProperties = 0;
+
+  if( illuminationType == Toolkit::Model3dView::DIFFUSE_WITH_TEXTURE ||
+      illuminationType == Toolkit::Model3dView::DIFFUSE_WITH_NORMAL_MAP )
+  {
+    objectProperties |= ObjLoader::TEXTURE_COORDINATES;
+  }
+
+  if( illuminationType == Toolkit::Model3dView::DIFFUSE_WITH_NORMAL_MAP )
+  {
+    objectProperties |= ObjLoader::TANGENTS | ObjLoader::BINOMIALS;
+  }
+
+  return objectProperties;
+}
+
 } // namespace Internal
 } // namespace Toolkit
 } // namespace Dali
index 8e44911..9c24faa 100644 (file)
@@ -146,6 +146,15 @@ private:
   void UpdateShaderUniforms();
 
 
+  /*
+   * @brief Given a specific shader type, find out which properties are necessary for it.
+   *
+   * @param[in] illuminationType The type of shader we intend to use.
+   * @return A bitmask of the properties we require to be loaded to use the given shader.
+   */
+  int GetShaderProperties( Toolkit::Model3dView::IlluminationType illuminationType );
+
+
   ObjLoader mObjLoader;
 
   //Properties
index bc4e174..aaf7c60 100644 (file)
@@ -19,6 +19,7 @@
 #include "obj-loader.h"
 
 // EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
 #include <string>
 #include <sstream>
 #include <string.h>
@@ -32,6 +33,10 @@ namespace Toolkit
 namespace Internal
 {
 
+namespace
+{
+  const int MAX_POINT_INDICES = 4;
+}
 using namespace Dali;
 
 ObjLoader::ObjLoader()
@@ -39,8 +44,8 @@ ObjLoader::ObjLoader()
   mSceneLoaded = false;
   mMaterialLoaded = false;
   mHasTexturePoints = false;
-  mHasNormalMap = false;
   mHasDiffuseMap = false;
+  mHasNormalMap = false;
   mHasSpecularMap = false;
   mSceneAABB.Init();
 }
@@ -67,9 +72,6 @@ void ObjLoader::CalculateTangentArray(const Dali::Vector<Vector3>& vertex,
                                       Dali::Vector<Vector3>& normal,
                                       Dali::Vector<Vector3>& tangent)
 {
-  normal.Clear();
-  normal.Resize(vertex.Size());
-
   Dali::Vector<Vector3> tangents;
   tangents.Resize( vertex.Size() );
 
@@ -172,12 +174,16 @@ void ObjLoader::CreateGeometryArray(Dali::Vector<Vertex> & vertices,
   //we need to recalculate the normals too, because we need just one normal,tangent, bitangent per vertex
   //In the case of a textureless object, we don't need tangents for our shader and so we skip this step
   //TODO: Use a better function to calculate tangents
-
   if( mTangents.Size() == 0 && mHasTexturePoints )
   {
-    mTangents.Resize( mNormals.Size() );
-    mBiTangents.Resize( mNormals.Size() );
+    mNormals.Clear();
+
+    mNormals.Resize( mPoints.Size() );
+    mTangents.Resize( mPoints.Size() );
+    mBiTangents.Resize( mPoints.Size() );
+
     CalculateTangentArray( mPoints, mTextures, mTriangles, mNormals, mTangents );
+
     for ( unsigned int ui = 0 ; ui < mNormals.Size() ; ++ui )
     {
       mBiTangents[ui] = mNormals[ui].Cross(mTangents[ui]);
@@ -275,14 +281,14 @@ void ObjLoader::CreateGeometryArray(Dali::Vector<Vertex> & vertices,
   }
 }
 
-bool ObjLoader::Load( char* objBuffer, std::streampos fileSize, std::string& materialFile )
+bool ObjLoader::LoadObject( char* objBuffer, std::streampos fileSize )
 {
   Vector3 point;
   Vector2 texture;
-  std::string vet[4], name;
-  int ptIdx[4];
-  int nrmIdx[4];
-  int texIdx[4];
+  std::string vet[MAX_POINT_INDICES], name;
+  int ptIdx[MAX_POINT_INDICES];
+  int nrmIdx[MAX_POINT_INDICES];
+  int texIdx[MAX_POINT_INDICES];
   TriIndex triangle,triangle2;
   int pntAcum = 0, texAcum = 0, nrmAcum = 0;
   bool iniObj = false;
@@ -372,7 +378,7 @@ bool ObjLoader::Load( char* objBuffer, std::streampos fileSize, std::string& mat
       }
 
       int numIndices = 0;
-      while( isline >> vet[numIndices] )
+      while( isline >> vet[numIndices] && numIndices < MAX_POINT_INDICES )
       {
         numIndices++;
       }
@@ -476,9 +482,6 @@ bool ObjLoader::Load( char* objBuffer, std::streampos fileSize, std::string& mat
     {
       isline >> name;
     }
-    else
-    {
-    }
   }
 
   if ( iniObj )
@@ -490,11 +493,10 @@ bool ObjLoader::Load( char* objBuffer, std::streampos fileSize, std::string& mat
   }
 
   return false;
-
 }
 
-void ObjLoader::LoadMaterial( char* objBuffer, std::streampos fileSize, std::string& texture0Url,
-                              std::string& texture1Url, std::string& texture2Url )
+void ObjLoader::LoadMaterial( char* objBuffer, std::streampos fileSize, std::string& diffuseTextureUrl,
+                              std::string& normalTextureUrl, std::string& glossTextureUrl )
 {
   float fR,fG,fB;
 
@@ -518,11 +520,15 @@ void ObjLoader::LoadMaterial( char* objBuffer, std::streampos fileSize, std::str
     {
       isline >> info;
     }
+    else if ( tag == "Ka" ) //ambient color
+    {
+      isline >> fR >> fG >> fB;
+    }
     else if ( tag == "Kd" ) //diffuse color
     {
       isline >> fR >> fG >> fB;
     }
-    else if ( tag == "Kd" ) //Ambient color
+    else if ( tag == "Ks" ) //specular color
     {
       isline >> fR >> fG >> fB;
     }
@@ -535,19 +541,19 @@ void ObjLoader::LoadMaterial( char* objBuffer, std::streampos fileSize, std::str
     else if ( tag == "map_Kd" )
     {
       isline >> info;
-      texture0Url = info;
+      diffuseTextureUrl = info;
       mHasDiffuseMap = true;
     }
     else if ( tag == "bump" )
     {
       isline >> info;
-      texture1Url = info;
+      normalTextureUrl = info;
       mHasNormalMap = true;
     }
     else if ( tag == "map_Ks" )
     {
       isline >> info;
-      texture2Url = info;
+      glossTextureUrl = info;
       mHasSpecularMap = true;
     }
   }
@@ -555,7 +561,7 @@ void ObjLoader::LoadMaterial( char* objBuffer, std::streampos fileSize, std::str
   mMaterialLoaded = true;
 }
 
-Geometry ObjLoader::CreateGeometry( Toolkit::Model3dView::IlluminationType illuminationType )
+Geometry ObjLoader::CreateGeometry( int objectProperties )
 {
   Geometry surface = Geometry::New();
 
@@ -575,8 +581,7 @@ Geometry ObjLoader::CreateGeometry( Toolkit::Model3dView::IlluminationType illum
   surface.AddVertexBuffer( surfaceVertices );
 
   //Some need texture coordinates
-  if( ( (illuminationType == Toolkit::Model3dView::DIFFUSE_WITH_NORMAL_MAP ) ||
-        (illuminationType == Toolkit::Model3dView::DIFFUSE_WITH_TEXTURE ) ) && mHasTexturePoints && mHasDiffuseMap )
+  if( ( objectProperties & TEXTURE_COORDINATES ) && mHasTexturePoints && mHasDiffuseMap )
   {
     Property::Map textureFormat;
     textureFormat["aTexCoord"] = Property::VECTOR2;
@@ -587,7 +592,7 @@ Geometry ObjLoader::CreateGeometry( Toolkit::Model3dView::IlluminationType illum
   }
 
   //Some need tangent and bitangent
-  if( illuminationType == Toolkit::Model3dView::DIFFUSE_WITH_NORMAL_MAP && mHasTexturePoints )
+  if( ( objectProperties & TANGENTS ) && ( objectProperties & BINOMIALS ) && mHasTexturePoints )
   {
     Property::Map vertexExtFormat;
     vertexExtFormat["aTangent"] = Property::VECTOR3;
@@ -598,15 +603,12 @@ Geometry ObjLoader::CreateGeometry( Toolkit::Model3dView::IlluminationType illum
     surface.AddVertexBuffer( extraVertices );
   }
 
+  //If indices are required, we set them.
   if ( indices.Size() )
   {
     surface.SetIndexBuffer ( &indices[0], indices.Size() );
   }
 
-  vertices.Clear();
-  verticesExt.Clear();
-  indices.Clear();
-
   return surface;
 }
 
index 0a9ea25..0336323 100644 (file)
 
 // EXTERNAL INCLUDES
 #include <dali/devel-api/rendering/renderer.h>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/model3d-view/model3d-view.h>
-
+#include <limits>
 
 namespace Dali
 {
@@ -65,7 +62,7 @@ public:
     {}
 
     VertexExt( const Vector3& tangent, const Vector3& binormal )
-    : tangent( tangent), bitangent (binormal)
+    : tangent( tangent), bitangent( binormal )
     {}
 
     Vector3 tangent;
@@ -76,36 +73,45 @@ public:
   {
     void Init()
     {
-      pointMin = Vector3(999999.9,999999.9,999999.9);
-      pointMax = Vector3(-999999.9,-999999.9,-999999.9);
+      pointMin = Vector3( std::numeric_limits<float>::max(), std::numeric_limits<float>::max(), std::numeric_limits<float>::max() );
+      pointMax = Vector3( std::numeric_limits<float>::min(), std::numeric_limits<float>::min(), std::numeric_limits<float>::min() );
     }
 
-    void ConsiderNewPointInVolume(const Vector3& position)
+    void ConsiderNewPointInVolume( const Vector3& position )
     {
-      pointMin.x = std::min(position.x, pointMin.x);
-      pointMin.y = std::min(position.y, pointMin.y);
-      pointMin.z = std::min(position.z, pointMin.z);
+      pointMin.x = std::min( position.x, pointMin.x );
+      pointMin.y = std::min( position.y, pointMin.y );
+      pointMin.z = std::min( position.z, pointMin.z );
 
-      pointMax.x = std::max(position.x, pointMax.x);
-      pointMax.y = std::max(position.y, pointMax.y);
-      pointMax.z = std::max(position.z, pointMax.z);
+      pointMax.x = std::max( position.x, pointMax.x );
+      pointMax.y = std::max( position.y, pointMax.y );
+      pointMax.z = std::max( position.z, pointMax.z );
     }
 
     Vector3 pointMin;
     Vector3 pointMax;
   };
 
+  //Defines bit masks to declare which properties are needed by anyone requesting a geometry.
+  enum ObjectProperties
+  {
+    TEXTURE_COORDINATES = 1 << 0,
+    TANGENTS = 1 << 1,
+    BINOMIALS = 1 << 2
+  };
+
   ObjLoader();
   virtual ~ObjLoader();
 
   bool      IsSceneLoaded();
   bool      IsMaterialLoaded();
 
-  bool      Load(char* objBuffer, std::streampos fileSize, std::string& materialFile);
+  bool      LoadObject( char* objBuffer, std::streampos fileSize );
 
-  void      LoadMaterial(char* objBuffer, std::streampos fileSize, std::string& texture0Url, std::string& texture1Url, std::string& texture2Url);
+  void      LoadMaterial( char* objBuffer, std::streampos fileSize, std::string& diffuseTextureUrl,
+                          std::string& normalTextureUrl, std::string& glossTextureUrl );
 
-  Geometry  CreateGeometry(Toolkit::Model3dView::IlluminationType illuminationType);
+  Geometry  CreateGeometry( int objectProperties );
 
   Vector3   GetCenter();
   Vector3   GetSize();
@@ -138,19 +144,19 @@ private:
   Dali::Vector<Vector3> mBiTangents;
   Dali::Vector<TriIndex> mTriangles;
 
-  void CalculateTangentArray(const Dali::Vector<Vector3>& vertex,
-                             const Dali::Vector<Vector2>& texcoord,
-                             Dali::Vector<TriIndex>& triangle,
-                             Dali::Vector<Vector3>& normal,
-                             Dali::Vector<Vector3>& tangent);
+  void CalculateTangentArray( const Dali::Vector<Vector3>& vertex,
+                              const Dali::Vector<Vector2>& texcoord,
+                              Dali::Vector<TriIndex>& triangle,
+                              Dali::Vector<Vector3>& normal,
+                              Dali::Vector<Vector3>& tangent );
 
-  void CenterAndScale(bool center, Dali::Vector<Vector3>& points);
+  void CenterAndScale( bool center, Dali::Vector<Vector3>& points );
 
 
-  void CreateGeometryArray(Dali::Vector<Vertex> & vertices,
-                           Dali::Vector<Vector2> & textures,
-                           Dali::Vector<VertexExt> & verticesExt,
-                           Dali::Vector<unsigned short> & indices);
+  void CreateGeometryArray( Dali::Vector<Vertex> & vertices,
+                            Dali::Vector<Vector2> & textures,
+                            Dali::Vector<VertexExt> & verticesExt,
+                            Dali::Vector<unsigned short> & indices );
 
 };
 
diff --git a/dali-toolkit/internal/controls/renderers/mesh/mesh-renderer.cpp b/dali-toolkit/internal/controls/renderers/mesh/mesh-renderer.cpp
new file mode 100644 (file)
index 0000000..8b3256d
--- /dev/null
@@ -0,0 +1,553 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * 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 "mesh-renderer.h"
+
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+#include <dali/public-api/images/resource-image.h>
+#include <dali/public-api/common/stage.h>
+#include <dali/devel-api/adaptor-framework/file-loader.h>
+#include <fstream>
+
+//INTERNAL INCLUDES
+#include <dali-toolkit/internal/controls/renderers/renderer-string-constants.h>
+#include <dali-toolkit/internal/controls/renderers/renderer-factory-impl.h>
+#include <dali-toolkit/internal/controls/renderers/renderer-factory-cache.h>
+#include <dali-toolkit/internal/controls/renderers/control-renderer-data-impl.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+namespace
+{
+
+//Defines ordering of textures for shaders.
+//All shaders, if including certain texture types, must include them in the same order.
+//Within the texture set for the renderer, textures are ordered in the same manner.
+enum TextureIndex
+{
+  DIFFUSE_INDEX = 0u,
+  NORMAL_INDEX = 1u,
+  GLOSS_INDEX = 2u
+};
+
+const char * const RENDERER_TYPE_VALUE( "mesh" ); //String label for which type of control renderer this is.
+const char * const LIGHT_POSITION( "uLightPosition" ); //Shader property
+const char * const OBJECT_MATRIX( "uObjectMatrix" ); //Shader property
+
+//Shaders
+//If a shader requires certain textures, they must be listed in order,
+//as detailed in the TextureIndex enum documentation.
+
+//A basic shader that doesn't use textures at all.
+const char* SIMPLE_VERTEX_SHADER = DALI_COMPOSE_SHADER(
+  attribute highp vec3 aPosition;\n
+  attribute highp vec3 aNormal;\n
+  varying mediump vec3 vIllumination;\n
+  uniform mediump vec3 uSize;\n
+  uniform mediump mat4 uMvpMatrix;\n
+  uniform mediump mat4 uModelView;\n
+  uniform mediump mat3 uNormalMatrix;
+  uniform mediump mat4 uObjectMatrix;\n
+  uniform mediump vec3 uLightPosition;\n
+
+  void main()\n
+  {\n
+    vec4 vertexPosition = vec4( aPosition * min( uSize.x, uSize.y ), 1.0 );\n
+    vertexPosition = uObjectMatrix * vertexPosition;\n
+    vertexPosition = uMvpMatrix * vertexPosition;\n
+
+    //Illumination in Model-View space - Transform attributes and uniforms\n
+    vec4 vertPos = uModelView * vec4( aPosition.xyz, 1.0 );\n
+    vec3 normal = uNormalMatrix * mat3( uObjectMatrix ) * aNormal;\n
+    vec4 centre = uModelView * vec4( 0.0, 0.0, 0.0, 1.0 );\n
+    vec4 lightPos = vec4( centre.x, centre.y, uLightPosition.z, 1.0 );\n
+    vec3 vecToLight = normalize( lightPos.xyz - vertPos.xyz );\n
+
+    float lightDiffuse = max( dot( vecToLight, normal ), 0.0 );\n
+    vIllumination = vec3( lightDiffuse * 0.5 + 0.5 );\n
+
+    gl_Position = vertexPosition;\n
+  }\n
+);
+
+//Fragment shader corresponding to the texture-less shader.
+const char* SIMPLE_FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
+  precision mediump float;\n
+  varying mediump vec3 vIllumination;\n
+  uniform lowp vec4 uColor;\n
+
+  void main()\n
+  {\n
+    gl_FragColor = vec4( vIllumination.rgb * uColor.rgb, uColor.a );\n
+  }\n
+);
+
+//Diffuse and specular illumination shader with albedo texture. Texture is index 0.
+const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
+  attribute highp vec3 aPosition;\n
+  attribute highp vec2 aTexCoord;\n
+  attribute highp vec3 aNormal;\n
+  varying mediump vec2 vTexCoord;\n
+  varying mediump vec3 vIllumination;\n
+  varying mediump float vSpecular;\n
+  uniform mediump vec3 uSize;\n
+  uniform mediump mat4 uMvpMatrix;\n
+  uniform mediump mat4 uModelView;
+  uniform mediump mat3 uNormalMatrix;
+  uniform mediump mat4 uObjectMatrix;\n
+  uniform mediump vec3 uLightPosition;\n
+
+  void main()
+  {\n
+    vec4 vertexPosition = vec4( aPosition * min( uSize.x, uSize.y ), 1.0 );\n
+    vertexPosition = uObjectMatrix * vertexPosition;\n
+    vertexPosition = uMvpMatrix * vertexPosition;\n
+
+    //Illumination in Model-View space - Transform attributes and uniforms\n
+    vec4 vertPos = uModelView * vec4( aPosition.xyz, 1.0 );\n
+    vec4 centre = uModelView * vec4( 0.0, 0.0, 0.0, 1.0 );\n
+    vec4 lightPos = vec4( centre.x, centre.y, uLightPosition.z, 1.0 );\n
+    vec3 normal = normalize( uNormalMatrix * mat3( uObjectMatrix ) * aNormal );\n
+
+    vec3 vecToLight = normalize( lightPos.xyz - vertPos.xyz );\n
+    vec3 viewDir = normalize( -vertPos.xyz );
+
+    vec3 halfVector = normalize( viewDir + vecToLight );
+
+    float lightDiffuse = dot( vecToLight, normal );\n
+    lightDiffuse = max( 0.0,lightDiffuse );\n
+    vIllumination = vec3( lightDiffuse * 0.5 + 0.5 );\n
+
+    vec3 reflectDir = reflect( -vecToLight, normal );
+    vSpecular = pow( max( dot( reflectDir, viewDir ), 0.0 ), 4.0 );
+
+    vTexCoord = aTexCoord;\n
+    gl_Position = vertexPosition;\n
+  }\n
+);
+
+//Fragment shader corresponding to the diffuse and specular illumination shader with albedo texture
+const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
+  precision mediump float;\n
+  varying mediump vec2 vTexCoord;\n
+  varying mediump vec3 vIllumination;\n
+  varying mediump float vSpecular;\n
+  uniform sampler2D sDiffuse;\n
+  uniform lowp vec4 uColor;\n
+
+  void main()\n
+  {\n
+    vec4 texture = texture2D( sDiffuse, vTexCoord );\n
+    gl_FragColor = vec4( vIllumination.rgb * texture.rgb * uColor.rgb + vSpecular * 0.3, texture.a * uColor.a );\n
+  }\n
+);
+
+//Diffuse and specular illumination shader with albedo texture, normal map and gloss map shader.
+//Diffuse (albedo) texture is index 0, normal is 1, gloss is 2. They must be declared in this order.
+const char* NORMAL_MAP_VERTEX_SHADER = DALI_COMPOSE_SHADER(
+  attribute highp vec3 aPosition;\n
+  attribute highp vec2 aTexCoord;\n
+  attribute highp vec3 aNormal;\n
+  attribute highp vec3 aTangent;\n
+  attribute highp vec3 aBiNormal;\n
+  varying mediump vec2 vTexCoord;\n
+  varying mediump vec3 vLightDirection;\n
+  varying mediump vec3 vHalfVector;\n
+  uniform mediump vec3 uSize;\n
+  uniform mediump mat4 uMvpMatrix;\n
+  uniform mediump mat4 uModelView;
+  uniform mediump mat3 uNormalMatrix;
+  uniform mediump mat4 uObjectMatrix;\n
+  uniform mediump vec3 uLightPosition;\n
+
+  void main()
+  {\n
+    vec4 vertexPosition = vec4( aPosition * min( uSize.x, uSize.y ), 1.0 );\n
+    vertexPosition = uObjectMatrix * vertexPosition;\n
+    vertexPosition = uMvpMatrix * vertexPosition;\n
+
+    vec4 vertPos = uModelView * vec4( aPosition.xyz, 1.0 );\n
+    vec4 centre = uModelView * vec4( 0.0, 0.0, 0.0, 1.0 );\n
+    vec4 lightPos = vec4( centre.x, centre.y, uLightPosition.z, 1.0 );\n
+
+    vec3 tangent = normalize( uNormalMatrix * aTangent );
+    vec3 binormal = normalize( uNormalMatrix * aBiNormal );
+    vec3 normal = normalize( uNormalMatrix * mat3( uObjectMatrix ) * aNormal );
+
+    vec3 vecToLight = normalize( lightPos.xyz - vertPos.xyz );\n
+    vLightDirection.x = dot( vecToLight, tangent );
+    vLightDirection.y = dot( vecToLight, binormal );
+    vLightDirection.z = dot( vecToLight, normal );
+
+    vec3 viewDir = normalize( -vertPos.xyz );
+    vec3 halfVector = normalize( viewDir + vecToLight );
+    vHalfVector.x = dot( halfVector, tangent );
+    vHalfVector.y = dot( halfVector, binormal );
+    vHalfVector.z = dot( halfVector, normal );
+
+    vTexCoord = aTexCoord;\n
+    gl_Position = vertexPosition;\n
+  }\n
+);
+
+//Fragment shader corresponding to the shader that uses all textures (diffuse, normal and gloss maps)
+const char* NORMAL_MAP_FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
+  precision mediump float;\n
+  varying mediump vec2 vTexCoord;\n
+  varying mediump vec3 vLightDirection;\n
+  varying mediump vec3 vHalfVector;\n
+  uniform sampler2D sDiffuse;\n
+  uniform sampler2D sNormal;\n
+  uniform sampler2D sGloss;\n
+  uniform lowp vec4 uColor;\n
+
+  void main()\n
+  {\n
+    vec4 texture = texture2D( sDiffuse, vTexCoord );\n
+    vec3 normal = normalize( texture2D( sNormal, vTexCoord ).xyz * 2.0 - 1.0 );\n
+    vec4 glossMap = texture2D( sGloss, vTexCoord );\n
+
+    float lightDiffuse = max( 0.0, dot( normal, normalize( vLightDirection ) ) );\n
+    lightDiffuse = lightDiffuse * 0.5 + 0.5;\n
+
+    float shininess = pow ( max ( dot ( normalize( vHalfVector ), normal ), 0.0 ), 16.0 )  ;
+
+    gl_FragColor = vec4( texture.rgb * uColor.rgb * lightDiffuse + shininess * glossMap.rgb, texture.a * uColor.a );\n
+  }\n
+);
+
+} // namespace
+
+MeshRenderer::MeshRenderer( RendererFactoryCache& factoryCache )
+: ControlRenderer( factoryCache ),
+  mShaderType( ALL_TEXTURES ),
+  mUseTexture( true )
+{
+}
+
+MeshRenderer::~MeshRenderer()
+{
+}
+
+void MeshRenderer::DoInitialize( Actor& actor, const Property::Map& propertyMap )
+{
+  Property::Value* objectUrl = propertyMap.Find( OBJECT_URL );
+  if( !objectUrl || !objectUrl->Get( mObjectUrl ) )
+  {
+    DALI_LOG_ERROR( "Fail to provide object URL to the MeshRenderer object.\n" );
+  }
+
+  Property::Value* materialUrl = propertyMap.Find( MATERIAL_URL );
+
+  if( !materialUrl || !materialUrl->Get( mMaterialUrl ) || mMaterialUrl.empty() )
+  {
+    mUseTexture = false;
+  }
+
+  Property::Value* imagesUrl = propertyMap.Find( TEXTURES_PATH );
+  if( !imagesUrl || !imagesUrl->Get( mTexturesPath ) )
+  {
+    //Default behaviour is to assume files are in the same directory,
+    // or have their locations detailed in full when supplied.
+    mTexturesPath.clear();
+  }
+
+  Property::Value* shaderType = propertyMap.Find( SHADER_TYPE );
+  if( shaderType && shaderType->Get( mShaderTypeString ) )
+  {
+    if( mShaderTypeString == "textureless" )
+    {
+      mShaderType = TEXTURELESS;
+    }
+    else if( mShaderTypeString == "diffuseTexture" )
+    {
+      mShaderType = DIFFUSE_TEXTURE;
+    }
+    else if( mShaderTypeString == "allTextures" )
+    {
+      mShaderType = ALL_TEXTURES;
+    }
+    else
+    {
+      DALI_LOG_ERROR( "Unknown shader type provided to the MeshRenderer object.\n");
+    }
+  }
+}
+
+void MeshRenderer::SetSize( const Vector2& size )
+{
+  ControlRenderer::SetSize( size );
+
+  // ToDo: renderer responds to the size change
+}
+
+void MeshRenderer::SetClipRect( const Rect<int>& clipRect )
+{
+  ControlRenderer::SetClipRect( clipRect );
+
+  //ToDo: renderer responds to the clipRect change
+}
+
+void MeshRenderer::SetOffset( const Vector2& offset )
+{
+  //ToDo: renderer applies the offset
+}
+
+void MeshRenderer::DoSetOnStage( Actor& actor )
+{
+  InitializeRenderer();
+}
+
+void MeshRenderer::DoCreatePropertyMap( Property::Map& map ) const
+{
+  map.Clear();
+  map.Insert( RENDERER_TYPE, RENDERER_TYPE_VALUE );
+  map.Insert( OBJECT_URL, mObjectUrl );
+  map.Insert( MATERIAL_URL, mMaterialUrl );
+  map.Insert( TEXTURES_PATH, mTexturesPath );
+  map.Insert( SHADER_TYPE, mShaderTypeString );
+}
+
+void MeshRenderer::InitializeRenderer()
+{
+  //Try to load the geometry from the file.
+  if( !LoadGeometry() )
+  {
+    SupplyEmptyGeometry();
+    return;
+  }
+
+  //If a texture is used by the obj file, load the supplied material file.
+  if( mObjLoader.IsTexturePresent() && !mMaterialUrl.empty() )
+  {
+    if( !LoadMaterial() )
+    {
+      SupplyEmptyGeometry();
+      return;
+    }
+  }
+
+  //Now that the required parts are loaded, create the geometry for the object.
+  if( !CreateGeometry() )
+  {
+    SupplyEmptyGeometry();
+    return;
+  }
+
+  CreateShader();
+
+  //Load the various texture files supplied by the material file.
+  if( !LoadTextures() )
+  {
+    SupplyEmptyGeometry();
+    return;
+  }
+
+  mImpl->mRenderer = Renderer::New( mGeometry, mShader );
+  mImpl->mRenderer.SetTextures( mTextureSet );
+  mImpl->mRenderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::ON );
+}
+
+void MeshRenderer::SupplyEmptyGeometry()
+{
+  mGeometry = Geometry::New();
+  mShader = Shader::New( SIMPLE_VERTEX_SHADER, SIMPLE_FRAGMENT_SHADER );
+  mImpl->mRenderer = Renderer::New( mGeometry, mShader );
+
+  DALI_LOG_ERROR( "Initialisation error in mesh renderer.\n" );
+}
+
+void MeshRenderer::UpdateShaderUniforms()
+{
+  Stage stage = Stage::GetCurrent();
+
+  Vector3 lightPosition( 0, 0, stage.GetSize().width );
+  mShader.RegisterProperty( LIGHT_POSITION, lightPosition );
+
+  Matrix scaleMatrix;
+  scaleMatrix.SetIdentityAndScale( Vector3( 1.0, -1.0, 1.0 ) );
+  mShader.RegisterProperty( OBJECT_MATRIX, scaleMatrix );
+}
+
+void MeshRenderer::CreateShader()
+{
+  if( mShaderType == ALL_TEXTURES )
+  {
+    mShader = Shader::New( NORMAL_MAP_VERTEX_SHADER, NORMAL_MAP_FRAGMENT_SHADER );
+  }
+  else if( mShaderType == DIFFUSE_TEXTURE )
+  {
+    mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
+  }
+  else //Textureless
+  {
+    mShader = Shader::New( SIMPLE_VERTEX_SHADER, SIMPLE_FRAGMENT_SHADER );
+  }
+
+  UpdateShaderUniforms();
+}
+
+bool MeshRenderer::CreateGeometry()
+{
+  //Determine if we need to use a simpler shader to handle the provided data
+  if( mShaderType == ALL_TEXTURES )
+  {
+    if( !mObjLoader.IsNormalMapPresent() || !mObjLoader.IsSpecularMapPresent() )
+    {
+      mShaderType = DIFFUSE_TEXTURE;
+    }
+  }
+  if( !mObjLoader.IsTexturePresent() || !mObjLoader.IsDiffuseMapPresent() || !mUseTexture )
+  {
+    mShaderType = TEXTURELESS;
+  }
+
+  int objectProperties = 0;
+
+  if( mShaderType == DIFFUSE_TEXTURE ||
+      mShaderType == ALL_TEXTURES )
+  {
+    objectProperties |= ObjLoader::TEXTURE_COORDINATES;
+  }
+
+  if( mShaderType == ALL_TEXTURES )
+  {
+    objectProperties |= ObjLoader::TANGENTS | ObjLoader::BINOMIALS;
+  }
+
+  //Create geometry with attributes required by shader.
+  mGeometry = mObjLoader.CreateGeometry( objectProperties );
+
+  if( mGeometry )
+  {
+    return true;
+  }
+
+  DALI_LOG_ERROR( "Failed to load geometry in mesh renderer.\n" );
+  return false;
+}
+
+bool MeshRenderer::LoadGeometry()
+{
+  std::streampos fileSize;
+  Dali::Vector<char> fileContent;
+
+  if( FileLoader::ReadFile( mObjectUrl, fileSize, fileContent, FileLoader::TEXT ) )
+  {
+    mObjLoader.ClearArrays();
+    mObjLoader.LoadObject( fileContent.Begin(), fileSize );
+
+    //Get size information from the obj loaded
+    mSceneCenter = mObjLoader.GetCenter();
+    mSceneSize = mObjLoader.GetSize();
+
+    return true;
+  }
+
+  DALI_LOG_ERROR( "Failed to find object to load in mesh renderer.\n" );
+  return false;
+}
+
+bool MeshRenderer::LoadMaterial()
+{
+  std::streampos fileSize;
+  Dali::Vector<char> fileContent;
+
+  if( FileLoader::ReadFile( mMaterialUrl, fileSize, fileContent, FileLoader::TEXT ) )
+  {
+    //Load data into obj (usable) form
+    mObjLoader.LoadMaterial( fileContent.Begin(), fileSize, mDiffuseTextureUrl, mNormalTextureUrl, mGlossTextureUrl );
+    return true;
+  }
+
+  DALI_LOG_ERROR( "Failed to find texture set to load in mesh renderer.\n" );
+  mUseTexture = false;
+  return false;
+}
+
+bool MeshRenderer::LoadTextures()
+{
+  mTextureSet = TextureSet::New();
+
+  if( !mDiffuseTextureUrl.empty() )
+  {
+    std::string imageUrl = mTexturesPath + mDiffuseTextureUrl;
+
+    //Load textures
+    Image diffuseTexture = ResourceImage::New( imageUrl );
+    if( diffuseTexture )
+    {
+      mTextureSet.SetImage( DIFFUSE_INDEX, diffuseTexture );
+    }
+    else
+    {
+      DALI_LOG_ERROR( "Failed to load diffuse map texture in mesh renderer.\n");
+      return false;
+    }
+  }
+
+  if( !mNormalTextureUrl.empty() && ( mShaderType == ALL_TEXTURES ) )
+  {
+    std::string imageUrl = mTexturesPath + mNormalTextureUrl;
+
+    //Load textures
+    Image normalTexture = ResourceImage::New( imageUrl );
+    if( normalTexture )
+    {
+      mTextureSet.SetImage( NORMAL_INDEX, normalTexture );
+    }
+    else
+    {
+      DALI_LOG_ERROR( "Failed to load normal map texture in mesh renderer.\n");
+      return false;
+    }
+  }
+
+  if( !mGlossTextureUrl.empty() && ( mShaderType == ALL_TEXTURES ) )
+  {
+    std::string imageUrl = mTexturesPath + mGlossTextureUrl;
+
+    //Load textures
+    Image glossTexture = ResourceImage::New( imageUrl );
+    if( glossTexture )
+    {
+      mTextureSet.SetImage( GLOSS_INDEX, glossTexture );
+    }
+    else
+    {
+      DALI_LOG_ERROR( "Failed to load gloss map texture in mesh renderer.\n");
+      return false;
+    }
+  }
+
+  return true;
+}
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
diff --git a/dali-toolkit/internal/controls/renderers/mesh/mesh-renderer.h b/dali-toolkit/internal/controls/renderers/mesh/mesh-renderer.h
new file mode 100644 (file)
index 0000000..ede12fb
--- /dev/null
@@ -0,0 +1,207 @@
+#ifndef __DALI_TOOLKIT_INTERNAL_MESH_RENDERER_H__
+#define __DALI_TOOLKIT_INTERNAL_MESH_RENDERER_H__
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * 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 <fstream>
+#include <string.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/controls/renderers/control-renderer-impl.h>
+#include <dali-toolkit/internal/controls/model3d-view/obj-loader.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+/**
+ * The renderer which renders a 3D object to the control's quad
+ *
+ * The following Property::Map keys are required to create a MeshRender
+ *
+ * | %Property Name  | Type        | Representing                            |
+ * |-----------------|-------------|-----------------------------------------|
+ * | objectUrl       | STRING      | A URL to the .obj file                  |
+ * | materialUrl     | STRING      | A URL to the .mtl file                  |
+ * | texturesPath    | STRING      | A URL of the path to the texture images |
+ * | shaderType      | STRING      | An enum of shader types                 |
+ */
+class MeshRenderer: public ControlRenderer
+{
+public:
+
+  /**
+   * @brief Constructor.
+   *
+   * @param[in] factoryCache A pointer pointing to the RendererFactoryCache object
+   */
+  MeshRenderer( RendererFactoryCache& factoryCache );
+
+  /**
+   * @brief A reference counted object may only be deleted by calling Unreference().
+   */
+  virtual ~MeshRenderer();
+
+public:  // from ControlRenderer
+
+  /**
+   * @copydoc ControlRenderer::SetSize
+   */
+  virtual void SetSize( const Vector2& size );
+
+  /**
+   * @copydoc ControlRenderer::SetClipRect
+   */
+  virtual void SetClipRect( const Rect<int>& clipRect );
+
+  /**
+   * @copydoc ControlRenderer::SetOffset
+   */
+  virtual void SetOffset( const Vector2& offset );
+
+  /**
+   * @copydoc ControlRenderer::CreatePropertyMap
+   */
+  virtual void DoCreatePropertyMap( Property::Map& map ) const;
+
+protected:
+
+  /**
+   * @copydoc ControlRenderer::DoInitialize
+   */
+  virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
+
+  /**
+   * @copydoc ControlRenderer::DoSetOnStage
+   */
+  virtual void DoSetOnStage( Actor& actor );
+
+public:
+
+  /**
+   * Declare whether a texture map should be used for the object, if it's present. Defaults to true.
+   * @param[in] useTexture boolean declaration.
+   */
+  void SetUseTexture( bool useTexture );
+
+  /**
+   * Declare whether a normal map should be used for the object, if it's present. Defaults to true.
+   * @param[in] useNormalMap boolean declaration.
+   */
+  void SetUseNormalMap( bool useNormalMap );
+
+private:
+
+  //Corresponds to the shader that will be used by the mesh renderer.
+  enum ShaderType
+  {
+    TEXTURELESS,
+    DIFFUSE_TEXTURE,
+    ALL_TEXTURES
+  };
+
+  /**
+   * @brief Provide an empty geometry for the renderer to use.
+   * @details For use in error cases where the initialisation has failed for varying reasons.
+   */
+  void SupplyEmptyGeometry();
+
+  /**
+   * @brief Initialize the renderer with the geometry and shader from the cache, if not available, create and save to the cache for sharing.
+   */
+  void InitializeRenderer();
+
+  /**
+   * @brief Create a shader for the object to use.
+   */
+  void CreateShader();
+
+  /**
+   * @brief Update shader related info, uniforms, etc. for the new shader.
+   */
+  void UpdateShaderUniforms();
+
+  /**
+   * @brief Use the object URL stored in the renderer to load and create the geometry of the object.
+   * @return Boolean of success of operation.
+   */
+  bool CreateGeometry();
+
+  /**
+   * @brief Use the object URL stored in the renderer to load the geometry of the object.
+   * @return Boolean of success of operation.
+   */
+  bool LoadGeometry();
+
+  /**
+   * @brief Use the material URL stored in the renderer to load the material of the object.
+   * @return Boolean of success of operation.
+   */
+  bool LoadMaterial();
+
+  /**
+   * @brief Use the image and texture URL components to load the different types of texture.
+   * @return Boolean of success of operation. Returns false if any texture fails to load from a url.
+   */
+  bool LoadTextures();
+
+private:
+
+  // Undefined
+  MeshRenderer( const MeshRenderer& meshRenderer );
+
+  // Undefined
+  MeshRenderer& operator=( const MeshRenderer& meshRenderer );
+
+private:
+
+  std::string mObjectUrl;
+  std::string mMaterialUrl;
+
+  std::string mDiffuseTextureUrl;
+  std::string mNormalTextureUrl;
+  std::string mGlossTextureUrl;
+  std::string mTexturesPath;
+
+  std::string mShaderTypeString;
+
+  Shader mShader;
+  Geometry mGeometry;
+  TextureSet mTextureSet;
+
+  ObjLoader mObjLoader;
+  Vector3 mSceneCenter;
+  Vector3 mSceneSize;
+  ShaderType mShaderType;
+
+  bool mUseTexture;
+};
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif /* __DALI_TOOLKIT_INTERNAL_MESH_RENDERER_H__ */
index fb62e8c..fe00209 100644 (file)
@@ -32,6 +32,7 @@
 #include <dali-toolkit/internal/controls/renderers/npatch/npatch-renderer.h>
 #include <dali-toolkit/internal/controls/renderers/image/image-renderer.h>
 #include <dali-toolkit/internal/controls/renderers/svg/svg-renderer.h>
+#include <dali-toolkit/internal/controls/renderers/mesh/mesh-renderer.h>
 #include <dali-toolkit/internal/controls/renderers/renderer-factory-cache.h>
 #include <dali-toolkit/internal/controls/renderers/renderer-string-constants.h>
 #include <dali-toolkit/internal/controls/renderers/image-atlas-manager.h>
@@ -82,7 +83,7 @@ RendererFactory::RendererType RendererFactory::GetRendererType( const Property::
   std::string typeValue ;
   if( type && type->Get( typeValue ))
   {
-    if( typeValue ==  COLOR_RENDERER )
+    if( typeValue == COLOR_RENDERER )
     {
       rendererType = COLOR;
     }
@@ -90,14 +91,18 @@ RendererFactory::RendererType RendererFactory::GetRendererType( const Property::
     {
       rendererType = BORDER;
     }
-    else if( typeValue ==  GRADIENT_RENDERER )
+    else if( typeValue == GRADIENT_RENDERER )
     {
       rendererType = GRADIENT;
     }
-    else if( typeValue ==  IMAGE_RENDERER )
+    else if( typeValue == IMAGE_RENDERER )
     {
       rendererType = IMAGE;
     }
+    else if( typeValue == MESH_RENDERER )
+    {
+      rendererType = MESH;
+    }
   }
 
   // check the url if exist, to decide the renderer type
@@ -177,6 +182,11 @@ Toolkit::ControlRenderer RendererFactory::GetControlRenderer( const Property::Ma
       rendererPtr = new SvgRenderer( *( mFactoryCache.Get() ), *( mAtlasManager.Get() ) );
       break;
     }
+    case MESH:
+    {
+      rendererPtr = new MeshRenderer( *( mFactoryCache.Get() ) );
+      break;
+    }
     case UNDEFINED:
     default:
     {
@@ -444,12 +454,13 @@ void RendererFactory::ResetRenderer( Toolkit::ControlRenderer& renderer, Actor&
 
     //If there's no renderer type specified or if there hasn't been a renderer type change then we can reuse the renderer
     if( type == UNDEFINED ||
-        ( type == IMAGE    && typeid( controlRenderer ) == typeid( ImageRenderer ) ) ||
-        ( type == N_PATCH  && typeid( controlRenderer ) == typeid( NPatchRenderer ) ) ||
-        ( type == COLOR    && typeid( controlRenderer ) == typeid( ColorRenderer ) )||
-        ( type == GRADIENT && typeid( controlRenderer ) == typeid( GradientRenderer ) ) ||
-        ( type == BORDER   && typeid( controlRenderer ) == typeid( BorderRenderer ) ) ||
-        ( type == SVG      && typeid( controlRenderer ) == typeid( SvgRenderer ) ) )
+        ( type == IMAGE     && typeid( controlRenderer ) == typeid( ImageRenderer ) ) ||
+        ( type == N_PATCH   && typeid( controlRenderer ) == typeid( NPatchRenderer ) ) ||
+        ( type == COLOR     && typeid( controlRenderer ) == typeid( ColorRenderer ) ) ||
+        ( type == GRADIENT  && typeid( controlRenderer ) == typeid( GradientRenderer ) ) ||
+        ( type == BORDER    && typeid( controlRenderer ) == typeid( BorderRenderer ) ) ||
+        ( type == SVG       && typeid( controlRenderer ) == typeid( SvgRenderer ) ) ||
+        ( type == MESH      && typeid( controlRenderer ) == typeid( MeshRenderer ) ) )
     {
       controlRenderer.Initialize( actor, propertyMap );
       return;
@@ -485,4 +496,3 @@ void RendererFactory::CreateAtlasManager()
 } // namespace Toolkit
 
 } // namespace Dali
-
index ef01bd1..a5eb87a 100644 (file)
@@ -32,9 +32,17 @@ const char * const COLOR_RENDERER("color");
 const char * const BORDER_RENDERER("border");
 const char * const GRADIENT_RENDERER("gradient");
 const char * const IMAGE_RENDERER("image");
+const char * const MESH_RENDERER("mesh");
 
 const char * const IMAGE_URL_NAME("url");
 const char * const ATLAS_RECT_UNIFORM_NAME ( "uAtlasRect" );
+const char * const COLOR( "color" );
+
+//Mesh properties
+const char * const OBJECT_URL( "objectUrl" );
+const char * const MATERIAL_URL( "materialUrl" );
+const char * const TEXTURES_PATH( "texturesPath" );
+const char * const SHADER_TYPE( "shaderType" );
 
 } // namespace Internal
 
index ebaf29f..51e13f0 100644 (file)
@@ -32,9 +32,17 @@ extern const char * const COLOR_RENDERER;
 extern const char * const BORDER_RENDERER;
 extern const char * const GRADIENT_RENDERER;
 extern const char * const IMAGE_RENDERER;
+extern const char * const MESH_RENDERER;
 
 extern const char * const IMAGE_URL_NAME;
 extern const char * const ATLAS_RECT_UNIFORM_NAME;
+extern const char * const COLOR;
+
+//Mesh properties
+extern const char * const OBJECT_URL;
+extern const char * const MATERIAL_URL;
+extern const char * const TEXTURES_PATH;
+extern const char * const SHADER_TYPE;
 
 } // namespace Internal
 
index a2c1ad7..9e2e707 100644 (file)
@@ -19,8 +19,8 @@
 #include "svg-rasterize-thread.h"
 
 // INTERNAL INCLUDES
-#include "nanosvg/nanosvgrast.h"
-#include "svg-renderer.h"
+#include <dali-toolkit/third-party/nanosvg/nanosvgrast.h>
+#include <dali-toolkit/internal/controls/renderers/svg/svg-renderer.h>
 
 namespace Dali
 {
index ce3dbc0..8fbf70a 100644 (file)
@@ -26,8 +26,8 @@
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
-#include "nanosvg/nanosvg.h"
-#include "svg-rasterize-thread.h"
+#include <dali-toolkit/third-party/nanosvg/nanosvg.h>
+#include <dali-toolkit/internal/controls/renderers/svg/svg-rasterize-thread.h>
 #include <dali-toolkit/internal/controls/renderers/image/image-renderer.h>
 #include <dali-toolkit/internal/controls/renderers/renderer-factory-cache.h>
 #include <dali-toolkit/internal/controls/renderers/renderer-string-constants.h>
index f9edbdd..a33845e 100644 (file)
@@ -25,10 +25,9 @@ toolkit_src_files = \
    $(toolkit_src_dir)/controls/renderers/gradient/linear-gradient.cpp \
    $(toolkit_src_dir)/controls/renderers/gradient/radial-gradient.cpp \
    $(toolkit_src_dir)/controls/renderers/gradient/gradient-renderer.cpp \
-   $(toolkit_src_dir)/controls/renderers/svg/nanosvg/nanosvg.cc \
-   $(toolkit_src_dir)/controls/renderers/svg/nanosvg/nanosvgrast.cc \
    $(toolkit_src_dir)/controls/renderers/svg/svg-rasterize-thread.cpp \
    $(toolkit_src_dir)/controls/renderers/svg/svg-renderer.cpp \
+   $(toolkit_src_dir)/controls/renderers/mesh/mesh-renderer.cpp \
    $(toolkit_src_dir)/controls/alignment/alignment-impl.cpp \
    $(toolkit_src_dir)/controls/bloom-view/bloom-view-impl.cpp \
    $(toolkit_src_dir)/controls/bubble-effect/bubble-emitter-impl.cpp \
@@ -38,7 +37,6 @@ toolkit_src_files = \
    $(toolkit_src_dir)/controls/buttons/push-button-impl.cpp \
    $(toolkit_src_dir)/controls/buttons/radio-button-impl.cpp \
    $(toolkit_src_dir)/controls/effects-view/effects-view-impl.cpp \
-   $(toolkit_src_dir)/controls/flex-container/layout.c \
    $(toolkit_src_dir)/controls/flex-container/flex-container-impl.cpp \
    $(toolkit_src_dir)/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp \
    $(toolkit_src_dir)/controls/image-view/image-view-impl.cpp \
index cf47cb3..ff03ac9 100644 (file)
@@ -486,7 +486,6 @@ struct Decorator::Impl : public ConnectionTracker
     {
       const HandleImpl& primaryHandle = mHandle[LEFT_SELECTION_HANDLE];
       const HandleImpl& secondaryHandle = mHandle[RIGHT_SELECTION_HANDLE];
-      const HandleImpl& grabHandle = mHandle[GRAB_HANDLE];
       const CursorImpl& cursor = mCursor[PRIMARY_CURSOR];
 
       if( primaryHandle.active || secondaryHandle.active )
@@ -502,7 +501,15 @@ struct Decorator::Impl : public ConnectionTracker
       else
       {
         // Calculates the popup's position if the grab handle is active.
-        mCopyPastePopup.position = Vector3( cursor.position.x, -0.5f * popupSize.height - grabHandle.size.height + cursor.position.y, 0.0f );
+        const HandleImpl& grabHandle = mHandle[GRAB_HANDLE];
+        if( grabHandle.verticallyFlipped )
+        {
+          mCopyPastePopup.position = Vector3( cursor.position.x, -0.5f * popupSize.height - grabHandle.size.height + cursor.position.y, 0.0f );
+        }
+        else
+        {
+          mCopyPastePopup.position = Vector3( cursor.position.x, -0.5f * popupSize.height + cursor.position.y, 0.0f );
+        }
       }
     }
 
index b9921c2..dcfb3e4 100644 (file)
@@ -53,9 +53,10 @@ Script LogicalModel::GetScript( CharacterIndex characterIndex ) const
 {
   // If this operation is too slow, consider a binary search.
 
+  const ScriptRun* const scriptRunBuffer = mScriptRuns.Begin();
   for( Length index = 0u, length = mScriptRuns.Count(); index < length; ++index )
   {
-    const ScriptRun* const scriptRun = mScriptRuns.Begin() + index;
+    const ScriptRun* const scriptRun = scriptRunBuffer + index;
 
     if( ( scriptRun->characterRun.characterIndex <= characterIndex ) &&
         ( characterIndex < scriptRun->characterRun.characterIndex + scriptRun->characterRun.numberOfCharacters ) )
index 06b0f10..731b89d 100644 (file)
@@ -32,6 +32,7 @@ namespace Text
 
 void MergeFontDescriptions( const Vector<FontDescriptionRun>& fontDescriptions,
                             Vector<FontId>& fontIds,
+                            Vector<bool>& isDefaultFont,
                             const TextAbstraction::FontDescription& defaultFontDescription,
                             TextAbstraction::PointSize26Dot6 defaultPointSize,
                             CharacterIndex startIndex,
@@ -43,6 +44,9 @@ void MergeFontDescriptions( const Vector<FontDescriptionRun>& fontDescriptions,
   // Pointer to the font id buffer.
   FontId* fontIdsBuffer = fontIds.Begin();
 
+  // Pointer to the 'is default' font buffer.
+  bool* isDefaultFontBuffer = isDefaultFont.Begin();
+
   // Used to temporarily store the style per character.
   TextAbstraction::FontDescription fontDescription;
   TextAbstraction::PointSize26Dot6 fontSize;
@@ -57,7 +61,7 @@ void MergeFontDescriptions( const Vector<FontDescriptionRun>& fontDescriptions,
   const CharacterIndex lastCharacterPlusOne = startIndex + numberOfCharacters;
   for( CharacterIndex index = startIndex; index < lastCharacterPlusOne; ++index )
   {
-    bool defaultFont = true;
+    bool& defaultFont = *(isDefaultFontBuffer + index - startIndex );
 
     Length runIndex = 0u;
 
index b73da2f..8052638 100644 (file)
@@ -39,6 +39,7 @@ namespace Text
  *
  * @param[in] fontDescriptions The font descriptions.
  * @param[out] fontIds The font id for each character.
+ * @param[out] isDefaultFont Whether the font is a default one.
  * @param[in] defaultFontDescription The default font description.
  * @param[in] defaultPointSize The default font size.
  * @param[in] startIndex The character from where the fonts are merged.
@@ -46,6 +47,7 @@ namespace Text
  */
 void MergeFontDescriptions( const Vector<FontDescriptionRun>& fontDescriptions,
                             Vector<FontId>& fontIds,
+                            Vector<bool>& isDefaultFont,
                             const TextAbstraction::FontDescription& defaultFontDescription,
                             TextAbstraction::PointSize26Dot6 defaultPointSize,
                             CharacterIndex startIndex,
index ec9167b..1e8abf2 100644 (file)
@@ -47,7 +47,7 @@ namespace Text
 namespace Internal
 {
 
-bool ValidateFontsPerScript::FindValidFont( FontId fontId ) const
+bool ValidateFontsPerScript::IsValidFont( FontId fontId ) const
 {
   for( Vector<FontId>::ConstIterator it = mValidFonts.Begin(),
          endIt = mValidFonts.End();
@@ -186,7 +186,7 @@ void MultilanguageSupport::SetScripts( const Vector<Character>& text,
   // Count the number of characters which are valid for all scripts. i.e. white spaces or '\n'.
   Length numberOfAllScriptCharacters = 0u;
 
-  // Pointers to the text and break info buffers.
+  // Pointers to the text buffer.
   const Character* const textBuffer = text.Begin();
 
   // Traverse all characters and set the scripts.
@@ -238,7 +238,7 @@ void MultilanguageSupport::SetScripts( const Vector<Character>& text,
         currentScriptRun.characterRun.numberOfCharacters = 0u;
         currentScriptRun.script = TextAbstraction::UNKNOWN;
         numberOfAllScriptCharacters = 0u;
-     }
+      }
 
       // Get the next character.
       ++index;
@@ -415,8 +415,11 @@ void MultilanguageSupport::ValidateFonts( const Vector<Character>& text,
   // Merge font descriptions
   Vector<FontId> fontIds;
   fontIds.Resize( numberOfCharacters, defaultFontId );
+  Vector<bool> isDefaultFont;
+  isDefaultFont.Resize( numberOfCharacters, true );
   MergeFontDescriptions( fontDescriptions,
                          fontIds,
+                         isDefaultFont,
                          defaultFontDescription,
                          defaultPointSize,
                          startIndex,
@@ -424,26 +427,35 @@ void MultilanguageSupport::ValidateFonts( const Vector<Character>& text,
 
   const Character* const textBuffer = text.Begin();
   const FontId* const fontIdsBuffer = fontIds.Begin();
+  const bool* const isDefaultFontBuffer = isDefaultFont.Begin();
   Vector<ScriptRun>::ConstIterator scriptRunIt = scripts.Begin();
   Vector<ScriptRun>::ConstIterator scriptRunEndIt = scripts.End();
   bool isNewParagraphCharacter = false;
 
   PointSize26Dot6 currentPointSize = defaultPointSize;
   FontId currentFontId = 0u;
+  FontId previousFontId = 0u;
+
+  // Whether it's the first set of characters to be validated.
+  // Used in case the paragraph starts with characters common to all scripts.
+  bool isFirstSetToBeValidated = true;
 
   CharacterIndex lastCharacter = startIndex + numberOfCharacters;
   for( Length index = startIndex; index < lastCharacter; ++index )
   {
-    // Get the character.
+    // Get the current character.
     const Character character = *( textBuffer + index );
 
-    // Get the font for the character.
+    // Get the font for the current character.
     FontId fontId = *( fontIdsBuffer + index - startIndex );
 
-    // Get the script for the character.
-    Script script = GetScript( index,
-                               scriptRunIt,
-                               scriptRunEndIt );
+    // Whether the font being validated for the current character is a default one not set by the user.
+    const bool isDefault = *( isDefaultFontBuffer + index - startIndex );
+
+    // Get the script for the current character.
+    const Script script = GetScript( index,
+                                     scriptRunIt,
+                                     scriptRunEndIt );
 
     // Get the current point size.
     if( currentFontId != fontId )
@@ -466,12 +478,10 @@ void MultilanguageSupport::ValidateFonts( const Vector<Character>& text,
     }
 #endif
 
-    // Whether the font being validated is a default one not set by the user.
-    FontId preferredFont = fontId;
-
-    // Validate if the font set by the user supports the character.
+    // Validate whether the current character is supported by the given font.
+    bool isValidFont = false;
 
-    // Check first in the caches.
+    // Check first in the cache of default fonts per script and size.
 
     DefaultFonts* defaultFonts = *( defaultFontPerScriptCacheBuffer + script );
     FontId cachedDefaultFontId = 0u;
@@ -480,112 +490,136 @@ void MultilanguageSupport::ValidateFonts( const Vector<Character>& text,
       cachedDefaultFontId = defaultFonts->FindFont( fontClient, currentPointSize );
     }
 
-    // The user may have set the default font. Check it. Otherwise check in the valid fonts cache.
-    if( fontId != cachedDefaultFontId )
-    {
-      // Check in the valid fonts cache.
-      ValidateFontsPerScript* validateFontsPerScript = *( validFontsPerScriptCacheBuffer + script );
+    // Whether the cached default font is valid.
+    const bool isValidCachedDefaultFont = 0u != cachedDefaultFontId;
 
-      if( NULL == validateFontsPerScript )
-      {
-        validateFontsPerScript = new ValidateFontsPerScript();
+    // The font is valid if it matches with the default one for the current script and size and it's different than zero.
+    isValidFont = isValidCachedDefaultFont && ( fontId == cachedDefaultFontId );
 
-        *( validFontsPerScriptCacheBuffer + script ) = validateFontsPerScript;
-      }
+    bool isCommonScript = false;
+
+    // If the given font is not valid, it means either:
+    // - there is no cached font for the current script yet or,
+    // - the user has set a different font than the default one for the current script or,
+    // - the platform default font is different than the default font for the current script.
 
-      if( NULL != validateFontsPerScript )
+    // Need to check if the given font supports the current character.
+    if( !isValidFont ) // (1)
+    {
+      // Whether the current character is common for all scripts (i.e. white spaces, ...)
+
+      // Is not desirable to cache fonts for the common script.
+      //
+      // i.e. Consider the text " à¤¹à¤¿à¤‚दी", the 'white space' has assigned the DEVANAGARI script.
+      //      The user may have set a font or the platform's default is used.
+      //
+      //      As the 'white space' is the first character, no font is cached so the font validation
+      //      retrieves a glyph from the given font.
+      //
+      //      Many fonts support 'white spaces' so probably the font set by the user or the platform's default
+      //      supports the 'white space'. However, that font may not support the DEVANAGARI script.
+      isCommonScript = TextAbstraction::IsCommonScript( character );
+
+      if( isCommonScript )
+      {
+        if( isValidCachedDefaultFont &&
+            ( isDefault || ( currentFontId == previousFontId ) )  )
+        {
+          // At this point the character common for all scripts has no font assigned.
+          // If there is a valid previously cached default font for it, use that one.
+          fontId = cachedDefaultFontId;
+          isValidFont = true;
+        }
+      }
+      else
       {
-        if( !validateFontsPerScript->FindValidFont( fontId ) )
+        // Check in the valid fonts cache.
+        ValidateFontsPerScript* validateFontsPerScript = *( validFontsPerScriptCacheBuffer + script );
+
+        if( NULL != validateFontsPerScript )
+        {
+          isValidFont = validateFontsPerScript->IsValidFont( fontId );
+        }
+
+        if( !isValidFont ) // (2)
         {
           // Use the font client to validate the font.
-          GlyphIndex glyphIndex = fontClient.GetGlyphIndex( fontId, character );
+          const GlyphIndex glyphIndex = fontClient.GetGlyphIndex( fontId, character );
+
+          // The font is valid if there is a glyph for that character.
+          isValidFont = 0u != glyphIndex;
 
           // Emojis are present in many monochrome fonts; prefer color by default.
-          if( ( TextAbstraction::EMOJI == script ) &&
-              ( 0u != glyphIndex ) )
+          if( isValidFont &&
+              ( TextAbstraction::EMOJI == script ) )
           {
-            BufferImage bitmap = fontClient.CreateBitmap( fontId, glyphIndex );
-            if( bitmap &&
-                ( Pixel::BGRA8888 != bitmap.GetPixelFormat() ) )
-            {
-              glyphIndex = 0u;
-            }
-          }
+            const BufferImage bitmap = fontClient.CreateBitmap( fontId, glyphIndex );
 
-          if( 0u == glyphIndex )
-          {
-            // The font is not valid. Set to zero and a default one will be set.
-            fontId = 0u;
+            // For color emojis, the font is valid if the bitmap is RGBA.
+            isValidFont = bitmap && ( Pixel::BGRA8888 == bitmap.GetPixelFormat() );
           }
-          else
+
+          // If there is a valid font, cache it.
+          if( isValidFont )
           {
-            // Add the font to the valid font cache.
-
-            //   At this point the validated font supports the given character. However, characters
-            // common for all scripts, like white spaces or new paragraph characters, need to be
-            // processed differently.
-            //
-            //   i.e. A white space can have assigned a DEVANAGARI script but the font assigned may not
-            // support none of the DEVANAGARI glyphs. This font can't be added to the cache as a valid
-            // font for the DEVANAGARI script but the COMMON one.
-            if( TextAbstraction::IsCommonScript( character ) )
+            if( NULL == validateFontsPerScript )
             {
-              validateFontsPerScript = *( validFontsPerScriptCacheBuffer + TextAbstraction::COMMON );
+              validateFontsPerScript = new ValidateFontsPerScript();
 
-              if( NULL == validateFontsPerScript )
-              {
-                validateFontsPerScript = new ValidateFontsPerScript();
-
-                *( validFontsPerScriptCacheBuffer + TextAbstraction::COMMON ) = validateFontsPerScript;
-              }
+              *( validFontsPerScriptCacheBuffer + script ) = validateFontsPerScript;
             }
 
             validateFontsPerScript->mValidFonts.PushBack( fontId );
           }
-        }
-      }
-    }
 
-    // The font has not been validated. Find a default one.
-    if( 0u == fontId )
-    {
-      // The character has no font assigned. Get a default one from the cache
-      fontId = cachedDefaultFontId;
+          if( !isValidFont ) // (3)
+          {
+            // The given font has not been validated.
 
-      // If the cache has not a default font, get one from the font client.
-      if( 0u == fontId )
-      {
-        // Emojis are present in many monochrome fonts; prefer color by default.
-        bool preferColor = ( TextAbstraction::EMOJI == script );
+            if( isValidCachedDefaultFont )
+            {
+              // Use the cached default font for the script if there is one.
+              fontId = cachedDefaultFontId;
+            }
+            else
+            {
+              // There is no valid cached default font for the script.
 
-        // Find a fallback-font.
-        fontId = fontClient.FindFallbackFont( preferredFont, character, currentPointSize, preferColor );
+              DefaultFonts* defaultFontsPerScript = NULL;
 
-        // If the system does not support a suitable font, fallback to Latin
-        DefaultFonts* latinDefaults = NULL;
-        if( 0u == fontId )
-        {
-          latinDefaults = *( defaultFontPerScriptCacheBuffer + TextAbstraction::LATIN );
-          if( NULL != latinDefaults )
-          {
-            fontId = latinDefaults->FindFont( fontClient, currentPointSize );
-          }
-        }
+              // Emojis are present in many monochrome fonts; prefer color by default.
+              const bool preferColor = ( TextAbstraction::EMOJI == script );
 
-        if( 0u == fontId )
-        {
-          fontId = fontClient.FindDefaultFont( UTF32_A, currentPointSize );
-        }
+              // Find a fallback-font.
+              fontId = fontClient.FindFallbackFont( currentFontId, character, currentPointSize, preferColor );
 
-        // Cache the font.
-        if( NULL == latinDefaults )
-        {
-          latinDefaults = new DefaultFonts();
-          *( defaultFontPerScriptCacheBuffer + script ) = latinDefaults;
-        }
-        latinDefaults->mFonts.PushBack( fontId );
-      }
-    }
+              if( 0u == fontId )
+              {
+                // If the system does not support a suitable font, fallback to Latin
+                defaultFontsPerScript = *( defaultFontPerScriptCacheBuffer + TextAbstraction::LATIN );
+                if( NULL != defaultFontsPerScript )
+                {
+                  fontId = defaultFontsPerScript->FindFont( fontClient, currentPointSize );
+                }
+              }
+
+              if( 0u == fontId )
+              {
+                fontId = fontClient.FindDefaultFont( UTF32_A, currentPointSize );
+              }
+
+              // Cache the font.
+              if( NULL == defaultFontsPerScript )
+              {
+                defaultFontsPerScript = new DefaultFonts();
+                *( defaultFontPerScriptCacheBuffer + script ) = defaultFontsPerScript;
+              }
+              defaultFontsPerScript->mFonts.PushBack( fontId );
+            }
+          } // !isValidFont (3)
+        } // !isValidFont (2)
+      } // !isCommonScript
+    } // !isValidFont (1)
 
 #ifdef DEBUG_ENABLED
     {
@@ -600,6 +634,12 @@ void MultilanguageSupport::ValidateFonts( const Vector<Character>& text,
     }
 #endif
 
+    if( isFirstSetToBeValidated && !isCommonScript )
+    {
+      currentFontRun.fontId = fontId;
+      isFirstSetToBeValidated = false;
+    }
+
     // The font is now validated.
     if( ( fontId != currentFontRun.fontId ) ||
         isNewParagraphCharacter )
@@ -617,6 +657,11 @@ void MultilanguageSupport::ValidateFonts( const Vector<Character>& text,
       currentFontRun.characterRun.characterIndex = currentFontRun.characterRun.characterIndex + currentFontRun.characterRun.numberOfCharacters;
       currentFontRun.characterRun.numberOfCharacters = 0u;
       currentFontRun.fontId = fontId;
+
+      if( isNewParagraphCharacter )
+      {
+        isFirstSetToBeValidated = true;
+      }
     }
 
     // Add one more character to the run.
@@ -624,7 +669,8 @@ void MultilanguageSupport::ValidateFonts( const Vector<Character>& text,
 
     // Whether the current character is a new paragraph character.
     isNewParagraphCharacter = TextAbstraction::IsNewParagraph( character );
-  }
+    previousFontId = currentFontId;
+  } // end traverse characters.
 
   if( 0u != currentFontRun.characterRun.numberOfCharacters )
   {
index 283b021..ff5e94d 100644 (file)
@@ -67,7 +67,7 @@ struct ValidateFontsPerScript
    *
    * @return @e true if the font is in the vector of valid fonts.
    */
-  bool FindValidFont( FontId fontId ) const;
+  bool IsValidFont( FontId fontId ) const;
 
   Vector<FontId> mValidFonts;
 };
index e248c25..aad550c 100644 (file)
@@ -161,6 +161,13 @@ bool Controller::Impl::ProcessInputEvents()
     }
   }
 
+  if( mEventData->mUpdateCursorPosition ||
+      mEventData->mUpdateLeftSelectionPosition ||
+      mEventData->mUpdateRightSelectionPosition )
+  {
+    NotifyImfManager();
+  }
+
   // The cursor must also be repositioned after inserts into the model
   if( mEventData->mUpdateCursorPosition )
   {
@@ -276,6 +283,80 @@ bool Controller::Impl::ProcessInputEvents()
   return decoratorUpdated;
 }
 
+void Controller::Impl::NotifyImfManager()
+{
+  if( mEventData && mEventData->mImfManager )
+  {
+    CharacterIndex cursorPosition = GetLogicalCursorPosition();
+
+    const Length numberOfWhiteSpaces = GetNumberOfWhiteSpaces( 0u );
+
+    // Update the cursor position by removing the initial white spaces.
+    if( cursorPosition < numberOfWhiteSpaces )
+    {
+      cursorPosition = 0u;
+    }
+    else
+    {
+      cursorPosition -= numberOfWhiteSpaces;
+    }
+
+    mEventData->mImfManager.SetCursorPosition( cursorPosition );
+    mEventData->mImfManager.NotifyCursorPosition();
+  }
+}
+
+CharacterIndex Controller::Impl::GetLogicalCursorPosition() const
+{
+  CharacterIndex cursorPosition = 0u;
+
+  if( mEventData )
+  {
+    if( ( EventData::SELECTING == mEventData->mState ) ||
+        ( EventData::SELECTION_HANDLE_PANNING == mEventData->mState ) )
+    {
+      cursorPosition = std::min( mEventData->mRightSelectionPosition, mEventData->mLeftSelectionPosition );
+    }
+    else
+    {
+      cursorPosition = mEventData->mPrimaryCursorPosition;
+    }
+  }
+
+  return cursorPosition;
+}
+
+Length Controller::Impl::GetNumberOfWhiteSpaces( CharacterIndex index ) const
+{
+  Length numberOfWhiteSpaces = 0u;
+
+  // Get the buffer to the text.
+  Character* utf32CharacterBuffer = mLogicalModel->mText.Begin();
+
+  const Length totalNumberOfCharacters = mLogicalModel->mText.Count();
+  for( ; index < totalNumberOfCharacters; ++index, ++numberOfWhiteSpaces )
+  {
+    if( !TextAbstraction::IsWhiteSpace( *( utf32CharacterBuffer + index ) ) )
+    {
+      break;
+    }
+  }
+
+  return numberOfWhiteSpaces;
+}
+
+void Controller::Impl::GetText( CharacterIndex index, std::string& text ) const
+{
+  // Get the total number of characters.
+  Length numberOfCharacters = mLogicalModel->mText.Count();
+
+  // Retrieve the text.
+  if( 0u != numberOfCharacters )
+  {
+    Utf32ToUtf8( mLogicalModel->mText.Begin() + index, numberOfCharacters - index, text );
+  }
+}
+
 void Controller::Impl::CalculateTextUpdateIndices( Length& numberOfCharacters )
 {
   mTextUpdateInfo.mParagraphCharacterIndex = 0u;
index cefc5aa..003aec5 100644 (file)
@@ -429,6 +429,37 @@ struct Controller::Impl
     }
   }
 
+  /**
+   * @brief Helper to notify IMF manager with surrounding text & cursor changes.
+   */
+  void NotifyImfManager();
+
+  /**
+   * @brief Retrieve the current cursor position.
+   *
+   * @return The cursor position.
+   */
+  CharacterIndex GetLogicalCursorPosition() const;
+
+  /**
+   * @brief Retrieves the number of consecutive white spaces starting from the given @p index.
+   *
+   * @param[in] index The character index from where to count the number of consecutive white spaces.
+   *
+   * @return The number of consecutive white spaces.
+   */
+  Length GetNumberOfWhiteSpaces( CharacterIndex index ) const;
+
+  /**
+   * @brief Retrieve any text previously set starting from the given @p index.
+   *
+   * @param[in] index The character index from where to retrieve the text.
+   * @param[out] text A string of UTF-8 characters.
+   *
+   * @see Dali::Toolkit::Text::Controller::GetText()
+   */
+  void GetText( CharacterIndex index, std::string& text ) const;
+
   bool IsClipboardEmpty()
   {
     bool result( mClipboard && mClipboard.NumberOfItems() );
index 2891953..96a2dc3 100644 (file)
@@ -292,9 +292,6 @@ void Controller::SetText( const std::string& text )
     mImpl->mEventData->mEventQueue.clear();
   }
 
-  // Notify IMF as text changed
-  NotifyImfManager();
-
   // Do this last since it provides callbacks into application code
   mImpl->mControlInterface.TextChanged();
 }
@@ -303,12 +300,8 @@ void Controller::GetText( std::string& text ) const
 {
   if( !mImpl->IsShowingPlaceholderText() )
   {
-    Vector<Character>& utf32Characters = mImpl->mLogicalModel->mText;
-
-    if( 0u != utf32Characters.Count() )
-    {
-      Utf32ToUtf8( &utf32Characters[0], utf32Characters.Count(), text );
-    }
+    // Retrieves the text string.
+    mImpl->GetText( 0u, text );
   }
   else
   {
@@ -316,16 +309,6 @@ void Controller::GetText( std::string& text ) const
   }
 }
 
-unsigned int Controller::GetLogicalCursorPosition() const
-{
-  if( NULL != mImpl->mEventData )
-  {
-    return mImpl->mEventData->mPrimaryCursorPosition;
-  }
-
-  return 0u;
-}
-
 void Controller::SetPlaceholderText( PlaceholderType type, const std::string& text )
 {
   if( NULL != mImpl->mEventData )
@@ -2018,9 +2001,13 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent )
       textChanged = true;
     }
 
-    if( ( mImpl->mEventData->mState != EventData::INTERRUPTED ) &&
-        ( mImpl->mEventData->mState != EventData::INACTIVE ) )
+    if ( ( mImpl->mEventData->mState != EventData::INTERRUPTED ) &&
+         ( mImpl->mEventData->mState != EventData::INACTIVE ) &&
+         ( Dali::DALI_KEY_SHIFT_LEFT != keyCode ) )
     {
+      // Should not change the state if the key is the shift send by the imf manager.
+      // Otherwise, when the state is SELECTING the text controller can't send the right
+      // surrounding info to the imf.
       mImpl->ChangeState( EventData::EDITING );
     }
 
@@ -2564,12 +2551,6 @@ void Controller::TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Butt
       mImpl->SendSelectionToClipboard( true ); // Synchronous call to modify text
       mImpl->mOperationsPending = ALL_OPERATIONS;
 
-      // This is to reset the virtual keyboard to Upper-case
-      if( 0u == mImpl->mLogicalModel->mText.Count() )
-      {
-        NotifyImfManager();
-      }
-
       if( ( 0u != mImpl->mLogicalModel->mText.Count() ) ||
           !mImpl->IsPlaceholderAvailable() )
       {
@@ -2632,35 +2613,36 @@ void Controller::TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Butt
 
 ImfManager::ImfCallbackData Controller::OnImfEvent( ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent )
 {
-  bool update = false;
+  // Whether the text needs to be relaid-out.
   bool requestRelayout = false;
 
-  std::string text;
-  unsigned int cursorPosition = 0u;
+  // Whether to retrieve the text and cursor position to be sent to the IMF manager.
+  bool retrieveText = false;
+  bool retrieveCursor = false;
 
   switch( imfEvent.eventName )
   {
     case ImfManager::COMMIT:
     {
       InsertText( imfEvent.predictiveString, Text::Controller::COMMIT );
-      update = true;
       requestRelayout = true;
+      retrieveCursor = true;
       break;
     }
     case ImfManager::PREEDIT:
     {
       InsertText( imfEvent.predictiveString, Text::Controller::PRE_EDIT );
-      update = true;
       requestRelayout = true;
+      retrieveCursor = true;
       break;
     }
     case ImfManager::DELETESURROUNDING:
     {
-      update = RemoveText( imfEvent.cursorOffset,
-                           imfEvent.numberOfChars,
-                           DONT_UPDATE_INPUT_STYLE );
+      const bool textDeleted = RemoveText( imfEvent.cursorOffset,
+                                           imfEvent.numberOfChars,
+                                           DONT_UPDATE_INPUT_STYLE );
 
-      if( update )
+      if( textDeleted )
       {
         if( ( 0u != mImpl->mLogicalModel->mText.Count() ) ||
             !mImpl->IsPlaceholderAvailable() )
@@ -2673,17 +2655,16 @@ ImfManager::ImfCallbackData Controller::OnImfEvent( ImfManager& imfManager, cons
         }
         mImpl->mEventData->mUpdateCursorPosition = true;
         mImpl->mEventData->mScrollAfterDelete = true;
+
+        requestRelayout = true;
+        retrieveCursor = true;
       }
-      requestRelayout = true;
       break;
     }
     case ImfManager::GETSURROUNDING:
     {
-      GetText( text );
-      cursorPosition = GetLogicalCursorPosition();
-
-      imfManager.SetSurroundingText( text );
-      imfManager.SetCursorPosition( cursorPosition );
+      retrieveText = true;
+      retrieveCursor = true;
       break;
     }
     case ImfManager::VOID:
@@ -2693,12 +2674,6 @@ ImfManager::ImfCallbackData Controller::OnImfEvent( ImfManager& imfManager, cons
     }
   } // end switch
 
-  if( ImfManager::GETSURROUNDING != imfEvent.eventName )
-  {
-    GetText( text );
-    cursorPosition = GetLogicalCursorPosition();
-  }
-
   if( requestRelayout )
   {
     mImpl->mOperationsPending = ALL_OPERATIONS;
@@ -2708,7 +2683,32 @@ ImfManager::ImfCallbackData Controller::OnImfEvent( ImfManager& imfManager, cons
     mImpl->mControlInterface.TextChanged();
   }
 
-  ImfManager::ImfCallbackData callbackData( update, cursorPosition, text, false );
+  std::string text;
+  CharacterIndex cursorPosition = 0u;
+  Length numberOfWhiteSpaces = 0u;
+
+  if( retrieveCursor )
+  {
+    numberOfWhiteSpaces = mImpl->GetNumberOfWhiteSpaces( 0u );
+
+    cursorPosition = mImpl->GetLogicalCursorPosition();
+
+    if( cursorPosition < numberOfWhiteSpaces )
+    {
+      cursorPosition = 0u;
+    }
+    else
+    {
+      cursorPosition -= numberOfWhiteSpaces;
+    }
+  }
+
+  if( retrieveText )
+  {
+    mImpl->GetText( numberOfWhiteSpaces, text );
+  }
+
+  ImfManager::ImfCallbackData callbackData( ( retrieveText || retrieveCursor ), cursorPosition, text, false );
 
   return callbackData;
 }
@@ -2746,11 +2746,6 @@ bool Controller::BackspaceKeyEvent()
 
   if( removed )
   {
-    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::KeyEvent %p DALI_KEY_BACKSPACE RemovedText\n", this );
-    // Notifiy the IMF manager after text changed
-    // Automatic  Upper-case and restarting prediction on an existing word require this.
-    NotifyImfManager();
-
     if( ( 0u != mImpl->mLogicalModel->mText.Count() ) ||
         !mImpl->IsPlaceholderAvailable() )
     {
@@ -2767,23 +2762,6 @@ bool Controller::BackspaceKeyEvent()
   return removed;
 }
 
-void Controller::NotifyImfManager()
-{
-  if( NULL != mImpl->mEventData )
-  {
-    if( mImpl->mEventData->mImfManager )
-    {
-      // Notifying IMF of a cursor change triggers a surrounding text request so updating it now.
-      std::string text;
-      GetText( text );
-      mImpl->mEventData->mImfManager.SetSurroundingText( text );
-
-      mImpl->mEventData->mImfManager.SetCursorPosition( GetLogicalCursorPosition() );
-      mImpl->mEventData->mImfManager.NotifyCursorPosition();
-    }
-  }
-}
-
 void Controller::ShowPlaceholderText()
 {
   if( mImpl->IsPlaceholderAvailable() )
index 7badd1e..e559fad 100644 (file)
@@ -191,7 +191,7 @@ public:
   /**
    * @brief Retrieve any text previously set.
    *
-   * @return A string of UTF-8 characters.
+   * @param[out] text A string of UTF-8 characters.
    */
   void GetText( std::string& text ) const;
 
@@ -212,13 +212,6 @@ public:
                    UpdateInputStyleType type  );
 
   /**
-   * @brief Retrieve the current cursor position.
-   *
-   * @return The cursor position.
-   */
-  unsigned int GetLogicalCursorPosition() const;
-
-  /**
    * @brief Replaces any placeholder text previously set.
    *
    * @param[in] type Different placeholder-text can be shown when the control is active/inactive.
@@ -963,11 +956,6 @@ private:
   bool BackspaceKeyEvent();
 
   /**
-   * @brief Helper to notify IMF manager with surrounding text & cursor changes.
-   */
-  void NotifyImfManager();
-
-  /**
    * @brief Helper to clear font-specific data.
    */
   void ShowPlaceholderText();
index 536df51..85b8aa8 100644 (file)
@@ -83,7 +83,6 @@ public:
     DIFFUSE_WITH_NORMAL_MAP
   };
 
-
   /**
    * @brief Create a new instance of a Model3dView control.
    *
index ef55c84..a4e1d30 100644 (file)
@@ -31,7 +31,7 @@ namespace Toolkit
 
 const unsigned int TOOLKIT_MAJOR_VERSION = 1;
 const unsigned int TOOLKIT_MINOR_VERSION = 1;
-const unsigned int TOOLKIT_MICRO_VERSION = 39;
+const unsigned int TOOLKIT_MICRO_VERSION = 40;
 const char * const TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
diff --git a/dali-toolkit/third-party/file.list b/dali-toolkit/third-party/file.list
new file mode 100644 (file)
index 0000000..53e027f
--- /dev/null
@@ -0,0 +1,4 @@
+third_party_src_files = \
+   $(third_party_src_dir)/nanosvg/nanosvg.cc \
+   $(third_party_src_dir)/nanosvg/nanosvgrast.cc \
+   $(third_party_src_dir)/facebook-flexbox/layout.c
diff --git a/docs/content/images/renderers/mesh-renderer.png b/docs/content/images/renderers/mesh-renderer.png
new file mode 100644 (file)
index 0000000..d5e8ca0
Binary files /dev/null and b/docs/content/images/renderers/mesh-renderer.png differ
index b19b5dd..6930b03 100644 (file)
@@ -14,6 +14,7 @@ DALi provides the following renderers:
  + [Gradient](@ref gradient-renderer)
  + [Image](@ref image-renderers)
  + [Border](@ref border-renderer)
+ + [Mesh](@ref mesh-renderer)
  
 Controls can provide properties that allow users to specify the renderer type.
 Setting renderer properties are done via a property map.
@@ -423,6 +424,42 @@ control.background =
 };
 ~~~
 
+___________________________________________________________________________________________________
+
+## Mesh Renderer {#mesh-renderer}
+
+Renders a mesh using a .obj file, optionally with textures provided by a mtl file. Scaled to fit the control.
+
+![ ](../assets/img/renderers/mesh-renderer.png)
+![ ](renderers/mesh-renderer.png)
+
+### Properties Supported
+
+**RendererType** "mesh"
+
+| Property Name | Type    | Required           | Description                                                          |
+|---------------|:-------:|:------------------:|----------------------------------------------------------------------|
+| objectUrl     | STRING  | Yes                | The location of the .obj file.                                       |
+| materialUrl   | STRING  | No                 | The location of the .mtl file. Leave blank for a textureless object. |
+| texturesPath  | STRING  | If using material  | Path to the directory textures (including gloss and normal) are stored in.   |
+| shaderType    | STRING  | No                 | Sets the type of shader to be used with the mesh. Note that if anything the shader requires is missing, it will use a simpler one that it can handle with what has been supplied.\n Possible values: "textureless", "diffuseTexture", "allTextures".  |
+
+### Usage
+
+~~~{.cpp}
+// C++
+Dali::Toolkit::Control control = Dali::Toolkit::Control::New();
+
+Dali::Property::Map map;
+
+map[ "rendererType" ] = "mesh";
+map[ "objectUrl"    ] = "home/models/Dino.obj";
+map[ "materialUrl"  ] = "home/models/Dino.mtl";
+map[ "texturesPath" ] = "home/images/";
+
+control.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
+~~~
+
 @class _Guide_Control_Renderers
 
 */
index 7ec107a..80ce145 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali-toolkit
 Summary:    The OpenGLES Canvas Core Library Toolkit
-Version:    1.1.39
+Version:    1.1.40
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-2-Clause and MIT
@@ -37,6 +37,12 @@ BuildRequires:  dali-adaptor-devel
   %define dali_toolkit_profile MOBILE
 %endif
 
+%if 0%{?enable_coverage}
+CXXFLAGS+=" -fprofile-arcs -ftest-coverage --coverage "
+LDFLAGS+=" -fprofile-arcs -ftest-coverage --coverage -lgcov "
+%endif
+
+
 %description
 The OpenGLES Canvas Core Library Toolkit - a set of controls that provide
 user interface functionality.
@@ -155,4 +161,3 @@ exit 0
 %defattr(-,root,root,-)
 %{dev_include_path}/%{name}/*
 %{_libdir}/pkgconfig/*.pc
-