Merge branch 'tizen' into new_text 84/32384/1
authorPaul Wisbey <p.wisbey@samsung.com>
Wed, 17 Dec 2014 14:30:30 +0000 (14:30 +0000)
committerPaul Wisbey <p.wisbey@samsung.com>
Wed, 17 Dec 2014 14:31:06 +0000 (14:31 +0000)
Change-Id: I56c3eea20ba2a50052d63ca4b221fe6dd6183d1f

19 files changed:
automated-tests/README.md
automated-tests/execute.sh
automated-tests/src/dali-toolkit-internal/CMakeLists.txt
automated-tests/src/dali-toolkit-internal/tct-dali-toolkit-internal-core.cpp
automated-tests/src/dali-toolkit-unmanaged/CMakeLists.txt
automated-tests/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core.cpp
automated-tests/src/dali-toolkit/CMakeLists.txt
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-harness.cpp [new file with mode: 0644]
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-harness.h [new file with mode: 0644]
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.h
automated-tests/src/dali-toolkit/tct-dali-toolkit-core.cpp
base/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp
base/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.h
base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp
base/dali-toolkit/public-api/controls/control-impl.cpp
base/dali-toolkit/public-api/controls/control.h
optional/dali-toolkit/public-api/dali-toolkit-version.cpp
packaging/dali-toolkit.spec

index 19e7203..d582bf1 100644 (file)
@@ -86,17 +86,21 @@ To execute tests, cd into automated-tests and run
 
 This will execute dali, dali-unmanaged and dali-internal test sets. Note that the output summary for the first will be printed before running the second.
 
-To execute a subset of tests, you can run individual test sets, e.g.
+By default the tests execute in parallel, which is faster but does not produce a single output file (summary.xml).  Use this to execute the tests in series:
 
-    ./execute.sh dali
+    ./execute.sh -s
 
-or for finer granularity, specify a test source file:
+To see the summary.xml results, execute the tests in series and open as follows:
 
-    ./execute.sh dali utc-Dali-Actor.cpp
+    firefox --new-window summary.xml
 
-To see the results, you can open the summary.xml in firefox.
+To see a list of all of the options:
 
-    firefox --new-window summary.xml
+    ./execute.sh -h
+
+To execute a subset of tests, you can run individual test sets, e.g.
+
+    ./execute.sh dali
 
 To get coverage output, run
 
index 1c77009..04dbd1f 100755 (executable)
@@ -1,20 +1,31 @@
 #!/bin/bash
 
-TEMP=`getopt -o sr --long serial,rerun -n 'execute.sh' -- "$@"`
+TEMP=`getopt -o hsr --long help,serial,rerun -n 'execute.sh' -- "$@"`
 
 if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
 
 # Note the quotes around `$TEMP': they are essential!
 eval set -- "$TEMP"
 
-opt_parallel=1
+function usage
+{
+    echo -e "Usage: execute.sh\t\tExecute test cases from all modules in parallel"
+    echo -e "       execute.sh <testmodule>\tExecute test cases from the given module in parallel"
+    echo -e "       execute.sh -s\t\tExecute test cases in serial using Testkit-Lite"
+    echo -e "       execute.sh -r\t\tExecute test cases in parallel, re-running failed test cases in serial afterwards"
+    echo -e "       execute.sh <testcase>\tFind and execute the given test case"
+    exit 2
+}
+
+opt_serial=0
 opt_rerun=""
 while true ; do
     case "$1" in
-        -s|--serial)   opt_parallel=0 ; shift ;;
+        -h|--help)     usage ;;
+        -s|--serial)   opt_serial=1 ; shift ;;
         -r|--rerun)    opt_rerun="-r" ; shift ;;
         --) shift; break;;
-       *) echo "Internal error $1!" ; exit 1 ;;
+        *) echo "Internal error $1!" ; exit 1 ;;
     esac
 done
 
@@ -25,6 +36,8 @@ function execute
     scripts/add_style.pl $1
 }
 
+
+
 # Clean up old test results
 rm -f tct*core-tests.xml
 
@@ -35,34 +48,59 @@ fi
 
 find build \( -name "*.gcda" \) -exec rm '{}' \;
 
-if [ $opt_parallel = 1 ] ; then
+ASCII_BOLD="\e[1m"
+ASCII_RESET="\e[0m"
 
+if [ $opt_serial = 1 ] ; then
+    # Run all test case executables serially, create XML output
     if [ -n "$1" ] ; then
-        if [ -f "build/src/$1/tct-$1-core" ] ; then
-            build/src/$1/tct-$1-core -p $opt_rerun
-        fi
+        execute $1 $*
     else
         for mod in `ls -1 src/ | grep -v CMakeList `
         do
             if [ $mod != 'common' ] && [ $mod != 'manual' ]; then
-                echo EXECUTING $mod
-                build/src/$mod/tct-$mod-core -p $opt_rerun
+
+                echo -ne "$ASCII_BOLD"
+                echo -e "Executing $mod$ASCII_RESET"
+                execute $mod $*
             fi
         done
     fi
 
+    scripts/summarize.pl
 else
-    if [ -n "$1" ] ; then
-        execute $1 $*
+    # if $1 is an executable filename, execute it·
+
+    if [ -z "$1" ] ; then
+        # No arguments:
+        # Execute each test executable in turn, using parallel execution
+        for mod in `ls -1 src/ | grep -v CMakeList | grep -v common | grep -v manual`
+        do
+            echo -e "$ASCII_BOLD"
+            echo -e "Executing $mod$ASCII_RESET"
+            build/src/$mod/tct-$mod-core $opt_rerun
+        done
+
+    elif [ -f "build/src/$1/tct-$1-core" ] ; then
+        # First argument is an executable filename - execute only that with any
+        # remaining arguments
+        module=$1
+        shift;
+        build/src/$module/tct-$module-core $opt_rerun $*
+
     else
-        for mod in `ls -1 src/ | grep -v CMakeList `
+       # First argument is not an executable. Is it a test case name?
+       # Try executing each executable with the test case name until success/known failure
+        for mod in `ls -1 src/ | grep -v CMakeList | grep -v common | grep -v manual`
         do
-            if [ $mod != 'common' ] && [ $mod != 'manual' ]; then
-                echo EXECUTING $mod
-                execute $mod $*
+            output=`build/src/$mod/tct-$mod-core $1`
+            ret=$?
+            if [ $ret -ne 6 ] ; then
+               echo $output
+               if [ $ret -eq 0 ] ; then echo -e "\nPassed" ; fi
+               exit $ret
             fi
         done
+        echo $1 not found
     fi
-
-    scripts/summarize.pl
 fi
index 78b995d..227f4af 100644 (file)
@@ -17,6 +17,7 @@ SET(TC_SOURCES
 
 # Append list of test harness files (Won't get parsed for test cases)
 LIST(APPEND TC_SOURCES
+   ../dali-toolkit/dali-toolkit-test-utils/test-harness.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard.cpp
index c80af33..0a37d05 100644 (file)
-#include <stdio.h>
 #include <string.h>
-#include "tct-dali-toolkit-internal-core.h"
-#include <stdlib.h>
 #include <getopt.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <vector>
-#include <map>
-
-int RunTestCase( struct testcase_s& testCase )
-{
-  int result = 1;
-  if( testCase.startup )
-  {
-    testCase.startup();
-  }
-  result = testCase.function();
-  if( testCase.cleanup )
-  {
-    testCase.cleanup();
-  }
-  return result;
-}
-
-#define MAX_NUM_CHILDREN 16
-
-struct TestCase
-{
-  int testCase;
-  const char* testCaseName;
-
-  TestCase()
-  : testCase(0),
-    testCaseName(NULL)
-  {
-  }
-
-  TestCase(int tc, const char* name)
-  : testCase(tc),
-    testCaseName(name)
-  {
-  }
-  TestCase(const TestCase& rhs)
-  : testCase(rhs.testCase),
-    testCaseName(rhs.testCaseName)
-  {
-  }
-  TestCase& operator=(const TestCase& rhs)
-  {
-    testCase = rhs.testCase;
-    testCaseName = rhs.testCaseName;
-    return *this;
-
-  }
-};
-
-
-typedef std::map<int, TestCase> RunningTestCases;
-
-// Constantly runs up to MAX_NUM_CHILDREN processes
-int RunAllInParallel(const char* processName, bool reRunFailed)
-{
-  int numFailures = 0;
-  int numPasses = 0;
-  int numTestCases = sizeof(tc_array)/sizeof(struct testcase_s) - 1;
-
-  RunningTestCases children;
-  std::vector<int> failedTestCases;
-
-  // Fork up to MAX_NUM_CHILDREN processes, then
-  // wait. As soon as a proc completes, fork the next.
-
-  int nextTestCase = 0;
-  int numRunningChildren = 0;
-  while( nextTestCase < numTestCases || numRunningChildren > 0)
-  {
-    if( nextTestCase < numTestCases )
-    {
-      while( numRunningChildren < MAX_NUM_CHILDREN )
-      {
-        int pid = fork();
-        if( pid == 0 ) // Child process
-        {
-          close(STDOUT_FILENO);
-          close(STDERR_FILENO);
-          exit( RunTestCase( tc_array[nextTestCase] ) );
-        }
-        else if(pid == -1)
-        {
-          perror("fork");
-          exit(2);
-        }
-        else // Parent process
-        {
-          TestCase tc(nextTestCase, tc_array[nextTestCase].name);
-          children[pid] = tc;
-          nextTestCase++;
-          numRunningChildren++;
-        }
-      }
-    }
-
-    int status=0;
-    int childPid = waitpid(-1, &status, 0);
-    if( childPid == -1 )
-    {
-      perror("waitpid");
-      exit(2);
-    }
-
-    if( WIFEXITED(status) )
-    {
-      if( childPid > 0 )
-      {
-        int testResult = WEXITSTATUS(status);
-        if( testResult )
-        {
-          printf("Test case %s failed: %d\n", children[childPid].testCaseName, testResult);
-          failedTestCases.push_back(children[childPid].testCase);
-          numFailures++;
-        }
-        else
-        {
-          numPasses++;
-        }
-        numRunningChildren--;
-      }
-    }
-
-    else if( WIFSIGNALED(status) )
-    {
-      if( childPid > 0 )
-      {
-        RunningTestCases::iterator iter = children.find(childPid);
-        if( iter != children.end() )
-        {
-          printf("Test case %s exited with signal %d\n", iter->second.testCaseName, WTERMSIG(status));
-          failedTestCases.push_back(iter->second.testCase);
-        }
-        else
-        {
-          printf("Unknown child process: %d signaled %d\n", childPid, WTERMSIG(status));
-        }
-
-        numFailures++;
-        numRunningChildren--;
-      }
-    }
-  }
-
-  printf("\rNumber of test passes: %d                                        \n", numPasses);
-  printf("Number of test failures: %d\n", numFailures);
-
-  if( reRunFailed )
-  {
-    for( unsigned int i=0; i<failedTestCases.size(); i++)
-    {
-      printf("Running test case %s:\n", tc_array[failedTestCases[i]].name );
-      RunTestCase( tc_array[failedTestCases[i] ] );
-    }
-  }
-
-  return numFailures;
-}
-
-int FindAndRunTestCase(const char* testCaseName)
-{
-  int result = 2;
-
-  for( int i = 0; tc_array[i].name; i++ )
-  {
-    if( !strcmp(testCaseName, tc_array[i].name) )
-    {
-      return RunTestCase( tc_array[i] );
-    }
-  }
-
-  printf("Unknown testcase name: \"%s\"\n", testCaseName);
-  return result;
-}
+#include <stdlib.h>
+#include <test-harness.h>
+#include "tct-dali-toolkit-internal-core.h"
 
 int main(int argc, char * const argv[])
 {
-  int result = -1;
+  int result = TestHarness::EXIT_STATUS_BAD_ARGUMENT;
 
-  const char* optString = "pr";
-  bool optParallel(false);
+  const char* optString = "r";
   bool optRerunFailed(false);
 
   int nextOpt = 0;
@@ -195,26 +17,24 @@ int main(int argc, char * const argv[])
     nextOpt = getopt( argc, argv, optString );
     switch(nextOpt)
     {
-      case 'p':
-        optParallel = true;
-        break;
       case 'r':
         optRerunFailed = true;
         break;
+      case '?':
+        TestHarness::Usage(argv[0]);
+        exit(TestHarness::EXIT_STATUS_BAD_ARGUMENT);
+        break;
     }
   } while( nextOpt != -1 );
 
-  if( optParallel )
+  if( optind == argc ) // no testcase name in argument list
   {
-    result = RunAllInParallel(argv[0], optRerunFailed);
+    result = TestHarness::RunAllInParallel(argv[0], tc_array, optRerunFailed);
   }
   else
   {
-    if (argc != 2) {
-      printf("Usage: %s <testcase name>\n", argv[0]);
-      return 2;
-    }
-    result = FindAndRunTestCase(argv[1]);
+    // optind is index of next argument - interpret as testcase name
+    result = TestHarness::FindAndRunTestCase(tc_array, argv[optind]);
   }
   return result;
 }
index a41b335..f62490f 100644 (file)
@@ -53,6 +53,7 @@ SET(TC_SOURCES
 
 # Append list of test harness files (Won't get parsed for test cases)
 LIST(APPEND TC_SOURCES
+   ../dali-toolkit/dali-toolkit-test-utils/test-harness.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard.cpp
index 9036241..c3f6586 100644 (file)
-#include <stdio.h>
 #include <string.h>
-#include "tct-dali-toolkit-unmanaged-core.h"
-#include <stdlib.h>
 #include <getopt.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <vector>
-#include <map>
-
-int RunTestCase( struct testcase_s& testCase )
-{
-  int result = 1;
-  if( testCase.startup )
-  {
-    testCase.startup();
-  }
-  result = testCase.function();
-  if( testCase.cleanup )
-  {
-    testCase.cleanup();
-  }
-  return result;
-}
-
-#define MAX_NUM_CHILDREN 16
-
-struct TestCase
-{
-  int testCase;
-  const char* testCaseName;
-
-  TestCase()
-  : testCase(0),
-    testCaseName(NULL)
-  {
-  }
-
-  TestCase(int tc, const char* name)
-  : testCase(tc),
-    testCaseName(name)
-  {
-  }
-  TestCase(const TestCase& rhs)
-  : testCase(rhs.testCase),
-    testCaseName(rhs.testCaseName)
-  {
-  }
-  TestCase& operator=(const TestCase& rhs)
-  {
-    testCase = rhs.testCase;
-    testCaseName = rhs.testCaseName;
-    return *this;
-
-  }
-};
-
-
-typedef std::map<int, TestCase> RunningTestCases;
-
-// Constantly runs up to MAX_NUM_CHILDREN processes
-int RunAllInParallel(const char* processName, bool reRunFailed)
-{
-  int numFailures = 0;
-  int numPasses = 0;
-  int numTestCases = sizeof(tc_array)/sizeof(struct testcase_s) - 1;
-
-  RunningTestCases children;
-  std::vector<int> failedTestCases;
-
-  // Fork up to MAX_NUM_CHILDREN processes, then
-  // wait. As soon as a proc completes, fork the next.
-
-  int nextTestCase = 0;
-  int numRunningChildren = 0;
-  while( nextTestCase < numTestCases || numRunningChildren > 0)
-  {
-    if( nextTestCase < numTestCases )
-    {
-      while( numRunningChildren < MAX_NUM_CHILDREN )
-      {
-        int pid = fork();
-        if( pid == 0 ) // Child process
-        {
-          close(STDOUT_FILENO);
-          close(STDERR_FILENO);
-          exit( RunTestCase( tc_array[nextTestCase] ) );
-        }
-        else if(pid == -1)
-        {
-          perror("fork");
-          exit(2);
-        }
-        else // Parent process
-        {
-          TestCase tc(nextTestCase, tc_array[nextTestCase].name);
-          children[pid] = tc;
-          nextTestCase++;
-          numRunningChildren++;
-        }
-      }
-    }
-
-    int status=0;
-    int childPid = waitpid(-1, &status, 0);
-    if( childPid == -1 )
-    {
-      perror("waitpid");
-      exit(2);
-    }
-
-    if( WIFEXITED(status) )
-    {
-      if( childPid > 0 )
-      {
-        int testResult = WEXITSTATUS(status);
-        if( testResult )
-        {
-          printf("Test case %s failed: %d\n", children[childPid].testCaseName, testResult);
-          failedTestCases.push_back(children[childPid].testCase);
-          numFailures++;
-        }
-        else
-        {
-          numPasses++;
-        }
-        numRunningChildren--;
-      }
-    }
-
-    else if( WIFSIGNALED(status) )
-    {
-      if( childPid > 0 )
-      {
-        RunningTestCases::iterator iter = children.find(childPid);
-        if( iter != children.end() )
-        {
-          printf("Test case %s exited with signal %d\n", iter->second.testCaseName, WTERMSIG(status));
-          failedTestCases.push_back(iter->second.testCase);
-        }
-        else
-        {
-          printf("Unknown child process: %d signaled %d\n", childPid, WTERMSIG(status));
-        }
-
-        numFailures++;
-        numRunningChildren--;
-      }
-    }
-  }
-
-  printf("\rNumber of test passes: %d                                        \n", numPasses);
-  printf("Number of test failures: %d\n", numFailures);
-
-  if( reRunFailed )
-  {
-    for( unsigned int i=0; i<failedTestCases.size(); i++)
-    {
-      printf("Running test case %s:\n", tc_array[failedTestCases[i]].name );
-      RunTestCase( tc_array[failedTestCases[i] ] );
-    }
-  }
-
-  return numFailures;
-}
-
-int FindAndRunTestCase(const char* testCaseName)
-{
-  int result = 2;
-
-  for( int i = 0; tc_array[i].name; i++ )
-  {
-    if( !strcmp(testCaseName, tc_array[i].name) )
-    {
-      return RunTestCase( tc_array[i] );
-    }
-  }
-
-  printf("Unknown testcase name: \"%s\"\n", testCaseName);
-  return result;
-}
+#include <stdlib.h>
+#include <test-harness.h>
+#include "tct-dali-toolkit-unmanaged-core.h"
 
 int main(int argc, char * const argv[])
 {
-  int result = -1;
+  int result = TestHarness::EXIT_STATUS_BAD_ARGUMENT;
 
-  const char* optString = "pr";
-  bool optParallel(false);
+  const char* optString = "r";
   bool optRerunFailed(false);
 
   int nextOpt = 0;
@@ -195,26 +17,24 @@ int main(int argc, char * const argv[])
     nextOpt = getopt( argc, argv, optString );
     switch(nextOpt)
     {
-      case 'p':
-        optParallel = true;
-        break;
       case 'r':
         optRerunFailed = true;
         break;
+      case '?':
+        TestHarness::Usage(argv[0]);
+        exit(TestHarness::EXIT_STATUS_BAD_ARGUMENT);
+        break;
     }
   } while( nextOpt != -1 );
 
-  if( optParallel )
+  if( optind == argc ) // no testcase name in argument list
   {
-    result = RunAllInParallel(argv[0], optRerunFailed);
+    result = TestHarness::RunAllInParallel(argv[0], tc_array, optRerunFailed);
   }
   else
   {
-    if (argc != 2) {
-      printf("Usage: %s <testcase name>\n", argv[0]);
-      return 2;
-    }
-    result = FindAndRunTestCase(argv[1]);
+    // optind is index of next argument - interpret as testcase name
+    result = TestHarness::FindAndRunTestCase(tc_array, argv[optind]);
   }
   return result;
 }
index afe9242..0ebd611 100644 (file)
@@ -36,6 +36,7 @@ SET(TC_SOURCES
 
 # Append list of test harness files (Won't get parsed for test cases)
 LIST(APPEND TC_SOURCES
+   dali-toolkit-test-utils/test-harness.cpp
    dali-toolkit-test-utils/toolkit-accessibility-manager.cpp
    dali-toolkit-test-utils/toolkit-application.cpp
    dali-toolkit-test-utils/toolkit-clipboard.cpp
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-harness.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-harness.cpp
new file mode 100644 (file)
index 0000000..3fed0a2
--- /dev/null
@@ -0,0 +1,305 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "test-harness.h"
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <vector>
+#include <map>
+#include <cstring>
+#include <testcase.h>
+
+namespace TestHarness
+{
+
+typedef std::map<int, TestCase> RunningTestCases;
+
+namespace
+{
+const char* RED_COLOR="\e[1;31m";
+const char* GREEN_COLOR="\e[1;32m";
+const char* ASCII_RESET="\e[0m";
+const char* ASCII_BOLD="\e[1m";
+}
+
+
+int RunTestCase( struct ::testcase_s& testCase )
+{
+  int result = EXIT_STATUS_TESTCASE_FAILED;
+
+  try
+  {
+    if( testCase.startup )
+    {
+      testCase.startup();
+    }
+    result = testCase.function();
+    if( testCase.cleanup )
+    {
+      testCase.cleanup();
+    }
+  }
+  catch (...)
+  {
+    printf("Caught exception in test case.\n");
+    result = EXIT_STATUS_TESTCASE_ABORTED;
+  }
+
+  return result;
+}
+
+int RunTestCaseInChildProcess( struct ::testcase_s& testCase, bool suppressOutput )
+{
+  int testResult = EXIT_STATUS_TESTCASE_FAILED;
+
+  int pid = fork();
+  if( pid == 0 ) // Child process
+  {
+    if( suppressOutput )
+    {
+      close(STDOUT_FILENO);
+      close(STDERR_FILENO);
+    }
+    exit( RunTestCase( testCase ) );
+  }
+  else if(pid == -1)
+  {
+    perror("fork");
+    exit(EXIT_STATUS_FORK_FAILED);
+  }
+  else // Parent process
+  {
+    int status = 0;
+    int childPid = waitpid(-1, &status, 0);
+    if( childPid == -1 )
+    {
+      perror("waitpid");
+      exit(EXIT_STATUS_WAITPID_FAILED);
+    }
+    if( WIFEXITED(status) )
+    {
+      if( childPid > 0 )
+      {
+        testResult = WEXITSTATUS(status);
+        if( testResult )
+        {
+          printf("Test case %s failed: %d\n", testCase.name, testResult);
+        }
+      }
+    }
+    else if(WIFSIGNALED(status) )
+    {
+      testResult = EXIT_STATUS_TESTCASE_ABORTED;
+
+#ifdef WCOREDUMP
+      if(WCOREDUMP(status))
+      {
+        printf("Test case %s crashed\n", testCase.name);
+      }
+#endif
+      printf("Test case %s exited with signal %s\n", testCase.name, strsignal(WTERMSIG(status)));
+    }
+    else if(WIFSTOPPED(status))
+    {
+      printf("Test case %s stopped with signal %s\n", testCase.name, strsignal(WSTOPSIG(status)));
+    }
+  }
+  return testResult;
+}
+
+void OutputStatistics( int numPasses, int numFailures )
+{
+  const char* failureColor = GREEN_COLOR;
+  if( numFailures > 0 )
+  {
+    failureColor = RED_COLOR;
+  }
+  printf("\rNumber of test passes:   %s%4d (%5.2f%%)%s\n", ASCII_BOLD, numPasses, 100.0f * (float)numPasses / (numPasses+numFailures),  ASCII_RESET);
+  printf("%sNumber of test failures:%s %s%4d%s\n", failureColor, ASCII_RESET, ASCII_BOLD, numFailures, ASCII_RESET);
+
+}
+
+
+int RunAll(const char* processName, ::testcase tc_array[], bool reRunFailed)
+{
+  int numFailures = 0;
+  int numPasses = 0;
+
+  // Run test cases in child process( to kill output/handle signals ), but run serially.
+  for( unsigned int i=0; tc_array[i].name; i++)
+  {
+    int result = RunTestCaseInChildProcess( tc_array[i], true );
+    if( result == 0 )
+    {
+      numPasses++;
+    }
+    else
+    {
+      numFailures++;
+    }
+  }
+
+  OutputStatistics(numPasses, numFailures);
+
+  return numFailures;
+}
+
+
+
+// Constantly runs up to MAX_NUM_CHILDREN processes
+int RunAllInParallel(  const char* processName, ::testcase tc_array[], bool reRunFailed)
+{
+  int numFailures = 0;
+  int numPasses = 0;
+
+  RunningTestCases children;
+  std::vector<int> failedTestCases;
+
+  // Fork up to MAX_NUM_CHILDREN processes, then
+  // wait. As soon as a proc completes, fork the next.
+
+  int nextTestCase = 0;
+  int numRunningChildren = 0;
+
+  while( tc_array[nextTestCase].name || numRunningChildren > 0)
+  {
+    // Create more children (up to the max number or til the end of the array)
+    while( numRunningChildren < MAX_NUM_CHILDREN && tc_array[nextTestCase].name )
+    {
+      int pid = fork();
+      if( pid == 0 ) // Child process
+      {
+        close(STDOUT_FILENO);
+        close(STDERR_FILENO);
+        exit( RunTestCase( tc_array[nextTestCase] ) );
+      }
+      else if(pid == -1)
+      {
+        perror("fork");
+        exit(EXIT_STATUS_FORK_FAILED);
+      }
+      else // Parent process
+      {
+        TestCase tc(nextTestCase, tc_array[nextTestCase].name);
+        children[pid] = tc;
+        nextTestCase++;
+        numRunningChildren++;
+      }
+    }
+
+    // Wait for the next child to finish
+
+    int status=0;
+    int childPid = waitpid(-1, &status, 0);
+    if( childPid == -1 )
+    {
+      perror("waitpid");
+      exit(EXIT_STATUS_WAITPID_FAILED);
+    }
+
+    if( WIFEXITED(status) )
+    {
+      if( childPid > 0 )
+      {
+        int testResult = WEXITSTATUS(status);
+        if( testResult )
+        {
+          printf("Test case %s failed: %d\n", children[childPid].testCaseName, testResult);
+          failedTestCases.push_back(children[childPid].testCase);
+          numFailures++;
+        }
+        else
+        {
+          numPasses++;
+        }
+        numRunningChildren--;
+      }
+    }
+
+    else if( WIFSIGNALED(status) || WIFSTOPPED(status))
+    {
+      status = WIFSIGNALED(status)?WTERMSIG(status):WSTOPSIG(status);
+
+      if( childPid > 0 )
+      {
+        RunningTestCases::iterator iter = children.find(childPid);
+        if( iter != children.end() )
+        {
+          printf("Test case %s exited with signal %s\n", iter->second.testCaseName, strsignal(status));
+          failedTestCases.push_back(iter->second.testCase);
+        }
+        else
+        {
+          printf("Unknown child process: %d signaled %s\n", childPid, strsignal(status));
+        }
+
+        numFailures++;
+        numRunningChildren--;
+      }
+    }
+  }
+
+  OutputStatistics( numPasses, numFailures );
+
+  if( reRunFailed )
+  {
+    for( unsigned int i=0; i<failedTestCases.size(); i++)
+    {
+      char* testCaseStrapline;
+      int numChars = asprintf(&testCaseStrapline, "Test case %s", tc_array[failedTestCases[i]].name );
+      printf("\n%s\n", testCaseStrapline);
+      for(int j=0; j<numChars; j++)
+      {
+        printf("=");
+      }
+      printf("\n");
+      RunTestCaseInChildProcess( tc_array[failedTestCases[i] ], false );
+    }
+  }
+
+  return numFailures;
+}
+
+
+
+int FindAndRunTestCase(::testcase tc_array[], const char* testCaseName)
+{
+  int result = EXIT_STATUS_TESTCASE_NOT_FOUND;
+
+  for( int i = 0; tc_array[i].name; i++ )
+  {
+    if( !strcmp(testCaseName, tc_array[i].name) )
+    {
+      return RunTestCase( tc_array[i] );
+    }
+  }
+
+  printf("Unknown testcase name: \"%s\"\n", testCaseName);
+  return result;
+}
+
+void Usage(const char* program)
+{
+  printf("Usage: \n"
+         "   %s <testcase name>\t\t Execute a test case\n"
+         "   %s \t\t Execute all test cases in parallel\n"
+         "   %s -r\t\t Execute all test cases in parallel, rerunning failed test cases\n",
+         program, program, program);
+}
+
+} // namespace
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-harness.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-harness.h
new file mode 100644 (file)
index 0000000..e6dc517
--- /dev/null
@@ -0,0 +1,109 @@
+#ifndef TEST_HARNESS_H
+#define TEST_HARNESS_H
+
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <testcase.h>
+
+namespace TestHarness
+{
+
+enum ExitStatus
+{
+  EXIT_STATUS_TESTCASE_SUCCEEDED,   // 0
+  EXIT_STATUS_TESTCASE_FAILED,      // 1
+  EXIT_STATUS_TESTCASE_ABORTED,     // 2
+  EXIT_STATUS_FORK_FAILED,          // 3
+  EXIT_STATUS_WAITPID_FAILED,       // 4
+  EXIT_STATUS_BAD_ARGUMENT,         // 5
+  EXIT_STATUS_TESTCASE_NOT_FOUND    // 6
+};
+
+const int MAX_NUM_CHILDREN(16);
+
+struct TestCase
+{
+  int testCase;
+  const char* testCaseName;
+
+  TestCase()
+  : testCase(0),
+    testCaseName(NULL)
+  {
+  }
+
+  TestCase(int tc, const char* name)
+  : testCase(tc),
+    testCaseName(name)
+  {
+  }
+  TestCase(const TestCase& rhs)
+  : testCase(rhs.testCase),
+    testCaseName(rhs.testCaseName)
+  {
+  }
+  TestCase& operator=(const TestCase& rhs)
+  {
+    testCase = rhs.testCase;
+    testCaseName = rhs.testCaseName;
+    return *this;
+
+  }
+};
+
+/**
+ * Run a test case
+ * @param[in] testCase The Testkit-lite test case to run
+ */
+int RunTestCase( struct testcase_s& testCase );
+
+/**
+ * Run all test cases in parallel
+ * @param[in] processName The name of this process
+ * @param[in] tc_array The array of auto-generated testkit-lite test cases
+ * @param[in] reRunFailed True if failed test cases should be re-run
+ * @return 0 on success
+ */
+int RunAllInParallel(const char* processName, testcase tc_array[], bool reRunFailed);
+
+/**
+ * Run all test cases in serial
+ * @param[in] processName The name of this process
+ * @param[in] tc_array The array of auto-generated testkit-lite test cases
+ * @param[in] reRunFailed True if failed test cases should be re-run
+ * @return 0 on success
+ */
+int RunAll(const char* processName, testcase tc_array[], bool reRunFailed);
+
+/**
+ * Find the named test case in the given array, and run it
+ * @param[in] tc_array The array of auto-generated testkit-lite test cases
+ * @param[in] testCaseName the name of the test case to run
+ * @return 0 on success
+ */
+int FindAndRunTestCase(::testcase tc_array[], const char* testCaseName);
+
+/**
+ * Display usage instructions for this program
+ * @param[in] program The name of this program
+ */
+void Usage(const char* program);
+
+} // namespace TestHarness
+
+#endif
index 986346e..260e70c 100644 (file)
@@ -50,7 +50,7 @@ public:
   void Reset();
 
   bool RestoreAfterFocusLost() const;
-  void SetRestoreAferFocusLost( bool toggle );
+  void SetRestoreAfterFocusLost( bool toggle );
   void NotifyCursorPosition();
   int GetCursorPosition();
   void SetCursorPosition( unsigned int cursorPosition );
@@ -170,7 +170,7 @@ bool ImfManager::RestoreAfterFocusLost() const
   return mRestoreAfterFocusLost;
 }
 
-void ImfManager::SetRestoreAferFocusLost( bool toggle )
+void ImfManager::SetRestoreAfterFocusLost( bool toggle )
 {
   mRestoreAfterFocusLost = toggle;
 }
@@ -241,9 +241,9 @@ bool ImfManager::RestoreAfterFocusLost() const
   return Internal::Adaptor::ImfManager::GetImplementation(*this).RestoreAfterFocusLost();
 }
 
-void ImfManager::SetRestoreAferFocusLost( bool toggle )
+void ImfManager::SetRestoreAfterFocusLost( bool toggle )
 {
-  Internal::Adaptor::ImfManager::GetImplementation(*this).SetRestoreAferFocusLost( toggle );
+  Internal::Adaptor::ImfManager::GetImplementation(*this).SetRestoreAfterFocusLost( toggle );
 }
 
 void ImfManager::Reset()
index 2ac731f..aab3940 100644 (file)
@@ -151,7 +151,7 @@ public:
    * Set status whether the IMF has to restore the keyboard after losing focus.
    * @param[in] toggle True means that keyboard should be restored after focus lost and regained.
    */
-  void SetRestoreAferFocusLost( bool toggle );
+  void SetRestoreAfterFocusLost( bool toggle );
 
   /**
    * Send message reset the pred-edit state / imf module.  Used to interupt pre-edit state maybe due to a touch input.
index 195627e..87b2f56 100644 (file)
-#include <stdio.h>
 #include <string.h>
-#include "tct-dali-toolkit-core.h"
-#include <stdlib.h>
 #include <getopt.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <vector>
-#include <map>
-
-int RunTestCase( struct testcase_s& testCase )
-{
-  int result = 1;
-  if( testCase.startup )
-  {
-    testCase.startup();
-  }
-  result = testCase.function();
-  if( testCase.cleanup )
-  {
-    testCase.cleanup();
-  }
-  return result;
-}
-
-#define MAX_NUM_CHILDREN 16
-
-struct TestCase
-{
-  int testCase;
-  const char* testCaseName;
-
-  TestCase()
-  : testCase(0),
-    testCaseName(NULL)
-  {
-  }
-
-  TestCase(int tc, const char* name)
-  : testCase(tc),
-    testCaseName(name)
-  {
-  }
-  TestCase(const TestCase& rhs)
-  : testCase(rhs.testCase),
-    testCaseName(rhs.testCaseName)
-  {
-  }
-  TestCase& operator=(const TestCase& rhs)
-  {
-    testCase = rhs.testCase;
-    testCaseName = rhs.testCaseName;
-    return *this;
-
-  }
-};
-
-
-typedef std::map<int, TestCase> RunningTestCases;
-
-// Constantly runs up to MAX_NUM_CHILDREN processes
-int RunAllInParallel(const char* processName, bool reRunFailed)
-{
-  int numFailures = 0;
-  int numPasses = 0;
-  int numTestCases = sizeof(tc_array)/sizeof(struct testcase_s) - 1;
-
-  RunningTestCases children;
-  std::vector<int> failedTestCases;
-
-  // Fork up to MAX_NUM_CHILDREN processes, then
-  // wait. As soon as a proc completes, fork the next.
-
-  int nextTestCase = 0;
-  int numRunningChildren = 0;
-  while( nextTestCase < numTestCases || numRunningChildren > 0)
-  {
-    if( nextTestCase < numTestCases )
-    {
-      while( numRunningChildren < MAX_NUM_CHILDREN )
-      {
-        int pid = fork();
-        if( pid == 0 ) // Child process
-        {
-          close(STDOUT_FILENO);
-          close(STDERR_FILENO);
-          exit( RunTestCase( tc_array[nextTestCase] ) );
-        }
-        else if(pid == -1)
-        {
-          perror("fork");
-          exit(2);
-        }
-        else // Parent process
-        {
-          TestCase tc(nextTestCase, tc_array[nextTestCase].name);
-          children[pid] = tc;
-          nextTestCase++;
-          numRunningChildren++;
-        }
-      }
-    }
-
-    int status=0;
-    int childPid = waitpid(-1, &status, 0);
-    if( childPid == -1 )
-    {
-      perror("waitpid");
-      exit(2);
-    }
-
-    if( WIFEXITED(status) )
-    {
-      if( childPid > 0 )
-      {
-        int testResult = WEXITSTATUS(status);
-        if( testResult )
-        {
-          printf("Test case %s failed: %d\n", children[childPid].testCaseName, testResult);
-          failedTestCases.push_back(children[childPid].testCase);
-          numFailures++;
-        }
-        else
-        {
-          numPasses++;
-        }
-        numRunningChildren--;
-      }
-    }
-
-    else if( WIFSIGNALED(status) )
-    {
-      if( childPid > 0 )
-      {
-        RunningTestCases::iterator iter = children.find(childPid);
-        if( iter != children.end() )
-        {
-          printf("Test case %s exited with signal %d\n", iter->second.testCaseName, WTERMSIG(status));
-          failedTestCases.push_back(iter->second.testCase);
-        }
-        else
-        {
-          printf("Unknown child process: %d signaled %d\n", childPid, WTERMSIG(status));
-        }
-
-        numFailures++;
-        numRunningChildren--;
-      }
-    }
-  }
-
-  printf("\rNumber of test passes: %d                                        \n", numPasses);
-  printf("Number of test failures: %d\n", numFailures);
-
-  if( reRunFailed )
-  {
-    for( unsigned int i=0; i<failedTestCases.size(); i++)
-    {
-      printf("Running test case %s:\n", tc_array[failedTestCases[i]].name );
-      RunTestCase( tc_array[failedTestCases[i] ] );
-    }
-  }
-
-  return numFailures;
-}
-
-int FindAndRunTestCase(const char* testCaseName)
-{
-  int result = 2;
-
-  for( int i = 0; tc_array[i].name; i++ )
-  {
-    if( !strcmp(testCaseName, tc_array[i].name) )
-    {
-      return RunTestCase( tc_array[i] );
-    }
-  }
-
-  printf("Unknown testcase name: \"%s\"\n", testCaseName);
-  return result;
-}
+#include <stdlib.h>
+#include <test-harness.h>
+#include "tct-dali-toolkit-core.h"
 
 int main(int argc, char * const argv[])
 {
-  int result = -1;
+  int result = TestHarness::EXIT_STATUS_BAD_ARGUMENT;
 
-  const char* optString = "pr";
-  bool optParallel(false);
+  const char* optString = "r";
   bool optRerunFailed(false);
 
   int nextOpt = 0;
@@ -195,26 +17,24 @@ int main(int argc, char * const argv[])
     nextOpt = getopt( argc, argv, optString );
     switch(nextOpt)
     {
-      case 'p':
-        optParallel = true;
-        break;
       case 'r':
         optRerunFailed = true;
         break;
+      case '?':
+        TestHarness::Usage(argv[0]);
+        exit(TestHarness::EXIT_STATUS_BAD_ARGUMENT);
+        break;
     }
   } while( nextOpt != -1 );
 
-  if( optParallel )
+  if( optind == argc ) // no testcase name in argument list
   {
-    result = RunAllInParallel(argv[0], optRerunFailed);
+    result = TestHarness::RunAllInParallel(argv[0], tc_array, optRerunFailed);
   }
   else
   {
-    if (argc != 2) {
-      printf("Usage: %s <testcase name>\n", argv[0]);
-      return 2;
-    }
-    result = FindAndRunTestCase(argv[1]);
+    // optind is index of next argument - interpret as testcase name
+    result = TestHarness::FindAndRunTestCase(tc_array, argv[optind]);
   }
   return result;
 }
index 231f85c..345a247 100644 (file)
@@ -686,21 +686,42 @@ void ItemView::InsertItem( Item newItem, float durationSeconds )
 {
   mAddingItems = true;
 
-  SetupActor( newItem, durationSeconds );
-  Self().Add( newItem.second );
+  Actor displacedActor;
+  ItemPoolIter afterDisplacedIter = mItemPool.end();
 
   ItemPoolIter foundIter = mItemPool.find( newItem.first );
   if( mItemPool.end() != foundIter )
   {
-    Actor moveMe = foundIter->second;
+    SetupActor( newItem, durationSeconds );
+    Self().Add( newItem.second );
+
+    displacedActor = foundIter->second;
     foundIter->second = newItem.second;
 
+    afterDisplacedIter = ++foundIter;
+  }
+  else
+  {
+    // Inserting before the existing item range?
+    ItemPoolIter iter = mItemPool.begin();
+    if( iter != mItemPool.end() &&
+        iter->first > newItem.first )
+    {
+      displacedActor = iter->second;
+      mItemPool.erase( iter++ ); // iter is still valid after the erase
+
+      afterDisplacedIter = iter;
+    }
+  }
+
+  if( displacedActor )
+  {
     // Move the existing actors to make room
-    for( ItemPoolIter iter = ++foundIter; mItemPool.end() != iter; ++iter )
+    for( ItemPoolIter iter = afterDisplacedIter; mItemPool.end() != iter; ++iter )
     {
       Actor temp = iter->second;
-      iter->second = moveMe;
-      moveMe = temp;
+      iter->second = displacedActor;
+      displacedActor = temp;
 
       iter->second.RemoveConstraints();
       mActiveLayout->ApplyConstraints(iter->second, iter->first, durationSeconds, mScrollPositionObject, Self() );
@@ -708,16 +729,12 @@ void ItemView::InsertItem( Item newItem, float durationSeconds )
 
     // Create last item
     ItemId lastId = mItemPool.rbegin()->first;
-    Item lastItem( lastId + 1, moveMe );
+    Item lastItem( lastId + 1, displacedActor );
     mItemPool.insert( lastItem );
 
     lastItem.second.RemoveConstraints();
     mActiveLayout->ApplyConstraints(lastItem.second, lastItem.first, durationSeconds, mScrollPositionObject, Self() );
   }
-  else
-  {
-    mItemPool.insert( newItem );
-  }
 
   CalculateDomainSize(Self().GetCurrentSize());
 
@@ -786,16 +803,18 @@ void ItemView::InsertItems( const ItemContainer& newItems, float durationSeconds
 
 void ItemView::RemoveItem( unsigned int itemId, float durationSeconds )
 {
-  bool actorRemoved = RemoveActor( itemId );
-  if( actorRemoved )
+  bool actorsReordered = RemoveActor( itemId );
+  if( actorsReordered )
   {
     ReapplyAllConstraints( durationSeconds );
+
+    OnItemsRemoved();
   }
 }
 
 void ItemView::RemoveItems( const ItemIdContainer& itemIds, float durationSeconds )
 {
-  bool actorRemoved( false );
+  bool actorsReordered( false );
 
   // Remove from highest id to lowest
   set<ItemId> sortedItems;
@@ -808,27 +827,44 @@ void ItemView::RemoveItems( const ItemIdContainer& itemIds, float durationSecond
   {
     if( RemoveActor( *iter ) )
     {
-      actorRemoved = true;
+      actorsReordered = true;
     }
   }
 
-  if( actorRemoved )
+  if( actorsReordered )
   {
     ReapplyAllConstraints( durationSeconds );
+
+    OnItemsRemoved();
   }
 }
 
 bool ItemView::RemoveActor(unsigned int itemId)
 {
-  bool removed( false );
-
-  const ItemPoolIter removeIter = mItemPool.find( itemId );
+  bool reordered( false );
 
+  ItemPoolIter removeIter = mItemPool.find( itemId );
   if( removeIter != mItemPool.end() )
   {
     ReleaseActor(itemId, removeIter->second);
+  }
+  else
+  {
+    // Removing before the existing item range?
+    ItemPoolIter iter = mItemPool.begin();
+    if( iter != mItemPool.end() &&
+        iter->first > itemId )
+    {
+      // In order to decrement the first visible item ID
+      mItemPool.insert( Item(iter->first - 1, Actor()) );
+
+      removeIter = mItemPool.begin();
+    }
+  }
 
-    removed = true;
+  if( removeIter != mItemPool.end() )
+  {
+    reordered = true;
 
     // Adjust the remaining item IDs, for example if item 2 is removed:
     //   Initial actors:     After insert:
@@ -850,7 +886,7 @@ bool ItemView::RemoveActor(unsigned int itemId)
     }
   }
 
-  return removed;
+  return reordered;
 }
 
 void ItemView::ReplaceItem( Item replacementItem, float durationSeconds )
@@ -1099,8 +1135,19 @@ void ItemView::ReapplyAllConstraints( float durationSeconds )
     actor.RemoveConstraints();
     mActiveLayout->ApplyConstraints(actor, id, durationSeconds, mScrollPositionObject, Self());
   }
+}
 
+void ItemView::OnItemsRemoved()
+{
   CalculateDomainSize(Self().GetCurrentSize());
+
+  // Adjust scroll-position after an item is removed
+  if( mActiveLayout )
+  {
+    float firstItemScrollPosition = ClampFirstItemPosition(GetCurrentLayoutPosition(0), Self().GetCurrentSize(), *mActiveLayout);
+
+    mScrollPositionObject.SetProperty( ScrollConnector::SCROLL_POSITION, firstItemScrollPosition );
+  }
 }
 
 float ItemView::ClampFirstItemPosition(float targetPosition, const Vector3& targetSize, ItemLayout& layout)
index dba4629..51bb3ae 100644 (file)
@@ -289,7 +289,7 @@ private:
   /**
    * Remove an Actor if found in the ItemPool.
    * @param[in] itemId The item to remove.
-   * @return True if an actor was removed.
+   * @return True if the remaining actors were reordered.
    */
   bool RemoveActor( unsigned int itemId );
 
@@ -399,6 +399,11 @@ private:
   void ReapplyAllConstraints( float durationSeconds );
 
   /**
+   * Helper to relayout after item(s) are removed.
+   */
+  void OnItemsRemoved();
+
+  /**
    * Helper to remove items outside a given range.
    * @param[in] range The range of required items.
    */
index 90dd6d5..512b163 100644 (file)
@@ -1042,7 +1042,7 @@ void TextInput::OnKeyInputFocusGained()
     imfManager.Activate();
 
     // When window gain lost focus, the imf manager is deactivated. Thus when window gain focus again, the imf manager must be activated.
-    imfManager.SetRestoreAferFocusLost( true );
+    imfManager.SetRestoreAfterFocusLost( true );
 
     imfManager.SetCursorPosition( mCursorPosition );
     imfManager.NotifyCursorPosition();
@@ -1076,7 +1076,7 @@ void TextInput::OnKeyInputFocusLost()
   if ( imfManager )
   {
     // The text editing is finished. Therefore the imf manager don't have restore activation.
-    imfManager.SetRestoreAferFocusLost( false );
+    imfManager.SetRestoreAfterFocusLost( false );
 
     // Notify that the text editing finish.
     imfManager.Deactivate();
index bea8263..d678af6 100644 (file)
@@ -1101,7 +1101,7 @@ void Control::Initialize()
     styleManager.StyleChangeSignal().Connect( this, &Control::DoStyleChange );
 
     // SetTheme
-    GetImpl( styleManager ).ApplyThemeStyle( GetOwner() );
+    GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) );
   }
 
   SetRequiresHoverEvents(mImpl->mFlags & REQUIRES_HOVER_EVENTS);
@@ -1204,7 +1204,7 @@ void Control::OnActivated()
 
 void Control::OnThemeChange( Toolkit::StyleManager styleManager )
 {
-  GetImpl( styleManager ).ApplyThemeStyle( GetOwner() );
+  GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) );
 }
 
 void Control::OnFontChange( bool defaultFontChange, bool defaultFontSizeChange )
index 8d4d732..e50c544 100644 (file)
@@ -380,15 +380,17 @@ public:
    */
   KeyEventSignalV2& KeyEventSignal();
 
-public: // Intended for control developers (used implicitly)
+public: // Intended for control developers
 
   /**
    * @brief Create an initialised Control.
    *
    * @param[in] implementation The implementation for this control.
    * @return A handle to a newly allocated Dali resource.
+   *
+   * @note Should NOT be called to create a handle from the implementation. As stated, this allocates a NEW Dali resource.
    */
-  Control(Internal::Control& implementation);
+  explicit Control(Internal::Control& implementation);
 
   /**
    * @brief This constructor is used by CustomActor within Dali core to create additional Control handles
@@ -396,7 +398,7 @@ public: // Intended for control developers (used implicitly)
    *
    * @param [in] internal A pointer to a newly allocated Dali resource
    */
-  Control(Dali::Internal::CustomActor* internal);
+  explicit Control(Dali::Internal::CustomActor* internal);
 
 public: // Templates for Deriving Classes
 
index 7de9ea8..7623c7e 100644 (file)
@@ -31,7 +31,7 @@ namespace Toolkit
 
 const unsigned int TOOLKIT_MAJOR_VERSION = 1;
 const unsigned int TOOLKIT_MINOR_VERSION = 0;
-const unsigned int TOOLKIT_MICRO_VERSION = 19;
+const unsigned int TOOLKIT_MICRO_VERSION = 21;
 const char * const TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 2d1fffa..5a9d722 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali-toolkit
 Summary:    The OpenGLES Canvas Core Library Toolkit
-Version:    1.0.19
+Version:    1.0.21
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0