From: David Steele Date: Fri, 11 Apr 2014 10:25:39 +0000 (+0100) Subject: Adding new test harness X-Git-Tag: dali-2014-wk16-release~3 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=fa6279fb2830427d5ab569ca14e6ade1557ef2fa Adding new test harness [Issue#] N/A [Problem] N/A [Cause] N/A [Solution] N/A [Verification] Build Repo Getting about 90% pass rate on target and desktop. Change-Id: I2b174d7cd6c603ce9083471ae4cb972728b6e02f Signed-off-by: David Steele --- diff --git a/automated-tests/CMakeLists.txt b/automated-tests/CMakeLists.txt new file mode 100644 index 0000000..9e15203 --- /dev/null +++ b/automated-tests/CMakeLists.txt @@ -0,0 +1,11 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +PROJECT(tct_coreapi_utc) + +INCLUDE(FindPkgConfig) +SET(BIN_DIR "/opt/usr/bin") + +INCLUDE_DIRECTORIES( + src/common +) + +ADD_SUBDIRECTORY(src) diff --git a/automated-tests/.gitignore b/automated-tests/TET/.gitignore similarity index 100% rename from automated-tests/.gitignore rename to automated-tests/TET/.gitignore diff --git a/automated-tests/_export_desktop.sh b/automated-tests/TET/_export_desktop.sh similarity index 100% rename from automated-tests/_export_desktop.sh rename to automated-tests/TET/_export_desktop.sh diff --git a/automated-tests/_export_env.sh b/automated-tests/TET/_export_env.sh similarity index 100% rename from automated-tests/_export_env.sh rename to automated-tests/TET/_export_env.sh diff --git a/automated-tests/_export_sbs.sh b/automated-tests/TET/_export_sbs.sh similarity index 100% rename from automated-tests/_export_sbs.sh rename to automated-tests/TET/_export_sbs.sh diff --git a/automated-tests/_export_target_env.sh b/automated-tests/TET/_export_target_env.sh similarity index 100% rename from automated-tests/_export_target_env.sh rename to automated-tests/TET/_export_target_env.sh diff --git a/automated-tests/TET/build.sh b/automated-tests/TET/build.sh new file mode 100755 index 0000000..d857de3 --- /dev/null +++ b/automated-tests/TET/build.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +TEMP=`getopt -o 2vds: --long 2,verbose,desktop,scenario: \ + -n 'build_out.sh' -- "$@"` + +if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi + +# Note the quotes around `$TEMP': they are essential! +eval set -- "$TEMP" + +scenario=all +opt_verbose=0 +opt_env=scratchbox + +while true ; do + case "$1" in + -d|--desktop) opt_env=desktop ; shift ;; + -s|--scenario) scenario="$2" ; shift 2 ;; + -v|--verbose) opt_verbose=1 ; shift ;; + -2|--2) opt_env=sbs ; shift ;; + --) shift ; break ;; + *) echo "Internal error!" ; exit 1 ;; + esac +done + + +case "$opt_env" in + desktop) + . _export_desktop.sh + cat < coverage.mk +LDFLAGS += --coverage +EOF + ;; + scratchbox) + . _export_env.sh + cat < coverage.mk +LDFLAGS += +EOF + ;; + sbs) + . _export_sbs.sh + cat < coverage.mk +LDFLAGS += +EOF + ;; +esac + + +echo PATH=$PATH +echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH +echo TET_ROOT=$TET_ROOT +echo TET_SUITE_ROOT=$TET_SUITE_ROOT +echo ARCH=$ARCH + +RESULT_DIR=results-$ARCH +HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal + +# Faster cleanup. +find . -name Makefile -execdir make -f {} clean \; + +mkdir -p $RESULT_DIR +if [ $opt_verbose -eq 1 ] ; then + tcc -b -j - ./ $scenario | tee $JOURNAL_RESULT +else + tcc -b -j $JOURNAL_RESULT -p ./ $scenario +fi +./tbp.pl $JOURNAL_RESULT + + diff --git a/automated-tests/build_out.sh b/automated-tests/TET/build_out.sh similarity index 100% rename from automated-tests/build_out.sh rename to automated-tests/TET/build_out.sh diff --git a/automated-tests/coverage.mk b/automated-tests/TET/coverage.mk similarity index 100% rename from automated-tests/coverage.mk rename to automated-tests/TET/coverage.mk diff --git a/automated-tests/TET/coverage.sh b/automated-tests/TET/coverage.sh new file mode 100755 index 0000000..98798db --- /dev/null +++ b/automated-tests/TET/coverage.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +( cd ../build/slp ; make cov_data ) + +for i in `find . -name Makefile` ; do + ( + cd $(dirname $i) + echo `pwd` + covs=( `ls *.gcda 2>/dev/null` ) + if [[ $? -eq 0 ]] + then + make coverage + fi + ) +done + +( + cd .. ; + genhtml -o build/slp/doc/coverage `find . -name dali.info` +) + + diff --git a/automated-tests/dali-internal-test-suite/master-makefile.mk b/automated-tests/TET/dali-internal-test-suite/master-makefile.mk similarity index 100% rename from automated-tests/dali-internal-test-suite/master-makefile.mk rename to automated-tests/TET/dali-internal-test-suite/master-makefile.mk diff --git a/automated-tests/dali-internal-test-suite/tc-gen.sh b/automated-tests/TET/dali-internal-test-suite/tc-gen.sh similarity index 100% rename from automated-tests/dali-internal-test-suite/tc-gen.sh rename to automated-tests/TET/dali-internal-test-suite/tc-gen.sh diff --git a/automated-tests/dali-test-suite/text-input/.gitignore b/automated-tests/TET/dali-internal-test-suite/text-input/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/text-input/.gitignore rename to automated-tests/TET/dali-internal-test-suite/text-input/.gitignore diff --git a/automated-tests/dali-test-suite/view/Makefile b/automated-tests/TET/dali-internal-test-suite/text-input/Makefile similarity index 100% rename from automated-tests/dali-test-suite/view/Makefile rename to automated-tests/TET/dali-internal-test-suite/text-input/Makefile diff --git a/automated-tests/dali-internal-test-suite/text-input/file.list b/automated-tests/TET/dali-internal-test-suite/text-input/file.list similarity index 100% rename from automated-tests/dali-internal-test-suite/text-input/file.list rename to automated-tests/TET/dali-internal-test-suite/text-input/file.list diff --git a/automated-tests/dali-internal-test-suite/text-input/tslist b/automated-tests/TET/dali-internal-test-suite/text-input/tslist similarity index 100% rename from automated-tests/dali-internal-test-suite/text-input/tslist rename to automated-tests/TET/dali-internal-test-suite/text-input/tslist diff --git a/automated-tests/dali-internal-test-suite/text-input/utc-Dali-TextInput.cpp b/automated-tests/TET/dali-internal-test-suite/text-input/utc-Dali-TextInput.cpp similarity index 100% rename from automated-tests/dali-internal-test-suite/text-input/utc-Dali-TextInput.cpp rename to automated-tests/TET/dali-internal-test-suite/text-input/utc-Dali-TextInput.cpp diff --git a/automated-tests/dali-internal-test-suite/text-view/.gitignore b/automated-tests/TET/dali-internal-test-suite/text-view/.gitignore similarity index 100% rename from automated-tests/dali-internal-test-suite/text-view/.gitignore rename to automated-tests/TET/dali-internal-test-suite/text-view/.gitignore diff --git a/automated-tests/dali-test-suite/transition-effects/Makefile b/automated-tests/TET/dali-internal-test-suite/text-view/Makefile similarity index 100% rename from automated-tests/dali-test-suite/transition-effects/Makefile rename to automated-tests/TET/dali-internal-test-suite/text-view/Makefile diff --git a/automated-tests/dali-internal-test-suite/text-view/file.list b/automated-tests/TET/dali-internal-test-suite/text-view/file.list similarity index 100% rename from automated-tests/dali-internal-test-suite/text-view/file.list rename to automated-tests/TET/dali-internal-test-suite/text-view/file.list diff --git a/automated-tests/dali-internal-test-suite/text-view/tslist b/automated-tests/TET/dali-internal-test-suite/text-view/tslist similarity index 100% rename from automated-tests/dali-internal-test-suite/text-view/tslist rename to automated-tests/TET/dali-internal-test-suite/text-view/tslist diff --git a/automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView-HelperAndDebug.cpp b/automated-tests/TET/dali-internal-test-suite/text-view/utc-Dali-TextView-HelperAndDebug.cpp similarity index 100% rename from automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView-HelperAndDebug.cpp rename to automated-tests/TET/dali-internal-test-suite/text-view/utc-Dali-TextView-HelperAndDebug.cpp diff --git a/automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView-Processor-Types.cpp b/automated-tests/TET/dali-internal-test-suite/text-view/utc-Dali-TextView-Processor-Types.cpp similarity index 100% rename from automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView-Processor-Types.cpp rename to automated-tests/TET/dali-internal-test-suite/text-view/utc-Dali-TextView-Processor-Types.cpp diff --git a/automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView-Processor.cpp b/automated-tests/TET/dali-internal-test-suite/text-view/utc-Dali-TextView-Processor.cpp similarity index 100% rename from automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView-Processor.cpp rename to automated-tests/TET/dali-internal-test-suite/text-view/utc-Dali-TextView-Processor.cpp diff --git a/automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView-Relayout-Utilities.cpp b/automated-tests/TET/dali-internal-test-suite/text-view/utc-Dali-TextView-Relayout-Utilities.cpp similarity index 100% rename from automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView-Relayout-Utilities.cpp rename to automated-tests/TET/dali-internal-test-suite/text-view/utc-Dali-TextView-Relayout-Utilities.cpp diff --git a/automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView.cpp b/automated-tests/TET/dali-internal-test-suite/text-view/utc-Dali-TextView.cpp similarity index 100% rename from automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView.cpp rename to automated-tests/TET/dali-internal-test-suite/text-view/utc-Dali-TextView.cpp diff --git a/automated-tests/dali-internal-test-suite/utc-MODULE-CLASS.cpp.in b/automated-tests/TET/dali-internal-test-suite/utc-MODULE-CLASS.cpp.in similarity index 100% rename from automated-tests/dali-internal-test-suite/utc-MODULE-CLASS.cpp.in rename to automated-tests/TET/dali-internal-test-suite/utc-MODULE-CLASS.cpp.in diff --git a/automated-tests/dali-test-suite/.gitignore b/automated-tests/TET/dali-test-suite/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/.gitignore rename to automated-tests/TET/dali-test-suite/.gitignore diff --git a/automated-tests/dali-test-suite/alignment/.gitignore b/automated-tests/TET/dali-test-suite/alignment/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/alignment/.gitignore rename to automated-tests/TET/dali-test-suite/alignment/.gitignore diff --git a/automated-tests/dali-test-suite/toolbar/Makefile b/automated-tests/TET/dali-test-suite/alignment/Makefile similarity index 100% rename from automated-tests/dali-test-suite/toolbar/Makefile rename to automated-tests/TET/dali-test-suite/alignment/Makefile diff --git a/automated-tests/dali-test-suite/alignment/file.list b/automated-tests/TET/dali-test-suite/alignment/file.list similarity index 100% rename from automated-tests/dali-test-suite/alignment/file.list rename to automated-tests/TET/dali-test-suite/alignment/file.list diff --git a/automated-tests/dali-test-suite/alignment/tslist b/automated-tests/TET/dali-test-suite/alignment/tslist similarity index 100% rename from automated-tests/dali-test-suite/alignment/tslist rename to automated-tests/TET/dali-test-suite/alignment/tslist diff --git a/automated-tests/dali-test-suite/alignment/utc-Dali-Alignment.cpp b/automated-tests/TET/dali-test-suite/alignment/utc-Dali-Alignment.cpp similarity index 100% rename from automated-tests/dali-test-suite/alignment/utc-Dali-Alignment.cpp rename to automated-tests/TET/dali-test-suite/alignment/utc-Dali-Alignment.cpp diff --git a/automated-tests/dali-test-suite/bubble-emitter/.gitignore b/automated-tests/TET/dali-test-suite/bubble-emitter/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/bubble-emitter/.gitignore rename to automated-tests/TET/dali-test-suite/bubble-emitter/.gitignore diff --git a/automated-tests/dali-test-suite/text-view/Makefile b/automated-tests/TET/dali-test-suite/bubble-emitter/Makefile similarity index 100% rename from automated-tests/dali-test-suite/text-view/Makefile rename to automated-tests/TET/dali-test-suite/bubble-emitter/Makefile diff --git a/automated-tests/dali-test-suite/bubble-emitter/file.list b/automated-tests/TET/dali-test-suite/bubble-emitter/file.list similarity index 100% rename from automated-tests/dali-test-suite/bubble-emitter/file.list rename to automated-tests/TET/dali-test-suite/bubble-emitter/file.list diff --git a/automated-tests/dali-test-suite/bubble-emitter/tslist b/automated-tests/TET/dali-test-suite/bubble-emitter/tslist similarity index 100% rename from automated-tests/dali-test-suite/bubble-emitter/tslist rename to automated-tests/TET/dali-test-suite/bubble-emitter/tslist diff --git a/automated-tests/dali-test-suite/bubble-emitter/utc-Dali-BubbleEmitter.cpp b/automated-tests/TET/dali-test-suite/bubble-emitter/utc-Dali-BubbleEmitter.cpp similarity index 100% rename from automated-tests/dali-test-suite/bubble-emitter/utc-Dali-BubbleEmitter.cpp rename to automated-tests/TET/dali-test-suite/bubble-emitter/utc-Dali-BubbleEmitter.cpp diff --git a/automated-tests/dali-test-suite/builder/.gitignore b/automated-tests/TET/dali-test-suite/builder/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/builder/.gitignore rename to automated-tests/TET/dali-test-suite/builder/.gitignore diff --git a/automated-tests/dali-test-suite/text-input/Makefile b/automated-tests/TET/dali-test-suite/builder/Makefile similarity index 100% rename from automated-tests/dali-test-suite/text-input/Makefile rename to automated-tests/TET/dali-test-suite/builder/Makefile diff --git a/automated-tests/dali-test-suite/builder/file.list b/automated-tests/TET/dali-test-suite/builder/file.list similarity index 100% rename from automated-tests/dali-test-suite/builder/file.list rename to automated-tests/TET/dali-test-suite/builder/file.list diff --git a/automated-tests/dali-test-suite/builder/tslist b/automated-tests/TET/dali-test-suite/builder/tslist similarity index 100% rename from automated-tests/dali-test-suite/builder/tslist rename to automated-tests/TET/dali-test-suite/builder/tslist diff --git a/automated-tests/dali-test-suite/builder/utc-Dali-Builder.cpp b/automated-tests/TET/dali-test-suite/builder/utc-Dali-Builder.cpp similarity index 100% rename from automated-tests/dali-test-suite/builder/utc-Dali-Builder.cpp rename to automated-tests/TET/dali-test-suite/builder/utc-Dali-Builder.cpp diff --git a/automated-tests/dali-test-suite/builder/utc-Dali-JsonParser.cpp b/automated-tests/TET/dali-test-suite/builder/utc-Dali-JsonParser.cpp similarity index 100% rename from automated-tests/dali-test-suite/builder/utc-Dali-JsonParser.cpp rename to automated-tests/TET/dali-test-suite/builder/utc-Dali-JsonParser.cpp diff --git a/automated-tests/dali-test-suite/buttons/.gitignore b/automated-tests/TET/dali-test-suite/buttons/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/buttons/.gitignore rename to automated-tests/TET/dali-test-suite/buttons/.gitignore diff --git a/automated-tests/dali-test-suite/table-view/Makefile b/automated-tests/TET/dali-test-suite/buttons/Makefile similarity index 100% rename from automated-tests/dali-test-suite/table-view/Makefile rename to automated-tests/TET/dali-test-suite/buttons/Makefile diff --git a/automated-tests/dali-test-suite/buttons/file.list b/automated-tests/TET/dali-test-suite/buttons/file.list similarity index 100% rename from automated-tests/dali-test-suite/buttons/file.list rename to automated-tests/TET/dali-test-suite/buttons/file.list diff --git a/automated-tests/dali-test-suite/buttons/tslist b/automated-tests/TET/dali-test-suite/buttons/tslist similarity index 100% rename from automated-tests/dali-test-suite/buttons/tslist rename to automated-tests/TET/dali-test-suite/buttons/tslist diff --git a/automated-tests/dali-test-suite/buttons/utc-Dali-Button.cpp b/automated-tests/TET/dali-test-suite/buttons/utc-Dali-Button.cpp similarity index 100% rename from automated-tests/dali-test-suite/buttons/utc-Dali-Button.cpp rename to automated-tests/TET/dali-test-suite/buttons/utc-Dali-Button.cpp diff --git a/automated-tests/dali-test-suite/buttons/utc-Dali-CheckBoxButton.cpp b/automated-tests/TET/dali-test-suite/buttons/utc-Dali-CheckBoxButton.cpp similarity index 100% rename from automated-tests/dali-test-suite/buttons/utc-Dali-CheckBoxButton.cpp rename to automated-tests/TET/dali-test-suite/buttons/utc-Dali-CheckBoxButton.cpp diff --git a/automated-tests/dali-test-suite/buttons/utc-Dali-PushButton.cpp b/automated-tests/TET/dali-test-suite/buttons/utc-Dali-PushButton.cpp similarity index 100% rename from automated-tests/dali-test-suite/buttons/utc-Dali-PushButton.cpp rename to automated-tests/TET/dali-test-suite/buttons/utc-Dali-PushButton.cpp diff --git a/automated-tests/dali-test-suite/cluster/.gitignore b/automated-tests/TET/dali-test-suite/cluster/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/cluster/.gitignore rename to automated-tests/TET/dali-test-suite/cluster/.gitignore diff --git a/automated-tests/dali-test-suite/super-blur-view/Makefile b/automated-tests/TET/dali-test-suite/cluster/Makefile similarity index 100% rename from automated-tests/dali-test-suite/super-blur-view/Makefile rename to automated-tests/TET/dali-test-suite/cluster/Makefile diff --git a/automated-tests/dali-test-suite/cluster/file.list b/automated-tests/TET/dali-test-suite/cluster/file.list similarity index 100% rename from automated-tests/dali-test-suite/cluster/file.list rename to automated-tests/TET/dali-test-suite/cluster/file.list diff --git a/automated-tests/dali-test-suite/cluster/tslist b/automated-tests/TET/dali-test-suite/cluster/tslist similarity index 100% rename from automated-tests/dali-test-suite/cluster/tslist rename to automated-tests/TET/dali-test-suite/cluster/tslist diff --git a/automated-tests/dali-test-suite/cluster/utc-Dali-Cluster.cpp b/automated-tests/TET/dali-test-suite/cluster/utc-Dali-Cluster.cpp similarity index 100% rename from automated-tests/dali-test-suite/cluster/utc-Dali-Cluster.cpp rename to automated-tests/TET/dali-test-suite/cluster/utc-Dali-Cluster.cpp diff --git a/automated-tests/dali-test-suite/control/.gitignore b/automated-tests/TET/dali-test-suite/control/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/control/.gitignore rename to automated-tests/TET/dali-test-suite/control/.gitignore diff --git a/automated-tests/dali-test-suite/slider/Makefile b/automated-tests/TET/dali-test-suite/control/Makefile similarity index 100% rename from automated-tests/dali-test-suite/slider/Makefile rename to automated-tests/TET/dali-test-suite/control/Makefile diff --git a/automated-tests/dali-test-suite/control/dummy-control.h b/automated-tests/TET/dali-test-suite/control/dummy-control.h similarity index 100% rename from automated-tests/dali-test-suite/control/dummy-control.h rename to automated-tests/TET/dali-test-suite/control/dummy-control.h diff --git a/automated-tests/dali-test-suite/control/file.list b/automated-tests/TET/dali-test-suite/control/file.list similarity index 100% rename from automated-tests/dali-test-suite/control/file.list rename to automated-tests/TET/dali-test-suite/control/file.list diff --git a/automated-tests/dali-test-suite/control/tslist b/automated-tests/TET/dali-test-suite/control/tslist similarity index 100% rename from automated-tests/dali-test-suite/control/tslist rename to automated-tests/TET/dali-test-suite/control/tslist diff --git a/automated-tests/dali-test-suite/control/utc-Dali-Control.cpp b/automated-tests/TET/dali-test-suite/control/utc-Dali-Control.cpp similarity index 100% rename from automated-tests/dali-test-suite/control/utc-Dali-Control.cpp rename to automated-tests/TET/dali-test-suite/control/utc-Dali-Control.cpp diff --git a/automated-tests/dali-test-suite/control/utc-Dali-ControlImpl.cpp b/automated-tests/TET/dali-test-suite/control/utc-Dali-ControlImpl.cpp similarity index 100% rename from automated-tests/dali-test-suite/control/utc-Dali-ControlImpl.cpp rename to automated-tests/TET/dali-test-suite/control/utc-Dali-ControlImpl.cpp diff --git a/automated-tests/dali-test-suite/default-controls/.gitignore b/automated-tests/TET/dali-test-suite/default-controls/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/default-controls/.gitignore rename to automated-tests/TET/dali-test-suite/default-controls/.gitignore diff --git a/automated-tests/dali-test-suite/shader-effects/Makefile b/automated-tests/TET/dali-test-suite/default-controls/Makefile similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/Makefile rename to automated-tests/TET/dali-test-suite/default-controls/Makefile diff --git a/automated-tests/dali-test-suite/default-controls/file.list b/automated-tests/TET/dali-test-suite/default-controls/file.list similarity index 100% rename from automated-tests/dali-test-suite/default-controls/file.list rename to automated-tests/TET/dali-test-suite/default-controls/file.list diff --git a/automated-tests/dali-test-suite/default-controls/tslist b/automated-tests/TET/dali-test-suite/default-controls/tslist similarity index 100% rename from automated-tests/dali-test-suite/default-controls/tslist rename to automated-tests/TET/dali-test-suite/default-controls/tslist diff --git a/automated-tests/dali-test-suite/default-controls/utc-Dali-DefaultControls.cpp b/automated-tests/TET/dali-test-suite/default-controls/utc-Dali-DefaultControls.cpp similarity index 100% rename from automated-tests/dali-test-suite/default-controls/utc-Dali-DefaultControls.cpp rename to automated-tests/TET/dali-test-suite/default-controls/utc-Dali-DefaultControls.cpp diff --git a/automated-tests/dali-test-suite/focus-manager/.gitignore b/automated-tests/TET/dali-test-suite/focus-manager/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/focus-manager/.gitignore rename to automated-tests/TET/dali-test-suite/focus-manager/.gitignore diff --git a/automated-tests/dali-test-suite/selectors/Makefile b/automated-tests/TET/dali-test-suite/focus-manager/Makefile similarity index 100% rename from automated-tests/dali-test-suite/selectors/Makefile rename to automated-tests/TET/dali-test-suite/focus-manager/Makefile diff --git a/automated-tests/dali-test-suite/focus-manager/file.list b/automated-tests/TET/dali-test-suite/focus-manager/file.list similarity index 100% rename from automated-tests/dali-test-suite/focus-manager/file.list rename to automated-tests/TET/dali-test-suite/focus-manager/file.list diff --git a/automated-tests/dali-test-suite/focus-manager/tslist b/automated-tests/TET/dali-test-suite/focus-manager/tslist similarity index 100% rename from automated-tests/dali-test-suite/focus-manager/tslist rename to automated-tests/TET/dali-test-suite/focus-manager/tslist diff --git a/automated-tests/dali-test-suite/focus-manager/utc-Dali-FocusManager.cpp b/automated-tests/TET/dali-test-suite/focus-manager/utc-Dali-FocusManager.cpp similarity index 100% rename from automated-tests/dali-test-suite/focus-manager/utc-Dali-FocusManager.cpp rename to automated-tests/TET/dali-test-suite/focus-manager/utc-Dali-FocusManager.cpp diff --git a/automated-tests/dali-test-suite/focus-manager/utc-Dali-KeyInputFocusManager.cpp b/automated-tests/TET/dali-test-suite/focus-manager/utc-Dali-KeyInputFocusManager.cpp similarity index 100% rename from automated-tests/dali-test-suite/focus-manager/utc-Dali-KeyInputFocusManager.cpp rename to automated-tests/TET/dali-test-suite/focus-manager/utc-Dali-KeyInputFocusManager.cpp diff --git a/automated-tests/dali-test-suite/focus-manager/utc-Dali-KeyboardFocusManager.cpp b/automated-tests/TET/dali-test-suite/focus-manager/utc-Dali-KeyboardFocusManager.cpp similarity index 100% rename from automated-tests/dali-test-suite/focus-manager/utc-Dali-KeyboardFocusManager.cpp rename to automated-tests/TET/dali-test-suite/focus-manager/utc-Dali-KeyboardFocusManager.cpp diff --git a/automated-tests/dali-test-suite/item-view/.gitignore b/automated-tests/TET/dali-test-suite/item-view/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/item-view/.gitignore rename to automated-tests/TET/dali-test-suite/item-view/.gitignore diff --git a/automated-tests/dali-test-suite/scroll-view/Makefile b/automated-tests/TET/dali-test-suite/item-view/Makefile similarity index 100% rename from automated-tests/dali-test-suite/scroll-view/Makefile rename to automated-tests/TET/dali-test-suite/item-view/Makefile diff --git a/automated-tests/dali-test-suite/item-view/file.list b/automated-tests/TET/dali-test-suite/item-view/file.list similarity index 100% rename from automated-tests/dali-test-suite/item-view/file.list rename to automated-tests/TET/dali-test-suite/item-view/file.list diff --git a/automated-tests/dali-test-suite/item-view/tslist b/automated-tests/TET/dali-test-suite/item-view/tslist similarity index 100% rename from automated-tests/dali-test-suite/item-view/tslist rename to automated-tests/TET/dali-test-suite/item-view/tslist diff --git a/automated-tests/dali-test-suite/item-view/utc-Dali-AlbumLayout.cpp b/automated-tests/TET/dali-test-suite/item-view/utc-Dali-AlbumLayout.cpp similarity index 100% rename from automated-tests/dali-test-suite/item-view/utc-Dali-AlbumLayout.cpp rename to automated-tests/TET/dali-test-suite/item-view/utc-Dali-AlbumLayout.cpp diff --git a/automated-tests/dali-test-suite/item-view/utc-Dali-DepthLayout.cpp b/automated-tests/TET/dali-test-suite/item-view/utc-Dali-DepthLayout.cpp similarity index 100% rename from automated-tests/dali-test-suite/item-view/utc-Dali-DepthLayout.cpp rename to automated-tests/TET/dali-test-suite/item-view/utc-Dali-DepthLayout.cpp diff --git a/automated-tests/dali-test-suite/item-view/utc-Dali-GridLayout.cpp b/automated-tests/TET/dali-test-suite/item-view/utc-Dali-GridLayout.cpp similarity index 100% rename from automated-tests/dali-test-suite/item-view/utc-Dali-GridLayout.cpp rename to automated-tests/TET/dali-test-suite/item-view/utc-Dali-GridLayout.cpp diff --git a/automated-tests/dali-test-suite/item-view/utc-Dali-ItemLayout.cpp b/automated-tests/TET/dali-test-suite/item-view/utc-Dali-ItemLayout.cpp similarity index 100% rename from automated-tests/dali-test-suite/item-view/utc-Dali-ItemLayout.cpp rename to automated-tests/TET/dali-test-suite/item-view/utc-Dali-ItemLayout.cpp diff --git a/automated-tests/dali-test-suite/item-view/utc-Dali-ItemView.cpp b/automated-tests/TET/dali-test-suite/item-view/utc-Dali-ItemView.cpp similarity index 100% rename from automated-tests/dali-test-suite/item-view/utc-Dali-ItemView.cpp rename to automated-tests/TET/dali-test-suite/item-view/utc-Dali-ItemView.cpp diff --git a/automated-tests/dali-test-suite/item-view/utc-Dali-NavigationLayout.cpp b/automated-tests/TET/dali-test-suite/item-view/utc-Dali-NavigationLayout.cpp similarity index 100% rename from automated-tests/dali-test-suite/item-view/utc-Dali-NavigationLayout.cpp rename to automated-tests/TET/dali-test-suite/item-view/utc-Dali-NavigationLayout.cpp diff --git a/automated-tests/dali-test-suite/item-view/utc-Dali-RollLayout.cpp b/automated-tests/TET/dali-test-suite/item-view/utc-Dali-RollLayout.cpp similarity index 100% rename from automated-tests/dali-test-suite/item-view/utc-Dali-RollLayout.cpp rename to automated-tests/TET/dali-test-suite/item-view/utc-Dali-RollLayout.cpp diff --git a/automated-tests/dali-test-suite/item-view/utc-Dali-SpiralLayout.cpp b/automated-tests/TET/dali-test-suite/item-view/utc-Dali-SpiralLayout.cpp similarity index 100% rename from automated-tests/dali-test-suite/item-view/utc-Dali-SpiralLayout.cpp rename to automated-tests/TET/dali-test-suite/item-view/utc-Dali-SpiralLayout.cpp diff --git a/automated-tests/dali-test-suite/master-makefile.mk b/automated-tests/TET/dali-test-suite/master-makefile.mk similarity index 100% rename from automated-tests/dali-test-suite/master-makefile.mk rename to automated-tests/TET/dali-test-suite/master-makefile.mk diff --git a/automated-tests/dali-test-suite/navigation-frame/.gitignore b/automated-tests/TET/dali-test-suite/navigation-frame/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/navigation-frame/.gitignore rename to automated-tests/TET/dali-test-suite/navigation-frame/.gitignore diff --git a/automated-tests/dali-test-suite/popup/Makefile b/automated-tests/TET/dali-test-suite/navigation-frame/Makefile similarity index 100% rename from automated-tests/dali-test-suite/popup/Makefile rename to automated-tests/TET/dali-test-suite/navigation-frame/Makefile diff --git a/automated-tests/dali-test-suite/navigation-frame/file.list b/automated-tests/TET/dali-test-suite/navigation-frame/file.list similarity index 100% rename from automated-tests/dali-test-suite/navigation-frame/file.list rename to automated-tests/TET/dali-test-suite/navigation-frame/file.list diff --git a/automated-tests/dali-test-suite/navigation-frame/tslist b/automated-tests/TET/dali-test-suite/navigation-frame/tslist similarity index 100% rename from automated-tests/dali-test-suite/navigation-frame/tslist rename to automated-tests/TET/dali-test-suite/navigation-frame/tslist diff --git a/automated-tests/dali-test-suite/navigation-frame/utc-Dali-NavigationControl.cpp b/automated-tests/TET/dali-test-suite/navigation-frame/utc-Dali-NavigationControl.cpp similarity index 100% rename from automated-tests/dali-test-suite/navigation-frame/utc-Dali-NavigationControl.cpp rename to automated-tests/TET/dali-test-suite/navigation-frame/utc-Dali-NavigationControl.cpp diff --git a/automated-tests/dali-test-suite/navigation-frame/utc-Dali-Page.cpp b/automated-tests/TET/dali-test-suite/navigation-frame/utc-Dali-Page.cpp similarity index 100% rename from automated-tests/dali-test-suite/navigation-frame/utc-Dali-Page.cpp rename to automated-tests/TET/dali-test-suite/navigation-frame/utc-Dali-Page.cpp diff --git a/automated-tests/dali-test-suite/page-turn-view/.gitignore b/automated-tests/TET/dali-test-suite/page-turn-view/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/page-turn-view/.gitignore rename to automated-tests/TET/dali-test-suite/page-turn-view/.gitignore diff --git a/automated-tests/dali-test-suite/page-turn-view/Makefile b/automated-tests/TET/dali-test-suite/page-turn-view/Makefile similarity index 100% rename from automated-tests/dali-test-suite/page-turn-view/Makefile rename to automated-tests/TET/dali-test-suite/page-turn-view/Makefile diff --git a/automated-tests/dali-test-suite/page-turn-view/file.list b/automated-tests/TET/dali-test-suite/page-turn-view/file.list similarity index 100% rename from automated-tests/dali-test-suite/page-turn-view/file.list rename to automated-tests/TET/dali-test-suite/page-turn-view/file.list diff --git a/automated-tests/dali-test-suite/page-turn-view/tslist b/automated-tests/TET/dali-test-suite/page-turn-view/tslist similarity index 100% rename from automated-tests/dali-test-suite/page-turn-view/tslist rename to automated-tests/TET/dali-test-suite/page-turn-view/tslist diff --git a/automated-tests/dali-test-suite/page-turn-view/utc-Dali-PageTurnView.cpp b/automated-tests/TET/dali-test-suite/page-turn-view/utc-Dali-PageTurnView.cpp similarity index 100% rename from automated-tests/dali-test-suite/page-turn-view/utc-Dali-PageTurnView.cpp rename to automated-tests/TET/dali-test-suite/page-turn-view/utc-Dali-PageTurnView.cpp diff --git a/automated-tests/dali-test-suite/popup/.gitignore b/automated-tests/TET/dali-test-suite/popup/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/popup/.gitignore rename to automated-tests/TET/dali-test-suite/popup/.gitignore diff --git a/automated-tests/dali-test-suite/navigation-frame/Makefile b/automated-tests/TET/dali-test-suite/popup/Makefile similarity index 100% rename from automated-tests/dali-test-suite/navigation-frame/Makefile rename to automated-tests/TET/dali-test-suite/popup/Makefile diff --git a/automated-tests/dali-test-suite/popup/file.list b/automated-tests/TET/dali-test-suite/popup/file.list similarity index 100% rename from automated-tests/dali-test-suite/popup/file.list rename to automated-tests/TET/dali-test-suite/popup/file.list diff --git a/automated-tests/dali-test-suite/popup/tslist b/automated-tests/TET/dali-test-suite/popup/tslist similarity index 100% rename from automated-tests/dali-test-suite/popup/tslist rename to automated-tests/TET/dali-test-suite/popup/tslist diff --git a/automated-tests/dali-test-suite/popup/utc-Dali-Popup.cpp b/automated-tests/TET/dali-test-suite/popup/utc-Dali-Popup.cpp similarity index 100% rename from automated-tests/dali-test-suite/popup/utc-Dali-Popup.cpp rename to automated-tests/TET/dali-test-suite/popup/utc-Dali-Popup.cpp diff --git a/automated-tests/dali-test-suite/scroll-view/.gitignore b/automated-tests/TET/dali-test-suite/scroll-view/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/scroll-view/.gitignore rename to automated-tests/TET/dali-test-suite/scroll-view/.gitignore diff --git a/automated-tests/dali-test-suite/item-view/Makefile b/automated-tests/TET/dali-test-suite/scroll-view/Makefile similarity index 100% rename from automated-tests/dali-test-suite/item-view/Makefile rename to automated-tests/TET/dali-test-suite/scroll-view/Makefile diff --git a/automated-tests/dali-test-suite/scroll-view/file.list b/automated-tests/TET/dali-test-suite/scroll-view/file.list similarity index 100% rename from automated-tests/dali-test-suite/scroll-view/file.list rename to automated-tests/TET/dali-test-suite/scroll-view/file.list diff --git a/automated-tests/dali-test-suite/scroll-view/tslist b/automated-tests/TET/dali-test-suite/scroll-view/tslist similarity index 100% rename from automated-tests/dali-test-suite/scroll-view/tslist rename to automated-tests/TET/dali-test-suite/scroll-view/tslist diff --git a/automated-tests/dali-test-suite/scroll-view/utc-Dali-ScrollView.cpp b/automated-tests/TET/dali-test-suite/scroll-view/utc-Dali-ScrollView.cpp similarity index 100% rename from automated-tests/dali-test-suite/scroll-view/utc-Dali-ScrollView.cpp rename to automated-tests/TET/dali-test-suite/scroll-view/utc-Dali-ScrollView.cpp diff --git a/automated-tests/dali-test-suite/scroll-view/utc-Dali-ScrollViewEffect.cpp b/automated-tests/TET/dali-test-suite/scroll-view/utc-Dali-ScrollViewEffect.cpp similarity index 100% rename from automated-tests/dali-test-suite/scroll-view/utc-Dali-ScrollViewEffect.cpp rename to automated-tests/TET/dali-test-suite/scroll-view/utc-Dali-ScrollViewEffect.cpp diff --git a/automated-tests/dali-test-suite/selectors/.gitignore b/automated-tests/TET/dali-test-suite/selectors/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/selectors/.gitignore rename to automated-tests/TET/dali-test-suite/selectors/.gitignore diff --git a/automated-tests/dali-test-suite/focus-manager/Makefile b/automated-tests/TET/dali-test-suite/selectors/Makefile similarity index 100% rename from automated-tests/dali-test-suite/focus-manager/Makefile rename to automated-tests/TET/dali-test-suite/selectors/Makefile diff --git a/automated-tests/dali-test-suite/selectors/file.list b/automated-tests/TET/dali-test-suite/selectors/file.list similarity index 100% rename from automated-tests/dali-test-suite/selectors/file.list rename to automated-tests/TET/dali-test-suite/selectors/file.list diff --git a/automated-tests/dali-test-suite/selectors/tslist b/automated-tests/TET/dali-test-suite/selectors/tslist similarity index 100% rename from automated-tests/dali-test-suite/selectors/tslist rename to automated-tests/TET/dali-test-suite/selectors/tslist diff --git a/automated-tests/dali-test-suite/selectors/utc-Dali-RotatingSelector.cpp b/automated-tests/TET/dali-test-suite/selectors/utc-Dali-RotatingSelector.cpp similarity index 100% rename from automated-tests/dali-test-suite/selectors/utc-Dali-RotatingSelector.cpp rename to automated-tests/TET/dali-test-suite/selectors/utc-Dali-RotatingSelector.cpp diff --git a/automated-tests/dali-test-suite/shader-effects/.gitignore b/automated-tests/TET/dali-test-suite/shader-effects/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/.gitignore rename to automated-tests/TET/dali-test-suite/shader-effects/.gitignore diff --git a/automated-tests/dali-test-suite/default-controls/Makefile b/automated-tests/TET/dali-test-suite/shader-effects/Makefile similarity index 100% rename from automated-tests/dali-test-suite/default-controls/Makefile rename to automated-tests/TET/dali-test-suite/shader-effects/Makefile diff --git a/automated-tests/dali-test-suite/shader-effects/file.list b/automated-tests/TET/dali-test-suite/shader-effects/file.list similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/file.list rename to automated-tests/TET/dali-test-suite/shader-effects/file.list diff --git a/automated-tests/dali-test-suite/shader-effects/tslist b/automated-tests/TET/dali-test-suite/shader-effects/tslist similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/tslist rename to automated-tests/TET/dali-test-suite/shader-effects/tslist diff --git a/automated-tests/dali-test-suite/shader-effects/utc-Dali-BendyEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-BendyEffect.cpp similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/utc-Dali-BendyEffect.cpp rename to automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-BendyEffect.cpp diff --git a/automated-tests/dali-test-suite/shader-effects/utc-Dali-BlindEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-BlindEffect.cpp similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/utc-Dali-BlindEffect.cpp rename to automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-BlindEffect.cpp diff --git a/automated-tests/dali-test-suite/shader-effects/utc-Dali-BloomView.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-BloomView.cpp similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/utc-Dali-BloomView.cpp rename to automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-BloomView.cpp diff --git a/automated-tests/dali-test-suite/shader-effects/utc-Dali-CarouselEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-CarouselEffect.cpp similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/utc-Dali-CarouselEffect.cpp rename to automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-CarouselEffect.cpp diff --git a/automated-tests/dali-test-suite/shader-effects/utc-Dali-DisplacementEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-DisplacementEffect.cpp similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/utc-Dali-DisplacementEffect.cpp rename to automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-DisplacementEffect.cpp diff --git a/automated-tests/dali-test-suite/shader-effects/utc-Dali-DissolveEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-DissolveEffect.cpp similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/utc-Dali-DissolveEffect.cpp rename to automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-DissolveEffect.cpp diff --git a/automated-tests/dali-test-suite/shader-effects/utc-Dali-DistanceFieldEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-DistanceFieldEffect.cpp similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/utc-Dali-DistanceFieldEffect.cpp rename to automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-DistanceFieldEffect.cpp diff --git a/automated-tests/dali-test-suite/shader-effects/utc-Dali-GaussianBlurView.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-GaussianBlurView.cpp similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/utc-Dali-GaussianBlurView.cpp rename to automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-GaussianBlurView.cpp diff --git a/automated-tests/dali-test-suite/shader-effects/utc-Dali-IrisEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-IrisEffect.cpp similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/utc-Dali-IrisEffect.cpp rename to automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-IrisEffect.cpp diff --git a/automated-tests/dali-test-suite/shader-effects/utc-Dali-MaskEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-MaskEffect.cpp similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/utc-Dali-MaskEffect.cpp rename to automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-MaskEffect.cpp diff --git a/automated-tests/dali-test-suite/shader-effects/utc-Dali-NinePatchMaskEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-NinePatchMaskEffect.cpp similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/utc-Dali-NinePatchMaskEffect.cpp rename to automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-NinePatchMaskEffect.cpp diff --git a/automated-tests/dali-test-suite/shader-effects/utc-Dali-OverlayEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-OverlayEffect.cpp similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/utc-Dali-OverlayEffect.cpp rename to automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-OverlayEffect.cpp diff --git a/automated-tests/dali-test-suite/shader-effects/utc-Dali-PageTurnEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-PageTurnEffect.cpp similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/utc-Dali-PageTurnEffect.cpp rename to automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-PageTurnEffect.cpp diff --git a/automated-tests/dali-test-suite/shader-effects/utc-Dali-Ripple2DEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-Ripple2DEffect.cpp similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/utc-Dali-Ripple2DEffect.cpp rename to automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-Ripple2DEffect.cpp diff --git a/automated-tests/dali-test-suite/shader-effects/utc-Dali-RippleEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-RippleEffect.cpp similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/utc-Dali-RippleEffect.cpp rename to automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-RippleEffect.cpp diff --git a/automated-tests/dali-test-suite/shader-effects/utc-Dali-ShadowView.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-ShadowView.cpp similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/utc-Dali-ShadowView.cpp rename to automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-ShadowView.cpp diff --git a/automated-tests/dali-test-suite/shader-effects/utc-Dali-ShearEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-ShearEffect.cpp similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/utc-Dali-ShearEffect.cpp rename to automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-ShearEffect.cpp diff --git a/automated-tests/dali-test-suite/shader-effects/utc-Dali-SoftButtonEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-SoftButtonEffect.cpp similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/utc-Dali-SoftButtonEffect.cpp rename to automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-SoftButtonEffect.cpp diff --git a/automated-tests/dali-test-suite/shader-effects/utc-Dali-SpotEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-SpotEffect.cpp similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/utc-Dali-SpotEffect.cpp rename to automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-SpotEffect.cpp diff --git a/automated-tests/dali-test-suite/shader-effects/utc-Dali-SquareDissolveEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-SquareDissolveEffect.cpp similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/utc-Dali-SquareDissolveEffect.cpp rename to automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-SquareDissolveEffect.cpp diff --git a/automated-tests/dali-test-suite/shader-effects/utc-Dali-SwirlEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-SwirlEffect.cpp similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/utc-Dali-SwirlEffect.cpp rename to automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-SwirlEffect.cpp diff --git a/automated-tests/dali-test-suite/shader-effects/utc-Dali-WaterEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-WaterEffect.cpp similarity index 100% rename from automated-tests/dali-test-suite/shader-effects/utc-Dali-WaterEffect.cpp rename to automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-WaterEffect.cpp diff --git a/automated-tests/dali-test-suite/slider/.gitignore b/automated-tests/TET/dali-test-suite/slider/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/slider/.gitignore rename to automated-tests/TET/dali-test-suite/slider/.gitignore diff --git a/automated-tests/dali-test-suite/control/Makefile b/automated-tests/TET/dali-test-suite/slider/Makefile similarity index 100% rename from automated-tests/dali-test-suite/control/Makefile rename to automated-tests/TET/dali-test-suite/slider/Makefile diff --git a/automated-tests/dali-test-suite/slider/file.list b/automated-tests/TET/dali-test-suite/slider/file.list similarity index 100% rename from automated-tests/dali-test-suite/slider/file.list rename to automated-tests/TET/dali-test-suite/slider/file.list diff --git a/automated-tests/dali-test-suite/slider/tslist b/automated-tests/TET/dali-test-suite/slider/tslist similarity index 100% rename from automated-tests/dali-test-suite/slider/tslist rename to automated-tests/TET/dali-test-suite/slider/tslist diff --git a/automated-tests/dali-test-suite/slider/utc-Dali-Slider.cpp b/automated-tests/TET/dali-test-suite/slider/utc-Dali-Slider.cpp similarity index 100% rename from automated-tests/dali-test-suite/slider/utc-Dali-Slider.cpp rename to automated-tests/TET/dali-test-suite/slider/utc-Dali-Slider.cpp diff --git a/automated-tests/dali-test-suite/super-blur-view/.gitignore b/automated-tests/TET/dali-test-suite/super-blur-view/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/super-blur-view/.gitignore rename to automated-tests/TET/dali-test-suite/super-blur-view/.gitignore diff --git a/automated-tests/dali-test-suite/cluster/Makefile b/automated-tests/TET/dali-test-suite/super-blur-view/Makefile similarity index 100% rename from automated-tests/dali-test-suite/cluster/Makefile rename to automated-tests/TET/dali-test-suite/super-blur-view/Makefile diff --git a/automated-tests/dali-test-suite/super-blur-view/file.list b/automated-tests/TET/dali-test-suite/super-blur-view/file.list similarity index 100% rename from automated-tests/dali-test-suite/super-blur-view/file.list rename to automated-tests/TET/dali-test-suite/super-blur-view/file.list diff --git a/automated-tests/dali-test-suite/super-blur-view/tslist b/automated-tests/TET/dali-test-suite/super-blur-view/tslist similarity index 100% rename from automated-tests/dali-test-suite/super-blur-view/tslist rename to automated-tests/TET/dali-test-suite/super-blur-view/tslist diff --git a/automated-tests/dali-test-suite/super-blur-view/utc-Dali-SuperBlurView.cpp b/automated-tests/TET/dali-test-suite/super-blur-view/utc-Dali-SuperBlurView.cpp similarity index 100% rename from automated-tests/dali-test-suite/super-blur-view/utc-Dali-SuperBlurView.cpp rename to automated-tests/TET/dali-test-suite/super-blur-view/utc-Dali-SuperBlurView.cpp diff --git a/automated-tests/dali-test-suite/table-view/.gitignore b/automated-tests/TET/dali-test-suite/table-view/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/table-view/.gitignore rename to automated-tests/TET/dali-test-suite/table-view/.gitignore diff --git a/automated-tests/dali-test-suite/buttons/Makefile b/automated-tests/TET/dali-test-suite/table-view/Makefile similarity index 100% rename from automated-tests/dali-test-suite/buttons/Makefile rename to automated-tests/TET/dali-test-suite/table-view/Makefile diff --git a/automated-tests/dali-test-suite/table-view/file.list b/automated-tests/TET/dali-test-suite/table-view/file.list similarity index 100% rename from automated-tests/dali-test-suite/table-view/file.list rename to automated-tests/TET/dali-test-suite/table-view/file.list diff --git a/automated-tests/dali-test-suite/table-view/tslist b/automated-tests/TET/dali-test-suite/table-view/tslist similarity index 100% rename from automated-tests/dali-test-suite/table-view/tslist rename to automated-tests/TET/dali-test-suite/table-view/tslist diff --git a/automated-tests/dali-test-suite/table-view/utc-Dali-TableView.cpp b/automated-tests/TET/dali-test-suite/table-view/utc-Dali-TableView.cpp similarity index 100% rename from automated-tests/dali-test-suite/table-view/utc-Dali-TableView.cpp rename to automated-tests/TET/dali-test-suite/table-view/utc-Dali-TableView.cpp diff --git a/automated-tests/dali-test-suite/tc-gen.sh b/automated-tests/TET/dali-test-suite/tc-gen.sh similarity index 100% rename from automated-tests/dali-test-suite/tc-gen.sh rename to automated-tests/TET/dali-test-suite/tc-gen.sh diff --git a/automated-tests/dali-internal-test-suite/text-input/.gitignore b/automated-tests/TET/dali-test-suite/text-input/.gitignore similarity index 100% rename from automated-tests/dali-internal-test-suite/text-input/.gitignore rename to automated-tests/TET/dali-test-suite/text-input/.gitignore diff --git a/automated-tests/dali-test-suite/builder/Makefile b/automated-tests/TET/dali-test-suite/text-input/Makefile similarity index 100% rename from automated-tests/dali-test-suite/builder/Makefile rename to automated-tests/TET/dali-test-suite/text-input/Makefile diff --git a/automated-tests/dali-test-suite/text-input/file.list b/automated-tests/TET/dali-test-suite/text-input/file.list similarity index 100% rename from automated-tests/dali-test-suite/text-input/file.list rename to automated-tests/TET/dali-test-suite/text-input/file.list diff --git a/automated-tests/dali-test-suite/text-input/tslist b/automated-tests/TET/dali-test-suite/text-input/tslist similarity index 100% rename from automated-tests/dali-test-suite/text-input/tslist rename to automated-tests/TET/dali-test-suite/text-input/tslist diff --git a/automated-tests/dali-test-suite/text-input/utc-Dali-TextInput.cpp b/automated-tests/TET/dali-test-suite/text-input/utc-Dali-TextInput.cpp similarity index 100% rename from automated-tests/dali-test-suite/text-input/utc-Dali-TextInput.cpp rename to automated-tests/TET/dali-test-suite/text-input/utc-Dali-TextInput.cpp diff --git a/automated-tests/dali-test-suite/text-view/.gitignore b/automated-tests/TET/dali-test-suite/text-view/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/text-view/.gitignore rename to automated-tests/TET/dali-test-suite/text-view/.gitignore diff --git a/automated-tests/dali-test-suite/bubble-emitter/Makefile b/automated-tests/TET/dali-test-suite/text-view/Makefile similarity index 100% rename from automated-tests/dali-test-suite/bubble-emitter/Makefile rename to automated-tests/TET/dali-test-suite/text-view/Makefile diff --git a/automated-tests/dali-test-suite/text-view/file.list b/automated-tests/TET/dali-test-suite/text-view/file.list similarity index 100% rename from automated-tests/dali-test-suite/text-view/file.list rename to automated-tests/TET/dali-test-suite/text-view/file.list diff --git a/automated-tests/dali-test-suite/text-view/tslist b/automated-tests/TET/dali-test-suite/text-view/tslist similarity index 100% rename from automated-tests/dali-test-suite/text-view/tslist rename to automated-tests/TET/dali-test-suite/text-view/tslist diff --git a/automated-tests/dali-test-suite/text-view/utc-Dali-MarkupProcessor.cpp b/automated-tests/TET/dali-test-suite/text-view/utc-Dali-MarkupProcessor.cpp similarity index 100% rename from automated-tests/dali-test-suite/text-view/utc-Dali-MarkupProcessor.cpp rename to automated-tests/TET/dali-test-suite/text-view/utc-Dali-MarkupProcessor.cpp diff --git a/automated-tests/dali-test-suite/text-view/utc-Dali-TextView.cpp b/automated-tests/TET/dali-test-suite/text-view/utc-Dali-TextView.cpp similarity index 100% rename from automated-tests/dali-test-suite/text-view/utc-Dali-TextView.cpp rename to automated-tests/TET/dali-test-suite/text-view/utc-Dali-TextView.cpp diff --git a/automated-tests/dali-test-suite/toolbar/.gitignore b/automated-tests/TET/dali-test-suite/toolbar/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/toolbar/.gitignore rename to automated-tests/TET/dali-test-suite/toolbar/.gitignore diff --git a/automated-tests/dali-test-suite/alignment/Makefile b/automated-tests/TET/dali-test-suite/toolbar/Makefile similarity index 100% rename from automated-tests/dali-test-suite/alignment/Makefile rename to automated-tests/TET/dali-test-suite/toolbar/Makefile diff --git a/automated-tests/dali-test-suite/toolbar/file.list b/automated-tests/TET/dali-test-suite/toolbar/file.list similarity index 100% rename from automated-tests/dali-test-suite/toolbar/file.list rename to automated-tests/TET/dali-test-suite/toolbar/file.list diff --git a/automated-tests/dali-test-suite/toolbar/tslist b/automated-tests/TET/dali-test-suite/toolbar/tslist similarity index 100% rename from automated-tests/dali-test-suite/toolbar/tslist rename to automated-tests/TET/dali-test-suite/toolbar/tslist diff --git a/automated-tests/dali-test-suite/toolbar/utc-Dali-ToolBar.cpp b/automated-tests/TET/dali-test-suite/toolbar/utc-Dali-ToolBar.cpp similarity index 100% rename from automated-tests/dali-test-suite/toolbar/utc-Dali-ToolBar.cpp rename to automated-tests/TET/dali-test-suite/toolbar/utc-Dali-ToolBar.cpp diff --git a/automated-tests/dali-test-suite/transition-effects/.gitignore b/automated-tests/TET/dali-test-suite/transition-effects/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/transition-effects/.gitignore rename to automated-tests/TET/dali-test-suite/transition-effects/.gitignore diff --git a/automated-tests/dali-internal-test-suite/text-view/Makefile b/automated-tests/TET/dali-test-suite/transition-effects/Makefile similarity index 100% rename from automated-tests/dali-internal-test-suite/text-view/Makefile rename to automated-tests/TET/dali-test-suite/transition-effects/Makefile diff --git a/automated-tests/dali-test-suite/transition-effects/file.list b/automated-tests/TET/dali-test-suite/transition-effects/file.list similarity index 100% rename from automated-tests/dali-test-suite/transition-effects/file.list rename to automated-tests/TET/dali-test-suite/transition-effects/file.list diff --git a/automated-tests/dali-test-suite/transition-effects/tslist b/automated-tests/TET/dali-test-suite/transition-effects/tslist similarity index 100% rename from automated-tests/dali-test-suite/transition-effects/tslist rename to automated-tests/TET/dali-test-suite/transition-effects/tslist diff --git a/automated-tests/dali-test-suite/transition-effects/utc-Dali-CubeTransitionEffect.cpp b/automated-tests/TET/dali-test-suite/transition-effects/utc-Dali-CubeTransitionEffect.cpp similarity index 100% rename from automated-tests/dali-test-suite/transition-effects/utc-Dali-CubeTransitionEffect.cpp rename to automated-tests/TET/dali-test-suite/transition-effects/utc-Dali-CubeTransitionEffect.cpp diff --git a/automated-tests/dali-test-suite/ui-builder/.gitignore b/automated-tests/TET/dali-test-suite/ui-builder/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/ui-builder/.gitignore rename to automated-tests/TET/dali-test-suite/ui-builder/.gitignore diff --git a/automated-tests/dali-test-suite/ui-builder/file.list b/automated-tests/TET/dali-test-suite/ui-builder/file.list similarity index 100% rename from automated-tests/dali-test-suite/ui-builder/file.list rename to automated-tests/TET/dali-test-suite/ui-builder/file.list diff --git a/automated-tests/dali-test-suite/utc-MODULE-CLASS.cpp.in b/automated-tests/TET/dali-test-suite/utc-MODULE-CLASS.cpp.in similarity index 100% rename from automated-tests/dali-test-suite/utc-MODULE-CLASS.cpp.in rename to automated-tests/TET/dali-test-suite/utc-MODULE-CLASS.cpp.in diff --git a/automated-tests/dali-test-suite/view/.gitignore b/automated-tests/TET/dali-test-suite/view/.gitignore similarity index 100% rename from automated-tests/dali-test-suite/view/.gitignore rename to automated-tests/TET/dali-test-suite/view/.gitignore diff --git a/automated-tests/dali-internal-test-suite/text-input/Makefile b/automated-tests/TET/dali-test-suite/view/Makefile similarity index 100% rename from automated-tests/dali-internal-test-suite/text-input/Makefile rename to automated-tests/TET/dali-test-suite/view/Makefile diff --git a/automated-tests/dali-test-suite/view/file.list b/automated-tests/TET/dali-test-suite/view/file.list similarity index 100% rename from automated-tests/dali-test-suite/view/file.list rename to automated-tests/TET/dali-test-suite/view/file.list diff --git a/automated-tests/dali-test-suite/view/tslist b/automated-tests/TET/dali-test-suite/view/tslist similarity index 100% rename from automated-tests/dali-test-suite/view/tslist rename to automated-tests/TET/dali-test-suite/view/tslist diff --git a/automated-tests/dali-test-suite/view/utc-Dali-View.cpp b/automated-tests/TET/dali-test-suite/view/utc-Dali-View.cpp similarity index 100% rename from automated-tests/dali-test-suite/view/utc-Dali-View.cpp rename to automated-tests/TET/dali-test-suite/view/utc-Dali-View.cpp diff --git a/automated-tests/dali-toolkit-test-utils/dali-toolkit-test-suite-utils.h b/automated-tests/TET/dali-toolkit-test-utils/dali-toolkit-test-suite-utils.h similarity index 100% rename from automated-tests/dali-toolkit-test-utils/dali-toolkit-test-suite-utils.h rename to automated-tests/TET/dali-toolkit-test-utils/dali-toolkit-test-suite-utils.h diff --git a/automated-tests/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp b/automated-tests/TET/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp similarity index 100% rename from automated-tests/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp rename to automated-tests/TET/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp diff --git a/automated-tests/dali-toolkit-test-utils/toolkit-accessibility-manager.h b/automated-tests/TET/dali-toolkit-test-utils/toolkit-accessibility-manager.h similarity index 100% rename from automated-tests/dali-toolkit-test-utils/toolkit-accessibility-manager.h rename to automated-tests/TET/dali-toolkit-test-utils/toolkit-accessibility-manager.h diff --git a/automated-tests/dali-toolkit-test-utils/toolkit-adaptor.cpp b/automated-tests/TET/dali-toolkit-test-utils/toolkit-adaptor.cpp similarity index 100% rename from automated-tests/dali-toolkit-test-utils/toolkit-adaptor.cpp rename to automated-tests/TET/dali-toolkit-test-utils/toolkit-adaptor.cpp diff --git a/automated-tests/dali-toolkit-test-utils/toolkit-adaptor.h b/automated-tests/TET/dali-toolkit-test-utils/toolkit-adaptor.h similarity index 100% rename from automated-tests/dali-toolkit-test-utils/toolkit-adaptor.h rename to automated-tests/TET/dali-toolkit-test-utils/toolkit-adaptor.h diff --git a/automated-tests/dali-toolkit-test-utils/toolkit-application.cpp b/automated-tests/TET/dali-toolkit-test-utils/toolkit-application.cpp similarity index 100% rename from automated-tests/dali-toolkit-test-utils/toolkit-application.cpp rename to automated-tests/TET/dali-toolkit-test-utils/toolkit-application.cpp diff --git a/automated-tests/dali-toolkit-test-utils/toolkit-application.h b/automated-tests/TET/dali-toolkit-test-utils/toolkit-application.h similarity index 100% rename from automated-tests/dali-toolkit-test-utils/toolkit-application.h rename to automated-tests/TET/dali-toolkit-test-utils/toolkit-application.h diff --git a/automated-tests/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp b/automated-tests/TET/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp similarity index 100% rename from automated-tests/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp rename to automated-tests/TET/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp diff --git a/automated-tests/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.h b/automated-tests/TET/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.h similarity index 100% rename from automated-tests/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.h rename to automated-tests/TET/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.h diff --git a/automated-tests/dali-toolkit-test-utils/toolkit-orientation.cpp b/automated-tests/TET/dali-toolkit-test-utils/toolkit-orientation.cpp similarity index 100% rename from automated-tests/dali-toolkit-test-utils/toolkit-orientation.cpp rename to automated-tests/TET/dali-toolkit-test-utils/toolkit-orientation.cpp diff --git a/automated-tests/dali-toolkit-test-utils/toolkit-orientation.h b/automated-tests/TET/dali-toolkit-test-utils/toolkit-orientation.h similarity index 100% rename from automated-tests/dali-toolkit-test-utils/toolkit-orientation.h rename to automated-tests/TET/dali-toolkit-test-utils/toolkit-orientation.h diff --git a/automated-tests/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp b/automated-tests/TET/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp similarity index 100% rename from automated-tests/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp rename to automated-tests/TET/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp diff --git a/automated-tests/dali-toolkit-test-utils/toolkit-physical-keyboard.h b/automated-tests/TET/dali-toolkit-test-utils/toolkit-physical-keyboard.h similarity index 100% rename from automated-tests/dali-toolkit-test-utils/toolkit-physical-keyboard.h rename to automated-tests/TET/dali-toolkit-test-utils/toolkit-physical-keyboard.h diff --git a/automated-tests/dali-toolkit-test-utils/toolkit-style-monitor.cpp b/automated-tests/TET/dali-toolkit-test-utils/toolkit-style-monitor.cpp similarity index 100% rename from automated-tests/dali-toolkit-test-utils/toolkit-style-monitor.cpp rename to automated-tests/TET/dali-toolkit-test-utils/toolkit-style-monitor.cpp diff --git a/automated-tests/dali-toolkit-test-utils/toolkit-style-monitor.h b/automated-tests/TET/dali-toolkit-test-utils/toolkit-style-monitor.h similarity index 100% rename from automated-tests/dali-toolkit-test-utils/toolkit-style-monitor.h rename to automated-tests/TET/dali-toolkit-test-utils/toolkit-style-monitor.h diff --git a/automated-tests/dali-toolkit-test-utils/toolkit-test-application.h b/automated-tests/TET/dali-toolkit-test-utils/toolkit-test-application.h similarity index 100% rename from automated-tests/dali-toolkit-test-utils/toolkit-test-application.h rename to automated-tests/TET/dali-toolkit-test-utils/toolkit-test-application.h diff --git a/automated-tests/dali-toolkit-test-utils/toolkit-timer.cpp b/automated-tests/TET/dali-toolkit-test-utils/toolkit-timer.cpp similarity index 100% rename from automated-tests/dali-toolkit-test-utils/toolkit-timer.cpp rename to automated-tests/TET/dali-toolkit-test-utils/toolkit-timer.cpp diff --git a/automated-tests/dali-toolkit-test-utils/toolkit-timer.h b/automated-tests/TET/dali-toolkit-test-utils/toolkit-timer.h similarity index 100% rename from automated-tests/dali-toolkit-test-utils/toolkit-timer.h rename to automated-tests/TET/dali-toolkit-test-utils/toolkit-timer.h diff --git a/automated-tests/debug.sh b/automated-tests/TET/debug.sh similarity index 100% rename from automated-tests/debug.sh rename to automated-tests/TET/debug.sh diff --git a/automated-tests/debug_target.sh b/automated-tests/TET/debug_target.sh similarity index 100% rename from automated-tests/debug_target.sh rename to automated-tests/TET/debug_target.sh diff --git a/automated-tests/TET/execute.sh b/automated-tests/TET/execute.sh new file mode 100755 index 0000000..e4059ee --- /dev/null +++ b/automated-tests/TET/execute.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +TEMP=`getopt -o ds: --long desktop,scenario: \ + -n 'build_out.sh' -- "$@"` + +if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi + +# Note the quotes around `$TEMP': they are essential! +eval set -- "$TEMP" + +scenario=all +env=./_export_env.sh + +while true ; do + case "$1" in + -d|--desktop) env=./_export_desktop.sh ; shift ;; + -s|--scenario) scenario="$2" ; shift 2 ;; + --) shift ; break ;; + *) echo "Internal error!" ; exit 1 ;; + esac +done + + +# Source correct environment +. $env + + +echo PATH=$PATH +echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH +echo TET_ROOT=$TET_ROOT +echo TET_SUITE_ROOT=$TET_SUITE_ROOT +echo ARCH=$ARCH + +RESULT_DIR=results-$ARCH +HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir -p $RESULT_DIR + +tcc -e -j $JOURNAL_RESULT -p ./ $scenario +./tbp.pl $JOURNAL_RESULT + diff --git a/automated-tests/execute_target.sh b/automated-tests/TET/execute_target.sh similarity index 100% rename from automated-tests/execute_target.sh rename to automated-tests/TET/execute_target.sh diff --git a/automated-tests/rules.mk.in b/automated-tests/TET/rules.mk.in similarity index 100% rename from automated-tests/rules.mk.in rename to automated-tests/TET/rules.mk.in diff --git a/automated-tests/tbp.pl b/automated-tests/TET/tbp.pl similarity index 100% rename from automated-tests/tbp.pl rename to automated-tests/TET/tbp.pl diff --git a/automated-tests/tet_scen b/automated-tests/TET/tet_scen similarity index 100% rename from automated-tests/tet_scen rename to automated-tests/TET/tet_scen diff --git a/automated-tests/tetbuild.cfg b/automated-tests/TET/tetbuild.cfg similarity index 100% rename from automated-tests/tetbuild.cfg rename to automated-tests/TET/tetbuild.cfg diff --git a/automated-tests/tetclean.cfg b/automated-tests/TET/tetclean.cfg similarity index 100% rename from automated-tests/tetclean.cfg rename to automated-tests/TET/tetclean.cfg diff --git a/automated-tests/tetexec.cfg b/automated-tests/TET/tetexec.cfg similarity index 100% rename from automated-tests/tetexec.cfg rename to automated-tests/TET/tetexec.cfg diff --git a/automated-tests/build.sh b/automated-tests/build.sh index d857de3..14eaf96 100755 --- a/automated-tests/build.sh +++ b/automated-tests/build.sh @@ -1,70 +1,25 @@ #!/bin/bash -TEMP=`getopt -o 2vds: --long 2,verbose,desktop,scenario: \ - -n 'build_out.sh' -- "$@"` +rm -rf build +mkdir build -if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi +function build +{ + (cd src/$1; ../../scripts/tcheadgen.sh tct-$1-core.h) + if [ $? -ne 0 ]; then echo "Aborting..."; exit 1; fi + (cd build ; cmake .. -DMODULE=$1 ; make -j7 ) +} -# Note the quotes around `$TEMP': they are essential! -eval set -- "$TEMP" +if [ -n "$1" ] ; then + echo BUILDING ONLY $1 + build $1 -scenario=all -opt_verbose=0 -opt_env=scratchbox - -while true ; do - case "$1" in - -d|--desktop) opt_env=desktop ; shift ;; - -s|--scenario) scenario="$2" ; shift 2 ;; - -v|--verbose) opt_verbose=1 ; shift ;; - -2|--2) opt_env=sbs ; shift ;; - --) shift ; break ;; - *) echo "Internal error!" ; exit 1 ;; - esac -done - - -case "$opt_env" in - desktop) - . _export_desktop.sh - cat < coverage.mk -LDFLAGS += --coverage -EOF - ;; - scratchbox) - . _export_env.sh - cat < coverage.mk -LDFLAGS += -EOF - ;; - sbs) - . _export_sbs.sh - cat < coverage.mk -LDFLAGS += -EOF - ;; -esac - - -echo PATH=$PATH -echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH -echo TET_ROOT=$TET_ROOT -echo TET_SUITE_ROOT=$TET_SUITE_ROOT -echo ARCH=$ARCH - -RESULT_DIR=results-$ARCH -HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html -JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal - -# Faster cleanup. -find . -name Makefile -execdir make -f {} clean \; - -mkdir -p $RESULT_DIR -if [ $opt_verbose -eq 1 ] ; then - tcc -b -j - ./ $scenario | tee $JOURNAL_RESULT else - tcc -b -j $JOURNAL_RESULT -p ./ $scenario + for mod in `ls -1 src/ | grep -v CMakeList ` + do + if [ $mod != 'common' ] && [ $mod != 'manual' ]; then + echo BUILDING $mod + build $mod + fi + done fi -./tbp.pl $JOURNAL_RESULT - - diff --git a/automated-tests/coverage.sh b/automated-tests/coverage.sh index 98798db..0b49287 100755 --- a/automated-tests/coverage.sh +++ b/automated-tests/coverage.sh @@ -2,14 +2,16 @@ ( cd ../build/slp ; make cov_data ) -for i in `find . -name Makefile` ; do + +for i in `find . -name "*.dir"` ; do ( - cd $(dirname $i) + cd $i echo `pwd` covs=( `ls *.gcda 2>/dev/null` ) if [[ $? -eq 0 ]] then - make coverage + lcov --directory . -c -o dali.info + lcov --remove dali.info "*boost*" "/usr/include/*" "*/automated-tests/*" -o dali.info fi ) done @@ -18,5 +20,3 @@ done cd .. ; genhtml -o build/slp/doc/coverage `find . -name dali.info` ) - - diff --git a/automated-tests/execute.sh b/automated-tests/execute.sh index e4059ee..ec5c9e2 100755 --- a/automated-tests/execute.sh +++ b/automated-tests/execute.sh @@ -1,42 +1,27 @@ #!/bin/bash -TEMP=`getopt -o ds: --long desktop,scenario: \ - -n 'build_out.sh' -- "$@"` - -if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi - -# Note the quotes around `$TEMP': they are essential! -eval set -- "$TEMP" - -scenario=all -env=./_export_env.sh - -while true ; do - case "$1" in - -d|--desktop) env=./_export_desktop.sh ; shift ;; - -s|--scenario) scenario="$2" ; shift 2 ;; - --) shift ; break ;; - *) echo "Internal error!" ; exit 1 ;; - esac -done - - -# Source correct environment -. $env - - -echo PATH=$PATH -echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH -echo TET_ROOT=$TET_ROOT -echo TET_SUITE_ROOT=$TET_SUITE_ROOT -echo ARCH=$ARCH - -RESULT_DIR=results-$ARCH -HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html -JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal - -mkdir -p $RESULT_DIR - -tcc -e -j $JOURNAL_RESULT -p ./ $scenario -./tbp.pl $JOURNAL_RESULT - +function execute +{ + scripts/tctestsgen.sh $1 `pwd` desktop + testkit-lite -f `pwd`/tests.xml -o tct-${1}-core-tests.xml -A --comm localhost + scripts/add_style.pl $1 +} + +# Clean up old test results +rm -f tct*core-tests.xml + +if [ -n "$1" ] ; then + echo EXECUTING ONLY $1 + execute $1 + +else + for mod in `ls -1 src/ | grep -v CMakeList ` + do + if [ $mod != 'common' ] && [ $mod != 'manual' ]; then + echo EXECUTING $mod + execute $mod + fi + done +fi + +scripts/summarize.pl diff --git a/automated-tests/packaging/core-dali-toolkit-tests.spec b/automated-tests/packaging/core-dali-toolkit-tests.spec new file mode 100644 index 0000000..58ba556 --- /dev/null +++ b/automated-tests/packaging/core-dali-toolkit-tests.spec @@ -0,0 +1,55 @@ +%define MODULE_NAME dali-toolkit +%define MODULE_LIBNAME dali-toolkit +Name: core-%{MODULE_NAME}-tests +Summary: Core API unit TC (%{name}) +Version: 0.1 +Release: 0 +Group: Development/Tools +License: Apache License, Version 2.0, Samsung Properietary +Source0: %{name}-%{version}.tar.gz +Requires: dali +Requires: dali-adaptor +Requires: dali-toolkit +BuildRequires: dali-integration-devel +BuildRequires: pkgconfig(dali-core) +BuildRequires: pkgconfig(dali) +BuildRequires: pkgconfig(dali-toolkit) +BuildRequires: libxml2-devel +BuildRequires: cmake + +%description +Core API unit TC (%{name}) + +%prep +%setup -q + +%build + +%define PREFIX "%{_libdir}/%{name}" + +export LDFLAGS+="-Wl,--rpath=%{PREFIX} -Wl,--as-needed" +cd automated-tests +cmake . -DMODULE="%{MODULE_NAME}" -DCMAKE_INSTALL_PREFIX=%{_prefix} + +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +cd automated-tests +%make_install +mkdir -p %{buildroot}/opt/usr/share/license +cp %{_builddir}/%{name}-%{version}/LICENSE %{buildroot}/opt/usr/share/license/%{name} +mkdir -p %{buildroot}/tmp/ +cp %{_builddir}/%{name}-%{version}/automated-tests/scripts/add_all_smack_rule.sh %{buildroot}/tmp/ +cp %{_builddir}/%{name}-%{version}/automated-tests/scripts/all_smack.rule %{buildroot}/tmp/ + +%post + +%postun + + +%files +/opt/usr/bin/* +/opt/usr/share/license/%{name} +/tmp/add_all_smack_rule.sh +/tmp/all_smack.rule diff --git a/automated-tests/packaging/core-dali-toolkit-unmanaged-tests.spec b/automated-tests/packaging/core-dali-toolkit-unmanaged-tests.spec new file mode 100644 index 0000000..3499f22 --- /dev/null +++ b/automated-tests/packaging/core-dali-toolkit-unmanaged-tests.spec @@ -0,0 +1,55 @@ +%define MODULE_NAME dali-toolkit-unmanaged +%define MODULE_LIBNAME dali-toolkit-unmanaged +Name: core-%{MODULE_NAME}-tests +Summary: Core API unit TC (%{name}) +Version: 0.1 +Release: 0 +Group: Development/Tools +License: Apache License, Version 2.0, Samsung Properietary +Source0: %{name}-%{version}.tar.gz +Requires: dali +Requires: dali-adaptor +Requires: dali-toolkit +BuildRequires: dali-integration-devel +BuildRequires: pkgconfig(dali-core) +BuildRequires: pkgconfig(dali) +BuildRequires: pkgconfig(dali-toolkit) +BuildRequires: libxml2-devel +BuildRequires: cmake + +%description +Core API unit TC (%{name}) + +%prep +%setup -q + +%build + +%define PREFIX "%{_libdir}/%{name}" + +export LDFLAGS+="-Wl,--rpath=%{PREFIX} -Wl,--as-needed" +cd automated-tests +cmake . -DMODULE="%{MODULE_NAME}" -DCMAKE_INSTALL_PREFIX=%{_prefix} + +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +cd automated-tests +%make_install +mkdir -p %{buildroot}/opt/usr/share/license +cp %{_builddir}/%{name}-%{version}/LICENSE %{buildroot}/opt/usr/share/license/%{name} +mkdir -p %{buildroot}/tmp/ +cp %{_builddir}/%{name}-%{version}/automated-tests/scripts/add_all_smack_rule.sh %{buildroot}/tmp/ +cp %{_builddir}/%{name}-%{version}/automated-tests/scripts/all_smack.rule %{buildroot}/tmp/ + +%post + +%postun + + +%files +/opt/usr/bin/* +/opt/usr/share/license/%{name} +/tmp/add_all_smack_rule.sh +/tmp/all_smack.rule diff --git a/automated-tests/packaging/core-dali-unmanaged-tests.spec b/automated-tests/packaging/core-dali-unmanaged-tests.spec new file mode 100644 index 0000000..dfb0ffb --- /dev/null +++ b/automated-tests/packaging/core-dali-unmanaged-tests.spec @@ -0,0 +1,53 @@ +%define MODULE_NAME dali-unmanaged +%define MODULE_LIBNAME dali-unmanaged +Name: core-%{MODULE_NAME}-tests +Summary: Core API unit TC (%{name}) +Version: 0.1 +Release: 0 +Group: Development/Tools +License: Apache License, Version 2.0, Samsung Properietary +Source0: %{name}-%{version}.tar.gz +Requires: dali +BuildRequires: dali-devel +BuildRequires: dali-integration-devel +BuildRequires: pkgconfig(dali-core) +BuildRequires: pkgconfig(dali) +BuildRequires: libxml2-devel +BuildRequires: cmake + +%description +Core API unit TC (%{name}) + +%prep +%setup -q + +%build + +%define PREFIX "%{_libdir}/%{name}" + +export LDFLAGS+="-Wl,--rpath=%{PREFIX} -Wl,--as-needed" +cd automated-tests +cmake . -DMODULE="%{MODULE_NAME}" -DCMAKE_INSTALL_PREFIX=%{_prefix} + +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +cd automated-tests +%make_install +mkdir -p %{buildroot}/opt/usr/share/license +cp %{_builddir}/%{name}-%{version}/LICENSE %{buildroot}/opt/usr/share/license/%{name} +mkdir -p %{buildroot}/tmp/ +cp %{_builddir}/%{name}-%{version}/automated-tests/scripts/add_all_smack_rule.sh %{buildroot}/tmp/ +cp %{_builddir}/%{name}-%{version}/automated-tests/scripts/all_smack.rule %{buildroot}/tmp/ + +%post + +%postun + + +%files +/opt/usr/bin/* +/opt/usr/share/license/%{name} +/tmp/add_all_smack_rule.sh +/tmp/all_smack.rule diff --git a/automated-tests/scripts/add_all_smack_rule.sh b/automated-tests/scripts/add_all_smack_rule.sh new file mode 100755 index 0000000..8efb158 --- /dev/null +++ b/automated-tests/scripts/add_all_smack_rule.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +SCRIPTDIR=`dirname $(readlink -f $0)` +SMACK_FILE=$SCRIPTDIR/all_smack.rule + +echo "" +echo "Add smack rule in $SMACK_FILE" +echo "===================================================" +echo "" + +while read rule; do + NO_BLANK=$(echo $rule | sed 's/ //g' | sed 's/ //g') + if [ ${#NO_BLANK} -lt 1 ]; then + echo "Blank" + continue + elif [ `echo $NO_BLANK|cut -c1-1` = '#' ]; then + echo "Comment" + continue + fi + + echo "echo \"$rule\" > /smack/load2" + echo "$rule" > /smack/load2 +done < $SMACK_FILE + +echo "===================================================" +echo "" diff --git a/automated-tests/scripts/add_smack_rule.sh b/automated-tests/scripts/add_smack_rule.sh new file mode 100755 index 0000000..22fe5ee --- /dev/null +++ b/automated-tests/scripts/add_smack_rule.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +SCRIPTDIR=`dirname $(readlink -f $0)` +SMACK_FILE=$SCRIPTDIR/all_smack.rule + +echo "" +echo "Add smack rule in $SMACK_FILE" +echo "===================================================" + +echo "sdb root on" +sdb root on + +while read rule; do + NO_BLANK=$(echo $rule | sed 's/ //g' | sed 's/ //g') + if [ ${#NO_BLANK} -lt 1 ]; then + #echo "Blank" + continue + elif [ `echo $NO_BLANK|cut -c1-1` = '#' ]; then + #echo "Comment" + continue + fi + + echo "sdb shell \"echo $rule > /smack/load2\"" + sdb shell "echo $rule > /smack/load2" +done < $SMACK_FILE + +echo "===================================================" +echo "" diff --git a/automated-tests/scripts/add_style.pl b/automated-tests/scripts/add_style.pl new file mode 100755 index 0000000..95888f9 --- /dev/null +++ b/automated-tests/scripts/add_style.pl @@ -0,0 +1,27 @@ +#!/usr/bin/perl + +use strict; +use Encode; +use Getopt::Long; +use Cwd; + +my $pwd = getcwd; +my $MOD_NAME = $ARGV[0]; +my $results_xml = "tct-$MOD_NAME-core-tests.xml"; +my $results_out = "results_xml.$$"; + +# Copy $results_xml, writing new stylesheet line: +# Write as second line +open RESULTS, "<$results_xml" || die "Can't open $results_xml for reading:$!\n"; +open RESULTS_OUT, ">$results_out" || die "Can't open $results_out for writing:$!\n"; +my $fline = readline RESULTS; +print RESULTS_OUT $fline; +print RESULTS_OUT "\n"; +while() +{ + print RESULTS_OUT $_; +} +close RESULTS_OUT; +close RESULTS; +unlink $results_xml; +print `mv $results_out $results_xml`; diff --git a/automated-tests/scripts/all_smack.rule b/automated-tests/scripts/all_smack.rule new file mode 100644 index 0000000..93f2b67 --- /dev/null +++ b/automated-tests/scripts/all_smack.rule @@ -0,0 +1,28 @@ +# calendar-service +_ calendar-service::svc rwx + +# capi-appfw-application +_ alarm-server::alarm rw +_ aul::launch x +_ aul::terminate x + +# capi-network-bluetooth +_ bt-service::admin w +_ bt-service::manager w +_ bt-service::gap w +_ bt-service::spp w +_ bt:service::opp w + +# capi-network-nfc +_ nfc-manager rwx +_ nfc-manager::tag rwx +_ nfc-manager::p2p rwx +_ nfc-manager::admin rwx +_ nfc-manager::common rwx + +# capi-location-* +_ location::maps rw +_ location::client rw + +# libmdm +_ mdm-server::eas rw diff --git a/automated-tests/scripts/autocompletion.sh b/automated-tests/scripts/autocompletion.sh new file mode 100755 index 0000000..d952c73 --- /dev/null +++ b/automated-tests/scripts/autocompletion.sh @@ -0,0 +1,18 @@ +#!/bin/bash +if [ -z "$TC_PROJECT_DIR" ]; then + echo "CoreAPI project directory can't be found. `basename $0` exitting..." + exit 1 +fi + +_tcbuild () { + local cur + cur=${COMP_WORDS[$COMP_CWORD]} + if [ $COMP_CWORD -eq 1 ]; then + COMPREPLY=( $( compgen -W "addmod build install rmmod" -- $cur ) ) + else #if [ $COMP_CWORD -eq 2 ]; then + COMPREPLY=( $( cd $TC_PROJECT_DIR/src; compgen -d -X "common" -- $cur ) ) + fi + return 0 +} + +complete -F _tcbuild tcbuild diff --git a/automated-tests/scripts/init.sh b/automated-tests/scripts/init.sh new file mode 100755 index 0000000..1ccd9ea --- /dev/null +++ b/automated-tests/scripts/init.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +PROJECT_DIR="$(cd "$(dirname $0)" && cd .. && pwd)" + +ln -s $PROJECT_DIR/scripts/tcbuild.sh $PROJECT_DIR/tcbuild + +echo "" >> $HOME/.bashrc +echo "# CoreAPI-tests convenience helpers" >> $HOME/.bashrc +echo "export TC_PROJECT_DIR=\"$PROJECT_DIR\"" >> $HOME/.bashrc +echo "source $PROJECT_DIR/scripts/autocompletion.sh" >> $HOME/.bashrc diff --git a/automated-tests/scripts/retriever.sh b/automated-tests/scripts/retriever.sh new file mode 100755 index 0000000..d3b123b --- /dev/null +++ b/automated-tests/scripts/retriever.sh @@ -0,0 +1,197 @@ +#!/bin/bash + +USAGE=$(cat < 2, +# - argument doesn't begin with '-' and number of arguments is > 1 +if [[ ( "$1" == -* && ( ! "$1" =~ ^-(anum|mnum|f)$ || $# > 2 ) ) || ( "$1" != -* && $# > 1 ) ]]; then + echo -e "$USAGE" + exit 1 +fi + + +# get directory from last argument (or assume current one) +if [[ ! "$1" =~ ^-(anum|mnum|f)$ ]]; then + DIR=${1:-.} +else + DIR=${2:-.} +fi + + +# populate $TC_FILES with files declared in CMakeLists.txt +get_tc_files $DIR +if [ $? != 0 ]; then + exit 1 +fi + + +# run appropriate subcommand +case "$1" in + -anum) + tc_anum $TC_FILES ;; + -mnum) + tc_mnum $TC_FILES ;; + -f) + tc_fullinfo $TC_FILES ;; + *) + tc_names $TC_FILES ;; +esac diff --git a/automated-tests/scripts/summarize.pl b/automated-tests/scripts/summarize.pl new file mode 100755 index 0000000..c90eb89 --- /dev/null +++ b/automated-tests/scripts/summarize.pl @@ -0,0 +1,109 @@ +#!/usr/bin/perl + +use strict; +use XML::Parser; +use Encode; +use Getopt::Long; +use Cwd; + +my $pwd = getcwd; +my $num_tests=0; +my $num_passes=0; +my $num_actual_passes=0; +my $text = ""; + +sub handle_start +{ + my ($p, $elt, %attrs) = @_; + + if($elt =~ /testcase/) + { + $num_tests++; + if($attrs{"result"} eq "PASS") + { + $num_passes++; + } + } + if($elt =~ /actual_result/) + { + $text = ""; + } +} + +sub handle_end +{ + my ($p, $elt) = @_; + if($elt =~ /actual_result/) + { + if($text eq "PASS") + { + $num_actual_passes++; + } + $text = ""; + } +} + +sub handle_char +{ + my ($p, $str) = @_; + $text .= $str; +} + +my($parser) = new XML::Parser(Handlers => {Start => \&handle_start, + End => \&handle_end, + Char => \&handle_char}); + + +# Write summary.xml: +open SUMMARY, ">summary.xml" || die "Can't open summary.xml for writing:$!\n"; +print SUMMARY << "EOS"; + + + + + + 2014-03-21_18_52_41 + 2014-03-21_18_57_54 + +EOS + +print "\n\nSummary of all tests:\n"; +my $output_files = `ls tct*core-tests.xml`; +my $file; +foreach $file (split /\s+/, $output_files ) +{ + $num_tests=0; + $num_passes=0; + $num_actual_passes=0; + $text = ""; + + $parser->parsefile($file); + + my $pass_rate = sprintf("%5.2f", $num_passes * 100.0 / $num_tests); + my $num_fails = $num_tests - $num_passes; + my $fail_rate = sprintf("%5.2f", $num_fails * 100.0 / $num_tests); + + my $suite_name = $file; + $suite_name =~ s/\.xml$//; + + print "$suite_name: $num_passes tests passed out of $num_tests ( $pass_rate% )\n"; + +print SUMMARY << "EOS2"; + + $num_tests + $num_passes + $pass_rate + $num_fails + $fail_rate + 0 + 0.00 + 0 + 0.00 + +EOS2 +} + +print SUMMARY "\n"; +close SUMMARY; + +print "Summary of results written to summary.xml\n"; diff --git a/automated-tests/scripts/tcbuild.sh b/automated-tests/scripts/tcbuild.sh new file mode 100755 index 0000000..42eaef0 --- /dev/null +++ b/automated-tests/scripts/tcbuild.sh @@ -0,0 +1,213 @@ +#!/bin/bash + +#---------- DEBUG_BEGIN ---------- +#ARG="-d" # debug-on flag, might be set as $1 +# keyprompt "introductory message" -- wait until any key pressed +function keyprompt { echo -ne "\n\e[1;31m$1 -- " && read -n 1 && echo -e "\n\e[0m"; } +# d_bp -- breakpoint at which user need to press any key to proceed +function d_bp { if [[ "$ARG" == "-d" ]]; then keyprompt "d >> Press any key"; fi } +# d_showVar VARNAME -- print bash variable name +function d_showVar { if [ "$ARG" == "-d" -a -n "$1" ]; then echo "d >> ${1} = ${!1}"; fi } +# d_print "message" -- print a debug message +function d_print { if [ "$ARG" == "-d" -a -n "$1" ]; then echo -e "d >> $1"; fi } +#---------- DEBUG_END ---------- + +PROJECT_DIR="$(cd "$(dirname $0)" && pwd)" +d_showVar PROJECT_DIR + +function gbs_profile { +perl -e " +use Config::Tiny; +my \$Config = Config::Tiny->read( \"\$ENV{HOME}/.gbs.conf\" ); +my \$profile = \$Config->{general}->{profile}; +\$profile =~ s/profile.//; +print \$profile;" +} + +PROFILE=`gbs_profile` +RPM_DIR="$HOME/GBS-ROOT/local/repos/$PROFILE/armv7l/RPMS" +d_showVar RPM_DIR + +function add_module { + # argument check + if [ -z "$1" ]; then echo "Usage: `basename $0` addmod [module_lib_name]"; exit 1; fi + + MODULE_NAME=$1 + d_showVar MODULE_NAME + MODULE_NAME_C=$(echo $MODULE_NAME | sed -e 's/-\([a-z]\)/\U\1/' -e 's/^\([a-z]\)/\U\1/') + d_showVar MODULE_NAME_C + MODULE_NAME_U=$(echo $MODULE_NAME | sed -e 's/-/_/') + d_showVar MODULE_NAME_U +# MODULE_LIBNAME=${2:-capi-$MODULE_NAME} + MODULE_LIBNAME=$1 + d_showVar MODULE_LIBNAME + + echo "Adding $MODULE_NAME module to project..." + d_bp + cd $PROJECT_DIR + # prepare .spec file + echo "-- Generating packaging/core-$MODULE_NAME-tests.spec file" + if [ ! -d packaging ]; then mkdir packaging; fi + sed -e "s:\[MODULE_NAME\]:$MODULE_NAME:g" -e "s:\[MODULE_LIBNAME\]:$MODULE_LIBNAME:g" \ + templates/core-\[module_name\]-tests.spec > packaging/core-$MODULE_NAME-tests.spec + # prepare src directory + mkdir src/$MODULE_NAME + echo "-- Generating src/$MODULE_NAME/CMakeLists.txt file" + sed -e "s:%{MODULE_NAME}:$MODULE_NAME:g" -e "s:%{MODULE_LIBNAME}:$MODULE_LIBNAME:g" \ + templates/src-directory/CMakeLists.txt > src/$MODULE_NAME/CMakeLists.txt + echo "-- Generating src/$MODULE_NAME/tct-$MODULE_NAME-core.c file" + sed -e "s:%{MODULE_NAME}:$MODULE_NAME:g" \ + templates/src-directory/tct-\[module_name\]-core.c > src/$MODULE_NAME/tct-$MODULE_NAME-core.c + echo "-- Generating src/$MODULE_NAME/utc-$MODULE_NAME.c file" + sed -e "s:%{MODULE_NAME_U}:$MODULE_NAME_U:g" -e "s:%{MODULE_NAME_C}:$MODULE_NAME_C:g" \ + templates/src-directory/utc-\[module_name\].c > src/$MODULE_NAME/utc-$MODULE_NAME.c + echo "Task finished successfully" +} + +function rm_module { + # argument check + if [ -z "$1" ]; then echo "Usage: `basename $0` rmmod "; exit 1; fi + + MODULE_NAME=$1 + d_showVar MODULE_NAME + + echo "Removing $MODULE_NAME module from project..." + d_bp + echo "---- Updating /opt/tct/packages/package_list.xml" + scripts/tcpackageslistsgen.sh $MODULE_NAME /opt/tct/packages/package_list.xml 1 + if [ $? -ne 0 ]; then echo "Aborting..."; exit 1; fi + # echo "---- Updating test plans" + # scripts/tcpackageslistsgen.sh $MODULE_NAME /opt/tct/manager/plan/*.xml 1 + # if [ $? -ne 0 ]; then echo "Aborting..."; exit 1; fi + + cd $PROJECT_DIR + echo "-- Removing packaging/core-$MODULE_NAME-tests.spec file" + rm packaging/core-$MODULE_NAME-tests.spec + echo "-- Removing src/$MODULE_NAME directory" + rm -r src/$MODULE_NAME + echo "Task finished successfully" +} + +function build { + if [ -n "$1" ]; then + (cd src/$1; ../../scripts/tcheadgen.sh tct-$1-core.h) + if [ $? -ne 0 ]; then echo "Aborting..."; exit 1; fi + cp packaging/core-$1-tests.spec ../packaging + gbs build -A armv7l --spec core-$1-tests.spec --include-all --keep-packs | \ + tee build.log | stdbuf -o0 sed -e 's/error:/\x1b[1;91m&\x1b[0m/' \ + -e 's/warning:/\x1b[93m&\x1b[0m/' + rm ../packaging/core-$1-tests.spec + else + echo "Build requires a module name" + exit 1 + fi +} + +function inst { + if [ -z "$1" ] + then + for mod in `ls -1 src/ | grep -v CMakeLists` + do + + if [ $mod != 'common' ] && [ $mod != 'manual' ]; then + + PKG_NAME="core-$mod-tests" + d_showVar PKG_NAME + VER=$(cat packaging/$PKG_NAME.spec | awk '/^Version:/ { print $2; exit; }') + d_showVar VER + PKG_VNAME="$PKG_NAME-$VER" + d_showVar PKG_VNAME + PKG_FNAME="$PKG_VNAME-0.armv7l.rpm" + d_showVar PKG_FNAME + + if [ -f "$RPM_DIR/$PKG_FNAME" ] + then + inst $mod + echo "" + fi + fi + done + else + cd $PROJECT_DIR + # setting variables + MOD_NAME="$1" + d_showVar MOD_NAME + PKG_NAME="core-$MOD_NAME-tests" + d_showVar PKG_NAME + VER=$(cat packaging/$PKG_NAME.spec | awk '/^Version:/ { print $2; exit; }') + d_showVar VER + PKG_VNAME="$PKG_NAME-$VER" + d_showVar PKG_VNAME + PKG_FNAME="$PKG_VNAME-0.armv7l.rpm" + d_showVar PKG_FNAME + TCT_DIR="opt/tct-$MOD_NAME-core-tests" + d_showVar TCT_DIR + + echo "Deploying $MOD_NAME suite to tct-mgr..." + d_bp + # prepare tct directory and files + echo "-- Preparing suite .zip file..." + echo "---- Creating /tmp/$TCT_DIR directory" + rm -r /tmp/opt > /dev/null 2>&1 + mkdir -p /tmp/$TCT_DIR + # README + echo "---- Copying /tmp/$TCT_DIR" + cp templates/tct-package/README /tmp/$TCT_DIR + # rpm + echo "---- Copying /tmp/$TCT_DIR package" + cp $RPM_DIR/$PKG_FNAME /tmp/$TCT_DIR + if [ $? -ne 0 ]; then echo "Aborting..."; exit 1; fi + # inst.sh + echo "---- Generating /tmp/$TCT_DIR/inst.sh file" + sed -e "s:%{PKG_NAME}:\"$PKG_NAME\":g" -e "s:%{PKG_FULLNAME}:\"$PKG_FNAME\":g" \ + -e "s:%{PKG_DIR}:\"/opt/usr/media/tct/$TCT_DIR\":g" \ + templates/tct-package/inst.sh > /tmp/$TCT_DIR/inst.sh + chmod a+x /tmp/$TCT_DIR/inst.sh + # tests.xml + echo "---- Generating /tmp/$TCT_DIR" + scripts/tctestsgen.sh $MOD_NAME /tmp/$TCT_DIR target + if [ $? -ne 0 ]; then echo "Aborting..."; exit 1; fi + # zip + echo "---- Preparing /tmp/tct/packages/tct-$MOD_NAME-core-tests-2.2.1-1.zip file" + # clear old zips + rm -r /tmp/tct/packages > /dev/null 2>&1 + mkdir -p /tmp/tct/packages + # create new zip + ( cd /tmp; zip -r /tmp/tct/packages/tct-$MOD_NAME-core-tests-2.2.1-1.zip opt > /dev/null 2>&1; ) + # deployment + echo "-- Suite deployment..." + echo "---- Copying /opt/tct/packages/tct-$MOD_NAME-core-tests-2.2.1-1.zip" + cp /tmp/tct/packages/tct-$MOD_NAME-core-tests-2.2.1-1.zip /opt/tct/packages/ + echo "---- Updating /opt/tct/packages/package_list.xml" + scripts/tcpackageslistsgen.sh $MOD_NAME /opt/tct/packages/package_list.xml 0 + if [ $? -ne 0 ]; then echo "Aborting..."; exit 1; fi + # echo "---- Updating test plans" + # for file in `grep -r tct-$MOD_NAME-core-tests /opt/tct/manager/plan/ | cut -d: -f1 | uniq` + # do + # scripts/tcpackageslistsgen.sh $MOD_NAME $file + # done + # scripts/tcpackageslistsgen.sh $MOD_NAME /opt/tct/manager/plan/Full_test.xml + # if [ $? -ne 0 ]; then echo "Aborting..."; exit 1; fi + echo "Task finished successfully" + fi +} + +if [ -z "$1" ]; then + # usage note + echo "Usage: `basename $0` [module_lib_name]" + exit 1 +elif [ "addmod" == "$1" ]; then + # add new module + add_module $2 $3 +elif [ "rmmod" == "$1" ]; then + # remove module + rm_module $2 +elif [ "build" == "$1" ]; then + # build the binary + build $2 +elif [ "install" == "$1" ]; then + # install + inst $2 +else + echo "Invalid subcommand: $1" +fi diff --git a/automated-tests/scripts/tcheadgen.sh b/automated-tests/scripts/tcheadgen.sh new file mode 100755 index 0000000..c7b7700 --- /dev/null +++ b/automated-tests/scripts/tcheadgen.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +if [[ -z $1 ]]; then + echo "Usage note: tcheadgen.sh " + exit 1 +fi + +FILE="$PWD/$1" +TFILE="/tmp/retr.csv" +HEADER_NAME=$(echo $1 | tr '[:lower:]' '[:upper:]' | sed -e 's/-/_/g' -e 's/\./_/') +SCRIPT_DIR="$(cd "$(dirname $0)" && pwd)" + +$SCRIPT_DIR/retriever.sh > $TFILE +if [ $? -ne 0 ]; then cat $TFILE; exit 1; fi +awk -F',' -v HEADER_NAME="$HEADER_NAME" ' + BEGIN { + OFS = ", "; + + startup_counter = 0; + startup_list[0] = ""; + + cleanup_counter = 0; + cleanup_list[0] = ""; + + testcase_counter = 0; + testcase_list[0] = ""; + + tc_array_counter = 0; + tc_array_list[0] = ""; + +print "#ifndef __" HEADER_NAME "__" +print "#define __" HEADER_NAME "__" +print "" +print "#include \"testcase.h\"" +print "" + } + { + testcase_list[testcase_counter++] = $1; + + if (startup_counter == 0 || startup_list[startup_counter-1] != $2) + startup_list[startup_counter++] = $2; + + if (startup_counter == 0 || cleanup_list[cleanup_counter-1] != $3) + cleanup_list[cleanup_counter++] = $3; + + tc_array_list[tc_array_counter++] = "\"" $1 "\", " $1 ", " $2 ", " $3; + } + END { + sc_count = (startup_counter > cleanup_counter) ? startup_counter : cleanup_counter; + for (i = 0; i < sc_count; i++) { + if (i < startup_counter && startup_list[i] != "NULL") +print "extern void " startup_list[i] "(void);" + if (i < cleanup_counter && cleanup_list[i] != "NULL") +print "extern void " cleanup_list[i] "(void);" + } + +print "" + for (i = 0; i < testcase_counter; i++) +print "extern int " testcase_list[i] "(void);" + +print "" +print "testcase tc_array[] = {" + + for (i = 0; i < tc_array_counter; i++) +print " {" tc_array_list[i] "}," + +print " {NULL, NULL}" +print "};" +print "" +print "#endif // __" HEADER_NAME "__" +}' $TFILE > $FILE diff --git a/automated-tests/scripts/tcpackageslistsgen.sh b/automated-tests/scripts/tcpackageslistsgen.sh new file mode 100755 index 0000000..15ea51f --- /dev/null +++ b/automated-tests/scripts/tcpackageslistsgen.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +if [ -z $1 -o -z $2 ]; then + echo "Usage note: tcpackageslistsgen.sh " + exit 1 +fi + +MODULE_NAME=$1 +FILE=$2 +if [ ! -f $FILE ]; then + echo "No such file: $2" + exit +fi +SCRIPT_DIR="$(cd "$(dirname $0)" && pwd)" +AUTO_NUM=$(cd $SCRIPT_DIR/..; scripts/retriever.sh -anum src/$MODULE_NAME) +if [ $? -ne 0 ]; then echo $AUTO_NUM; exit 1; fi +MAN_NUM=$(cd $SCRIPT_DIR/..; scripts/retriever.sh -mnum src/$MODULE_NAME) +if [ $? -ne 0 ]; then echo $MAN_NUM; exit 1; fi + +TFILE="/tmp/tempfile.xml" +if [ -f $TFILE ]; then + rm $TFILE +fi + +function regen { + awk -v RS='\r\n' -v ORS='\r\n' -v MODULE_NAME=$MODULE_NAME -v AUTO_NUM=$AUTO_NUM -v MAN_NUM=$MAN_NUM ' + BEGIN { + found = 0; + replaced = 0; + } + $0 ~ "" { + found = 1; + next + } + /<\/suite>/ { + if (found == 1) { +print " "; +print " " AUTO_NUM ""; +print " " MAN_NUM ""; +print " " AUTO_NUM+MAN_NUM ""; +print " tct-" MODULE_NAME "-core-tests-2.2.1-1.zip"; +print " "; + found = 0; + replaced = 1; + } else { + print $0; + } + next + } + /<\/ns3:testplan>/ { + if (replaced == 0) { +print " "; +print " " AUTO_NUM ""; +print " " MAN_NUM ""; +print " " AUTO_NUM+MAN_NUM ""; +print " tct-" MODULE_NAME "-core-tests-2.2.1-1.zip"; +print " "; +print $0 + } else { + print $0 + } + next + } + { + if (found == 0) { + print $0; + } + }' $FILE > $TFILE + cat $TFILE > $FILE +} + +regen diff --git a/automated-tests/scripts/tctestsgen.sh b/automated-tests/scripts/tctestsgen.sh new file mode 100755 index 0000000..4b920b9 --- /dev/null +++ b/automated-tests/scripts/tctestsgen.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +if [[ -z $1 ]]; then + echo "Usage note: tctestsgen.sh " + exit 1 +fi + +MODULE_NAME=$1 +MODULE_NAME_C=$(echo $MODULE_NAME | sed -e 's/-\([a-z]\)/\U\1/' -e 's/^\([a-z]\)/\U\1/') +SCRIPT_DIR="$(cd "$(dirname $0)" && pwd)" +TC_DIR="/opt/usr/bin/tct-$1-core" +if [[ $3 == "desktop" ]] ; then + TC_DIR="build/src/$1" +fi + +FILE="$2/tests.xml" +if [ -a $FILE ]; then + rm $FILE +fi +TFILE="/tmp/tcs.csv" +if [ -a $TFILE ]; then + rm $TFILE +fi + +function gen { + awk -F',' -v MODULE_NAME=$MODULE_NAME -v MODULE_NAME_C=$MODULE_NAME_C -v TC_DIR=$TC_DIR ' + BEGIN { + set = "" +print ""; +print " "; +print ""; +print " "; + } + { + if (set != "" && set != $2) { +print " " + } + + if (set != $2) { + set = $2; +print " "; + } + + tcname = $1; + tcpurpose = $3 + +print " "; +print " "; + +print " " TC_DIR "/tct-" MODULE_NAME "-core " tcname ""; +print " "; +print " "; + } + END { + if (set != "") { +print " " + } +print " " +print "" + }' $TFILE > $FILE +} + +(cd $SCRIPT_DIR/..; scripts/retriever.sh -f src/$MODULE_NAME > ${TFILE}_pre) +if [ $? -ne 0 ]; then cat ${TFILE}_pre; exit 1; fi +cat ${TFILE}_pre | sort -t',' -k2,2 -s > $TFILE +gen diff --git a/automated-tests/src/CMakeLists.txt b/automated-tests/src/CMakeLists.txt new file mode 100644 index 0000000..e4f0a2b --- /dev/null +++ b/automated-tests/src/CMakeLists.txt @@ -0,0 +1,6 @@ +IF( DEFINED MODULE ) + MESSAGE(STATUS "Building: ${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}") + ADD_SUBDIRECTORY(${MODULE}) +ELSE( DEFINED MODULE ) + MESSAGE(FATAL_ERROR "No module selected to build. Aborting...") +ENDIF( DEFINED MODULE ) diff --git a/automated-tests/src/common/assert.h b/automated-tests/src/common/assert.h new file mode 100644 index 0000000..a5d6cff --- /dev/null +++ b/automated-tests/src/common/assert.h @@ -0,0 +1,82 @@ +#ifndef _ASSERT_H_ +#define _ASSERT_H_ +#include +#include + +#define assert(exp) \ + if (!(exp)) { \ + fprintf(stderr, \ + "Assert fail in %s:%d\n", __FILE__, __LINE__); \ + fprintf(stderr, \ + "Following expression is not true:\n" \ + "%s\n", #exp); \ + return 1; \ + } + +#define assert_eq(var, ref) \ + if (var != ref) { \ + fprintf(stderr, \ + "Assert fail in %s:%d\n", __FILE__, __LINE__); \ + fprintf(stderr, \ + "Values \"%s\" and \"%s\" are not equal:\n" \ + "%s == %d, %s == %d\n", \ + #var, #ref, #var, (int)var, #ref, (int)ref); \ + return 1; \ + } + +#define assert_neq(var, ref) \ + if (var == ref) { \ + fprintf(stderr, \ + "Assert fail in %s:%d\n", __FILE__, __LINE__); \ + fprintf(stderr, \ + "Values \"%s\" and \"%s\" are equal:\n" \ + "%s == %s == %d\n", \ + #var, #ref, #var, #ref, (int)ref); \ + return 1; \ + } + +#define assert_gt(var, ref) \ + if (var <= ref) { \ + fprintf(stderr, \ + "Assert fail in %s:%d\n", __FILE__, __LINE__); \ + fprintf(stderr, \ + "Value \"%s\" is not greater than \"%s\":\n" \ + "%s == %d, %s == %d\n", \ + #var, #ref, #var, var, #ref, ref); \ + return 1; \ + } + +#define assert_geq(var, ref) \ + if (var < ref) { \ + fprintf(stderr, \ + "Assert fail in %s:%d\n", __FILE__, __LINE__); \ + fprintf(stderr, \ + "Value \"%s\" is not greater or equal to \"%s\":\n" \ + "%s == %d, %s == %d\n", \ + #var, #ref, #var, var, #ref, ref); \ + return 1; \ + } + +#define assert_lt(var, ref) \ + if (var >= ref) { \ + fprintf(stderr, \ + "Assert fail in %s:%d\n", __FILE__, __LINE__); \ + fprintf(stderr, \ + "Value \"%s\" is not lower than \"%s\":\n" \ + "%s == %d, %s == %d\n", \ + #var, #ref, #var, var, #ref, ref); \ + return 1; \ + } + +#define assert_leq(var, ref) \ + if (var > ref) { \ + fprintf(stderr, \ + "Assert fail in %s:%d\n", __FILE__, __LINE__); \ + fprintf(stderr, \ + "Value \"%s\" is not lower or equal to \"%s\":\n" \ + "%s == %d, %s == %d\n", \ + #var, #ref, #var, var, #ref, ref); \ + return 1; \ + } + +#endif // _ASSERT_H_ diff --git a/automated-tests/src/common/testcase.h b/automated-tests/src/common/testcase.h new file mode 100644 index 0000000..011a452 --- /dev/null +++ b/automated-tests/src/common/testcase.h @@ -0,0 +1,18 @@ +#ifndef _TESTCASE_H_ +#define _TESTCASE_H_ + +/* pointer to startup/cleanup functions */ +typedef void (*void_fun_ptr)(void); + +/* pointer to testcase functions */ +typedef int (*tc_fun_ptr)(void); + +/* struct describing specific testcase */ +typedef struct testcase_s { + const char* name; + tc_fun_ptr function; + void_fun_ptr startup; + void_fun_ptr cleanup; +} testcase; + +#endif // _TESTCASE_H_ diff --git a/automated-tests/src/dali-toolkit-internal/CMakeLists.txt b/automated-tests/src/dali-toolkit-internal/CMakeLists.txt new file mode 100644 index 0000000..ab71b72 --- /dev/null +++ b/automated-tests/src/dali-toolkit-internal/CMakeLists.txt @@ -0,0 +1,67 @@ +SET(PKG_NAME "dali-toolkit-internal") + +SET(EXEC_NAME "tct-${PKG_NAME}-core") +SET(RPM_NAME "core-${PKG_NAME}-tests") + +SET(CAPI_LIB "dali-toolkit-internal") + +# List of test case sources (Only these get parsed for test cases) +SET(TC_SOURCES + utc-Dali-PushButton.cpp + utc-Dali-TextView-HelperAndDebug.cpp + utc-Dali-TextView-Processor-Types.cpp + utc-Dali-TextView-Processor.cpp + utc-Dali-TextView-Relayout-Utilities.cpp + utc-Dali-TextView.cpp +) + +# Append list of test harness files (Won't get parsed for test cases) +LIST(APPEND TC_SOURCES + ../dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-orientation.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp + ../dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp + ../dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-application.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-gesture-manager.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp +) + + +PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED + dali-core + dali + dali-toolkit +) + +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb --coverage -Wall -Werror=return-type") + +FOREACH(directory ${${CAPI_LIB}_LIBRARY_DIRS}) + SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -L${directory}") +ENDFOREACH(directory ${CAPI_LIB_LIBRARY_DIRS}) + +INCLUDE_DIRECTORIES( + ${${CAPI_LIB}_INCLUDE_DIRS} + ../dali-toolkit/dali-toolkit-test-utils + ../../.. +) + +ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES}) +TARGET_LINK_LIBRARIES(${EXEC_NAME} + ${${CAPI_LIB}_LIBRARIES} +) + +INSTALL(PROGRAMS ${EXEC_NAME} + DESTINATION ${BIN_DIR}/${EXEC_NAME} +) diff --git a/automated-tests/src/dali-toolkit-internal/tct-dali-toolkit-internal-core.cpp b/automated-tests/src/dali-toolkit-internal/tct-dali-toolkit-internal-core.cpp new file mode 100644 index 0000000..2bbd960 --- /dev/null +++ b/automated-tests/src/dali-toolkit-internal/tct-dali-toolkit-internal-core.cpp @@ -0,0 +1,31 @@ +#include +#include +#include "tct-dali-toolkit-internal-core.h" + +int main(int argc, const char *argv[]) +{ + int result = -1; + int i; + + if (argc != 2) { + printf("Usage: %s \n", argv[0]); + return 2; + } + + for (i = 0; tc_array[i].name; i++) { + if (!strcmp(argv[1], tc_array[i].name)) { + if (tc_array[i].startup) + tc_array[i].startup(); + + result = tc_array[i].function(); + + if (tc_array[i].cleanup) + tc_array[i].cleanup(); + + return result; + } + } + + printf("Unknown testcase name: \"%s\"\n", argv[1]); + return 2; +} diff --git a/automated-tests/src/dali-toolkit-internal/tct-dali-toolkit-internal-core.h b/automated-tests/src/dali-toolkit-internal/tct-dali-toolkit-internal-core.h new file mode 100644 index 0000000..298b305 --- /dev/null +++ b/automated-tests/src/dali-toolkit-internal/tct-dali-toolkit-internal-core.h @@ -0,0 +1,88 @@ +#ifndef __TCT_DALI_TOOLKIT_INTERNAL_CORE_H__ +#define __TCT_DALI_TOOLKIT_INTERNAL_CORE_H__ + +#include "testcase.h" + +extern void dali_text_view_helper_and_debug_startup(void); +extern void dali_text_view_helper_and_debug_cleanup(void); +extern void dali_text_view_processor_types_startup(void); +extern void dali_text_view_processor_types_cleanup(void); +extern void dali_text_view_processor_startup(void); +extern void dali_text_view_processor_cleanup(void); +extern void dali_text_view_relayout_utils_startup(void); +extern void dali_text_view_relayout_utils_cleanup(void); +extern void dali_text_view_startup(void); +extern void dali_text_view_cleanup(void); + +extern int UtcDaliPushButtonInterruptEventWhenInsensitive(void); +extern int UtcDaliPushButtonInterruptEventWhenNonVisible(void); +extern int UtcDaliPushButtonProperties(void); +extern int UtcDaliTextViewGetIndicesFromGlobalCharacterIndex(void); +extern int UtcDaliTextViewDebugCouts(void); +extern int UtcDaliTextViewDefaultConstructorDestructor_PT(void); +extern int UtcDaliTextViewCopyConstructorOperator(void); +extern int UtcDaliTextViewEqualityOperator(void); +extern int UtcDaliTextViewSplitInLines(void); +extern int UtcDaliTextViewSplitInWords(void); +extern int UtcDaliTextViewBeginsRightToLeftCharacter(void); +extern int UtcDaliTextViewContainsRightToLeftCharacter(void); +extern int UtcDaliTextViewFindNearestWord(void); +extern int UtcDaliTextViewDefaultConstructorDestructor_RU(void); +extern int UtcDaliTextViewCalculateSubLineLayout(void); +extern int UtcDaliTextViewCalculateAlignmentOffsets(void); +extern int UtcDaliTextViewCalculateJustificationOffsets(void); +extern int UtcDaliTextViewCalculateVisibility(void); +extern int UtcDaliTextViewMiscelaneousAsserts(void); +extern int UtcDaliTextViewCreateTextInfo(void); +extern int UtcDaliTextViewSplitWord(void); +extern int UtcDaliTextViewUpdateTextInfo(void); +extern int UtcDaliTextViewSplitWordGroup(void); +extern int UtcDaliTextViewSplitLine(void); +extern int UtcDaliTextViewMergeWord01(void); +extern int UtcDaliTextViewMergeWord02(void); +extern int UtcDaliTextViewMergeGroup01(void); +extern int UtcDaliTextViewMergeGroup02(void); +extern int UtcDaliTextViewMergeLine01(void); +extern int UtcDaliTextViewMergeLine02(void); +extern int UtcDaliTextViewRemoveCharactersFromWord(void); +extern int UtcDaliTextViewRemoveWordsFromGroup(void); +extern int UtcDaliTextViewRemoveGroupsFromLine(void); + +testcase tc_array[] = { + {"UtcDaliPushButtonInterruptEventWhenInsensitive", UtcDaliPushButtonInterruptEventWhenInsensitive, NULL, NULL}, + {"UtcDaliPushButtonInterruptEventWhenNonVisible", UtcDaliPushButtonInterruptEventWhenNonVisible, NULL, NULL}, + {"UtcDaliPushButtonProperties", UtcDaliPushButtonProperties, NULL, NULL}, + {"UtcDaliTextViewGetIndicesFromGlobalCharacterIndex", UtcDaliTextViewGetIndicesFromGlobalCharacterIndex, dali_text_view_helper_and_debug_startup, dali_text_view_helper_and_debug_cleanup}, + {"UtcDaliTextViewDebugCouts", UtcDaliTextViewDebugCouts, dali_text_view_helper_and_debug_startup, dali_text_view_helper_and_debug_cleanup}, + {"UtcDaliTextViewDefaultConstructorDestructor_PT", UtcDaliTextViewDefaultConstructorDestructor_PT, dali_text_view_processor_types_startup, dali_text_view_processor_types_cleanup}, + {"UtcDaliTextViewCopyConstructorOperator", UtcDaliTextViewCopyConstructorOperator, dali_text_view_processor_types_startup, dali_text_view_processor_types_cleanup}, + {"UtcDaliTextViewEqualityOperator", UtcDaliTextViewEqualityOperator, dali_text_view_processor_types_startup, dali_text_view_processor_types_cleanup}, + {"UtcDaliTextViewSplitInLines", UtcDaliTextViewSplitInLines, dali_text_view_processor_startup, dali_text_view_processor_cleanup}, + {"UtcDaliTextViewSplitInWords", UtcDaliTextViewSplitInWords, dali_text_view_processor_startup, dali_text_view_processor_cleanup}, + {"UtcDaliTextViewBeginsRightToLeftCharacter", UtcDaliTextViewBeginsRightToLeftCharacter, dali_text_view_processor_startup, dali_text_view_processor_cleanup}, + {"UtcDaliTextViewContainsRightToLeftCharacter", UtcDaliTextViewContainsRightToLeftCharacter, dali_text_view_processor_startup, dali_text_view_processor_cleanup}, + {"UtcDaliTextViewFindNearestWord", UtcDaliTextViewFindNearestWord, dali_text_view_processor_startup, dali_text_view_processor_cleanup}, + {"UtcDaliTextViewDefaultConstructorDestructor_RU", UtcDaliTextViewDefaultConstructorDestructor_RU, dali_text_view_relayout_utils_startup, dali_text_view_relayout_utils_cleanup}, + {"UtcDaliTextViewCalculateSubLineLayout", UtcDaliTextViewCalculateSubLineLayout, dali_text_view_relayout_utils_startup, dali_text_view_relayout_utils_cleanup}, + {"UtcDaliTextViewCalculateAlignmentOffsets", UtcDaliTextViewCalculateAlignmentOffsets, dali_text_view_relayout_utils_startup, dali_text_view_relayout_utils_cleanup}, + {"UtcDaliTextViewCalculateJustificationOffsets", UtcDaliTextViewCalculateJustificationOffsets, dali_text_view_relayout_utils_startup, dali_text_view_relayout_utils_cleanup}, + {"UtcDaliTextViewCalculateVisibility", UtcDaliTextViewCalculateVisibility, dali_text_view_relayout_utils_startup, dali_text_view_relayout_utils_cleanup}, + {"UtcDaliTextViewMiscelaneousAsserts", UtcDaliTextViewMiscelaneousAsserts, dali_text_view_relayout_utils_startup, dali_text_view_relayout_utils_cleanup}, + {"UtcDaliTextViewCreateTextInfo", UtcDaliTextViewCreateTextInfo, dali_text_view_startup, dali_text_view_cleanup}, + {"UtcDaliTextViewSplitWord", UtcDaliTextViewSplitWord, dali_text_view_startup, dali_text_view_cleanup}, + {"UtcDaliTextViewUpdateTextInfo", UtcDaliTextViewUpdateTextInfo, dali_text_view_startup, dali_text_view_cleanup}, + {"UtcDaliTextViewSplitWordGroup", UtcDaliTextViewSplitWordGroup, dali_text_view_startup, dali_text_view_cleanup}, + {"UtcDaliTextViewSplitLine", UtcDaliTextViewSplitLine, dali_text_view_startup, dali_text_view_cleanup}, + {"UtcDaliTextViewMergeWord01", UtcDaliTextViewMergeWord01, dali_text_view_startup, dali_text_view_cleanup}, + {"UtcDaliTextViewMergeWord02", UtcDaliTextViewMergeWord02, dali_text_view_startup, dali_text_view_cleanup}, + {"UtcDaliTextViewMergeGroup01", UtcDaliTextViewMergeGroup01, dali_text_view_startup, dali_text_view_cleanup}, + {"UtcDaliTextViewMergeGroup02", UtcDaliTextViewMergeGroup02, dali_text_view_startup, dali_text_view_cleanup}, + {"UtcDaliTextViewMergeLine01", UtcDaliTextViewMergeLine01, dali_text_view_startup, dali_text_view_cleanup}, + {"UtcDaliTextViewMergeLine02", UtcDaliTextViewMergeLine02, dali_text_view_startup, dali_text_view_cleanup}, + {"UtcDaliTextViewRemoveCharactersFromWord", UtcDaliTextViewRemoveCharactersFromWord, dali_text_view_startup, dali_text_view_cleanup}, + {"UtcDaliTextViewRemoveWordsFromGroup", UtcDaliTextViewRemoveWordsFromGroup, dali_text_view_startup, dali_text_view_cleanup}, + {"UtcDaliTextViewRemoveGroupsFromLine", UtcDaliTextViewRemoveGroupsFromLine, dali_text_view_startup, dali_text_view_cleanup}, + {NULL, NULL} +}; + +#endif // __TCT_DALI_TOOLKIT_INTERNAL_CORE_H__ diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-PushButton.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-PushButton.cpp new file mode 100644 index 0000000..d381f5c --- /dev/null +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-PushButton.cpp @@ -0,0 +1,723 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 + +#include +#include +#include +#include +#include + + +using namespace Dali; +using namespace Toolkit; + +namespace +{ + +static bool gPushButtonToggleState = false; +bool PushButtonToggled( Button button, bool toggled ) +{ + gPushButtonToggleState = toggled && ( toggled == static_cast( button ).IsToggled() ); + return true; +} + + +const Dali::TouchPoint pointDownInside( 0, TouchPoint::Down, 240, 400 ); +const Dali::TouchPoint pointUpInside( 0, TouchPoint::Up, 240, 400 ); +const Dali::TouchPoint pointLeave( 0, TouchPoint::Leave, 240, 400 ); +const Dali::TouchPoint pointEnter( 0, TouchPoint::Motion, 240, 400 ); +const Dali::TouchPoint pointMotionOut( 0, TouchPoint::Motion, 10, 10 ); +const Dali::TouchPoint pointDownOutside( 0, TouchPoint::Down, 10, 10 ); +const Dali::TouchPoint pointUpOutside( 0, TouchPoint::Up, 10, 10 ); +} // namespace + + +////////////////////////////////////////////////////////// + +namespace +{ +static bool gOnTouchPointInterrupted = false; +} //namespace + +namespace Dali +{ + +namespace Toolkit +{ + +namespace Internal +{ +class TETButton; +} + +/** + * Creates a Button to test if interrupt events are handled correctly. + */ +class TETButton : public Button +{ +public: + // PushButton Pressed + typedef SignalV2< bool ( Button ) > PressedSignalV2; + + PressedSignalV2& PressedSignal(); + + /** + * Default constructor. + */ + TETButton(); + + /** + * Copy constructor. + */ + TETButton( const Button& button ); + + /** + * Assignment operator. + */ + TETButton& operator=( const TETButton& button ); + + /** + * Creates and initializes a new button. + */ + static TETButton New(); + + /** + * Down cast to TETButton. + */ + static TETButton DownCast( BaseHandle handle ); + + /** + * Creates a handle using the Toolkit::Internal implementation. + * @param[in] implementation The Control implementation. + */ + TETButton( Internal::TETButton& implementation ); + + /** + * Allows the creation of this Control from an Internal::CustomActor pointer. + * @param[in] internal A pointer to the internal CustomActor. + */ + TETButton( Dali::Internal::CustomActor* internal ); +}; + +namespace Internal +{ + +/** + * Internal implementation + */ +class TETButton : public Button +{ +public: + /** + * Construct a new Button. + */ + TETButton(); + + /** + * A reference counted object may only be deleted by calling Unreference() + */ + virtual ~TETButton(); + + /** + * Creates an internal button. + */ + static Toolkit::TETButton New(); + + /** + * @return the pressed signal. + */ + Toolkit::TETButton::PressedSignalV2& PressedSignal(); + + /** + * Callback called when an interrupt events is received. + */ + void OnTouchPointInterrupted(); + + /** + * Callback received when a down event is received. + */ + void OnButtonDown(); + + Toolkit::TETButton::PressedSignalV2 mPressedSignal; ///< Signal emitted when the button is pressed. +}; + +} // namespace Internal + +TETButton::TETButton() +{ +} + +TETButton::TETButton( const Button& button ) +: Button( button ) +{ +} + +TETButton& TETButton::operator=( const TETButton& button ) +{ + if( &button != this ) + { + Button::operator=( button ); + } + return *this; +} + +TETButton TETButton::New() +{ + return Internal::TETButton::New(); +} + +TETButton TETButton::DownCast( BaseHandle handle ) +{ + return Control::DownCast(handle); +} + +TETButton::PressedSignalV2& TETButton::PressedSignal() +{ + TETButton button( *this ); + DALI_ASSERT_ALWAYS( button ); + + Dali::RefObject& handle = button.GetImplementation(); + + return static_cast( handle ).PressedSignal(); +} + +TETButton::TETButton( Internal::TETButton& implementation ) +: Button( implementation ) +{} + +TETButton::TETButton( Dali::Internal::CustomActor* internal ) +: Button( internal ) +{ + VerifyCustomActorPointer(internal); +} + +namespace Internal +{ + +TETButton::TETButton() +: Button(), + mPressedSignal() +{ +} + +TETButton::~TETButton() +{ +} + +Toolkit::TETButton TETButton::New() +{ + // Create the implementation, temporarily owned on stack + IntrusivePtr< TETButton > internalTETButton = new TETButton(); + + // Pass ownership to CustomActor + Dali::Toolkit::TETButton tetButton( *internalTETButton ); + + // Second-phase init of the implementation + // This can only be done after the CustomActor connection has been made... + internalTETButton->Initialize(); + + return tetButton; +} + +Toolkit::TETButton::PressedSignalV2& TETButton::PressedSignal() +{ + return mPressedSignal; +} + +void TETButton::OnButtonDown() +{ + Toolkit::TETButton handle( GetOwner() ); + + //Emit signal. + mPressedSignal.Emit( handle ); +} + +void TETButton::OnTouchPointInterrupted() +{ + gOnTouchPointInterrupted = true; +} + +} // namespace Internal + +} // namespace Toolkit + +} // namespace Dali + +namespace +{ + +class TETButtonPressed : public Dali::ConnectionTracker +{ +public: + enum Test + { + SENSITIVENESS, + VISIBILITY + }; + + TETButtonPressed( Actor actor, Test test ) + : mActor( actor ), + mTest( test ) + { + } + + bool Callback( Button button ) + { + switch( mTest ) + { + case SENSITIVENESS: + { + mActor.SetSensitive( false ); + break; + } + case VISIBILITY: + { + std::cout <<"VISIBILITY false" << std::endl; + mActor.SetVisible( false ); + break; + } + default: + { + break; + } + } + return true; + } + + Actor mActor; + Test mTest; +}; + +static bool TestCallback(Actor actor, const TouchEvent& event) +{ + return true; +} + +} // namespace + +////////////////////////////////////////////////////////// + + +int UtcDaliPushButtonInterruptEventWhenInsensitive(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliPushButtonInterruptEventWhenInsensitive"); + + // * Creates an actor which contains a button. + // * The size of the actor is bigger than the button. + // * The button's boundary is contained in the actor's one. + Actor actor = Actor::New(); + TETButton tetButton= Toolkit::TETButton::New(); + + actor.SetName( "Actor" ); + tetButton.SetName( "TETButton" ); + + actor.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + actor.SetParentOrigin( ParentOrigin::TOP_LEFT ); + actor.SetPosition( 0, 0 ); + actor.SetSize( 400, 800 ); + + tetButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + tetButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); + tetButton.SetPosition( 240, 400 ); + tetButton.SetSize( 100, 100 ); + + actor.Add( tetButton ); + Stage::GetCurrent().Add( actor ); + + // * Actor's touch event is connected to a callback function + // and this callback function consumes the event. + actor.TouchedSignal().Connect( &TestCallback ); + + // * Button's pressed signal is connected to a callback function + // which also consumes the event. + // * Changes the sensitiveness of the button to false. + TETButtonPressed tetButtonPressed( actor, TETButtonPressed::SENSITIVENESS ); + tetButton.PressedSignal().Connect( &tetButtonPressed, &TETButtonPressed::Callback ); + + // Initializes TET state. + gOnTouchPointInterrupted = false; + tetButton.SetSensitive( true ); + + Dali::Integration::TouchEvent event; + + // TET starts. + + // Test a down point inside the button which is also consumed by the actor, and an up point + // consumed only by the actor. gOnTouchPointInterrupted should be true (Button receives an + // interrupt event. + + application.SendNotification(); + application.Render(); + + // A down event is sent inside the button's boundary. + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointDownInside ); + + // flush the queue and render once + application.SendNotification(); + application.Render(); + application.ProcessEvent( event ); + + // An up event is sent outside the button's boundary but inside the actor's one. + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointUpOutside ); + + // flush the queue and render once + application.SendNotification(); + application.Render(); + application.ProcessEvent( event ); + + DALI_TEST_CHECK( gOnTouchPointInterrupted ); + + // Test a down point inside the button which is also consumed by the actor, and a motion point + // consumed only by the actor. gOnTouchPointInterrupted should be true (Button receives an + // interrupt event. + + // Initializes TET state. + gOnTouchPointInterrupted = false; + actor.SetSensitive( true ); + tetButton.SetSensitive( true ); + + application.SendNotification(); + application.Render(); + + // A down event is sent inside the button's boundary. + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointDownInside ); + + // flush the queue and render once + application.SendNotification(); + application.Render(); + application.ProcessEvent( event ); + + // A motion event is sent outside the button's boundary but inside the actor's one. + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointMotionOut ); + + // flush the queue and render once + application.SendNotification(); + application.Render(); + application.ProcessEvent( event ); + + DALI_TEST_CHECK( gOnTouchPointInterrupted ); + + // Test a down point inside the button which is also consumed by the actor, and an up point + // also inside the button and consumed by the actor. gOnTouchPointInterrupted should be false. + + // Initializes TET state. + gOnTouchPointInterrupted = false; + actor.SetSensitive( true ); + tetButton.SetSensitive( true ); + + // A down event is sent inside the button's boundary. + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointDownInside ); + + // flush the queue and render once + application.SendNotification(); + application.Render(); + application.ProcessEvent( event ); + + actor.SetSensitive( true ); + // An up event is sent inside the button's boundary. + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointUpInside ); + + // flush the queue and render once + application.SendNotification(); + application.Render(); + application.ProcessEvent( event ); + + DALI_TEST_CHECK( !gOnTouchPointInterrupted ); + END_TEST; +} + +int UtcDaliPushButtonInterruptEventWhenNonVisible(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliPushButtonInterruptEventWhenNonVisible"); + + // Does same test as above but changing the visibility instead the sensitiveness. + + // * Creates an actor which contains a button. + // * The size of the actor is bigger than the button. + // * The button's boundary is contained in the actor's one. + Actor actor = Actor::New(); + TETButton tetButton = Toolkit::TETButton::New(); + + actor.SetName( "Actor" ); + tetButton.SetName( "TETButton" ); + + actor.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + actor.SetParentOrigin( ParentOrigin::TOP_LEFT ); + actor.SetPosition( 0, 0 ); + actor.SetSize( 400, 800 ); + + tetButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + tetButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); + tetButton.SetPosition( 240, 400 ); + tetButton.SetSize( 100, 100 ); + + actor.Add( tetButton ); + Stage::GetCurrent().Add( actor ); + + // * Actor's touch event is connected to a callback function + // and this callback function consumes the event. + actor.TouchedSignal().Connect( &TestCallback ); + + // * Button's pressed signal is connected to a callback function + // which also consumes the event. + // * Changes the visibility of the button to false. + TETButtonPressed tetButtonPressed( tetButton, TETButtonPressed::VISIBILITY ); + tetButton.PressedSignal().Connect( &tetButtonPressed, &TETButtonPressed::Callback ); + + // Initializes TET state. + gOnTouchPointInterrupted = false; + tetButton.SetVisible( true ); + + Dali::Integration::TouchEvent event; + + // TET starts. + + // Test a down point inside the button which is also consumed by the actor, and an up point + // consumed only by the actor. gOnTouchPointInterrupted should be true (Button receives an + // interrupt event. + + application.SendNotification(); + application.Render(); + + // A down event is sent inside the button's boundary. + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointDownInside ); + + // flush the queue and render once + application.SendNotification(); + application.Render(); + application.ProcessEvent( event ); + + // More renders are needed in order to allow the node of the actor to become invisible. + application.SendNotification(); + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + application.Render(); + + // An up event is sent outside the button's boundary but inside the actor's one. + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointUpOutside ); + + // flush the queue and render once + application.SendNotification(); + application.Render(); + application.ProcessEvent( event ); + + DALI_TEST_CHECK( gOnTouchPointInterrupted ); + + // Test a down point inside the button which is also consumed by the actor, and a motion point + // consumed only by the actor. gOnTouchPointInterrupted should be true (Button receives an + // interrupt event. + + // Initializes TET state. + gOnTouchPointInterrupted = false; + tetButton.SetVisible( true ); + + application.SendNotification(); + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + application.Render(); + + // A down event is sent inside the button's boundary. + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointDownInside ); + + // flush the queue and render once + application.SendNotification(); + application.Render(); + application.ProcessEvent( event ); + + // More renders are needed in order to allow the node of the actor to become invisible. + application.SendNotification(); + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + application.Render(); + + // A motion event is sent outside the button's boundary but inside the actor's one. + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointMotionOut ); + + // flush the queue and render once + application.SendNotification(); + application.Render(); + application.ProcessEvent( event ); + + DALI_TEST_CHECK( gOnTouchPointInterrupted ); + + // Test a down point inside the button which is also consumed by the actor, and an up point + // also inside the button and consumed by the actor. gOnTouchPointInterrupted should be false. + + // Initializes TET state. + gOnTouchPointInterrupted = false; + tetButton.SetVisible( true ); + + application.SendNotification(); + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + application.Render(); + + // A down event is sent inside the button's boundary. + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointDownInside ); + + // flush the queue and render once + application.SendNotification(); + application.Render(); + application.ProcessEvent( event ); + + tetButton.SetVisible( true ); + + application.SendNotification(); + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + application.Render(); + + // An up event is sent inside the button's boundary. + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointUpInside ); + + // flush the queue and render once + application.SendNotification(); + application.Render(); + application.ProcessEvent( event ); + + DALI_TEST_CHECK( !gOnTouchPointInterrupted ); + END_TEST; +} + +int UtcDaliPushButtonProperties(void) +{ + ToolkitTestApplication application; + + PushButton button = PushButton::New(); + Stage::GetCurrent().Add( button ); + + // PushButton::PROPERTY_AUTO_REPEATING + button.SetAutoRepeating( false ); + DALI_TEST_CHECK( ! button.GetProperty< bool >( PushButton::PROPERTY_AUTO_REPEATING ) ); + button.SetProperty( PushButton::PROPERTY_AUTO_REPEATING, true ); + DALI_TEST_CHECK( button.IsAutoRepeating() ) ; + DALI_TEST_CHECK( button.GetProperty< bool >( PushButton::PROPERTY_AUTO_REPEATING ) ); + + // PushButton::PROPERTY_INITIAL_AUTO_REPEATING_DELAY + button.SetInitialAutoRepeatingDelay( 10.0f ); + DALI_TEST_EQUALS( 10.0f, button.GetProperty< float >( PushButton::PROPERTY_INITIAL_AUTO_REPEATING_DELAY ), TEST_LOCATION ); + button.SetProperty( PushButton::PROPERTY_INITIAL_AUTO_REPEATING_DELAY, 25.0f ); + DALI_TEST_EQUALS( 25.0f, button.GetInitialAutoRepeatingDelay(), TEST_LOCATION ); + DALI_TEST_EQUALS( 25.0f, button.GetProperty< float >( PushButton::PROPERTY_INITIAL_AUTO_REPEATING_DELAY ), TEST_LOCATION ); + + // PushButton::PROPERTY_NEXT_AUTO_REPEATING_DELAY + button.SetNextAutoRepeatingDelay( 3.0f ); + DALI_TEST_EQUALS( 3.0f, button.GetProperty< float >( PushButton::PROPERTY_NEXT_AUTO_REPEATING_DELAY ), TEST_LOCATION ); + button.SetProperty( PushButton::PROPERTY_NEXT_AUTO_REPEATING_DELAY, 4.0f ); + DALI_TEST_EQUALS( 4.0f, button.GetNextAutoRepeatingDelay(), TEST_LOCATION ); + DALI_TEST_EQUALS( 4.0f, button.GetProperty< float >( PushButton::PROPERTY_NEXT_AUTO_REPEATING_DELAY ), TEST_LOCATION ); + + // PushButton::PROPERTY_TOGGLABLE + button.SetToggleButton( false ); + DALI_TEST_CHECK( ! button.GetProperty< bool >( PushButton::PROPERTY_TOGGLABLE ) ); + button.SetProperty( PushButton::PROPERTY_TOGGLABLE, true ); + DALI_TEST_CHECK( button.IsToggleButton() ) ; + DALI_TEST_CHECK( button.GetProperty< bool >( PushButton::PROPERTY_TOGGLABLE ) ); + + // PushButton::PROPERTY_TOGGLE + button.SetToggled( false ); + DALI_TEST_CHECK( ! button.GetProperty< bool >( PushButton::PROPERTY_TOGGLE ) ); + button.SetProperty( PushButton::PROPERTY_TOGGLE, true ); + DALI_TEST_CHECK( button.IsToggled() ) ; + DALI_TEST_CHECK( button.GetProperty< bool >( PushButton::PROPERTY_TOGGLE ) ); + + // PushButton::PROPERTY_NORMAL_STATE_ACTOR + { + button.SetButtonImage( Image::New( "IMAGE_PATH_1") ); + DALI_TEST_EQUALS( "IMAGE_PATH_1", button.GetProperty( PushButton::PROPERTY_NORMAL_STATE_ACTOR ).GetValue( "image" ).GetValue( "filename" ).Get< std::string >(), TEST_LOCATION ); + + Property::Map map; + map.push_back( Property::StringValuePair( "type", "ImageActor" ) ); + + button.SetProperty( PushButton::PROPERTY_NORMAL_STATE_ACTOR, map ); + DALI_TEST_EQUALS( "ImageActor", button.GetProperty( PushButton::PROPERTY_NORMAL_STATE_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION ); + } + + // PushButton::PROPERTY_PRESSED_IMAGE + { + button.SetPressedImage( Image::New( "IMAGE_PATH_2") ); + DALI_TEST_EQUALS( "IMAGE_PATH_2", button.GetProperty( PushButton::PROPERTY_PRESSED_STATE_ACTOR ).GetValue( "image" ).GetValue( "filename" ).Get< std::string >(), TEST_LOCATION ); + + Property::Map map; + map.push_back( Property::StringValuePair( "type", "TextActor" ) ); + + button.SetProperty( PushButton::PROPERTY_PRESSED_STATE_ACTOR, map ); + DALI_TEST_EQUALS( "TextActor", button.GetProperty( PushButton::PROPERTY_PRESSED_STATE_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION ); + } + + // PushButton::PROPERTY_DIMMED_STATE_ACTOR + { + button.SetDimmedImage( Image::New( "IMAGE_PATH_3") ); + DALI_TEST_EQUALS( "IMAGE_PATH_3", button.GetProperty( PushButton::PROPERTY_DIMMED_STATE_ACTOR ).GetValue( "image" ).GetValue( "filename" ).Get< std::string >(), TEST_LOCATION ); + + Property::Map map; + map.push_back( Property::StringValuePair( "type", "Actor" ) ); + + button.SetProperty( PushButton::PROPERTY_DIMMED_STATE_ACTOR, map ); + DALI_TEST_EQUALS( "Actor", button.GetProperty( PushButton::PROPERTY_DIMMED_STATE_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION ); + } + + // PushButton::PROPERTY_LABEL_ACTOR + { + button.SetLabelText( "LABEL_TEXT_CUSTOM" ); + DALI_TEST_EQUALS( "TextView", button.GetProperty( PushButton::PROPERTY_LABEL_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION ); + + Property::Map map; + map.push_back( Property::StringValuePair( "type", "Actor" ) ); + + button.SetProperty( PushButton::PROPERTY_LABEL_ACTOR, map ); + DALI_TEST_EQUALS( "Actor", button.GetProperty( PushButton::PROPERTY_LABEL_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION ); + } + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextView-HelperAndDebug.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextView-HelperAndDebug.cpp new file mode 100644 index 0000000..a807a72 --- /dev/null +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextView-HelperAndDebug.cpp @@ -0,0 +1,282 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 + +#include +#include +#include + +// Internal headers are allowed here +#include +#include +#include +#include +#include + +using namespace Dali; +using namespace Dali::Toolkit; +using namespace Dali::Toolkit::Internal; + +void dali_text_view_helper_and_debug_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void dali_text_view_helper_and_debug_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +namespace +{ +// Data structures used to create an 'experiment' in TET cases + +const Toolkit::Internal::TextView::LayoutParameters DEFAULT_LAYOUT_PARAMETERS; +const Toolkit::Internal::TextView::VisualParameters DEFAULT_VISUAL_PARAMETERS; + +struct GetIndicesFromGlobalCharacterIndexTest +{ + std::string description; + std::string input; + std::size_t position; + std::size_t lineIndex; + std::size_t groupIndex; + std::size_t wordIndex; + std::size_t characterIndex; +}; + +/** + * Gets the line, group, word, and character indices for a given text and a given position and checks the results with the given indices. + * + * If the test fails it prints a short description and the line where this function was called. + * + * @param description Short description of the experiment. + * @param input The input text. + * @param position Global position of the character. i.e in a text with with 1000 characters, position could be any value from 0 to 1000. + * @param resultLineIndex Index to the line where the character is located. + * @param resultGroupIndex Index to the group within the line where the character is located. + * @param resultWordIndex Index to the word within the group where the character is located. + * @param resultCharacterIndex Index to the character within the word where the character is located. + * @param location Where this function has been called. + * + * @return \e true if the experiment is successful. Otherwise returns \e false. + */ +bool TestGetIndicesFromGlobalCharacterIndex( const std::string& description, + const std::string& input, + const std::size_t position, + const std::size_t resultLineIndex, + const std::size_t resultGroupIndex, + const std::size_t resultWordIndex, + const std::size_t resultCharacterIndex, + const char* location ) +{ + tet_printf( "%s", description.c_str() ); + + // Create natural size, layout and text-actor info for the input word. + Toolkit::Internal::TextView::RelayoutData relayoutData; + TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray inputStyledText; + MarkupProcessor::GetStyledTextArray( input, inputStyledText, true ); + + TextViewProcessor::CreateTextInfo( inputStyledText, + DEFAULT_LAYOUT_PARAMETERS, + relayoutData ); + + TextViewProcessor::TextInfoIndices indices; + TextViewProcessor::GetIndicesFromGlobalCharacterIndex( position, + inputLayout, + indices ); + + if( indices.mLineIndex != resultLineIndex ) + { + tet_printf( "Fail. different line index. %s", location ); + return false; + } + if( indices.mGroupIndex != resultGroupIndex ) + { + tet_printf( "Fail. different group index. %s", location ); + return false; + } + if( indices.mWordIndex != resultWordIndex ) + { + tet_printf( "Fail. different word index. %s", location ); + return false; + } + if( indices.mCharacterIndex != resultCharacterIndex ) + { + tet_printf( "Fail. different character index. %s", location ); + return false; + } + + return true; +} + +////////////////////////////////////////////////////////////////// +} // namespace + + +int UtcDaliTextViewGetIndicesFromGlobalCharacterIndex(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewGetIndicesFromGlobalCharacterIndex : "); + struct GetIndicesFromGlobalCharacterIndexTest getIndicesFromGlobalCharacterIndexTests[] = + { + { + std::string( "Test position 0" ), + std::string( "text text text text text\n" + "text text טקסט טקסט text\n" + "text text text text text\n" + "\n" ), + 0, + 0, + 0, + 0, + 0 + }, + { + std::string( "Test position 76. (just after the last \\n)" ), + std::string( "text text text text text\n" + "text text טקסט טקסט text\n" + "text text text text text\n" + "\n" ), + 76, + 4, + 0, + 0, + 0 + }, + { + std::string( "Test position 73. (the last \\n)" ), + std::string( "text text text text text\n" + "text text טקסט טקסט text\n" + "text text text text text\n" + "\n" ), + 75, + 3, + 0, + 0, + 0 + }, + { + std::string( "Test position 35. (first hebrew character)" ), + std::string( "text text text text text\n" + "text text טקסט טקסט text\n" + "text text text text text\n" + "\n" ), + 35, + 1, + 1, + 0, + 0 + }, + { + std::string( "Test position 3. (end of the first word)" ), + std::string( "text text text text text\n" + "text text טקסט טקסט text\n" + "text text text text text\n" + "\n" ), + 3, + 0, + 0, + 0, + 3 + }, + /* TODO Check for mixed RTL and LTR text. + { + std::string( "Test position 33. (end of the second word of the second line)" ), + std::string( "text text text text text\n" + "text text טקסט טקסט text\n" + "text text text text text\n" + "\n" ), + 33, + 1, + 0, + 2, + 3 + }, + { + std::string( "Test position 43. (last hebrew character)" ), + std::string( "text text text text text\n" + "text text טקסט טקסט text\n" + "text text text text text\n" + "\n" ), + 43, + 1, + 1, + 3, + 3 + }, + */ + }; + const std::size_t numberOfTests( 5 ); + + for( std::size_t index = 0; index < numberOfTests; ++index ) + { + const GetIndicesFromGlobalCharacterIndexTest& test = getIndicesFromGlobalCharacterIndexTests[index]; + + if( !TestGetIndicesFromGlobalCharacterIndex( test.description, test.input, test.position, test.lineIndex, test.groupIndex, test.wordIndex, test.characterIndex, TEST_LOCATION ) ) + { + tet_result( TET_FAIL ); + } + } + + tet_result( TET_PASS ); + END_TEST; +} + +int UtcDaliTextViewDebugCouts(void) +{ + ///////////////////////////////////////////////////// + // Text debug functions to not to penalize coverage + ///////////////////////////////////////////////////// + + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewDebugCouts : "); + + Toolkit::Internal::TextView::RelayoutData relayoutData; + + MarkupProcessor::StyledTextArray inputStyledText; + MarkupProcessor::GetStyledTextArray( std::string( "Hello world\nhello world" ), inputStyledText, true ); + + TextViewProcessor::CreateTextInfo( inputStyledText, + DEFAULT_LAYOUT_PARAMETERS, + relayoutData ); + + Actor dummy = Actor::New(); + Toolkit::Internal::SplitByNewLineChar::Relayout( dummy, + Toolkit::Internal::TextView::RELAYOUT_ALL, + DEFAULT_LAYOUT_PARAMETERS, + DEFAULT_VISUAL_PARAMETERS, + relayoutData ); + + TextViewProcessor::dbgPrint( relayoutData.mTextLayoutInfo ); + + TextStyle textStyle; + TextViewProcessor::dbgPrint( textStyle ); + + TextViewProcessor::TextInfoIndices indices; + TextViewProcessor::dbgPrint( indices ); + + TextViewProcessor::dbgPrint( inputStyledText ); + + tet_result( TET_PASS ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextView-Processor-Types.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextView-Processor-Types.cpp new file mode 100644 index 0000000..bb2ef55 --- /dev/null +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextView-Processor-Types.cpp @@ -0,0 +1,289 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + + +// Internal headers are allowed here +#include + +using namespace Dali; +using namespace Dali::Toolkit; +using namespace Dali::Toolkit::Internal; + +void dali_text_view_processor_types_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void dali_text_view_processor_types_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +namespace +{ +// Data structures used to create an 'experiment' in TET cases + +////////////////////////////////////////////////////////////////// +} // namespace + + +int UtcDaliTextViewDefaultConstructorDestructor_PT(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewDefaultConstructorDestructor : "); + + TextViewProcessor::TextInfoIndices indices; + DALI_TEST_EQUALS( indices.mLineIndex, 0u, TEST_LOCATION ); + DALI_TEST_EQUALS( indices.mGroupIndex, 0u, TEST_LOCATION ); + DALI_TEST_EQUALS( indices.mWordIndex, 0u, TEST_LOCATION ); + DALI_TEST_EQUALS( indices.mCharacterIndex, 0u, TEST_LOCATION ); + + TextViewProcessor::CharacterLayoutInfo characterLayoutInfo; + DALI_TEST_EQUALS( characterLayoutInfo.mHeight, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo.mAdvance, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo.mBearing, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo.mPosition, Vector3::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo.mOffset, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo.mSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo.mAscender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo.mUnderlineThickness, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo.mUnderlinePosition, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_CHECK( !characterLayoutInfo.mGlyphActor ); + DALI_TEST_CHECK( characterLayoutInfo.mStyledText.mText.IsEmpty() ); + DALI_TEST_EQUALS( characterLayoutInfo.mColorAlpha, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo.mGradientColor, Vector4::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo.mStartPoint, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo.mEndPoint, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_CHECK( characterLayoutInfo.mIsVisible ); + DALI_TEST_CHECK( characterLayoutInfo.mSetText ); + DALI_TEST_CHECK( characterLayoutInfo.mSetStyle ); + + TextViewProcessor::WordLayoutInfo wordLayoutInfo; + DALI_TEST_EQUALS( wordLayoutInfo.mSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( wordLayoutInfo.mAscender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( wordLayoutInfo.mType, TextViewProcessor::NoSeparator, TEST_LOCATION ); + DALI_TEST_EQUALS( wordLayoutInfo.mCharactersLayoutInfo.size(), 0u, TEST_LOCATION ); + + TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo; + DALI_TEST_EQUALS( wordGroupLayoutInfo.mSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( wordGroupLayoutInfo.mAscender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( wordGroupLayoutInfo.mDirection, TextViewProcessor::LTR, TEST_LOCATION ); + DALI_TEST_EQUALS( wordGroupLayoutInfo.mWordsLayoutInfo.size(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS( wordGroupLayoutInfo.mNumberOfCharacters, 0u, TEST_LOCATION ); + + TextViewProcessor::LineLayoutInfo lineLayoutInfo; + DALI_TEST_EQUALS( lineLayoutInfo.mSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( lineLayoutInfo.mAscender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( lineLayoutInfo.mLineHeightOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( lineLayoutInfo.mWordGroupsLayoutInfo.size(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS( lineLayoutInfo.mNumberOfCharacters, 0u, TEST_LOCATION ); + + TextViewProcessor::TextLayoutInfo textLayoutInfo; + DALI_TEST_EQUALS( textLayoutInfo.mWholeTextSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo.mMaxWordWidth, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo.mLinesLayoutInfo.size(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo.mNumberOfCharacters, 0u, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo.mMaxItalicsOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo.mEllipsizeLayoutInfo.mSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo.mEllipsizeLayoutInfo.mAscender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo.mEllipsizeLayoutInfo.mType, TextViewProcessor::NoSeparator, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo.mEllipsizeLayoutInfo.mCharactersLayoutInfo.size(), 0u, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliTextViewCopyConstructorOperator(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewCopyConstructorOperator : "); + + TextViewProcessor::CharacterLayoutInfo characterLayoutInfo; + characterLayoutInfo.mHeight = 1.f; + characterLayoutInfo.mAdvance = 1.f; + characterLayoutInfo.mBearing = 1.f; + characterLayoutInfo.mPosition = Vector3( 1.f, 1.f, 1.f ); + characterLayoutInfo.mOffset = Vector2( 1.f, 1.f ); + characterLayoutInfo.mSize = Vector2( 1.f, 1.f ); + characterLayoutInfo.mAscender = 1.f; + characterLayoutInfo.mUnderlineThickness = 1.f; + characterLayoutInfo.mUnderlinePosition = 1.f; + + characterLayoutInfo.mGlyphActor = TextActor::New( "Hello" ); + characterLayoutInfo.mStyledText.mText = Text( "Hello" ); + + characterLayoutInfo.mColorAlpha = 0.f; + characterLayoutInfo.mGradientColor = Vector4( 1.f, 1.f, 1.f, 1.f ); + characterLayoutInfo.mStartPoint = Vector2( 1.f, 1.f ); + characterLayoutInfo.mEndPoint = Vector2( 1.f, 1.f ); + characterLayoutInfo.mIsVisible = false; + characterLayoutInfo.mSetText = false; + characterLayoutInfo.mSetStyle = false; + + TextViewProcessor::CharacterLayoutInfo characterLayoutInfo1; + characterLayoutInfo1 = characterLayoutInfo; + + DALI_TEST_EQUALS( characterLayoutInfo1.mHeight, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo1.mAdvance, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo1.mBearing, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo1.mPosition, Vector3( 1.f, 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo1.mOffset, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo1.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo1.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo1.mUnderlineThickness, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo1.mUnderlinePosition, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_CHECK( characterLayoutInfo1.mGlyphActor ); + DALI_TEST_EQUALS( characterLayoutInfo1.mStyledText.mText.GetLength(), 5u, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo1.mColorAlpha, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo1.mGradientColor, Vector4( 1.f, 1.f, 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo1.mStartPoint, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo1.mEndPoint, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_CHECK( !characterLayoutInfo1.mIsVisible ); + DALI_TEST_CHECK( !characterLayoutInfo1.mSetText ); + DALI_TEST_CHECK( !characterLayoutInfo1.mSetStyle ); + + TextViewProcessor::CharacterLayoutInfo characterLayoutInfo2( characterLayoutInfo ); + DALI_TEST_EQUALS( characterLayoutInfo2.mHeight, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo2.mAdvance, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo2.mBearing, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo2.mPosition, Vector3( 1.f, 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo2.mOffset, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo2.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo2.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo2.mUnderlineThickness, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo2.mUnderlinePosition, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_CHECK( characterLayoutInfo2.mGlyphActor ); + DALI_TEST_EQUALS( characterLayoutInfo2.mStyledText.mText.GetLength(), 5u, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo2.mColorAlpha, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo2.mGradientColor, Vector4( 1.f, 1.f, 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo2.mStartPoint, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo2.mEndPoint, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_CHECK( !characterLayoutInfo2.mIsVisible ); + DALI_TEST_CHECK( !characterLayoutInfo2.mSetText ); + DALI_TEST_CHECK( !characterLayoutInfo2.mSetStyle ); + + // Increases coverage. + characterLayoutInfo2.mGlyphActor.Reset(); + characterLayoutInfo1 = characterLayoutInfo2; + DALI_TEST_CHECK( !characterLayoutInfo1.mGlyphActor ); + + TextViewProcessor::WordLayoutInfo wordLayoutInfo; + wordLayoutInfo.mSize = Vector2( 1.f, 1.f ); + wordLayoutInfo.mAscender = 1.f; + wordLayoutInfo.mType = TextViewProcessor::LineSeparator; + + TextViewProcessor::WordLayoutInfo wordLayoutInfo1; + wordLayoutInfo1 = wordLayoutInfo; + + DALI_TEST_EQUALS( wordLayoutInfo1.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( wordLayoutInfo1.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( wordLayoutInfo1.mType, TextViewProcessor::LineSeparator, TEST_LOCATION ); + + TextViewProcessor::WordLayoutInfo wordLayoutInfo2( wordLayoutInfo ); + + DALI_TEST_EQUALS( wordLayoutInfo2.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( wordLayoutInfo2.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( wordLayoutInfo2.mType, TextViewProcessor::LineSeparator, TEST_LOCATION ); + + + TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo; + wordGroupLayoutInfo.mSize = Vector2( 1.f, 1.f ); + wordGroupLayoutInfo.mAscender = 1.f; + wordGroupLayoutInfo.mDirection = TextViewProcessor::RTL; + wordGroupLayoutInfo.mNumberOfCharacters = 1u; + + TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo1; + wordGroupLayoutInfo1 = wordGroupLayoutInfo; + + DALI_TEST_EQUALS( wordGroupLayoutInfo.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( wordGroupLayoutInfo.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( wordGroupLayoutInfo.mDirection, TextViewProcessor::RTL, TEST_LOCATION ); + DALI_TEST_EQUALS( wordGroupLayoutInfo.mNumberOfCharacters, 1u, TEST_LOCATION ); + + TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo2( wordGroupLayoutInfo ); + + DALI_TEST_EQUALS( wordGroupLayoutInfo.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( wordGroupLayoutInfo.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( wordGroupLayoutInfo.mDirection, TextViewProcessor::RTL, TEST_LOCATION ); + DALI_TEST_EQUALS( wordGroupLayoutInfo.mNumberOfCharacters, 1u, TEST_LOCATION ); + + + TextViewProcessor::LineLayoutInfo lineLayoutInfo; + lineLayoutInfo.mSize = Vector2( 1.f, 1.f ); + lineLayoutInfo.mAscender = 1.f; + lineLayoutInfo.mLineHeightOffset = 1.f; + lineLayoutInfo.mNumberOfCharacters = 1u; + + TextViewProcessor::LineLayoutInfo lineLayoutInfo1; + lineLayoutInfo1 = lineLayoutInfo; + + DALI_TEST_EQUALS( lineLayoutInfo1.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( lineLayoutInfo1.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( lineLayoutInfo1.mLineHeightOffset, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( lineLayoutInfo1.mNumberOfCharacters, 1u, TEST_LOCATION ); + + TextViewProcessor::LineLayoutInfo lineLayoutInfo2( lineLayoutInfo ); + + DALI_TEST_EQUALS( lineLayoutInfo2.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( lineLayoutInfo2.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( lineLayoutInfo2.mLineHeightOffset, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( lineLayoutInfo2.mNumberOfCharacters, 1u, TEST_LOCATION ); + + TextViewProcessor::TextLayoutInfo textLayoutInfo; + textLayoutInfo.mWholeTextSize = Vector2( 1.f, 1.f ); + textLayoutInfo.mMaxWordWidth = 1.f; + textLayoutInfo.mNumberOfCharacters = 1u; + textLayoutInfo.mMaxItalicsOffset = 1.f; + + TextViewProcessor::TextLayoutInfo textLayoutInfo1; + textLayoutInfo1 = textLayoutInfo; + + DALI_TEST_EQUALS( textLayoutInfo1.mWholeTextSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo1.mMaxWordWidth, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo1.mNumberOfCharacters, 1u, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo1.mMaxItalicsOffset, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + + TextViewProcessor::TextLayoutInfo textLayoutInfo2( textLayoutInfo ); + + DALI_TEST_EQUALS( textLayoutInfo2.mWholeTextSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo2.mMaxWordWidth, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo2.mNumberOfCharacters, 1u, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo2.mMaxItalicsOffset, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliTextViewEqualityOperator(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewEqualityOperator : "); + + TextViewProcessor::TextInfoIndices indices; + TextViewProcessor::TextInfoIndices indices1( 1u, 1u, 1u, 1u ); + + DALI_TEST_CHECK( !( indices == indices1 ) ); + + indices = indices1; + + DALI_TEST_CHECK( indices == indices1 ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextView-Processor.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextView-Processor.cpp new file mode 100644 index 0000000..a6b9c59 --- /dev/null +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextView-Processor.cpp @@ -0,0 +1,403 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + +// Internal headers are allowed here +#include + +using namespace Dali; +using namespace Dali::Toolkit; +using namespace Dali::Toolkit::Internal; + +void dali_text_view_processor_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void dali_text_view_processor_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +namespace +{ +// Data structures used to create an 'experiment' in TET cases + +////////////////////////////////////////////////////////////////// + +struct BeginsRightToLeftCharacterTest +{ + std::string description; + std::string input; + bool result; +}; + +bool TestBeginsRightToLeftCharacter( const std::string& description, const std::string& input, const bool result, const char* location ) +{ + // Creates a styled text with the markup or plain string. + MarkupProcessor::StyledTextArray styledText; + MarkupProcessor::GetStyledTextArray( input, styledText, true ); + + const bool ret = ( result == TextProcessor::BeginsRightToLeftCharacter( styledText ) ); + + if( !ret ) + { + tet_printf( "Fail. %s", location ); + tet_printf( "Input : %s", input.c_str() ); + } + + return ret; +} + +////////////////////////////////////////////////////////////////// + +struct ContainsRightToLeftCharacterTest +{ + std::string description; + std::string input; + bool result; +}; + +bool TestContainsRightToLeftCharacter( const std::string& description, const std::string& input, const bool result, const char* location ) +{ + // Creates a styled text with the markup or plain string. + MarkupProcessor::StyledTextArray styledText; + MarkupProcessor::GetStyledTextArray( input, styledText, true ); + + const bool ret = ( result == TextProcessor::ContainsRightToLeftCharacter( styledText ) ); + + if( !ret ) + { + tet_printf( "Fail. %s", location ); + tet_printf( "Input : %s", input.c_str() ); + } + + return ret; +} + +////////////////////////////////////////////////////////////////// + +struct FindNearestWordTest +{ + std::string description; + std::string input; + std::size_t offset; + std::size_t start; + std::size_t end; +}; + +bool TestFindNearestWord( const std::string& description, const std::string& input, const std::size_t offset, const std::size_t startResult, const std::size_t endResult, const char* location ) +{ + // Creates a styled text with the markup or plain string. + MarkupProcessor::StyledTextArray styledText; + MarkupProcessor::GetStyledTextArray( input, styledText, true ); + + std::size_t start; + std::size_t end; + TextProcessor::FindNearestWord( styledText, offset, start, end ); + + const bool ret = ( start == startResult ) && ( end == endResult ); + + if( !ret ) + { + tet_printf( "Fail. %s", location ); + tet_printf( "Input : %s, offset %d, start %d, end %d", input.c_str(), offset, start, end ); + } + + return ret; +} + +////////////////////////////////////////////////////////////////// + +struct SplitInLinesTest +{ + std::string inputText; + + std::size_t resultNumberOfLines; +}; + +bool TestSplitInLines( const SplitInLinesTest& test, const char* location ) +{ + // Creates a styled text with the markup or plain string. + MarkupProcessor::StyledTextArray styledText; + MarkupProcessor::GetStyledTextArray( test.inputText, styledText, true ); + + std::vector lines; + + TextProcessor::SplitInLines( styledText, + lines ); + + if( lines.size() != test.resultNumberOfLines ) + { + tet_printf( "Fail. %s", location ); + tet_printf( "Different number of lines, result %d, expected result %d", lines.size(), test.resultNumberOfLines ); + + return false; + } + + return true; +} + +////////////////////////////////////////////////////////////////// + +struct SplitInWordsTest +{ + std::string inputText; + + std::size_t resultNumberOfWords; +}; + +bool TestSplitInWords( const SplitInWordsTest& test, const char* location ) +{ + // Creates a styled text with the markup or plain string. + MarkupProcessor::StyledTextArray styledText; + MarkupProcessor::GetStyledTextArray( test.inputText, styledText, true ); + + std::vector words; + + TextProcessor::SplitInWords( styledText, + words ); + + if( words.size() != test.resultNumberOfWords ) + { + tet_printf( "Fail. %s", location ); + tet_printf( "Different number of words, result %d, expected result %d", words.size(), test.resultNumberOfWords ); + + return false; + } + + return true; +} + +////////////////////////////////////////////////////////////////// + +} // namespace + + +int UtcDaliTextViewSplitInLines(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewSplitInLines : "); + + struct SplitInLinesTest splitInLinesTest[] = + { + { + std::string( "Hello world\nhello world." ), + 2 + }, + { + std::string( "Hello world\nhello world.\n\n" ), + 4 + } + }; + const std::size_t numberOfTests( 2 ); + + for( std::size_t index = 0; index < numberOfTests; ++index ) + { + const SplitInLinesTest& test = splitInLinesTest[index]; + + if( !TestSplitInLines( test, TEST_LOCATION ) ) + { + tet_result( TET_FAIL ); + } + } + + tet_result( TET_PASS ); + END_TEST; +} + +int UtcDaliTextViewSplitInWords(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewSplitInWords : "); + + struct SplitInWordsTest splitInWordsTest[] = + { + { + std::string( "Hello world, hello word!" ), + 7 + }, + }; + const std::size_t numberOfTests( 1 ); + + for( std::size_t index = 0; index < numberOfTests; ++index ) + { + const SplitInWordsTest& test = splitInWordsTest[index]; + + if( !TestSplitInWords( test, TEST_LOCATION ) ) + { + tet_result( TET_FAIL ); + } + } + + tet_result( TET_PASS ); + END_TEST; +} + +int UtcDaliTextViewBeginsRightToLeftCharacter(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewBeginsRightToLeftCharacter : "); + + struct BeginsRightToLeftCharacterTest beginsRightToLeftCharacterTest[] = + { + { + std::string( "Test if it begins with a right to left character. Should return false." ), + std::string( "Hello world مرحبا العالم." ), + false + }, + { + std::string( "Test if it begins with a right to left character. Should return true." ), + std::string( "مرحبا العالم Hola mundo." ), + true + } + }; + const std::size_t numberOfTests( 2 ); + + for( std::size_t index = 0; index < numberOfTests; ++index ) + { + const BeginsRightToLeftCharacterTest& test = beginsRightToLeftCharacterTest[index]; + + if( !TestBeginsRightToLeftCharacter( test.description, test.input, test.result, TEST_LOCATION ) ) + { + tet_result( TET_FAIL ); + } + } + + tet_result( TET_PASS ); + END_TEST; +} + +int UtcDaliTextViewContainsRightToLeftCharacter(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewContainsRightToLeftCharacter : "); + + struct ContainsRightToLeftCharacterTest containsRightToLeftCharacterTest[] = + { + { + std::string( "Test if it contains a right to left character. Should return true." ), + std::string( "Hello world مرحبا العالم." ), + true + }, + { + std::string( "Test if it contains a right to left character. Should return true." ), + std::string( "مرحبا العالم Hola mundo." ), + true + }, + { + std::string( "Test if it contains a right to left character. Should return false." ), + std::string( "Hello world." ), + false + }, + { + std::string( "Test if it contains a right to left character. Should return true." ), + std::string( "مرحبا العالم." ), + true + } + }; + const std::size_t numberOfTests( 4 ); + + for( std::size_t index = 0; index < numberOfTests; ++index ) + { + const ContainsRightToLeftCharacterTest& test = containsRightToLeftCharacterTest[index]; + + if( !TestContainsRightToLeftCharacter( test.description, test.input, test.result, TEST_LOCATION ) ) + { + tet_result( TET_FAIL ); + } + } + + tet_result( TET_PASS ); + END_TEST; +} + +int UtcDaliTextViewFindNearestWord(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewFindNearestWord : "); + + struct FindNearestWordTest findNearestWordTest[] = + { + { + std::string( "" ), + std::string( "Hello world, hola mundo" ), + 0u, + 0u, + 5u + }, + { + std::string( "" ), + std::string( "Hello world, hola mundo" ), + 7u, + 6u, + 12u + }, + { + std::string( "" ), + std::string( "Hello world, hola mundo" ), + 11u, + 6u, + 12u + }, + { + std::string( "" ), + std::string( "Hello world, hola mundo" ), + 23u, + 18u, + 23u + }, + { + std::string( "" ), + std::string( "Hello world, hola mundo" ), + 5u, + 0u, + 5u + }, + { + std::string( "" ), + std::string( "Hello world, hola mundo مرحبا العالم" ), + 24u, + 25u, + 30u + } + }; + + const std::size_t numberOfTests( 6 ); + + for( std::size_t index = 0; index < numberOfTests; ++index ) + { + const FindNearestWordTest& test = findNearestWordTest[index]; + + if( !TestFindNearestWord( test.description, test.input, test.offset, test.start, test.end, TEST_LOCATION ) ) + { + tet_result( TET_FAIL ); + } + } + + tet_result( TET_PASS ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextView-Relayout-Utilities.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextView-Relayout-Utilities.cpp new file mode 100644 index 0000000..be24681 --- /dev/null +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextView-Relayout-Utilities.cpp @@ -0,0 +1,832 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 + +#include +#include +#include + +// Internal headers are allowed here +#include +#include + +using namespace Dali; +using namespace Dali::Toolkit; +using namespace Dali::Toolkit::Internal; + +void dali_text_view_relayout_utils_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void dali_text_view_relayout_utils_cleanup(void) +{ + test_return_value = TET_PASS; +} + +namespace +{ + +const Toolkit::Internal::TextView::LayoutParameters DEFAULT_LAYOUT_PARAMETERS; + +// Data structures used to create an 'experiment' in TET cases + + +bool TestEqual( float x, float y ) +{ + return ( fabsf( x - y ) < Math::MACHINE_EPSILON_1000 ); +} + +////////////////////////////////////////////////////////////////// + +struct CalculateSubLineLayoutTest +{ + std::string description; + std::string inputLine; + float parentWidth; + std::size_t groupIndex; + std::size_t wordIndex; + std::size_t characterIndex; + TextViewRelayout::HorizontalWrapType splitPolicy; + float shrinkFactor; + + float resultLineLength; + float resultMaxCharHeight; + float resultMaxAscender; +}; + +bool TestCalculateSubLineLayout( const CalculateSubLineLayoutTest& test, const char* location ) +{ + tet_printf( "%s", test.description.c_str() ); + + // Create styled text. + MarkupProcessor::StyledTextArray inputStyledText; + MarkupProcessor::GetStyledTextArray( test.inputLine, inputStyledText, true ); + + // Create styled text layout info. + Toolkit::Internal::TextView::RelayoutData relayoutData; + TextViewProcessor::CreateTextInfo( inputStyledText, + DEFAULT_LAYOUT_PARAMETERS, + relayoutData ); + + // Prepare input parameters and the result structure and call the function to be tested. + + // Creaqte indices. + TextViewProcessor::TextInfoIndices indices( 0, test.groupIndex, test.wordIndex, test.characterIndex ); + + // Get the input line. + TextViewProcessor::LineLayoutInfo inputLineLayout; + + if( !relayoutData.mTextLayoutInfo.mLinesLayoutInfo.empty() ) + { + inputLineLayout = *relayoutData.mTextLayoutInfo.mLinesLayoutInfo.begin(); + } + + // Result struct. + TextViewRelayout::SubLineLayoutInfo resultLayoutInfo; + + CalculateSubLineLayout( test.parentWidth, + indices, + inputLineLayout, + test.splitPolicy, + test.shrinkFactor, + resultLayoutInfo ); + + // Check results. + if( !TestEqual( test.resultLineLength, resultLayoutInfo.mLineLength ) ) + { + tet_printf( "Fail. different line length %f == %f. %s", test.resultLineLength, resultLayoutInfo.mLineLength, location ); + return false; + } + + if( !TestEqual( test.resultMaxCharHeight, resultLayoutInfo.mMaxCharHeight ) ) + { + tet_printf( "Fail. different max character height %f == %f. %s", test.resultMaxCharHeight, resultLayoutInfo.mMaxCharHeight, location ); + return false; + } + + if( !TestEqual( test.resultMaxAscender, resultLayoutInfo.mMaxAscender ) ) + { + tet_printf( "Fail. different max ascender %f == %f. %s", test.resultMaxAscender, resultLayoutInfo.mMaxAscender, location ); + return false; + } + + return true; +} + +////////////////////////////////////////////////////////////////// + +struct AlignmentOffsetTest +{ + Toolkit::Alignment::Type alignment; + float parentSize; + float wholeTextSize; + + float resultOffset; +}; + +bool TestAlignmentOffset( const AlignmentOffsetTest& test, const char* location ) +{ + float offset = 0.f; + + switch( test.alignment ) + { + case Toolkit::Alignment::HorizontalLeft: + case Toolkit::Alignment::HorizontalCenter: + case Toolkit::Alignment::HorizontalRight: + { + offset = TextViewRelayout::CalculateXoffset( test.alignment, test.parentSize, test.wholeTextSize ); + break; + } + case Toolkit::Alignment::VerticalTop: + case Toolkit::Alignment::VerticalCenter: + case Toolkit::Alignment::VerticalBottom: + { + offset = TextViewRelayout::CalculateYoffset( test.alignment, test.parentSize, test.wholeTextSize ); + break; + } + } + + // Check results. + if( !TestEqual( test.resultOffset, offset ) ) + { + tet_printf( "Fail. different offset %f == %f. %s", test.resultOffset, offset, location ); + return false; + } + + return true; +} + +////////////////////////////////////////////////////////////////// + +struct JustificationOffsetTest +{ + Toolkit::TextView::LineJustification justification; + float wholeTextWidth; + float lineLength; + + float resultOffset; +}; + +bool TestJustificationOffset( const JustificationOffsetTest& test, const char* location ) +{ + float offset = TextViewRelayout::CalculateJustificationOffset( test.justification, test.wholeTextWidth, test.lineLength ); + + // Check results. + if( !TestEqual( test.resultOffset, offset ) ) + { + tet_printf( "Fail. different offset %f == %f. %s", test.resultOffset, offset, location ); + return false; + } + + return true; +} + +////////////////////////////////////////////////////////////////// + +struct CalculateVisibilityTest +{ + Vector3 position; + Size size; + Size parentSize; + TextViewRelayout::VisibilityTestType type; + + bool resultVisible; +}; + +bool TestCalculateVisibility( const CalculateVisibilityTest& test, const char* location ) +{ + if( test.resultVisible != TextViewRelayout::IsVisible( test.position, test.size, test.parentSize, test.type ) ) + { + tet_printf( "Fail. different visibility. Type %d, %s", test.type, location ); + return false; + } + + return true; +} + +////////////////////////////////////////////////////////////////// + +} // namespace + + +int UtcDaliTextViewDefaultConstructorDestructor_RU(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewDefaultConstructorDestructor : "); + + // Test RelayoutParameters defaults. + TextViewRelayout::RelayoutParameters relayoutParameters; + + DALI_TEST_EQUALS( relayoutParameters.mPositionOffset, Vector3::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( relayoutParameters.mLineSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( relayoutParameters.mWordSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( relayoutParameters.mCharacterSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( relayoutParameters.mIndices.mLineIndex, 0u, TEST_LOCATION ); + DALI_TEST_EQUALS( relayoutParameters.mIndices.mGroupIndex, 0u, TEST_LOCATION ); + DALI_TEST_EQUALS( relayoutParameters.mIndices.mWordIndex, 0u, TEST_LOCATION ); + DALI_TEST_EQUALS( relayoutParameters.mIndices.mCharacterIndex, 0u, TEST_LOCATION ); + DALI_TEST_EQUALS( relayoutParameters.mCharacterGlobalIndex, 0u, TEST_LOCATION ); + DALI_TEST_CHECK( !relayoutParameters.mIsFirstCharacter ); + DALI_TEST_CHECK( !relayoutParameters.mIsFirstCharacterOfWord ); + DALI_TEST_CHECK( !relayoutParameters.mIsNewLine ); + DALI_TEST_CHECK( !relayoutParameters.mIsNewLineCharacter ); + DALI_TEST_CHECK( !relayoutParameters.mIsWhiteSpace ); + DALI_TEST_CHECK( !relayoutParameters.mIsVisible ); + + // Test FadeParameter defaults + TextViewRelayout::FadeParameters fadeParameters; + + DALI_TEST_EQUALS( fadeParameters.mRightFadeBoundary, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeParameters.mRightFadeThreshold, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeParameters.mRightFadeBoundaryOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeParameters.mRightFadeThresholdOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeParameters.mRightAlphaCoeficients, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeParameters.mLeftFadeBoundary, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeParameters.mLeftFadeThreshold, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeParameters.mLeftFadeBoundaryOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeParameters.mLeftFadeThresholdOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeParameters.mLeftAlphaCoeficients, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeParameters.mTopFadeBoundary, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeParameters.mTopFadeThreshold, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeParameters.mTopFadeBoundaryOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeParameters.mTopFadeThresholdOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeParameters.mTopAlphaCoeficients, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeParameters.mBottomFadeBoundary, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeParameters.mBottomFadeThreshold, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeParameters.mBottomFadeBoundaryOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeParameters.mBottomFadeThresholdOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeParameters.mBottomAlphaCoeficients, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_CHECK( !fadeParameters.mIsPartiallyVisible ); + + // Test EllipsizeParameters defaults + TextViewRelayout::EllipsizeParameters ellipsizeParameters; + + DALI_TEST_EQUALS( ellipsizeParameters.mPosition, Vector3::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( ellipsizeParameters.mLineDescender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( ellipsizeParameters.mLineWidth, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( ellipsizeParameters.mEllipsizeBoundary, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( ellipsizeParameters.mFirstIndex, 0u, TEST_LOCATION ); + DALI_TEST_EQUALS( ellipsizeParameters.mLastIndex, 0u, TEST_LOCATION ); + DALI_TEST_CHECK( !ellipsizeParameters.mEllipsizeLine ); + DALI_TEST_CHECK( !ellipsizeParameters.mIsLineWidthFullyVisible ); + DALI_TEST_CHECK( !ellipsizeParameters.mIsLineHeightFullyVisible ); + DALI_TEST_CHECK( !ellipsizeParameters.mIsNextLineFullyVisibleHeight ); + DALI_TEST_CHECK( !ellipsizeParameters.mCreateEllipsizedTextActors ); + DALI_TEST_CHECK( !ellipsizeParameters.mLineFits ); + DALI_TEST_CHECK( !ellipsizeParameters.mWordFits ); + + // Test UnderlineInfo defaults + TextViewRelayout::UnderlineInfo underlineInfo; + + DALI_TEST_EQUALS( underlineInfo.mMaxHeight, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( underlineInfo.mMaxThickness, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( underlineInfo.mPosition, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + + // Test TextUnderlineStatus defaults + TextViewRelayout::TextUnderlineStatus textUnderlineStatus; + + DALI_TEST_CHECK( textUnderlineStatus.mUnderlineInfo.empty() ); + DALI_TEST_EQUALS( textUnderlineStatus.mCharacterGlobalIndex, 0u, TEST_LOCATION ); + DALI_TEST_EQUALS( textUnderlineStatus.mLineGlobalIndex, 0u, TEST_LOCATION ); + DALI_TEST_CHECK( !textUnderlineStatus.mCurrentUnderlineStatus ); + + // Test SubLineLayoutInfo defaults + TextViewRelayout::SubLineLayoutInfo subLineLayoutInfo; + + DALI_TEST_EQUALS( subLineLayoutInfo.mLineLength, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( subLineLayoutInfo.mMaxCharHeight, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( subLineLayoutInfo.mMaxAscender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliTextViewCalculateSubLineLayout(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewCalculateSubLineLayout : "); + + struct CalculateSubLineLayoutTest calculateSubLineLayoutTest[] = + { + //WrapByCharacter + { + "The line is wraped by character. All characters have the same size.", + "Hello world", // input line + 100.f, // parent width + 0, + 0, // indices + 0, + TextViewRelayout::WrapByCharacter, // split policy + 1.f, + // results + 91.041672f, // line length. (only fits 8 characters 8x11.38) + 11.380209f, // max character height + 10.242188f // max ascender + }, + { + "The line is wraped by character. There are characters with different sizes.", + "Hello world", // input line + 100.f, // parent width + 0, + 0, // indices + 0, + TextViewRelayout::WrapByCharacter, // split policy + 1.f, + // results + 94.835075f, // line length. (only fits 8 characters 6x11.38 + 2x13.27) + 13.276911f, // max character height + 11.949220f // max ascender + }, + { + "The line is wraped by character. There are characters with different sizes. It calculates the layout for the second line.", + "Hello world hello world", // input line + 100.f, // parent width + 0, + 2, // indices. The third character of the third word starts in a new line. + 2, + TextViewRelayout::WrapByCharacter, // split policy + 1.f, + // results + 91.041672f, // line length. (only fits 8 characters 8x11.38) + 11.380209f, // max character height + 10.242188f // max ascender + }, + { + "The line is wraped by character. There are characters with different sizes. It calculates the layout for the third line.", + "Hello world hello world", // input line + 100.f, // parent width + 0, + 4, // indices. The fifth character of the fifth word starts in a new line. + 4, + TextViewRelayout::WrapByCharacter, // split policy + 1.f, + // results + 92.938377f, // line length. (only fits 8 characters 8x11.38) + 13.276911f, // max character height + 11.949220f // max ascender + }, + + //WrapByWord + { + "The line is wraped by word. All characters have the same size.", + "Hello world", // input line + 100.f, // parent width + 0, + 0, // indices. It shouldn't use the index character so 9999999 shouldn't make it crash. + 9999999, + TextViewRelayout::WrapByWord, // split policy + 1.f, + // results + 56.901047f, // line length. (only fits 5 characters 5x11.38, white space is not counted) + 11.380209f, // max character height + 10.242188f // max ascender + }, + { + "The line is wraped by word. There are characters with different sizes.", + "Hello world", // input line + 100.f, // parent width + 0, + 0, // indices. + 0, + TextViewRelayout::WrapByWord, // split policy + 1.f, + // results + 58.797747f, // line length. (only fits 5 characters 4x11.38 + 13.276911, white space is not counted) + 13.276911f, // max character height + 11.949220f // max ascender + }, + { + "The line is wraped by word. There are characters with different sizes. It calculates the layout for the second line.", + "Hello world hello world", // input line + 100.f, // parent width + 0, + 2, // indices. The third word starts in a new line. + 0, + TextViewRelayout::WrapByWord, // split policy + 1.f, + // results + 60.694449f, // line length. (only fits 5 characters 2x13.276911 + 3x11.38) + 13.276911f, // max character height + 11.949220f // max ascender + }, + { + "The line is wraped by word. The word doen't fit.", + "Hello world", // input line + 40.f, // parent width + 0, + 0, // indices. The third word starts in a new line. + 0, + TextViewRelayout::WrapByWord, // split policy + 1.f, + // results + 0.f, // line length. (The word doesn't fit) + 11.380209f, // max character height + 10.242188f // max ascender + }, + + //WrapByWordAndSplit + { + "The line is wraped by word and by character. All characters have the same size. There is not a long word.", + "Hello world hello world", // input line + 100.f, // parent width + 0, + 0, // indices. + 0, + TextViewRelayout::WrapByWordAndSplit, // split policy + 1.f, + // results + 56.901047f, // line length. (only fits 5 characters 5x11.38, white space is not counted) + 11.380209f, // max character height + 10.242188f // max ascender + }, + { + "The line is wraped by word and by character. All characters have the same size. There is a long word.", + "Helloooooooo world", // input line + 100.f, // parent width + 0, + 0, // indices. + 0, + TextViewRelayout::WrapByWordAndSplit, // split policy + 1.f, + // results + 91.041672f, // line length. (only fits 8 characters 8x11.38) + 11.380209f, // max character height + 10.242188f // max ascender + }, + { + "The line is wraped by word and by character. There are characters with different sizes. There is a long word. It calculates the layout for the second line.", + "Helloooooooo world", // input line + 100.f, // parent width + 0, + 0, // indices. + 8, + TextViewRelayout::WrapByWordAndSplit, // split policy + 1.f, + // results + 45.520836f, // line length. (only fits 8 characters 8x11.38) + 11.380209f, // max character height + 10.242188f // max ascender + }, + { + "The line is wraped by word and by character. There are characters with different sizes. There is a shrink factor.", + "Helloooooooo world", // input line + 100.f, // parent width + 0, + 0, // indices. + 8, + TextViewRelayout::WrapByWordAndSplit, // split policy + 0.7f, + // results + 95.593755f, // line length. (only fits 12 characters 8x11.38) + 7.9661463f, // max character height + 7.169531f // max ascender + }, + + //WrapByLineAndSplit + { + "The line is wraped by end of line and by character. All characters have the same size.", + "Hello world", // input line + 100.f, // parent width + 0, + 0, // indices + 0, + TextViewRelayout::WrapByLineAndSplit, // split policy + 1.f, + // results + 91.041672f, // line length. (only fits 8 characters 8x11.38) + 11.380209f, // max character height + 10.242188f // max ascender + }, + { + "The line fits in the width.", + "Hello", // input line + 100.f, // parent width + 0, + 0, // indices + 0, + TextViewRelayout::WrapByLineAndSplit, // split policy + 1.f, + // results + 56.901047f, // line length. (only fits 5 characters 5x11.38) + 11.380209f, // max character height + 10.242188f // max ascender + }, + { + "The line is wraped by end of line and by character. All characters have the same size. It calculates the layout for the second line.", + "Hello world, hello world", // input line + 100.f, // parent width + 0, + 2, // indices + 2, + TextViewRelayout::WrapByLineAndSplit, // split policy + 1.f, + // results + 91.041672f, // line length. (only fits 8 characters 8x11.38) + 11.380209f, // max character height + 10.242188f // max ascender + }, + }; + const std::size_t numberOfTests( 15 ); + + for( std::size_t index = 0; index < numberOfTests; ++index ) + { + const CalculateSubLineLayoutTest& test = calculateSubLineLayoutTest[index]; + + if( !TestCalculateSubLineLayout( test, TEST_LOCATION ) ) + { + tet_result( TET_FAIL ); + } + } + + tet_result( TET_PASS ); + END_TEST; +} + +int UtcDaliTextViewCalculateAlignmentOffsets(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewCalculateAlignmentOffsets : "); + + struct AlignmentOffsetTest alignmentOffsetTest[] = + { + { + Toolkit::Alignment::HorizontalLeft, + 100.f, + 75.f, + 0.f + }, + { + Toolkit::Alignment::HorizontalCenter, + 100.f, + 75.f, + 12.5f + }, + { + Toolkit::Alignment::HorizontalRight, + 100.f, + 75.f, + 25.f + }, + { + Toolkit::Alignment::VerticalTop, + 100.f, + 75.f, + 0.f + }, + { + Toolkit::Alignment::VerticalCenter, + 100.f, + 75.f, + 12.5f + }, + { + Toolkit::Alignment::VerticalBottom, + 100.f, + 75.f, + 25.f + } + }; + const std::size_t numberOfTests( 6 ); + + for( std::size_t index = 0; index < numberOfTests; ++index ) + { + const AlignmentOffsetTest& test = alignmentOffsetTest[index]; + + if( !TestAlignmentOffset( test, TEST_LOCATION ) ) + { + tet_result( TET_FAIL ); + } + } + + tet_result( TET_PASS ); + END_TEST; +} + +int UtcDaliTextViewCalculateJustificationOffsets(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewCalculateJustificationOffsets : "); + + struct JustificationOffsetTest justificationOffsetTest[] = + { + { + Toolkit::TextView::Left, + 100.f, + 75.f, + 0.f + }, + { + Toolkit::TextView::Justified, + 100.f, + 75.f, + 0.f + }, + { + Toolkit::TextView::Center, + 100.f, + 150.f, + -25.f + }, + { + Toolkit::TextView::Right, + 100.f, + 75.f, + 25.f + }, + }; + const std::size_t numberOfTests( 4 ); + + for( std::size_t index = 0; index < numberOfTests; ++index ) + { + const JustificationOffsetTest& test = justificationOffsetTest[index]; + + if( !TestJustificationOffset( test, TEST_LOCATION ) ) + { + tet_result( TET_FAIL ); + } + } + + tet_result( TET_PASS ); + END_TEST; +} + + +int UtcDaliTextViewCalculateVisibility(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewCalculateVisibility : "); + + struct CalculateVisibilityTest calculateVisibilityTest[] = + { + { + Vector3( 0.f, 10.f, 0.f ), + Size( 10.f, 10.f ), + Size( 100.f, 100.f ), + TextViewRelayout::FULLY_VISIBLE, + true + }, + { + Vector3( 10.f, 10.f, 0.f ), + Size( 10.f, 10.f ), + Size( 100.f, 100.f ), + TextViewRelayout::FULLY_VISIBLE, + true + }, + { + Vector3( 0.f, 10.f, 0.f ), + Size( 150.f, 10.f ), + Size( 100.f, 100.f ), + TextViewRelayout::FULLY_VISIBLE, + false + }, + { + Vector3( 0.f, 10.f, 0.f ), + Size( 10.f, 10.f ), + Size( 100.f, 100.f ), + TextViewRelayout::FULLY_VISIBLE_WIDTH, + true + }, + { + Vector3( 95.f, 10.f, 0.f ), + Size( 10.f, 10.f ), + Size( 100.f, 100.f ), + TextViewRelayout::FULLY_VISIBLE_WIDTH, + false + }, + { + Vector3( 0.f, 10.f, 0.f ), + Size( 10.f, 10.f ), + Size( 100.f, 100.f ), + TextViewRelayout::FULLY_VISIBLE_HEIGHT, + true + }, + { + Vector3( 0.f, 0.f, 0.f ), + Size( 10.f, 10.f ), + Size( 100.f, 100.f ), + TextViewRelayout::FULLY_VISIBLE_HEIGHT, + false + }, + { + Vector3( -10.f, 10.f, 0.f ), + Size( 150.f, 150.f ), + Size( 100.f, 100.f ), + TextViewRelayout::PARTIALLY_VISIBLE, + true + }, + { + Vector3( -100.f, -100.f, 0.f ), + Size( 10.f, 10.f ), + Size( 100.f, 100.f ), + TextViewRelayout::PARTIALLY_VISIBLE, + false + }, + { + Vector3( -10.f, 10.f, 0.f ), + Size( 50.f, 10.f ), + Size( 100.f, 100.f ), + TextViewRelayout::PARTIALLY_VISIBLE_WIDTH, + true + }, + { + Vector3( 110.f, 10.f, 0.f ), + Size( 10.f, 10.f ), + Size( 100.f, 100.f ), + TextViewRelayout::PARTIALLY_VISIBLE_WIDTH, + false + }, + { + Vector3( 0.f, 20.f, 0.f ), + Size( 10.f, 50.f ), + Size( 100.f, 100.f ), + TextViewRelayout::PARTIALLY_VISIBLE_HEIGHT, + true + }, + { + Vector3( 0.f, -10.f, 0.f ), + Size( 10.f, 10.f ), + Size( 100.f, 100.f ), + TextViewRelayout::PARTIALLY_VISIBLE_HEIGHT, + false + }, + }; + const std::size_t numberOfTests( 13 ); + + for( std::size_t index = 0; index < numberOfTests; ++index ) + { + const CalculateVisibilityTest& test = calculateVisibilityTest[index]; + + if( !TestCalculateVisibility( test, TEST_LOCATION ) ) + { + tet_result( TET_FAIL ); + } + } + + tet_result( TET_PASS ); + END_TEST; +} + +int UtcDaliTextViewMiscelaneousAsserts(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewMiscelaneousAsserts : "); + + float offset = 0.f; + + bool assert1 = false; + bool assert2 = false; + try + { + offset = Toolkit::Internal::TextViewRelayout::CalculateXoffset( Toolkit::Alignment::VerticalTop, 100.f, 50.f ); + } + catch( Dali::DaliException& e ) + { + tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() ); + DALI_TEST_EQUALS( e.mCondition, "!\"TextViewRelayout::CalculateXoffset: Wrong horizontal text alignment. Did you set a vertical one?\"", TEST_LOCATION ); + assert1 = true; + } + catch( ... ) + { + tet_result( TET_FAIL ); + } + DALI_TEST_EQUALS( offset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + + try + { + offset = Toolkit::Internal::TextViewRelayout::CalculateYoffset( Toolkit::Alignment::HorizontalRight, 100.f, 50.f ); + } + catch( Dali::DaliException& e ) + { + tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() ); + DALI_TEST_EQUALS( e.mCondition, "!\"TextViewRelayout::CalculateXoffset: Wrong vertical text alignment. Did you set an horizontal one?\"", TEST_LOCATION ); + assert2 = true; + } + catch( ... ) + { + tet_result( TET_FAIL ); + } + DALI_TEST_EQUALS( offset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + + DALI_TEST_CHECK( assert1 && assert2 ); + + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextView.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextView.cpp new file mode 100644 index 0000000..7d60f19 --- /dev/null +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextView.cpp @@ -0,0 +1,2909 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + + +// Internal headers are allowed here +#include +#include +#include +#include +#include + +using namespace Dali; +using namespace Dali::Toolkit; +using namespace Dali::Toolkit::Internal; + +void dali_text_view_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void dali_text_view_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +namespace +{ + +const Toolkit::Internal::TextView::LayoutParameters DEFAULT_LAYOUT_PARAMETERS; +const Toolkit::Internal::TextView::VisualParameters DEFAULT_VISUAL_PARAMETERS; + +// Data structures used to create an 'experiment' in TET cases + +struct SplitWordTest +{ + std::string description; + std::string input; + std::size_t position; + std::string firstResult; + std::string lastResult; +}; + +struct SplitWordGroupTest +{ + std::string description; + std::string input; + std::size_t wordPosition; + std::size_t position; + std::string firstResult; + std::string lastResult; +}; + +struct SplitLineTest +{ + std::string description; + std::string input; + std::size_t groupPosition; + std::size_t wordPosition; + std::size_t position; + float lineHeightOffset; + std::string firstResult; + std::string lastResult; +}; + +struct MergeWordsTest +{ + std::string description; + std::string inputFirst; + std::string inputLast; + std::string result; +}; + +struct MergeWordGroupsTest +{ + std::string description; + std::string inputFirst; + std::string inputLast; + std::string result; +}; + +struct MergeLinesTest +{ + std::string description; + std::string inputFirst; + std::string inputLast; + float lineHeightOffset; + std::string result; +}; + +struct RemoveCharactersFromWordTest +{ + std::string description; + std::string input; + std::size_t position; + std::size_t numberOfCharacters; + std::string result; +}; + +struct RemoveWordsFromGroupTest +{ + std::string description; + std::string input; + std::size_t wordIndex; + std::size_t numberOfWords; + std::string result; +}; + +struct RemoveGroupsFromLineTest +{ + std::string description; + std::string input; + std::size_t groupIndex; + std::size_t numberOfGroups; + float lineHeightOffset; + std::string result; +}; + +enum UpdateTextInfoOperation +{ + Insert, + Remove, + Replace +}; + +struct UpdateTextInfoTest +{ + std::string description; + UpdateTextInfoOperation operation; + std::string input; + std::size_t position; + std::size_t numberOfCharacters; + std::string inputText; + float lineHeightOffset; + std::string result; +}; + +// Useful Print functions when something goes wrong. + +void Print( const TextViewProcessor::CharacterLayoutInfo& character ) +{ + std::cout << " height : " << character.mHeight << std::endl; + std::cout << " advance : " << character.mAdvance << std::endl; + std::cout << " bearing : " << character.mBearing << std::endl; + std::cout << " mPosition : " << character.mPosition << std::endl; + std::cout << " mSize : " << character.mSize << std::endl; + std::cout << " mAscender : " << character.mAscender << std::endl; + + TextActor textActor = TextActor::DownCast( character.mGlyphActor ); + if( textActor ) + { + std::cout << "[" << textActor.GetText() << "]"; + } + else + { + std::cout << "{" << character.mStyledText.mText.GetText() << "}"; + } +} + +void Print( const TextViewProcessor::WordLayoutInfo& word ) +{ + std::cout << "["; + std::cout << " mSize : " << word.mSize << std::endl; + std::cout << " mAscender : " << word.mAscender << std::endl; + std::cout << " mType : " << word.mType << std::endl; + std::cout << "mNumberOfCharacters : " << word.mCharactersLayoutInfo.size() << std::endl; + std::cout << "["; + for( TextViewProcessor::CharacterLayoutInfoContainer::const_iterator it = word.mCharactersLayoutInfo.begin(), endIt = word.mCharactersLayoutInfo.end(); it != endIt; ++it ) + { + Print( *it ); + } + std::cout << "]"; std::cout << std::endl; + std::cout << "]"; std::cout << std::endl; +} + +void Print( const TextViewProcessor::WordGroupLayoutInfo& wordGroup ) +{ + std::cout << "("; + std::cout << " mSize : " << wordGroup.mSize << std::endl; + std::cout << " mAscender : " << wordGroup.mAscender << std::endl; + std::cout << " mDirection : " << wordGroup.mDirection << std::endl; + std::cout << "mNumberOfCharacters : " << wordGroup.mNumberOfCharacters << std::endl; + for( TextViewProcessor::WordLayoutInfoContainer::const_iterator it = wordGroup.mWordsLayoutInfo.begin(), endIt = wordGroup.mWordsLayoutInfo.end(); it != endIt; ++it ) + { + Print( *it ); + } + std::cout << ")"; std::cout << std::endl; +} + +void Print( const TextViewProcessor::LineLayoutInfo& line ) +{ + std::cout << "<"; + std::cout << " mSize : " << line.mSize << std::endl; + std::cout << " mAscender : " << line.mAscender << std::endl; + std::cout << "mNumberOfCharacters : " << line.mNumberOfCharacters << std::endl; + for( TextViewProcessor::WordGroupLayoutInfoContainer::const_iterator it = line.mWordGroupsLayoutInfo.begin(), endIt = line.mWordGroupsLayoutInfo.end(); it != endIt; ++it ) + { + Print( *it ); + } + std::cout << ">" << std::endl; +} + +void Print( const TextViewProcessor::TextLayoutInfo& text ) +{ + std::cout << "||"; + for( TextViewProcessor::LineLayoutInfoContainer::const_iterator it = text.mLinesLayoutInfo.begin(), endIt = text.mLinesLayoutInfo.end(); it != endIt; ++it ) + { + Print( *it ); + } + std::cout << "||" << std::endl; +} + +void Print( const TextStyle& style ) +{ + std::cout << " font name : " << style.GetFontName() << std::endl; + std::cout << " : " << style.GetFontStyle() << std::endl; + std::cout << " : " << style.GetFontPointSize() << std::endl; + std::cout << " : " << style.GetWeight() << std::endl; + std::cout << " : " << style.GetTextColor() << std::endl; + std::cout << " : " << style.GetItalics() << std::endl; + std::cout << " : " << style.GetUnderline() << std::endl; + std::cout << " : " << style.GetShadow() << std::endl; + std::cout << " : " << style.GetShadowColor() << std::endl; + std::cout << " : " << style.GetShadowOffset() << std::endl; + std::cout << " : " << style.GetGlow() << std::endl; + std::cout << " : " << style.GetGlowColor() << std::endl; + std::cout << " : " << style.GetGlowIntensity() << std::endl; + std::cout << " : " << style.GetSmoothEdge() << std::endl; + std::cout << " : " << style.GetOutline() << std::endl; + std::cout << " : " << style.GetOutlineThickness() << std::endl; +} + +// Test functions used to check if two data structures are equal. + +bool TestEqual( float x, float y ) +{ + return ( fabsf( x - y ) < Math::MACHINE_EPSILON_1000 ); +} + +bool TestEqual( const TextViewProcessor::CharacterLayoutInfo& character1, + const TextViewProcessor::CharacterLayoutInfo& character2 ) +{ + if( !TestEqual( character1.mHeight, character2.mHeight ) ) + { + return false; + } + if( !TestEqual( character1.mAdvance, character2.mAdvance ) ) + { + return false; + } + if( !TestEqual( character1.mBearing, character2.mBearing ) ) + { + return false; + } + + if( !TestEqual( character1.mPosition.x, character2.mPosition.x ) ) + { + return false; + } + if( !TestEqual( character1.mPosition.y, character2.mPosition.y ) ) + { + return false; + } + + if( !TestEqual( character1.mSize.x, character2.mSize.x ) ) + { + return false; + } + if( !TestEqual( character1.mSize.y, character2.mSize.y ) ) + { + return false; + } + + if( !TestEqual( character1.mAscender, character2.mAscender ) ) + { + return false; + } + + if( character1.mGlyphActor && !character2.mGlyphActor ) + { + return false; + } + + if( !character1.mGlyphActor && character2.mGlyphActor ) + { + return false; + } + + std::string text1; + std::string text2; + TextStyle style1; + TextStyle style2; + + TextActor textActor1 = TextActor::DownCast( character1.mGlyphActor ); + TextActor textActor2 = TextActor::DownCast( character2.mGlyphActor ); + if( textActor1 ) + { + text1 = textActor1.GetText(); + style1 = textActor1.GetTextStyle(); + + text2 = textActor2.GetText(); + style2 = textActor2.GetTextStyle(); + } + + if( text1 != text2 ) + { + return false; + } + + if( style1 != style2 ) + { + return false; + } + + text1 = character1.mStyledText.mText.GetText(); + style1 = character1.mStyledText.mStyle; + + text2 = character2.mStyledText.mText.GetText(); + style2 = character2.mStyledText.mStyle; + + if( text1 != text2 ) + { + return false; + } + + if( style1 != style2 ) + { + return false; + } + + return true; +} + +bool TestEqual( const TextViewProcessor::WordLayoutInfo& word1, + const TextViewProcessor::WordLayoutInfo& word2 ) +{ + if( !TestEqual( word1.mSize.x, word2.mSize.x ) ) + { + return false; + } + if( !TestEqual( word1.mSize.y, word2.mSize.y ) ) + { + return false; + } + + if( !TestEqual( word1.mAscender, word2.mAscender ) ) + { + return false; + } + + if( word1.mType != word2.mType ) + { + return false; + } + + if( word1.mCharactersLayoutInfo.size() != word2.mCharactersLayoutInfo.size() ) + { + return false; + } + + for( TextViewProcessor::CharacterLayoutInfoContainer::const_iterator it1 = word1.mCharactersLayoutInfo.begin(), endIt1 = word1.mCharactersLayoutInfo.end(), + it2 = word2.mCharactersLayoutInfo.begin(), endIt2 = word2.mCharactersLayoutInfo.end(); + ( it1 != endIt1 ) && ( it2 != endIt2 ); + ++it1, ++it2 ) + { + if( !TestEqual( *it1, *it2 ) ) + { + return false; + } + } + + return true; +} + +bool TestEqual( const TextViewProcessor::WordGroupLayoutInfo& group1, + const TextViewProcessor::WordGroupLayoutInfo& group2 ) +{ + + if( group1.mNumberOfCharacters != group2.mNumberOfCharacters ) + { + return false; + } + + if( group1.mWordsLayoutInfo.size() != group2.mWordsLayoutInfo.size() ) + { + return false; + } + + if( !TestEqual( group1.mSize.x, group2.mSize.x ) ) + { + return false; + } + if( !TestEqual( group1.mSize.y, group2.mSize.y ) ) + { + return false; + } + + if( !TestEqual( group1.mAscender, group2.mAscender ) ) + { + return false; + } + + if( group1.mDirection != group2.mDirection ) + { + return false; + } + + for( TextViewProcessor::WordLayoutInfoContainer::const_iterator it1 = group1.mWordsLayoutInfo.begin(), endIt1 = group1.mWordsLayoutInfo.end(), + it2 = group2.mWordsLayoutInfo.begin(), endIt2 = group2.mWordsLayoutInfo.end(); + ( it1 != endIt1 ) && ( it2 != endIt2 ); + ++it1, ++it2 ) + { + if( !TestEqual( *it1, *it2 ) ) + { + return false; + } + } + + return true; +} + +bool TestEqual( const TextViewProcessor::LineLayoutInfo& line1, + const TextViewProcessor::LineLayoutInfo& line2 ) +{ + if( !TestEqual( line1.mSize.x, line2.mSize.x ) ) + { + return false; + } + if( !TestEqual( line1.mSize.y, line2.mSize.y ) ) + { + return false; + } + + if( !TestEqual( line1.mAscender, line2.mAscender ) ) + { + return false; + } + + if( line1.mNumberOfCharacters != line2.mNumberOfCharacters ) + { + return false; + } + + if( line1.mWordGroupsLayoutInfo.size() != line2.mWordGroupsLayoutInfo.size() ) + { + return false; + } + + for( TextViewProcessor::WordGroupLayoutInfoContainer::const_iterator it1 = line1.mWordGroupsLayoutInfo.begin(), endIt1 = line1.mWordGroupsLayoutInfo.end(), + it2 = line2.mWordGroupsLayoutInfo.begin(), endIt2 = line2.mWordGroupsLayoutInfo.end(); + ( it1 != endIt1 ) && ( it2 != endIt2 ); + ++it1, ++it2 ) + { + if( !TestEqual( *it1, *it2 ) ) + { + return false; + } + } + + return true; +} + +bool TestEqual( const TextViewProcessor::TextLayoutInfo& text1, + const TextViewProcessor::TextLayoutInfo& text2 ) +{ + if( !TestEqual( text1.mWholeTextSize.x, text2.mWholeTextSize.x ) ) + { + return false; + } + if( !TestEqual( text1.mWholeTextSize.y, text2.mWholeTextSize.y ) ) + { + return false; + } + + if( !TestEqual( text1.mMaxWordWidth, text2.mMaxWordWidth ) ) + { + return false; + } + + if( text1.mNumberOfCharacters != text2.mNumberOfCharacters ) + { + return false; + } + + if( text1.mLinesLayoutInfo.size() != text2.mLinesLayoutInfo.size() ) + { + return false; + } + + for( TextViewProcessor::LineLayoutInfoContainer::const_iterator it1 = text1.mLinesLayoutInfo.begin(), endIt1 = text1.mLinesLayoutInfo.end(), + it2 = text2.mLinesLayoutInfo.begin(), endIt2 = text2.mLinesLayoutInfo.end(); + ( it1 != endIt1 ) && ( it2 != endIt2 ); + ++it1, ++it2 ) + { + if( !TestEqual( *it1, *it2 ) ) + { + return false; + } + } + + return true; +} + +/** + * Splits the \e input word in two by the given \e position and checks the results with \e firstResult and \e lastResult. + * + * If the test fails it prints a short description and the line where this function was called. + * + * @param description Short description of the experiment. i.e. "Split the word from the beginning. (position 0)". + * @param input The input word. + * @param position Where to split the word. + * @param firstResult First part of the split word. + * @param lastResult Last part of the split word. + * @param location Where this function has been called. + * + * @return \e true if the experiment is successful. Otherwise returns \e false. + */ +bool TestSplitWord( const std::string& description, const std::string& input, const size_t position, const std::string& firstResult, const std::string& lastResult, const char* location ) +{ + tet_printf( "%s", description.c_str() ); + + // Create layout info for the input word. + Toolkit::Internal::TextView::RelayoutData relayoutData; + TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray inputStyledText; + MarkupProcessor::GetStyledTextArray( input, inputStyledText, true ); + + TextViewProcessor::CreateTextInfo( inputStyledText, + DEFAULT_LAYOUT_PARAMETERS, + relayoutData ); + + // Get the input word + TextViewProcessor::WordLayoutInfo inputWordLayout; + + if( !inputLayout.mLinesLayoutInfo.empty() ) + { + const TextViewProcessor::LineLayoutInfo& line( *inputLayout.mLinesLayoutInfo.begin() ); + if( !line.mWordGroupsLayoutInfo.empty() ) + { + const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() ); + if( !group.mWordsLayoutInfo.empty() ) + { + inputWordLayout = *( *( *inputLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin(); + } + } + } + + // Create layout info for the first part of the result (after split the word) + + Toolkit::Internal::TextView::RelayoutData firstRelayoutData; + TextViewProcessor::TextLayoutInfo& firstResultLayout( firstRelayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray firstResultStyledText; + MarkupProcessor::GetStyledTextArray( firstResult, firstResultStyledText, true ); + + TextViewProcessor::CreateTextInfo( firstResultStyledText, + DEFAULT_LAYOUT_PARAMETERS, + firstRelayoutData ); + + // Get the first result word + TextViewProcessor::WordLayoutInfo firstResultWordLayout; + + if( !firstResultLayout.mLinesLayoutInfo.empty() ) + { + const TextViewProcessor::LineLayoutInfo& line( *firstResultLayout.mLinesLayoutInfo.begin() ); + if( !line.mWordGroupsLayoutInfo.empty() ) + { + const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() ); + if( !group.mWordsLayoutInfo.empty() ) + { + firstResultWordLayout = *( *( *firstResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin(); + } + } + } + + // Create layout info for the last part of the result (after split the word) + + Toolkit::Internal::TextView::RelayoutData lastRelayoutData; + TextViewProcessor::TextLayoutInfo& lastResultLayout( lastRelayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray lastResultStyledText; + MarkupProcessor::GetStyledTextArray( lastResult, lastResultStyledText, true ); + + TextViewProcessor::CreateTextInfo( lastResultStyledText, + DEFAULT_LAYOUT_PARAMETERS, + lastRelayoutData ); + + // Get the last result word + TextViewProcessor::WordLayoutInfo lastResultWordLayout; + + if( !lastResultLayout.mLinesLayoutInfo.empty() ) + { + const TextViewProcessor::LineLayoutInfo& line( *lastResultLayout.mLinesLayoutInfo.begin() ); + if( !line.mWordGroupsLayoutInfo.empty() ) + { + const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() ); + if( !group.mWordsLayoutInfo.empty() ) + { + lastResultWordLayout = *( *( *lastResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin(); + } + } + } + + // Split the word. + + TextViewProcessor::WordLayoutInfo lastWordLayoutInfo; + + SplitWord( position, + inputWordLayout, + lastWordLayoutInfo ); + + // Test results + if( !TestEqual( inputWordLayout, firstResultWordLayout ) ) + { + tet_printf( "Fail. different layout info. %s", location ); + return false; + } + + if( !TestEqual( lastWordLayoutInfo, lastResultWordLayout ) ) + { + tet_printf( "Fail. different layout info. %s", location ); + return false; + } + + return true; +} + +/** + * Splits the \e input group of words in two by the given \e wordPosition and \e position and checks the results with \e firstResult and \e lastResult. + * + * If the test fails it prints a short description and the line where this function was called. + * + * @param description Short description of the experiment. i.e. "Split the group of words from the beginning. (wordPosition 0 and position 0)". + * @param input The input word. + * @param wordPosition Index to the word within the group where to split the group. + * @param position Where to split the word. + * @param firstResult First part of the split group of words. + * @param lastResult Last part of the split group of words. + * @param location Where this function has been called. + * + * @return \e true if the experiment is successful. Otherwise returns \e false. + */ +bool TestSplitWordGroup( const std::string& description, + const std::string& input, + const size_t wordPosition, + const size_t position, + const std::string& firstResult, + const std::string& lastResult, + const char* location ) +{ + tet_printf( "%s", description.c_str() ); + + // Create layout info for the input group of words. + Toolkit::Internal::TextView::RelayoutData relayoutData; + TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray inputStyledText; + MarkupProcessor::GetStyledTextArray( input, inputStyledText, true ); + + TextViewProcessor::CreateTextInfo( inputStyledText, + DEFAULT_LAYOUT_PARAMETERS, + relayoutData ); + + // Get the input group of words + TextViewProcessor::WordGroupLayoutInfo inputWordGroupLayout; + + if( !inputLayout.mLinesLayoutInfo.empty() ) + { + const TextViewProcessor::LineLayoutInfo& line( *inputLayout.mLinesLayoutInfo.begin() ); + if( !line.mWordGroupsLayoutInfo.empty() ) + { + inputWordGroupLayout = *( *inputLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin(); + } + } + + // Create layout info for the first part of the result (after split the group of words) + + Toolkit::Internal::TextView::RelayoutData firstRelayoutData; + TextViewProcessor::TextLayoutInfo& firstResultLayout( firstRelayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray firstResultStyledText; + MarkupProcessor::GetStyledTextArray( firstResult, firstResultStyledText, true ); + + TextViewProcessor::CreateTextInfo( firstResultStyledText, + DEFAULT_LAYOUT_PARAMETERS, + firstRelayoutData ); + + // Get the first result group of words + TextViewProcessor::WordGroupLayoutInfo firstResultWordGroupLayout; + + if( !firstResultLayout.mLinesLayoutInfo.empty() ) + { + const TextViewProcessor::LineLayoutInfo& line( *firstResultLayout.mLinesLayoutInfo.begin() ); + if( !line.mWordGroupsLayoutInfo.empty() ) + { + firstResultWordGroupLayout = *( *firstResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin(); + } + } + + // Create layout info for the last part of the result (after split the group of words) + + Toolkit::Internal::TextView::RelayoutData lastRelayoutData; + TextViewProcessor::TextLayoutInfo& lastResultLayout( lastRelayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray lastResultStyledText; + MarkupProcessor::GetStyledTextArray( lastResult, lastResultStyledText, true ); + + TextViewProcessor::CreateTextInfo( lastResultStyledText, + DEFAULT_LAYOUT_PARAMETERS, + lastRelayoutData ); + + // Get the last result group of words + TextViewProcessor::WordGroupLayoutInfo lastResultWordGroupLayout; + + if( !lastResultLayout.mLinesLayoutInfo.empty() ) + { + const TextViewProcessor::LineLayoutInfo& line( *lastResultLayout.mLinesLayoutInfo.begin() ); + if( !line.mWordGroupsLayoutInfo.empty() ) + { + lastResultWordGroupLayout = *( *lastResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin(); + } + } + + // Split the group of words. + + TextViewProcessor::WordGroupLayoutInfo lastWordGroupLayoutInfo; + + TextViewProcessor::TextInfoIndices indices( 0, 0, wordPosition, position ); + SplitWordGroup( indices, + inputWordGroupLayout, + lastWordGroupLayoutInfo ); + + // Test results + if( !TestEqual( inputWordGroupLayout, firstResultWordGroupLayout ) ) + { + tet_printf( "Fail. different layout info. %s", location ); + return false; + } + + if( !TestEqual( lastWordGroupLayoutInfo, lastResultWordGroupLayout ) ) + { + tet_printf( "Fail. different layout info. %s", location ); + return false; + } + + return true; +} + +/** + * Splits the \e input line in two by the given \e groupPosition, \e wordPosition and \e position and checks the results with \e firstResult and \e lastResult. + * + * If the test fails it prints a short description and the line where this function was called. + * + * @param description Short description of the experiment. i.e. "Split the line from the beginning. (groupPosition 0, wordPosition 0 and position 0)". + * @param input The input word. + * @param groupPosition Index to the group of words within the line where to split the line. + * @param wordPosition Index to the word within the group where to split the group. + * @param position Where to split the word. + * @param lineHeightOffset Offset between lines. + * @param firstResult First part of the split line. + * @param lastResult Last part of the split line. + * @param location Where this function has been called. + * + * @return \e true if the experiment is successful. Otherwise returns \e false. + */ +bool TestSplitLine( const std::string& description, + const std::string& input, + const size_t groupPosition, + const size_t wordPosition, + const size_t position, + const float lineHeightOffset, + const std::string& firstResult, + const std::string& lastResult, + const char* location ) +{ + tet_printf( "%s", description.c_str() ); + + // Create layout info for the input line. + Toolkit::Internal::TextView::RelayoutData relayoutData; + TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray inputStyledText; + MarkupProcessor::GetStyledTextArray( input, inputStyledText, true ); + + TextViewProcessor::CreateTextInfo( inputStyledText, + Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar, + Toolkit::TextView::Original, + Toolkit::TextView::Original, + static_cast( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ), + Toolkit::TextView::Center, + PointSize( lineHeightOffset ), + std::string( "..." ), + true ), + relayoutData ); + + // Get the input line + TextViewProcessor::LineLayoutInfo inputLineLayout; + + if( !inputLayout.mLinesLayoutInfo.empty() ) + { + inputLineLayout = *inputLayout.mLinesLayoutInfo.begin(); + } + + // Create layout info for the first part of the result (after split the line) + + Toolkit::Internal::TextView::RelayoutData firstRelayoutData; + TextViewProcessor::TextLayoutInfo& firstResultLayout( firstRelayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray firstResultStyledText; + MarkupProcessor::GetStyledTextArray( firstResult, firstResultStyledText, true ); + + TextViewProcessor::CreateTextInfo( firstResultStyledText, + Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar, + Toolkit::TextView::Original, + Toolkit::TextView::Original, + static_cast( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ), + Toolkit::TextView::Center, + PointSize( lineHeightOffset ), + std::string( "..." ), + true ), + firstRelayoutData ); + + // Get the first result line + TextViewProcessor::LineLayoutInfo firstResultLineLayout; + + if( !firstResultLayout.mLinesLayoutInfo.empty() ) + { + firstResultLineLayout = *firstResultLayout.mLinesLayoutInfo.begin(); + } + + // Create layout info for the last part of the result (after split the line) + + Toolkit::Internal::TextView::RelayoutData lastRelayoutData; + TextViewProcessor::TextLayoutInfo& lastResultLayout( lastRelayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray lastResultStyledText; + MarkupProcessor::GetStyledTextArray( lastResult, lastResultStyledText, true ); + + TextViewProcessor::CreateTextInfo( lastResultStyledText, + Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar, + Toolkit::TextView::Original, + Toolkit::TextView::Original, + static_cast( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ), + Toolkit::TextView::Center, + PointSize( lineHeightOffset ), + std::string( "..."), + true ), + lastRelayoutData ); + + // Get the last result line + TextViewProcessor::LineLayoutInfo lastResultLineLayout; + + if( !lastResultLayout.mLinesLayoutInfo.empty() ) + { + lastResultLineLayout = *lastResultLayout.mLinesLayoutInfo.begin(); + } + + // Split the line. + + TextViewProcessor::LineLayoutInfo lastLineLayoutInfo; + + TextViewProcessor::TextInfoIndices indices( 0, groupPosition, wordPosition, position ); + SplitLine( indices, + PointSize( lineHeightOffset ), + inputLineLayout, + lastLineLayoutInfo ); + + // Test results + if( !TestEqual( inputLineLayout, firstResultLineLayout ) ) + { + tet_printf( "Fail. different layout info. %s", location ); + return false; + } + + if( !TestEqual( lastLineLayoutInfo, lastResultLineLayout ) ) + { + tet_printf( "Fail. different layout info. %s", location ); + return false; + } + + return true; +} + +/** + * Merges the \e inputFirst word and the \e inputLast word, and checks the results with \e result. + * + * If the test fails it prints a short description and the line where this function was called. + * + * @param description Short description of the experiment. i.e. "Merge two words with same style". + * @param inputFirst The first part of the word. + * @param inputLast The last part of the word. + * @param result The merged word. + * @param location Where this function has been called. + * + * @return \e true if the experiment is successful. Otherwise returns \e false. + */ +bool TestMergeWords( const std::string& description, const std::string& inputFirst, const std::string& inputLast, const std::string& result, const char* location ) +{ + tet_printf( "%s", description.c_str() ); + + // Create layout info for the inputFirst word. + Toolkit::Internal::TextView::RelayoutData firstRelayoutData; + TextViewProcessor::TextLayoutInfo& inputFirstLayout( firstRelayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray inputFirstStyledText; + MarkupProcessor::GetStyledTextArray( inputFirst, inputFirstStyledText, true ); + + TextViewProcessor::CreateTextInfo( inputFirstStyledText, + DEFAULT_LAYOUT_PARAMETERS, + firstRelayoutData ); + + // Get the input word + TextViewProcessor::WordLayoutInfo inputFirstWordLayout; + + if( !inputFirstLayout.mLinesLayoutInfo.empty() ) + { + const TextViewProcessor::LineLayoutInfo& line( *inputFirstLayout.mLinesLayoutInfo.begin() ); + if( !line.mWordGroupsLayoutInfo.empty() ) + { + const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() ); + if( !group.mWordsLayoutInfo.empty() ) + { + inputFirstWordLayout = *( *( *inputFirstLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin(); + } + } + } + + // Create layout info for the inputLast word. + Toolkit::Internal::TextView::RelayoutData lastRelayoutData; + TextViewProcessor::TextLayoutInfo& inputLastLayout( lastRelayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray inputLastStyledText; + MarkupProcessor::GetStyledTextArray( inputLast, inputLastStyledText, true ); + + TextViewProcessor::CreateTextInfo( inputLastStyledText, + DEFAULT_LAYOUT_PARAMETERS, + lastRelayoutData ); + + // Get the input word + TextViewProcessor::WordLayoutInfo inputLastWordLayout; + + if( !inputLastLayout.mLinesLayoutInfo.empty() ) + { + const TextViewProcessor::LineLayoutInfo& line( *inputLastLayout.mLinesLayoutInfo.begin() ); + if( !line.mWordGroupsLayoutInfo.empty() ) + { + const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() ); + if( !group.mWordsLayoutInfo.empty() ) + { + inputLastWordLayout = *( *( *inputLastLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin(); + } + } + } + + // Create layout info for the result word. + Toolkit::Internal::TextView::RelayoutData resultRelayoutData; + TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray resultStyledText; + MarkupProcessor::GetStyledTextArray( result, resultStyledText, true ); + + TextViewProcessor::CreateTextInfo( resultStyledText, + DEFAULT_LAYOUT_PARAMETERS, + resultRelayoutData ); + + // Get the result word + TextViewProcessor::WordLayoutInfo resultWordLayout; + + if( !resultLayout.mLinesLayoutInfo.empty() ) + { + const TextViewProcessor::LineLayoutInfo& line( *resultLayout.mLinesLayoutInfo.begin() ); + if( !line.mWordGroupsLayoutInfo.empty() ) + { + const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() ); + if( !group.mWordsLayoutInfo.empty() ) + { + resultWordLayout = *( *( *resultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin(); + } + } + } + + MergeWord( inputFirstWordLayout, + inputLastWordLayout ); + + if( !TestEqual( inputFirstWordLayout, resultWordLayout ) ) + { + tet_printf( "Fail. different layout info. %s", location ); + return false; + } + + return true; +} + +/** + * Merges the \e inputFirst group of words and the \e inputLast group of words, and checks the results with \e result. + * + * If the test fails it prints a short description and the line where this function was called. + * + * @param description Short description of the experiment. + * @param inputFirst The first part of the group of words. + * @param inputLast The last part of the group of words. + * @param result The merged group of word. + * @param location Where this function has been called. + * + * @return \e true if the experiment is successful. Otherwise returns \e false. + */ +bool TestMergeGroupsOfWords( const std::string& description, const std::string& inputFirst, const std::string& inputLast, const std::string& result, const char* location ) +{ + tet_printf( "%s", description.c_str() ); + + // Create layout info for the inputFirst group of word. + Toolkit::Internal::TextView::RelayoutData firstRelayoutData; + TextViewProcessor::TextLayoutInfo& inputFirstLayout( firstRelayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray inputFirstStyledText; + MarkupProcessor::GetStyledTextArray( inputFirst, inputFirstStyledText, true ); + + TextViewProcessor::CreateTextInfo( inputFirstStyledText, + DEFAULT_LAYOUT_PARAMETERS, + firstRelayoutData ); + + // Get the input group of words. + TextViewProcessor::WordGroupLayoutInfo inputFirstWordGroupLayout; + + if( !inputFirstLayout.mLinesLayoutInfo.empty() ) + { + const TextViewProcessor::LineLayoutInfo& line( *inputFirstLayout.mLinesLayoutInfo.begin() ); + if( !line.mWordGroupsLayoutInfo.empty() ) + { + inputFirstWordGroupLayout = *( *inputFirstLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin(); + } + } + + // Create layout info for the inputLast group of words. + Toolkit::Internal::TextView::RelayoutData lastRelayoutData; + TextViewProcessor::TextLayoutInfo& inputLastLayout( lastRelayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray inputLastStyledText; + MarkupProcessor::GetStyledTextArray( inputLast, inputLastStyledText, true ); + + TextViewProcessor::CreateTextInfo( inputLastStyledText, + DEFAULT_LAYOUT_PARAMETERS, + lastRelayoutData ); + + // Get the input group of words + TextViewProcessor::WordGroupLayoutInfo inputLastWordGroupLayout; + + if( !inputLastLayout.mLinesLayoutInfo.empty() ) + { + const TextViewProcessor::LineLayoutInfo& line( *inputLastLayout.mLinesLayoutInfo.begin() ); + if( !line.mWordGroupsLayoutInfo.empty() ) + { + inputLastWordGroupLayout = *( *inputLastLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin(); + } + } + + // Create layout info for the result group of words. + Toolkit::Internal::TextView::RelayoutData resultRelayoutData; + TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray resultStyledText; + MarkupProcessor::GetStyledTextArray( result, resultStyledText, true ); + + TextViewProcessor::CreateTextInfo( resultStyledText, + DEFAULT_LAYOUT_PARAMETERS, + resultRelayoutData ); + + // Get the result word + TextViewProcessor::WordGroupLayoutInfo resultWordGroupLayout; + + if( !resultLayout.mLinesLayoutInfo.empty() ) + { + const TextViewProcessor::LineLayoutInfo& line( *resultLayout.mLinesLayoutInfo.begin() ); + if( !line.mWordGroupsLayoutInfo.empty() ) + { + resultWordGroupLayout = *( *resultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin(); + } + } + + MergeWordGroup( inputFirstWordGroupLayout, + inputLastWordGroupLayout ); + + if( !TestEqual( inputFirstWordGroupLayout, resultWordGroupLayout ) ) + { + tet_printf( "Fail. different layout info. %s", location ); + return false; + } + + return true; +} + +/** + * Merges the \e inputFirst line and the \e inputLast line, and checks the results with \e result. + * + * If the test fails it prints a short description and the line where this function was called. + * + * @param description Short description of the experiment. + * @param inputFirst The first part of the line. + * @param inputLast The last part of the line. + * @param lineHeightOffset Offset between lines. + * @param result The merged line. + * @param location Where this function has been called. + * + * @return \e true if the experiment is successful. Otherwise returns \e false. + */ +bool TestMergeLines( const std::string& description, const std::string& inputFirst, const std::string& inputLast, const float lineHeightOffset, const std::string& result, const char* location ) +{ + tet_printf( "%s", description.c_str() ); + + // Create layout info for the inputFirst line. + Toolkit::Internal::TextView::RelayoutData firstRelayoutData; + TextViewProcessor::TextLayoutInfo& inputFirstLayout( firstRelayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray inputFirstStyledText; + MarkupProcessor::GetStyledTextArray( inputFirst, inputFirstStyledText, true ); + + TextViewProcessor::CreateTextInfo( inputFirstStyledText, + Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar, + Toolkit::TextView::Original, + Toolkit::TextView::Original, + static_cast( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ), + Toolkit::TextView::Center, + PointSize( lineHeightOffset ), + std::string( "..." ), + true ), + firstRelayoutData ); + + // Get the input word + TextViewProcessor::LineLayoutInfo inputFirstLineLayout; + + if( !inputFirstLayout.mLinesLayoutInfo.empty() ) + { + inputFirstLineLayout = *inputFirstLayout.mLinesLayoutInfo.begin(); + } + + // Create layout info for the inputLast line. + Toolkit::Internal::TextView::RelayoutData lastRelayoutData; + TextViewProcessor::TextLayoutInfo& inputLastLayout( lastRelayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray inputLastStyledText; + MarkupProcessor::GetStyledTextArray( inputLast, inputLastStyledText, true ); + + TextViewProcessor::CreateTextInfo( inputLastStyledText, + Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar, + Toolkit::TextView::Original, + Toolkit::TextView::Original, + static_cast( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ), + Toolkit::TextView::Center, + PointSize( lineHeightOffset ), + std::string( "..." ), + true ), + lastRelayoutData ); + + // Get the input word + TextViewProcessor::LineLayoutInfo inputLastLineLayout; + + if( !inputLastLayout.mLinesLayoutInfo.empty() ) + { + inputLastLineLayout = *inputLastLayout.mLinesLayoutInfo.begin(); + } + + // Create layout info for the result word. + Toolkit::Internal::TextView::RelayoutData resultRelayoutData; + TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray resultStyledText; + MarkupProcessor::GetStyledTextArray( result, resultStyledText, true ); + + TextViewProcessor::CreateTextInfo( resultStyledText, + Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar, + Toolkit::TextView::Original, + Toolkit::TextView::Original, + static_cast( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ), + Toolkit::TextView::Center, + PointSize( lineHeightOffset ), + std::string( "..." ), + true ), + resultRelayoutData ); + + // Get the result word + TextViewProcessor::LineLayoutInfo resultLineLayout; + + if( !resultLayout.mLinesLayoutInfo.empty() ) + { + resultLineLayout = *resultLayout.mLinesLayoutInfo.begin(); + } + + MergeLine( inputFirstLineLayout, + inputLastLineLayout ); + + if( !TestEqual( inputFirstLineLayout, resultLineLayout ) ) + { + tet_printf( "Fail. different layout info. %s", location ); + return false; + } + + return true; +} + +/** + * Removes from the \e input word the \e numberOfCharacters characters starting from the given \e position and checks the results with \e result. + * + * If the test fails it prints a short description and the line where this function was called. + * + * @param description Short description of the experiment. i.e. "Remove a whole group of characters. Merge". + * @param input The input word. + * @param position Where to start to remove characters + * @param numberOfCharacters The number of characters to remove. + * @param result The word without the removed characters. + * @param location Where this function has been called. + * + * @return \e true if the experiment is successful. Otherwise returns \e false. + */ +bool TestRemoveCharactersFromWord( const std::string& description, const std::string& input, const std::size_t position, const std::size_t numberOfCharacters, const std::string& result, const char* location ) +{ + tet_printf( "%s", description.c_str() ); + + // Create layout info for the input word. + Toolkit::Internal::TextView::RelayoutData relayoutData; + TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray inputStyledText; + MarkupProcessor::GetStyledTextArray( input, inputStyledText, true ); + + TextViewProcessor::CreateTextInfo( inputStyledText, + DEFAULT_LAYOUT_PARAMETERS, + relayoutData ); + + // Get the input word + TextViewProcessor::WordLayoutInfo inputWordLayout; + + if( !inputLayout.mLinesLayoutInfo.empty() ) + { + const TextViewProcessor::LineLayoutInfo& line( *inputLayout.mLinesLayoutInfo.begin() ); + if( !line.mWordGroupsLayoutInfo.empty() ) + { + const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() ); + if( !group.mWordsLayoutInfo.empty() ) + { + inputWordLayout = *( *( *inputLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin(); + } + } + } + + // Create layout info for the result word. + Toolkit::Internal::TextView::RelayoutData resultRelayoutData; + TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray resultStyledText; + MarkupProcessor::GetStyledTextArray( result, resultStyledText, true ); + + TextViewProcessor::CreateTextInfo( resultStyledText, + DEFAULT_LAYOUT_PARAMETERS, + resultRelayoutData ); + + // Get the result word + TextViewProcessor::WordLayoutInfo resultWordLayout; + + if( !resultLayout.mLinesLayoutInfo.empty() ) + { + const TextViewProcessor::LineLayoutInfo& line( *resultLayout.mLinesLayoutInfo.begin() ); + if( !line.mWordGroupsLayoutInfo.empty() ) + { + const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() ); + if( !group.mWordsLayoutInfo.empty() ) + { + resultWordLayout = *( *( *resultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin(); + } + } + } + + RemoveCharactersFromWord( position, + numberOfCharacters, + inputWordLayout ); + + if( !TestEqual( inputWordLayout, resultWordLayout ) ) + { + tet_printf( "Fail. different layout info. %s", location ); + return false; + } + + return true; +} + +/** + * Removes from the \e input group of words the \e numberOfWords words starting from the given \e wordIndex and checks the results with \e result. + * + * If the test fails it prints a short description and the line where this function was called. + * + * @param description Short description of the experiment. + * @param input The input group of words. + * @param wordIndex Where to start to remove words. + * @param numberOfWords The number of words to remove. + * @param result The group of words without the removed words. + * @param location Where this function has been called. + * + * @return \e true if the experiment is successful. Otherwise returns \e false. + */ +bool TestRemoveWordsFromGroup( const std::string& description, const std::string& input, const std::size_t wordIndex, const std::size_t numberOfWords, const std::string& result, const char* location ) +{ + tet_printf( "%s", description.c_str() ); + + // Create layout info for the input group of words. + Toolkit::Internal::TextView::RelayoutData relayoutData; + TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray inputStyledText; + MarkupProcessor::GetStyledTextArray( input, inputStyledText, true ); + + TextViewProcessor::CreateTextInfo( inputStyledText, + DEFAULT_LAYOUT_PARAMETERS, + relayoutData ); + + // Get the input group of words + TextViewProcessor::WordGroupLayoutInfo inputWordGroupLayout; + + if( !inputLayout.mLinesLayoutInfo.empty() ) + { + const TextViewProcessor::LineLayoutInfo& line( *inputLayout.mLinesLayoutInfo.begin() ); + if( !line.mWordGroupsLayoutInfo.empty() ) + { + inputWordGroupLayout = *( *inputLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin(); + } + } + + // Create layout info for the result group of words. + Toolkit::Internal::TextView::RelayoutData resultRelayoutData; + TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray resultStyledText; + MarkupProcessor::GetStyledTextArray( result, resultStyledText, true ); + + TextViewProcessor::CreateTextInfo( resultStyledText, + DEFAULT_LAYOUT_PARAMETERS, + resultRelayoutData ); + + // Get the result group of words. + TextViewProcessor::WordGroupLayoutInfo resultWordGroupLayout; + + if( !resultLayout.mLinesLayoutInfo.empty() ) + { + const TextViewProcessor::LineLayoutInfo& line( *resultLayout.mLinesLayoutInfo.begin() ); + if( !line.mWordGroupsLayoutInfo.empty() ) + { + resultWordGroupLayout = *( *resultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin(); + } + } + + RemoveWordsFromWordGroup( wordIndex, + numberOfWords, + inputWordGroupLayout ); + + if( !TestEqual( inputWordGroupLayout, resultWordGroupLayout ) ) + { + tet_printf( "Fail. different layout info. %s", location ); + return false; + } + + return true; +} + + +/** + * Removes from the \e input line the \e numberOfGroups groups of words starting from the given \e groupIndex and checks the results with \e result. + * + * If the test fails it prints a short description and the line where this function was called. + * + * @param description Short description of the experiment. + * @param input The input line. + * @param groupIndex Where to start to remove groups of words + * @param numberOfGroups The number of groups of words to remove. + * @param lineHeightOffset Offset between lines. + * @param result The line without the removed groups of words. + * @param location Where this function has been called. + * + * @return \e true if the experiment is successful. Otherwise returns \e false. + */ +bool TestRemoveGroupsFromLine( const std::string& description, const std::string& input, const std::size_t groupIndex, const std::size_t numberOfGroups, const float lineHeightOffset, const std::string& result, const char* location ) +{ + tet_printf( "%s", description.c_str() ); + + // Create layout info for the input line. + Toolkit::Internal::TextView::RelayoutData relayoutData; + TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray inputStyledText; + MarkupProcessor::GetStyledTextArray( input, inputStyledText, true ); + + TextViewProcessor::CreateTextInfo( inputStyledText, + Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar, + Toolkit::TextView::Original, + Toolkit::TextView::Original, + static_cast( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ), + Toolkit::TextView::Center, + PointSize( lineHeightOffset ), + std::string( "..." ), + true ), + relayoutData ); + + // Get the input line + TextViewProcessor::LineLayoutInfo inputLineLayout; + + if( !inputLayout.mLinesLayoutInfo.empty() ) + { + inputLineLayout = *inputLayout.mLinesLayoutInfo.begin(); + } + + // Create layout info for the result line. + Toolkit::Internal::TextView::RelayoutData resultRelayoutData; + TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray resultStyledText; + MarkupProcessor::GetStyledTextArray( result, resultStyledText, true ); + + TextViewProcessor::CreateTextInfo( resultStyledText, + Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar, + Toolkit::TextView::Original, + Toolkit::TextView::Original, + static_cast( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ), + Toolkit::TextView::Center, + PointSize( lineHeightOffset ), + std::string( "..." ), + true ), + resultRelayoutData ); + + // Get the result line + TextViewProcessor::LineLayoutInfo resultLineLayout; + + if( !resultLayout.mLinesLayoutInfo.empty() ) + { + resultLineLayout = *resultLayout.mLinesLayoutInfo.begin(); + } + + RemoveWordGroupsFromLine( groupIndex, + numberOfGroups, + PointSize( lineHeightOffset ), + inputLineLayout ); + + if( !TestEqual( inputLineLayout, resultLineLayout ) ) + { + tet_printf( "Fail. different layout info. %s", location ); + return false; + } + + return true; +} + +/** + * Tests inserts, removes and updates operation in the given \e input text and checks with the given \e result. + * + * If the test fails it prints a short description and the line where this function was called. + * + * @param description Short description of the experiment. + * @param operation Type of update operation (insert, remove, replace) + * @param input The input text. + * @param position Where to insert, remove or replace text. + * @param numberOfCharacters Number of characters to remove or replace. + * @param inputText Inserted or updated text. + * @param lineHeightOffset Offset between lines. + * @param result Expected result. + * @param location Where this function has been called. + * + * @return \e true if the experiment is successful. Otherwise returns \e false. + */ +bool TestUpdateTextInfo( const std::string& description, + const UpdateTextInfoOperation operation, + const std::string& input, + const std::size_t position, + const std::size_t numberOfCharacters, + const std::string& inputText, + const float lineHeightOffset, + const std::string& result, + const char* location ) +{ + tet_printf( "%s", description.c_str() ); + + // Create layout info for the input. + Toolkit::Internal::TextView::RelayoutData relayoutData; + TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray inputStyledText; + MarkupProcessor::GetStyledTextArray( input, inputStyledText, true ); + + TextViewProcessor::CreateTextInfo( inputStyledText, + Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar, + Toolkit::TextView::Original, + Toolkit::TextView::Original, + static_cast( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ), + Toolkit::TextView::Center, + PointSize( lineHeightOffset ), + std::string( "..." ), + true ), + relayoutData ); + + // Create layout info for the result. + Toolkit::Internal::TextView::RelayoutData resultRelayoutData; + TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo ); + + MarkupProcessor::StyledTextArray resultStyledText; + MarkupProcessor::GetStyledTextArray( result, resultStyledText, true ); + + TextViewProcessor::CreateTextInfo( resultStyledText, + Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar, + Toolkit::TextView::Original, + Toolkit::TextView::Original, + static_cast( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ), + Toolkit::TextView::Center, + PointSize( lineHeightOffset ), + std::string( "..." ), + true ), + resultRelayoutData ); + + // Choose operation and call appropiate UpdateTextInfo() method. + const Toolkit::Internal::TextView::LayoutParameters layoutParameters( Toolkit::TextView::SplitByNewLineChar, + Toolkit::TextView::Original, + Toolkit::TextView::Original, + static_cast( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ), + Toolkit::TextView::Center, + PointSize( lineHeightOffset ), + std::string( "..." ), + true ); + + switch( operation ) + { + case Insert: + { + MarkupProcessor::StyledTextArray inputStyledText; + MarkupProcessor::GetStyledTextArray( inputText, inputStyledText, true ); + + TextViewProcessor::UpdateTextInfo( position, + inputStyledText, + layoutParameters, + relayoutData ); + break; + } + case Remove: + { + TextViewProcessor::UpdateTextInfo( position, + numberOfCharacters, + layoutParameters, + relayoutData, + TextViewProcessor::CLEAR_TEXT ); + break; + } + case Replace: + { + MarkupProcessor::StyledTextArray inputStyledText; + MarkupProcessor::GetStyledTextArray( inputText, inputStyledText, true ); + + TextViewProcessor::UpdateTextInfo( position, + numberOfCharacters, + inputStyledText, + layoutParameters, + relayoutData ); + break; + } + default: + { + tet_printf( "TestUpdateTextInfo: unknown update operation. %s", location ); + return false; + } + } + + if( !TestEqual( inputLayout, resultLayout ) ) + { + tet_printf( "Fail. different layout info. %s", location ); + + std::cout << " result : "; Print( inputLayout ); + std::cout << " expected result : "; Print( resultLayout ); + return false; + } + + return true; +} + +} // namespace + + +int UtcDaliTextViewCreateTextInfo(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewCreateTextInfo : "); + + // Metrics for characters + + // Font size = 10 + // size : [9.48351, 9.48351] + // advance : 9.48351 + // bearing : 8.53516 + // ascender : 8.53516 + + // Font size = 12 + // size : [11.3802, 11.3802] + // advance : 11.3802 + // bearing : 10.2422 + // ascender : 10.2422 + + // Font size = 14 + // size : [13.2769, 13.2769] + // advance : 13.2769 + // bearing : 11.9492 + // ascender : 11.9492 + + const float WIDTH_10( 9.48351f ); + const float HEIGHT_10( 9.48351f ); + const float ADVANCE_10( 9.48351f ); + const float BEARING_10( 8.53516f ); + const float ASCENDER_10( 8.53516f ); + + const float WIDTH_12( 11.3802f ); + const float HEIGHT_12( 11.3802f ); + const float ADVANCE_12( 11.3802f ); + const float BEARING_12( 10.2422f ); + const float ASCENDER_12( 10.2422f ); + + + // Generate a text. + Toolkit::Internal::TextView::RelayoutData relayoutData; + TextViewProcessor::TextLayoutInfo& textLayoutInfo( relayoutData.mTextLayoutInfo ); + + std::string text( "Hello world!\n" + "\n" ); + + MarkupProcessor::StyledTextArray styledText; + MarkupProcessor::GetStyledTextArray( text, styledText, true ); + + TextViewProcessor::CreateTextInfo( styledText, + DEFAULT_LAYOUT_PARAMETERS, + relayoutData ); + + + // Build the text info with metric values. + + // Characters + + TextViewProcessor::CharacterLayoutInfo layoutInfo10; // ( [lo wo]) + layoutInfo10.mHeight = HEIGHT_10; + layoutInfo10.mAdvance = ADVANCE_10; + layoutInfo10.mBearing = BEARING_10; + layoutInfo10.mSize = Size( WIDTH_10, HEIGHT_10 ); + layoutInfo10.mAscender = ASCENDER_10; + TextViewProcessor::CharacterLayoutInfo layoutInfo12; // ( [Hel], [rld!] and [CR]) + layoutInfo12.mHeight = HEIGHT_12; + layoutInfo12.mAdvance = ADVANCE_12; + layoutInfo12.mBearing = BEARING_12; + layoutInfo12.mSize = Size( WIDTH_12, HEIGHT_12 ); + layoutInfo12.mAscender = ASCENDER_12; + + TextStyle style10; + style10.SetFontPointSize( PointSize( 10.f ) ); + TextStyle style12; + style12.SetFontPointSize( PointSize( 0.f ) ); // point size is set to zero because is a default point size. + + layoutInfo12.mStyledText.mStyle = style12; + layoutInfo10.mStyledText.mStyle = style10; + + // Words + + TextViewProcessor::WordLayoutInfo wordLayout1, wordLayout2, wordLayout3, wordLayout4; + + // Hello + wordLayout1.mSize = Size( 3.f * WIDTH_12 + 2.f * WIDTH_10, HEIGHT_12 ); + wordLayout1.mAscender = ASCENDER_12; + wordLayout1.mType = TextViewProcessor::NoSeparator; + + layoutInfo12.mStyledText.mText = Text( "H" ); + wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo12 ); // H + layoutInfo12.mStyledText.mText = Text( "e" ); + wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo12 ); // e + layoutInfo12.mStyledText.mText = Text( "l" ); + wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo12 ); // l + layoutInfo10.mStyledText.mText = Text( "l" ); + wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo10 ); // l + layoutInfo10.mStyledText.mText = Text( "o" ); + wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo10 ); // o + + // (white space) + wordLayout2.mSize = Size( WIDTH_10, HEIGHT_10 ); + wordLayout2.mAscender = ASCENDER_10; + wordLayout2.mType = TextViewProcessor::WordSeparator; + layoutInfo10.mStyledText.mText = Text( " " ); + wordLayout2.mCharactersLayoutInfo.push_back( layoutInfo10 ); // (white space) + + // world! + wordLayout3.mSize = Size( 2.f * WIDTH_10 + 4.f * WIDTH_12, HEIGHT_12 ); + wordLayout3.mAscender = ASCENDER_12; + wordLayout3.mType = TextViewProcessor::NoSeparator; + layoutInfo10.mStyledText.mText = Text( "w" ); + wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo10 ); // w + layoutInfo10.mStyledText.mText = Text( "o" ); + wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo10 ); // o + layoutInfo12.mStyledText.mText = Text( "r" ); + wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo12 ); // r + layoutInfo12.mStyledText.mText = Text( "l" ); + wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo12 ); // l + layoutInfo12.mStyledText.mText = Text( "d" ); + wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo12 ); // d + layoutInfo12.mStyledText.mText = Text( "!" ); + wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo12 ); // ! + + // (new line character) + wordLayout4.mSize = Size( 0.f, HEIGHT_12 ); + wordLayout4.mAscender = ASCENDER_12; + wordLayout4.mType = TextViewProcessor::LineSeparator; + layoutInfo12.mStyledText.mText = Text( "\n" ); + layoutInfo12.mSize.width = 0.f; + wordLayout4.mCharactersLayoutInfo.push_back( layoutInfo12 ); // (new line char) + + // Groups + + TextViewProcessor::WordGroupLayoutInfo groupLayout1, groupLayout2; + + groupLayout1.mSize = Size( 5.f * WIDTH_10 + 7.f * WIDTH_12, HEIGHT_12 ); + groupLayout1.mAscender = ASCENDER_12; + groupLayout1.mDirection = TextViewProcessor::LTR; + groupLayout1.mNumberOfCharacters = 13; + groupLayout1.mWordsLayoutInfo.push_back( wordLayout1 ); + groupLayout1.mWordsLayoutInfo.push_back( wordLayout2 ); + groupLayout1.mWordsLayoutInfo.push_back( wordLayout3 ); + groupLayout1.mWordsLayoutInfo.push_back( wordLayout4 ); + + groupLayout2.mSize = Size( 0.f, HEIGHT_12 ); + groupLayout2.mAscender = ASCENDER_12; + groupLayout2.mDirection = TextViewProcessor::LTR; + groupLayout2.mNumberOfCharacters = 1; + groupLayout2.mWordsLayoutInfo.push_back( wordLayout4 ); + + // Lines + + TextViewProcessor::LineLayoutInfo lineLayout1, lineLayout2, lineLayout3; + + lineLayout1.mSize = Size( 5.f * WIDTH_10 + 7.f * WIDTH_12, HEIGHT_12 ); + lineLayout1.mAscender = ASCENDER_12; + lineLayout1.mNumberOfCharacters = 13; + lineLayout1.mWordGroupsLayoutInfo.push_back( groupLayout1 ); + + lineLayout2.mSize = Size( 0.f, HEIGHT_12 ); + lineLayout2.mAscender = ASCENDER_12; + lineLayout2.mNumberOfCharacters = 1; + lineLayout2.mWordGroupsLayoutInfo.push_back( groupLayout2 ); + + lineLayout3.mSize = Size( 0.f, HEIGHT_12 ); + + // Text (layout) + TextViewProcessor::TextLayoutInfo textLayout; + + textLayout.mWholeTextSize = Size( 5.f * WIDTH_10 + 7.f * WIDTH_12, 3.f * HEIGHT_12 ); + textLayout.mMaxWordWidth = 2.f * WIDTH_10 + 4.f * WIDTH_12; + textLayout.mNumberOfCharacters = 14; + textLayout.mLinesLayoutInfo.push_back( lineLayout1 ); + textLayout.mLinesLayoutInfo.push_back( lineLayout2 ); + textLayout.mLinesLayoutInfo.push_back( lineLayout3 ); + + if(!TestEqual( textLayout, textLayoutInfo )) + { + std::cout << "Layout fails" << std::endl; + Print(textLayout); std::cout << std::endl; + Print(textLayoutInfo); std::cout << std::endl; + } + + DALI_TEST_CHECK( TestEqual( textLayout, textLayoutInfo ) ); + END_TEST; +} + +int UtcDaliTextViewSplitWord(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewSplitWord : "); + + struct SplitWordTest splitWordTests[] = + { + { + std::string( "Split word, position 0." ), + std::string( "Helloooo" ), + 0, + std::string( "" ), + std::string( "Helloooo" ), + }, + { + std::string( "Split word, position 8." ), + std::string( "Helloooo" ), + 8, + std::string( "Helloooo" ), + std::string( "" ), + }, + { + std::string( "Split word, position 2." ), + std::string( "Helloooo" ), + 2, + std::string( "He" ), + std::string( "lloooo" ), + }, + { + std::string( "Split word, position 3." ), + std::string( "Helloooo" ), + 3, + std::string( "Hel" ), + std::string( "loooo" ), + }, + { + std::string( "Split word, position 4." ), + std::string( "Helloooo" ), + 4, + std::string( "Hell" ), + std::string( "oooo" ), + }, + }; + const std::size_t numberOfTests( 5 ); + + for( std::size_t index = 0; index < numberOfTests; ++index ) + { + const SplitWordTest& test = splitWordTests[index]; + + if( !TestSplitWord( test.description, test.input, test.position, test.firstResult, test.lastResult, TEST_LOCATION ) ) + { + tet_result( TET_FAIL ); + } + } + + tet_result( TET_PASS ); + END_TEST; +} + +int UtcDaliTextViewUpdateTextInfo(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewUpdateTextInfo : "); + + struct UpdateTextInfoTest updateTextInfoTest[] = + { + // Remove operations + + { + std::string( "Remove from new line character to first character next line." ), + Remove, + std::string("Hello world\nhello world."), + 11, + 2, + std::string(""), + 0.f, + std::string("Hello worldello world."), + }, + { + std::string( "Replace style from new line character to first character next line." ), + Replace, + std::string("Hello world\nhello world."), + 11, + 2, + std::string("\nh"), + 0.f, + std::string("Hello world\nhello world."), + }, + { + std::string( "Remove from the beginning to the middle of last word." ), + Remove, + std::string("Hello world, hello world."), + 0, + 22, + std::string(), // Not used. + 0.f, + std::string("ld."), + }, + { + std::string( "Remove from the beginning to the middle of the text." ), + Remove, + std::string("Hello world hello world."), + 0, + 12, + std::string(), // Not used. + 0.f, + std::string("hello world."), + }, + // Remove within the same word: + // * within the same group of characters. + { + std::string( "Remove within the same word, within the same group of characters" ), + Remove, + std::string("Hello world\nhello world"), + 7, + 3, + std::string(), // Not used. + 0.f, + std::string( "Hello wd\nhello world" ) + }, + // * whole group of characters (merge adjacent group of characters) + { + std::string( "Remove within the same word, whole group of characters (merge adjacent group of characters)" ), + Remove, + std::string("Hello world\nhello world"), + 7, + 3, + std::string(), // Not used. + 0.f, + std::string( "Hello wd\nhello world" ) + }, + // * whole group of characters (don't merge adjacent gtoup of characters) + { + std::string( "Remove within the same word, whole group of characters (don't merge adjacent gtoup of characters)" ), + Remove, + std::string("Hello world\nhello world"), + 7, + 3, + std::string(), // Not used. + 0.f, + std::string( "Hello wd\nhello world" ) + }, + // * Remove whole word (merge words) + { + std::string( "Remove within the same word, whole word (merge words)" ), + Remove, + std::string("Hello world\nhello world"), + 5, + 1, + std::string(), // Not used. + 0.f, + std::string( "Helloworld\nhello world" ) + }, + // * Remove whole word (don't merge words) + { + std::string( "Remove within the same word, whole word (don't merge words)" ), + Remove, + std::string("Hello world\nhello world"), + 6, + 5, + std::string(), // Not used. + 0.f, + std::string( "Hello \nhello world" ) + }, + // * Remove whole word (merge lines) + { + std::string( "Remove within the same word, whole word (merge lines)" ), + Remove, + std::string("Hello world\nhello world"), + 11, + 1, + std::string(), // Not used. + 0.f, + std::string( "Hello worldhello world" ) + }, + // * Remove whole group of words + /* TODO check this when RTL text is working + { + std::string( "Remove within the same line, whole group of words (merge groups)" ), + Remove, + std::string("Hello world, שלום עולם, hello world"), + 10, + 15, + std::string(), // Not used. + 0.f, + std::string( "Hello worlello world" ) + }, + */ + // * Remove whole line + { + std::string( "Remove whole line" ), + Remove, + std::string("Hello world, hello world\n" + "Hello world, hello world\n" + "Hello world, hello world\n" + "Hello world, hello world\n"), + 25, + 25, + std::string(), // Not used. + 0.f, + std::string("Hello world, hello world\n" + "Hello world, hello world\n" + "Hello world, hello world\n"), + }, + { + std::string( "Remove whole line" ), + Remove, + std::string("Hello world, hello world\n" + "H"), + 25, + 1, + std::string(), // Not used. + 0.f, + std::string("Hello world, hello world\n"), + }, + + + // Insert operations + { + std::string( "insert some text" ), + Insert, + std::string("inpuext"), + 4, + 0, // Not used + std::string( "t t" ), + 0.f, + std::string( "input text" ) + }, + { + std::string( "Insert text at the end" ), + Insert, + std::string("touch "), + 6, + 0, + std::string("me\nhello"), + 0.f, + std::string("touch me\nhello") + }, + + // Replace operations. + { + std::string( "Replace style from the beginning to some point in the middle of the text." ), + Replace, + std::string( "Hello world" ), + 0, + 7, + std::string( "Hello w" ), + 0.f, + std::string( "Hello world" ) + }, + { + std::string( "Replace style from the middle of the text to the end." ), + Replace, + std::string( "Touch me\nhello" ), + 6, + 8, + std::string( "me\nhello" ), + 0.f, + std::string( "Touch me\nhello" ) + }, + { + std::string( "Remove characters from text. Previous next test:Replace style from the middle of the text 1." ), + Remove, + std::string( "Touch me\nhello\nworld" ), + 6, + 8, + std::string( "" ), + 0.f, + std::string( "Touch \nworld" ) + }, + { + std::string( "Insert styled text in the middle of a text. Previous: Replace style from the middle of the text 1." ), + Insert, + std::string( "Touch \nworld" ), + 6, + 0, + std::string( "me\nhello" ), + 0.f, + std::string( "Touch me\nhello\nworld" ) + }, + { + std::string( "Replace style from the middle of the text 1." ), + Replace, + std::string( "Touch me\nhello\nworld" ), + 6, + 8, + std::string( "me\nhello" ), + 0.f, + std::string( "Touch me\nhello\nworld" ) + }, + { + std::string( "Remove characters from text. Previous next test:Replace style from the middle of the text 2." ), + Remove, + std::string( "Touch me\nhello\nworld" ), + 6, + 9, + std::string( "" ), + 0.f, + std::string( "Touch world" ) + }, + { + std::string( "Replace style from the middle of the text 2." ), + Replace, + std::string( "Touch me\nhello\nworld" ), + 6, + 9, + std::string( "me\nhello\n" ), + 0.f, + std::string( "Touch me\nhello\nworld" ) + }, + }; + const std::size_t numberOfTests( 21 ); + + for( std::size_t index = 0; index < numberOfTests; ++index ) + { + const UpdateTextInfoTest& test = updateTextInfoTest[index]; + + if( !TestUpdateTextInfo( test.description, test.operation, test.input, test.position, test.numberOfCharacters, test.inputText, test.lineHeightOffset, test.result, TEST_LOCATION ) ) + { + tet_result( TET_FAIL ); + } + } + + tet_result( TET_PASS ); + END_TEST; +} + +int UtcDaliTextViewSplitWordGroup(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewSplitWordGroup : "); + + struct SplitWordGroupTest splitWordGroupTests[] = + { + { + std::string( "Split word group, wordPosition 0, position 0." ), + std::string( "Helloooo wooorld" ), + 0, + 0, + std::string( "" ), + std::string( "Helloooo wooorld" ), + }, + { + std::string( "Split word group, wordPosition 2, position 8." ), + std::string( "Helloooo wooorld" ), + 2, + 7, + std::string( "Helloooo wooorld" ), + std::string( "" ), + }, + { + std::string( "Split word group, wordPosition 0, position 2." ), + std::string( "Helloooo wooorld" ), + 0, + 2, + std::string( "He" ), + std::string( "lloooo wooorld" ), + }, + { + std::string( "Split word group, wordPosition 0, position 3." ), + std::string( "Helloooo wooorld" ), + 0, + 3, + std::string( "Hel" ), + std::string( "loooo wooorld" ), + }, + { + std::string( "Split word group, wordPosition 0, position 4." ), + std::string( "Helloooo wooorld" ), + 0, + 4, + std::string( "Hell" ), + std::string( "oooo wooorld" ), + }, + { + std::string( "Split word group, wordPosition 1, position 0." ), + std::string( "Helloooo wooorld" ), + 1, + 0, + std::string( "Helloooo" ), + std::string( " wooorld" ), + }, + }; + const std::size_t numberOfTests( 6 ); + + for( std::size_t index = 0; index < numberOfTests; ++index ) + { + const SplitWordGroupTest& test = splitWordGroupTests[index]; + + if( !TestSplitWordGroup( test.description, test.input, test.wordPosition, test.position, test.firstResult, test.lastResult, TEST_LOCATION ) ) + { + tet_result( TET_FAIL ); + } + } + + tet_result( TET_PASS ); + END_TEST; +} + +int UtcDaliTextViewSplitLine(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewSplitLine : "); + + struct SplitLineTest splitLineTests[] = + { + { + std::string( "Split line, groupPosition 0, wordPosition 0, position 0." ), + std::string( "Helloooo wooorld שלום עולם text text" ), + 0, + 0, + 0, + 3.f, + std::string( "" ), + std::string( "Helloooo wooorld שלום עולם text text" ), + }, + { + std::string( "Split line, groupPosition 2, wordPosition 2, position 4." ), + std::string( "Helloooo wooorld שלום עולם text text" ), + 2, + 2, + 4, + 0.f, + std::string( "Helloooo wooorld שלום עולם text text" ), + std::string( "" ), + }, + /* TODO check when RTL is working. + { + std::string( "Split line, groupPosition 1, wordPosition 2, position 0." ), + std::string( "Helloooo wooorld שלום עולם text text" ), + 1, + 2, + 0, + 0.f, + std::string( "Helloooo wooorld שלום" ), + std::string( " עולם text text" ), + }, + { + std::string( "Split line, groupPosition 1, wordPosition 0, position 0." ), + std::string( "Helloooo wooorld שלום עולם text text" ), + 1, + 0, + 0, + 0.f, + std::string( "Helloooo wooorld " ), + std::string( "שלום עולם text text" ), + }, + */ + { + std::string( "Split line, groupPosition 2, wordPosition 0, position 0." ), + std::string( "Helloooo wooorld שלום עולם text text" ), + 2, + 0, + 0, + 6.f, + std::string( "Helloooo wooorld שלום עולם " ), + std::string( "text text" ), + }, + }; + const std::size_t numberOfTests( 3 ); + + for( std::size_t index = 0; index < numberOfTests; ++index ) + { + const SplitLineTest& test = splitLineTests[index]; + + if( !TestSplitLine( test.description, test.input, test.groupPosition, test.wordPosition, test.position, test.lineHeightOffset, test.firstResult, test.lastResult, TEST_LOCATION ) ) + { + tet_result( TET_FAIL ); + } + } + + tet_result( TET_PASS ); + END_TEST; +} + +int UtcDaliTextViewMergeWord01(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewMergeWord01 : "); + + struct MergeWordsTest mergeWordsTests[] = + { + { + std::string( "Merge words with same style." ), + std::string( "Hel" ), + std::string( "lo" ), + std::string( "Hello" ), + }, + { + std::string( "Merge words with different styles." ), + std::string( "lo" ), + std::string( "Hello" ) + }, + }; + const std::size_t numberOfTests( 2 ); + + for( std::size_t index = 0; index < numberOfTests; ++index ) + { + const MergeWordsTest& test = mergeWordsTests[index]; + + if( !TestMergeWords( test.description, test.inputFirst, test.inputLast, test.result, TEST_LOCATION ) ) + { + tet_result( TET_FAIL ); + } + } + + tet_result( TET_PASS ); + END_TEST; +} + +int UtcDaliTextViewMergeWord02(void) +{ + // Negative test. + // It test white spaces and new line characters can't be merged to other words. + + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewMergeWord02 : "); + + // Generate three words + + Toolkit::Internal::TextView::RelayoutData relayoutData01; + Toolkit::Internal::TextView::RelayoutData relayoutData02; + Toolkit::Internal::TextView::RelayoutData relayoutData03; + TextViewProcessor::TextLayoutInfo& textLayoutInfo01( relayoutData01.mTextLayoutInfo ); + TextViewProcessor::TextLayoutInfo& textLayoutInfo02( relayoutData02.mTextLayoutInfo ); + TextViewProcessor::TextLayoutInfo& textLayoutInfo03( relayoutData03.mTextLayoutInfo ); + + std::string text01( " " ); + std::string text02( "\n" ); + std::string text03( "a" ); + MarkupProcessor::StyledTextArray styledText01; + MarkupProcessor::StyledTextArray styledText02; + MarkupProcessor::StyledTextArray styledText03; + MarkupProcessor::GetStyledTextArray( text01, styledText01, true ); + MarkupProcessor::GetStyledTextArray( text02, styledText02, true ); + MarkupProcessor::GetStyledTextArray( text03, styledText03, true ); + + TextViewProcessor::CreateTextInfo( styledText01, + DEFAULT_LAYOUT_PARAMETERS, + relayoutData01 ); + + TextViewProcessor::WordLayoutInfo wordLayoutInfo01; + + wordLayoutInfo01 = *( *( *textLayoutInfo01.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin(); + + TextViewProcessor::CreateTextInfo( styledText02, + DEFAULT_LAYOUT_PARAMETERS, + relayoutData02 ); + + TextViewProcessor::WordLayoutInfo wordLayoutInfo02; + + wordLayoutInfo02 = *( *( *textLayoutInfo02.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin(); + + TextViewProcessor::CreateTextInfo( styledText03, + DEFAULT_LAYOUT_PARAMETERS, + relayoutData03 ); + + TextViewProcessor::WordLayoutInfo wordLayoutInfo03; + + wordLayoutInfo03 = *( *( *textLayoutInfo03.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin(); + + // Test MergeWord() asserts if white spaces or new line chars are merged. + bool assert1 = false; + bool assert2 = false; + bool assert3 = false; + bool assert4 = false; + bool assert5 = false; + bool assert6 = false; + + try + { + MergeWord( wordLayoutInfo01, + wordLayoutInfo02 ); + } + catch( Dali::DaliException& e ) + { + tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() ); + DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION ); + assert1 = true; + } + try + { + MergeWord( wordLayoutInfo01, + wordLayoutInfo03 ); + } + catch( Dali::DaliException& e ) + { + tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() ); + DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION ); + assert2 = true; + } + try + { + MergeWord( wordLayoutInfo02, + wordLayoutInfo01 ); + } + catch( Dali::DaliException& e ) + { + tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() ); + DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION ); + assert3 = true; + } + try + { + MergeWord( wordLayoutInfo02, + wordLayoutInfo03 ); + } + catch( Dali::DaliException& e ) + { + tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() ); + DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION ); + assert4 = true; + } + try + { + MergeWord( wordLayoutInfo03, + wordLayoutInfo01 ); + } + catch( Dali::DaliException& e ) + { + tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() ); + DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION ); + assert5 = true; + } + try + { + MergeWord( wordLayoutInfo03, + wordLayoutInfo02 ); + } + catch( Dali::DaliException& e ) + { + tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() ); + DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION ); + assert6 = true; + } + + if( assert1 && assert2 && assert3 && assert4 && assert5 && assert6 ) + { + tet_result( TET_PASS ); + } + else + { + tet_result( TET_FAIL ); + } + END_TEST; +} + +int UtcDaliTextViewMergeGroup01(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewMergeGroup01 : "); + + struct MergeWordGroupsTest mergeWordGroupssTests[] = + { + { + std::string( "Merge a void first group." ), + std::string( "" ), + std::string( "Hello world" ), + std::string( "Hello world" ), + }, + { + std::string( "Merge a void last group." ), + std::string( "Hello world" ), + std::string( "" ), + std::string( "Hello world" ), + }, + { + std::string( "Merge groups and merge last and first words." ), + std::string( "Hello wor" ), + std::string( "ld, hello world" ), + std::string( "Hello world, hello world" ), + }, + { + std::string( "Merge groups and don't merge last and first words." ), + std::string( "Hello world, " ), + std::string( "hello world" ), + std::string( "Hello world, hello world" ) + }, + }; + const std::size_t numberOfTests( 4 ); + + for( std::size_t index = 0; index < numberOfTests; ++index ) + { + const MergeWordGroupsTest& test = mergeWordGroupssTests[index]; + + if( !TestMergeGroupsOfWords( test.description, test.inputFirst, test.inputLast, test.result, TEST_LOCATION ) ) + { + tet_result( TET_FAIL ); + } + } + + tet_result(TET_PASS); + END_TEST; +} + +int UtcDaliTextViewMergeGroup02(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewMergeGroup02 : "); + + Toolkit::Internal::TextView::RelayoutData relayoutData01; + Toolkit::Internal::TextView::RelayoutData relayoutData02; + Toolkit::Internal::TextView::RelayoutData relayoutData03; + TextViewProcessor::TextLayoutInfo& textLayoutInfo01( relayoutData01.mTextLayoutInfo ); + TextViewProcessor::TextLayoutInfo& textLayoutInfo02( relayoutData02.mTextLayoutInfo ); + TextViewProcessor::TextLayoutInfo& textLayoutInfo03( relayoutData03.mTextLayoutInfo ); + + std::string text01( "Hello \n" ); + std::string text02( "world" ); + std::string text03( "السلام عليكم" ); + MarkupProcessor::StyledTextArray styledText01; + MarkupProcessor::StyledTextArray styledText02; + MarkupProcessor::StyledTextArray styledText03; + MarkupProcessor::GetStyledTextArray( text01, styledText01, true ); + MarkupProcessor::GetStyledTextArray( text02, styledText02, true ); + MarkupProcessor::GetStyledTextArray( text03, styledText03, true ); + + TextViewProcessor::CreateTextInfo( styledText01, + DEFAULT_LAYOUT_PARAMETERS, + relayoutData01 ); + + TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo01; + + wordGroupLayoutInfo01 = *( *textLayoutInfo01.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin(); + + TextViewProcessor::CreateTextInfo( styledText02, + DEFAULT_LAYOUT_PARAMETERS, + relayoutData02 ); + + TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo02; + + wordGroupLayoutInfo02 = *( *textLayoutInfo02.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin(); + + TextViewProcessor::CreateTextInfo( styledText03, + DEFAULT_LAYOUT_PARAMETERS, + relayoutData03 ); + + TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo03; + + wordGroupLayoutInfo03 = *( *textLayoutInfo03.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin(); + + bool assert1 = false; + bool assert2 = false; + + try + { + MergeWordGroup( wordGroupLayoutInfo01, + wordGroupLayoutInfo02 ); + } + catch( Dali::DaliException& e ) + { + tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() ); + DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWordGroup(). ERROR: A group of words can't be merged to another group which finishes with a new line character.\"", TEST_LOCATION ); + assert1 = true; + } + + try + { + MergeWordGroup( wordGroupLayoutInfo03, + wordGroupLayoutInfo02 ); + } + catch( Dali::DaliException& e ) + { + tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() ); + DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWordGroup(). ERROR: groups with different direction can't be merged.\"", TEST_LOCATION ); + assert2 = true; + } + + if( assert1 && assert2 ) + { + tet_result( TET_PASS ); + } + else + { + tet_result( TET_FAIL ); + } + END_TEST; +} + +int UtcDaliTextViewMergeLine01(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewMergeLine01 : "); + + struct MergeLinesTest mergeLinesTests[] = + { + { + std::string( "Merge a void first line." ), + std::string( "" ), + std::string( "Hello world, this is a whole line" ), + 2.f, + std::string( "Hello world, this is a whole line" ) + }, + { + std::string( "Merge a void last line." ), + std::string( "Hello world, this is a whole line" ), + std::string( "" ), + 0.f, + std::string( "Hello world, this is a whole line" ) + }, + /* TODO: check when RTL text is working. + { + std::string( "Merge lines and merge last and first groups" ), + std::string( "Hello world, שלום" ), + std::string( " עולם, hello world." ), + 6.f, + std::string( "Hello world, שלום עולם, hello world." ) + }, + { + std::string( "Merge lines and don't merge last and first words." ), + std::string( "Hello world, " ), + std::string( "שלום עולם, hello world." ), + 3.f, + std::string( "Hello world, שלום עולם, hello world." ) + }, + */ + { + std::string( "Merge lines. Don't merge words" ), + std::string( "Hello world," ), + std::string( " this is a whole line" ), + 0.f, + std::string( "Hello world, this is a whole line" ) + }, + { + std::string( "Merge lines. Merge words" ), + std::string( "Hello world, th" ), + std::string( "is is a whole line" ), + 0.f, + std::string( "Hello world, this is a whole line" ) + }, + }; + const std::size_t numberOfTests( 4 ); + + for( std::size_t index = 0; index < numberOfTests; ++index ) + { + const MergeLinesTest& test = mergeLinesTests[index]; + + if( !TestMergeLines( test.description, test.inputFirst, test.inputLast, test.lineHeightOffset, test.result, TEST_LOCATION ) ) + { + tet_result( TET_FAIL ); + } + } + + tet_result( TET_PASS ); + END_TEST; +} + +int UtcDaliTextViewMergeLine02(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewMergeLine02 : "); + + Toolkit::Internal::TextView::RelayoutData relayoutData01; + Toolkit::Internal::TextView::RelayoutData relayoutData02; + TextViewProcessor::TextLayoutInfo& textLayoutInfo01( relayoutData01.mTextLayoutInfo ); + TextViewProcessor::TextLayoutInfo& textLayoutInfo02( relayoutData02.mTextLayoutInfo ); + + std::string text01( "Hello world\n" ); + std::string text02( "hello world" ); + MarkupProcessor::StyledTextArray styledText01; + MarkupProcessor::StyledTextArray styledText02; + MarkupProcessor::GetStyledTextArray( text01, styledText01, true ); + MarkupProcessor::GetStyledTextArray( text02, styledText02, true ); + + TextViewProcessor::CreateTextInfo( styledText01, + DEFAULT_LAYOUT_PARAMETERS, + relayoutData01 ); + + TextViewProcessor::LineLayoutInfo lineLayoutInfo01; + + lineLayoutInfo01 = *textLayoutInfo01.mLinesLayoutInfo.begin(); + + TextViewProcessor::CreateTextInfo( styledText02, + DEFAULT_LAYOUT_PARAMETERS, + relayoutData02 ); + + TextViewProcessor::LineLayoutInfo lineLayoutInfo02; + + lineLayoutInfo02 = *textLayoutInfo02.mLinesLayoutInfo.begin(); + + bool assert1 = false; + + try + { + MergeLine( lineLayoutInfo01, + lineLayoutInfo02 ); + } + catch( Dali::DaliException& e ) + { + tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() ); + DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeLine(). ERROR: A line can't be merged to another line which finishes with a new line character.\"", TEST_LOCATION ); + assert1 = true; + } + + if( assert1 ) + { + tet_result( TET_PASS ); + } + else + { + tet_result( TET_FAIL ); + } + END_TEST; +} + +int UtcDaliTextViewRemoveCharactersFromWord(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewMergeWord02 : "); + + struct RemoveCharactersFromWordTest removeCharactersFromWordTests[] = + { + { + std::string( "Delete 0 characters." ), + std::string( "Hello" ), + 3, + 0, + std::string( "Hello" ), + }, + { + std::string( "Delete within the same group of characters. Starting from the beginning" ), + std::string( "Hello" ), + 0, + 3, + std::string( "lo" ), + }, + { + std::string( "Delete within the same group of characters. Somewhere in the middle" ), + std::string( "Hello" ), + 2, + 2, + std::string( "Heo" ), + }, + { + std::string( "Delete within the same group of characters. Starting somewhere in the middle to the end" ), + std::string( "Hello" ), + 3, + 2, + std::string( "Hel" ), + }, + { + std::string( "Delete within the same group of characters. Finish just before a new one." ), + std::string( "HelloWorld" ), + 1, + 2, + std::string( "HloWorld" ), + }, + { + std::string( "Delete starting in one group of characters and finishing in a different one. No merge of groups." ), + std::string( "HelloWorld" ), + 2, + 3, + std::string( "HeWorld" ), + }, + { + std::string( "Delete within the same group of characters. Starting just after a different one." ), + std::string( "HelloWorld" ), + 7, + 2, + std::string( "HelloWod" ), + }, + { + std::string( "Delete whole group of characters. No merge" ), + std::string( "HelloWorld" ), + 3, + 4, + std::string( "Helrld" ), + }, + { + std::string( "Delete whole group of characters and part of the adjacent ones. No merge" ), + std::string( "HelloWorld" ), + 2, + 6, + std::string( "Held" ), + }, + { + std::string( "Delete whole group of characters. Merge" ), + std::string( "HelloWorld" ), + 3, + 4, + std::string( "Helrld" ), + }, + { + std::string( "Delete whole group of characters and part of the adjacent ones. Merge" ), + std::string( "HelloWorld" ), + 2, + 6, + std::string( "Held" ), + }, + }; + const std::size_t numberOfTests( 11 ); + + for( std::size_t index = 0; index < numberOfTests; ++index ) + { + const RemoveCharactersFromWordTest& test = removeCharactersFromWordTests[index]; + + if( !TestRemoveCharactersFromWord( test.description, test.input, test.position, test.numberOfCharacters, test.result, TEST_LOCATION ) ) + { + tet_result( TET_FAIL ); + } + } + + tet_result( TET_PASS ); + END_TEST; +} + +int UtcDaliTextViewRemoveWordsFromGroup(void) +{ + // Note: Currently RemoveWordsFromWordGroup() function is only used to remove a number of words from the beginning, or + // from a given index to the end. RemoveWordsFromWordGroup() doesn't merge words (if a white space is removed) so + // tehere isn't any TET case to cover these cases. To be done if needed. + + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewRemoveWordsFromGroup : "); + struct RemoveWordsFromGroupTest removeWordsFromGroupTests[] = + { + { + std::string( "Delete 0 words." ), + std::string( "Hello world, hello world" ), + 3, + 0, + std::string( "Hello world, hello world" ), + }, + { + std::string( "Delete some words in the middle. Don't merge words" ), + std::string( "Hello world, hello world" ), + 1, + 4, + std::string( "Hello world" ), + }, + { + std::string( "Delete words up to the end" ), + std::string( "Hello world, hello world" ), + 5, + 2, + std::string( "Hello world, hello" ), + }, + { + std::string( "Delete words from the beginning." ), + std::string( "Hello world, hello world" ), + 0, + 3, + std::string( " hello world" ), + }, + }; + const std::size_t numberOfTests( 4 ); + + for( std::size_t index = 0; index < numberOfTests; ++index ) + { + const RemoveWordsFromGroupTest& test = removeWordsFromGroupTests[index]; + + if( !TestRemoveWordsFromGroup( test.description, test.input, test.wordIndex, test.numberOfWords, test.result, TEST_LOCATION ) ) + { + tet_result( TET_FAIL ); + } + } + + tet_result( TET_PASS ); + END_TEST; +} + +int UtcDaliTextViewRemoveGroupsFromLine(void) +{ + // Note: Currently RemoveWordGroupsFromLine() function is only used to remove a number of group of words from the beginning, or + // from a given index to the end. RemoveWordGroupsFromLine() doesn't merge groups of words (if a whole group of words is removed) so + // tehere isn't any TET case to cover these cases. To be done if needed. + + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextViewRemoveGroupsFromLine : "); + struct RemoveGroupsFromLineTest removeGroupsFromLineTests[] = + { + { + std::string( "Delete 0 groups of words." ), + std::string( "Hello hello, שלום עולם hello hello" ), + 1, + 0, + 2.f, + std::string( "Hello hello, שלום עולם hello hello" ), + }, + { + std::string( "Delete from the middle to the end." ), + std::string( "Hello hello, שלום עולם hello hello" ), + 1, + 2, + 0.f, + std::string( "Hello hello, " ), + }, + { + std::string( "Delete from the beginning to the middle." ), + std::string( "Hello hello, שלום עולם hello hello" ), + 0, + 2, + 6.f, + std::string( "hello hello" ), + }, + }; + const std::size_t numberOfTests( 3 ); + + for( std::size_t index = 0; index < numberOfTests; ++index ) + { + const RemoveGroupsFromLineTest& test = removeGroupsFromLineTests[index]; + + if( !TestRemoveGroupsFromLine( test.description, test.input, test.groupIndex, test.numberOfGroups, test.lineHeightOffset, test.result, TEST_LOCATION ) ) + { + tet_result( TET_FAIL ); + } + } + + tet_result( TET_PASS ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/CMakeLists.txt b/automated-tests/src/dali-toolkit-unmanaged/CMakeLists.txt new file mode 100644 index 0000000..46af2cd --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/CMakeLists.txt @@ -0,0 +1,101 @@ +SET(PKG_NAME "dali-toolkit-unmanaged") + +SET(EXEC_NAME "tct-${PKG_NAME}-core") +SET(RPM_NAME "core-${PKG_NAME}-tests") + +SET(CAPI_LIB "dali-toolkit-unmanaged") + +# List of test case sources (Only these get parsed for test cases) +SET(TC_SOURCES + utc-Dali-AlbumLayout.cpp + utc-Dali-BendyEffect.cpp + utc-Dali-BlindEffect.cpp + utc-Dali-BloomView.cpp + utc-Dali-Builder.cpp + utc-Dali-CarouselEffect.cpp + utc-Dali-CheckBoxButton.cpp + utc-Dali-Cluster.cpp + utc-Dali-CubeTransitionEffect.cpp + utc-Dali-DepthLayout.cpp + utc-Dali-DisplacementEffect.cpp + utc-Dali-DistanceFieldEffect.cpp + utc-Dali-GaussianBlurView.cpp + utc-Dali-JsonParser.cpp + utc-Dali-KeyInputFocusManager.cpp + utc-Dali-NavigationControl.cpp + utc-Dali-NavigationLayout.cpp + utc-Dali-OverlayEffect.cpp + utc-Dali-Page.cpp + utc-Dali-PageTurnEffect.cpp + utc-Dali-PageTurnView.cpp + utc-Dali-RollLayout.cpp + utc-Dali-RotatingSelector.cpp + utc-Dali-ScrollView.cpp + utc-Dali-ShadowView.cpp + utc-Dali-ShearEffect.cpp + utc-Dali-Slider.cpp + utc-Dali-SoftButtonEffect.cpp + utc-Dali-SpiralLayout.cpp + utc-Dali-SpotEffect.cpp + utc-Dali-SquareDissolveEffect.cpp + utc-Dali-TableView.cpp + utc-Dali-ToolBar.cpp + utc-Dali-View.cpp + utc-Dali-WaterEffect.cpp + utc-Dali-Button.cpp + utc-Dali-ControlImpl.cpp + utc-Dali-DefaultControls.cpp + utc-Dali-ItemView.cpp + utc-Dali-KeyboardFocusManager.cpp + utc-Dali-ScrollViewEffect.cpp + utc-Dali-TextInput.cpp +) + +# Append list of test harness files (Won't get parsed for test cases) +LIST(APPEND TC_SOURCES + ../dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp + ../dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp + ../dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-application.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-gesture-manager.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp +) + + +PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED + dali-core + dali + dali-toolkit +) + +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb --coverage -Wall -Werror=return-type") + +FOREACH(directory ${${CAPI_LIB}_LIBRARY_DIRS}) + SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -L${directory}") +ENDFOREACH(directory ${CAPI_LIB_LIBRARY_DIRS}) + +INCLUDE_DIRECTORIES( + ${${CAPI_LIB}_INCLUDE_DIRS} + ../dali-toolkit/dali-toolkit-test-utils +) + +ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES}) +TARGET_LINK_LIBRARIES(${EXEC_NAME} + ${${CAPI_LIB}_LIBRARIES} +) + +INSTALL(PROGRAMS ${EXEC_NAME} + DESTINATION ${BIN_DIR}/${EXEC_NAME} +) diff --git a/automated-tests/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core.cpp b/automated-tests/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core.cpp new file mode 100644 index 0000000..b871625 --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core.cpp @@ -0,0 +1,31 @@ +#include +#include +#include "tct-dali-toolkit-unmanaged-core.h" + +int main(int argc, const char *argv[]) +{ + int result = -1; + int i; + + if (argc != 2) { + printf("Usage: %s \n", argv[0]); + return 2; + } + + for (i = 0; tc_array[i].name; i++) { + if (!strcmp(argv[1], tc_array[i].name)) { + if (tc_array[i].startup) + tc_array[i].startup(); + + result = tc_array[i].function(); + + if (tc_array[i].cleanup) + tc_array[i].cleanup(); + + return result; + } + } + + printf("Unknown testcase name: \"%s\"\n", argv[1]); + return 2; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core.h b/automated-tests/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core.h new file mode 100644 index 0000000..41dca42 --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core.h @@ -0,0 +1,712 @@ +#ifndef __TCT_DALI_TOOLKIT_UNMANAGED_CORE_H__ +#define __TCT_DALI_TOOLKIT_UNMANAGED_CORE_H__ + +#include "testcase.h" + +extern void album_layout_startup(void); +extern void album_layout_cleanup(void); +extern void bendy_effect_startup(void); +extern void bendy_effect_cleanup(void); +extern void blind_effect_startup(void); +extern void blind_effect_cleanup(void); +extern void bloom_view_startup(void); +extern void bloom_view_cleanup(void); +extern void builder_startup(void); +extern void builder_cleanup(void); +extern void carousel_effect_startup(void); +extern void carousel_effect_cleanup(void); +extern void checkbox_button_startup(void); +extern void checkbox_button_cleanup(void); +extern void cluster_startup(void); +extern void cluster_cleanup(void); +extern void cube_transition_effect_startup(void); +extern void cube_transition_effect_cleanup(void); +extern void depth_layout_startup(void); +extern void depth_layout_cleanup(void); +extern void utc_displacement_startup(void); +extern void utc_displacement_cleanup(void); +extern void utc_distance_field_effect_startup(void); +extern void utc_distance_field_effect_cleanup(void); +extern void utc_gaussian_blur_view_startup(void); +extern void utc_gaussian_blur_view_cleanup(void); +extern void utc_json_parser_startup(void); +extern void utc_json_parser_cleanup(void); +extern void key_input_focus_manager_startup(void); +extern void key_input_focus_manager_cleanup(void); +extern void navigation_control_startup(void); +extern void navigation_control_cleanup(void); +extern void overlay_effect_startup(void); +extern void overlay_effect_cleanup(void); +extern void dali_page_startup(void); +extern void dali_page_cleanup(void); +extern void page_turn_effect_startup(void); +extern void page_turn_effect_cleanup(void); +extern void dali_page_turn_view_startup(void); +extern void dali_page_turn_view_cleanup(void); +extern void dali_roll_layout_startup(void); +extern void dali_roll_layout_cleanup(void); +extern void rotating_selector_startup(void); +extern void rotating_selector_cleanup(void); +extern void scroll_view_startup(void); +extern void scroll_view_cleanup(void); +extern void shadow_view_startup(void); +extern void shadow_view_cleanup(void); +extern void shear_effect_startup(void); +extern void shear_effect_cleanup(void); +extern void dali_slider_startup(void); +extern void dali_slider_cleanup(void); +extern void soft_button_effect_startup(void); +extern void soft_button_effect_cleanup(void); +extern void spiral_layout_startup(void); +extern void spiral_layout_cleanup(void); +extern void spot_effect_startup(void); +extern void spot_effect_cleanup(void); +extern void square_dissolve_effect_startup(void); +extern void square_dissolve_effect_cleanup(void); +extern void dali_tableview_startup(void); +extern void dali_tableview_cleanup(void); +extern void dali_toolbar_startup(void); +extern void dali_toolbar_cleanup(void); +extern void dali_view_startup(void); +extern void dali_view_cleanup(void); +extern void dali_water_effect_startup(void); +extern void dali_water_effect_cleanup(void); +extern void dali_button_startup(void); +extern void dali_button_cleanup(void); +extern void control_impl_startup(void); +extern void control_impl_cleanup(void); +extern void dali_default_controls_startup(void); +extern void dali_default_controls_cleanup(void); +extern void dali_keyboard_focus_manager_startup(void); +extern void dali_keyboard_focus_manager_cleanup(void); +extern void dali_scroll_view_effect_startup(void); +extern void dali_scroll_view_effect_cleanup(void); + +extern int UtcDaliAlbumLayoutNew(void); +extern int UtcDaliAlbumSetAndGetItemSizeFunction(void); +extern int UtcDaliAlbumSetAndGetScrollSpeedFactor(void); +extern int UtcDaliAlbumSetAndGetMaximumSwipeSpeed(void); +extern int UtcDaliAlbumLayoutSetAndGetItemFlickAnimationDuration(void); +extern int UtcDaliAlbumSetNumOfItems(void); +extern int UtcDaliAlbumSetStackNum(void); +extern int UtcDaliAlbumSetPosition(void); +extern int UtcDaliAlbumSetRotationX(void); +extern int UtcDaliAlbumSetRotationZ(void); +extern int UtcDaliAlbumSetScale(void); +extern int UtcDaliAlbumSetColor(void); +extern int UtcDaliAlbumSetCenterPosition(void); +extern int UtcDaliAlbumSetSetCenterScale(void); +extern int UtcDaliAlbumSetSetCenterColor(void); +extern int UtcDaliAlbumSetStackPosition(void); +extern int UtcDaliAlbumSetSetStackScale(void); +extern int UtcDaliAlbumSetStackColor(void); +extern int UtcDaliBendyUninitializedEffect(void); +extern int UtcDaliBendyPropertyNamesEffect(void); +extern int UtcDaliBendyDefaultValuesEffect(void); +extern int UtcDaliBendyCustomValuesEffect(void); +extern int UtcDaliBlindEffectUninitialized(void); +extern int UtcDaliBlindEffectPropertyNames(void); +extern int UtcDaliBlindEffectDefaultValues(void); +extern int UtcDaliBlindEffectCustomValues(void); +extern int UtcDaliBloomViewUninitialized(void); +extern int UtcDaliBloomViewNew(void); +extern int UtcDaliBloomViewDownCast(void); +extern int UtcDaliBloomViewPropertyNames(void); +extern int UtcDaliBloomViewAddRemove(void); +extern int UtcDaliBloomActivateDeactivate(void); +extern int UtcDaliBuilderTextActorCreateFromStyle(void); +extern int UtcDaliBuilderTextActorCreateAnimation(void); +extern int UtcDaliBuilderTextActorApplyFromStyle(void); +extern int UtcDaliBuilderAddActors(void); +extern int UtcDaliBuilderAddActorsOther(void); +extern int UtcDaliBuilderStyles(void); +extern int UtcDaliBuilderSetProperty(void); +extern int UtcDaliCarouselEffectUninitialized(void); +extern int UtcDaliCarouselEffectPropertyNames(void); +extern int UtcDaliCarouselEffectDefaultValues(void); +extern int UtcDaliCarouselEffectCustomValues(void); +extern int UtcDaliCheckBoxButtonSetGetChecked(void); +extern int UtcDaliCheckBoxButtonSetImages(void); +extern int UtcDaliClusterNew(void); +extern int UtcDaliClusterDownCast(void); +extern int UtcDaliClusterAddAndRemoveChild(void); +extern int UtcDaliClusterExpandAndCollapseChild(void); +extern int UtcDaliClusterSetAndGetStyle(void); +extern int UtcDaliCubeTransitionWaveEffectNew(void); +extern int UtcDaliCubeTransitionCrossEffectNew(void); +extern int UtcDaliCubeTransitionFoldEffectNew(void); +extern int UtcDaliCubeTransitionEffectSetGetTransitionDuration(void); +extern int UtcDaliCubeTransitionEffectSetGetCubeDisplacement(void); +extern int UtcDaliCubeTransitionEffectGetRoot(void); +extern int UtcDaliCubeTransitionEffectIsTransiting(void); +extern int UtcDaliCubeTransitionEffectSetCurrentImage(void); +extern int UtcDaliCubeTransitionEffectSetTargetImage(void); +extern int UtcDaliCubeTransitionWaveEffectStartTransition(void); +extern int UtcDaliCubeTransitionCrossEffectStartTransition(void); +extern int UtcDaliCubeTransitionFoldEffectStartTransition(void); +extern int UtcDaliCubeTransitionEffectSignalTransitionCompleted(void); +extern int UtcDaliCubeTransitionEffectPauseResumeTransition(void); +extern int UtcDaliCubeTransitionWaveEffectStopTransition(void); +extern int UtcDaliCubeTransitionCrossEffectStopTransition(void); +extern int UtcDaliCubeTransitionFoldEffectStopTransition(void); +extern int UtcDaliDepthLayoutNew(void); +extern int UtcDaliDepthLayoutSetAndGetNumberOfColumns(void); +extern int UtcDaliDepthLayoutSetAndGetNumberOfRows(void); +extern int UtcDaliDepthLayoutSetAndGetRowSpacing(void); +extern int UtcDaliDepthLayoutSetAndGetTiltAngle(void); +extern int UtcDaliDepthLayoutSetAndGetItemSizeFunction(void); +extern int UtcDaliDepthLayoutSetAndGetBottomMarginFunction(void); +extern int UtcDaliDepthLayoutSetAndGetItemTiltAngle(void); +extern int UtcDaliDepthLayoutSetAndGetColumnPositionFunction(void); +extern int UtcDaliDepthLayoutSetAndGetScrollSpeedFactor(void); +extern int UtcDaliDepthLayoutSetAndGetMaximumSwipeSpeed(void); +extern int UtcDaliDepthLayoutSetAndGetItemFlickAnimationDuration(void); +extern int UtcDaliDepthLayoutConstraintLeft(void); +extern int UtcDaliDepthLayoutConstraintRight(void); +extern int UtcDaliDepthLayoutConstraintUp(void); +extern int UtcDaliDepthLayoutConstraintDown(void); +extern int UtcDaliDepthLayoutGetScrollToPosition(void); +extern int UtcDaliDepthLayoutScrollDirection(void); +extern int UtcDaliDisplacementEffectUninitialized(void); +extern int UtcDaliDisplacementEffectNew(void); +extern int UtcDaliDisplacementEffectPropertyNames(void); +extern int UtcDaliDisplacementEffectTestSetProperty(void); +extern int UtcDaliDistanceFieldEffectUninitialized(void); +extern int UtcDaliDistanceFieldEffectPropertyNames(void); +extern int UtcDaliDistanceFieldEffectDefaultValues(void); +extern int UtcDaliDistanceFieldEffectCustomValues(void); +extern int UtcDaliGaussianBlurViewUninitialized(void); +extern int UtcDaliGaussianBlurViewNew(void); +extern int UtcDaliGaussianBlurViewDownCast(void); +extern int UtcDaliGaussianBlurViewPropertyNames(void); +extern int UtcDaliGaussianBlurViewAddRemove(void); +extern int UtcDaliGaussianBlurActivateDeactivate(void); +extern int UtcDaliGaussianBlurViewSetGetBackgroundColor(void); +extern int UtcDaliGaussianBlurViewSetGetRenderTarget(void); +extern int UtcDaliJsonParserMethod01(void); +extern int UtcDaliJsonParserMethod02(void); +extern int UtcDaliJsonParserMethod03(void); +extern int UtcDaliJsonParserMethod04(void); +extern int UtcDaliJsonParserMethod05(void); +extern int UtcDaliJsonParserMethod06(void); +extern int UtcDaliJsonParserMethod07(void); +extern int UtcDaliJsonParserMethod08(void); +extern int UtcDaliJsonParserMethod09(void); +extern int UtcDaliJsonParserMethod10(void); +extern int UtcDaliKeyInputFocusManagerGet(void); +extern int UtcDaliKeyInputFocusManagerSetFocus(void); +extern int UtcDaliKeyInputFocusManagerGetCurrentFocusControl(void); +extern int UtcDaliKeyInputFocusManagerRemoveFocus(void); +extern int UtcDaliKeyInputFocusManagerIsKeyboardListener(void); +extern int UtcDaliKeyInputFocusManagerSignalKeyInputFocusChanged(void); +extern int UtcDaliKeyInputFocusManagerSignalUnhandledKeyEvent(void); +extern int UtcDaliNavigationControlNew(void); +extern int UtcDaliNavigationControlDownCast(void); +extern int UtcDaliNavigationControlPushItem(void); +extern int UtcDaliNavigationControlPopItem(void); +extern int UtcDaliNavigationControlGetItemCount(void); +extern int UtcDaliNavigationControlGetItem(void); +extern int UtcDaliNavigationControlGetCurrentItem(void); +extern int UtcDaliNavigationControlSetBackground(void); +extern int UtcDaliNavigationControlCreateNavigationToolBar(void); +extern int UtcDaliNavigationControlCreateNavigationTitleBar(void); +extern int UtcDaliNavigationLayoutNew(void); +extern int UtcDaliNavigationLayoutColumns(void); +extern int UtcDaliNavigationLayoutSetGetOrientation(void); +extern int UtcDaliNavigationLayoutTestConstraintLeft(void); +extern int UtcDaliNavigationLayoutTestConstraintRight(void); +extern int UtcDaliNavigationLayoutTestConstraintUp(void); +extern int UtcDaliNavigationLayoutTestConstraintDown(void); +extern int UtcDaliNavigationLayoutScrollDirection(void); +extern int UtcDaliNavigationLayoutSetGetColumnSpacing(void); +extern int UtcDaliNavigationLayoutSetGetTopMargin(void); +extern int UtcDaliNavigationLayoutSetGetBottomMargin(void); +extern int UtcDaliNavigationLayoutSetGetScrollSpeedFactor(void); +extern int UtcDaliNavigationLayoutSetGetMaximumSwipeSpeed(void); +extern int UtcDaliNavigationLayoutSetAndGetItemFlickAnimationDuration(void); +extern int UtcDaliNavigationLayoutGetScrollToPosition(void); +extern int UtcDaliOverlayConstructor(void); +extern int UtcDaliOverlayUninitializedEffect(void); +extern int UtcDaliPageNew(void); +extern int UtcDaliPageDownCast(void); +extern int UtcDaliPageSetGetTitle(void); +extern int UtcDaliPageSetGetSubTitle(void); +extern int UtcDaliPageSetGetTitleIcon(void); +extern int UtcDaliPageAddGetToolBarControl(void); +extern int UtcDaliPageAddGetTitleBarControl(void); +extern int UtcDaliPageSetGetPopupMenu(void); +extern int UtcDaliPageTurnEffectApply(void); +extern int UtcDaliPageTurnEffectConstruct(void); +extern int UtcDaliPageTurnPortraitViewNew(void); +extern int UtcDaliPageTurnLandscapeViewNew(void); +extern int UtcDaliPageTurnViewSetAndGetSpineShadowParameter(void); +extern int UtcDaliPageTurnViewGoToPageAndGetCurrentPage(void); +extern int UtcDaliPageTurnViewEnterLeaveEditMode(void); +extern int UtcDaliPageTurnViewGetHitActor(void); +extern int UtcDaliPageTurnViewRefresh(void); +extern int UtcDaliPageTurnViewSignals(void); +extern int UtcDaliRollLayoutNew(void); +extern int UtcDaliRollLayoutSetAndGetRowSpacing(void); +extern int UtcDaliRollLayoutSetAndGetItemSizeFunction(void); +extern int UtcDaliRollLayoutSetAndGetScrollSpeedFactor(void); +extern int UtcDaliRollLayoutSetAndGetMaximumSwipeSpeed(void); +extern int UtcDaliRollLayoutSetAndGetItemFlickAnimationDuration(void); +extern int UtcDaliRollLayoutConstraintLeft(void); +extern int UtcDaliRollLayoutConstraintRight(void); +extern int UtcDaliRollLayoutConstraintUp(void); +extern int UtcDaliRollLayoutConstraintDown(void); +extern int UtcDaliRollLayoutScrollDirection(void); +extern int UtcDaliRotatingSelectorNew(void); +extern int UtcDaliRotatingSelectorSetSelected(void); +extern int UtcDaliRotatingSelectorSetSelectedAndUnSelectedActor(void); +extern int UtcDaliRotatingSelectorSetSelectable(void); +extern int UtcDaliRotatingSelectorSignalSelected(void); +extern int UtcDaliScrollViewNew(void); +extern int UtcDaliScrollViewDownCast(void); +extern int UtcDaliScrollViewScrollToPosition(void); +extern int UtcDaliScrollViewScrollToPage(void); +extern int UtcDaliScrollViewScrollToActor(void); +extern int UtcDaliScrollViewScrollToSnapPoint(void); +extern int UtcDaliScrollViewRulerScale(void); +extern int UtcDaliScrollViewTransformTo(void); +extern int UtcDaliScrollViewRefreshInterval(void); +extern int UtcDaliScrollViewWrapMode(void); +extern int UtcDaliScrollViewActorAutoSnap(void); +extern int UtcDaliScrollViewSignalsStartComplete(void); +extern int UtcDaliScrollViewSignalsUpdate(void); +extern int UtcDaliScrollViewSignalsClamped(void); +extern int UtcDaliScrollViewScrollSensitive(void); +extern int UtcDaliScrollViewTouchesRequired(void); +extern int UtcDaliScrollViewAxisAutoLock(void); +extern int UtcDaliScrollViewAxisAutoLockGradient(void); +extern int UtcDaliScrollViewConstraints(void); +extern int UtcDaliScrollViewBind(void); +extern int UtcDaliRulerEnableDisable(void); +extern int UtcDaliRulerDomainEnableDisable(void); +extern int UtcDaliRulerSnapAndClamp(void); +extern int UtcDaliRulerFixedRulerSpacing(void); +extern int UtcDaliScrollViewOvershoot(void); +extern int UtcDaliScrollViewSnapAlphaFunction(void); +extern int UtcDaliScrollViewSnapDuration(void); +extern int UtcDaliScrollViewSignalsSnapStart(void); +extern int UtcDaliScrollViewSetMouseWheelScrollDistanceStep(void); +extern int UtcDaliScrollViewGetSet(void); +extern int UtcDaliShadowViewUninitialized(void); +extern int UtcDaliShadowViewNew(void); +extern int UtcDaliShadowViewDownCast(void); +extern int UtcDaliShadowViewPropertyNames(void); +extern int UtcDaliShadowViewAddRemove(void); +extern int UtcDaliShadowViewActivateDeactivate(void); +extern int UtcDaliShearEffectUninitialized(void); +extern int UtcDaliShearEffectPropertyNames(void); +extern int UtcDaliShearEffectDefaultValues(void); +extern int UtcDaliShearEffectCustomValues(void); +extern int UtcDaliSliderNew(void); +extern int UtcDaliSliderDestructor(void); +extern int UtcDaliSliderDownCast(void); +extern int UtcDaliSliderSignals(void); +extern int UtcDaliSoftButtonEffectUninitialized(void); +extern int UtcDaliSoftButtonEffectNew(void); +extern int UtcDaliSoftButtonEffectPropertyNames(void); +extern int UtcDaliSpiralLayoutNew(void); +extern int UtcDaliSpiralSetAndGetItemSizeFunction(void); +extern int UtcDaliSpiralSetAndGetItemSpacing(void); +extern int UtcDaliSpiralSetAndGetRevolutionDistance(void); +extern int UtcDaliSpiralSetAndGetSpiralRadiusFunction(void); +extern int UtcDaliSpiralSetAndGetTopItemAlignment(void); +extern int UtcDaliSpiralSetAndGetScrollSpeedFactor(void); +extern int UtcDaliSpiralSetAndGetMaximumSwipeSpeed(void); +extern int UtcDaliSpiralLayoutSetAndGetItemFlickAnimationDuration(void); +extern int UtcDaliSpiralLayoutConstraintLeft(void); +extern int UtcDaliSpiralLayoutConstraintRight(void); +extern int UtcDaliSpiralLayoutConstraintUp(void); +extern int UtcDaliSpiralLayoutConstraintDown(void); +extern int UtcDaliSpiralLayoutScrollDirection(void); +extern int UtcDaliSpiralLayoutGetScrollToPosition(void); +extern int UtcDaliSpotUninitializedEffect(void); +extern int UtcDaliSpotPropertyNamesEffect(void); +extern int UtcDaliSpotDefaultValuesEffect(void); +extern int UtcDaliSpotCustomValuesEffect(void); +extern int UtcDaliSquareDissolveEffectUninitialized(void); +extern int UtcDaliSquareDissolveEffectPropertyNames(void); +extern int UtcDaliSquareDissolveEffectDefaultValues(void); +extern int UtcDaliSquareDissolveEffectCustomValues(void); +extern int UtcDaliTableViewNew(void); +extern int UtcDaliTableViewMetricsPadding(void); +extern int UtcDaliTableViewMetricsFixed(void); +extern int UtcDaliTableViewMetricsRelative(void); +extern int UtcDaliTableViewAnimation(void); +extern int UtcDaliTableViewChild(void); +extern int UtcDaliTableViewAdd(void); +extern int UtcDaliTableViewCells(void); +extern int UtcDaliTableViewChildAssert(void); +extern int UtcDaliTableViewMetricsAssert(void); +extern int UtcDaliToolBarNew(void); +extern int UtcDaliToolBarSetBackground(void); +extern int UtcDaliToolBarAddControl01(void); +extern int UtcDaliToolBarAddControl02(void); +extern int UtcDaliToolBarRemoveControl01(void); +extern int UtcDaliToolBarRemoveControl02(void); +extern int UtcDaliViewNew(void); +extern int UtcDaliViewAddGetRemoveContentLayer01(void); +extern int UtcDaliViewAddGetRemoveContentLayer02(void); +extern int UtcDaliViewSetGetBackgroundLayer01(void); +extern int UtcDaliViewSetGetBackgroundLayer02(void); +extern int UtcDaliViewSetOrientationFunction(void); +extern int UtcDaliViewOrientationChanged(void); +extern int UtcSetAutoRotate(void); +extern int UtcDaliWaterEffectUninitialized(void); +extern int UtcDaliWaterEffectPropertyNames(void); +extern int UtcDaliWaterEffectOutOfBounds(void); +extern int UtcDaliWaterEffectDefaultValues(void); +extern int UtcDaliWaterEffectCustomValues(void); +extern int UtcDaliWaterEffectGetAmplitudePositive(void); +extern int UtcDaliWaterEffectGetAmplitudeNegative(void); +extern int UtcDaliWaterEffectGetCenterPositive(void); +extern int UtcDaliWaterEffectGetCenterNegative(void); +extern int UtcDaliWaterEffectGetPropagationPositive(void); +extern int UtcDaliWaterEffectGetPropagationNegative(void); +extern int UtcDaliButtonNew(void); +extern int UtcDaliButtonProperties(void); +extern int UtcDaliButtonSetGetDimmed(void); +extern int UtcDaliControlImplTypeRegistry(void); +extern int UtcDaliControlImplMouseWheelEvent(void); +extern int UtcDaliDefaultControlsCreateCheckBoxButton(void); +extern int UtcDaliItemViewAddAndGetLayout(void); +extern int UtcDaliItemViewAddAndRemoveLayout(void); +extern int UtcDaliItemViewActivateLayoutAndGetActiveLayout(void); +extern int UtcDaliKeyboardFocusManagerGet(void); +extern int UtcDaliKeyboardFocusManagerMoveFocus(void); +extern int UtcDaliKeyboardFocusManagerSignalFocusGroupChanged(void); +extern int UtcDaliScrollViewPageCubeEffectSetup(void); +extern int UtcDaliScrollViewPageCarouselEffectSetup(void); +extern int UtcDaliScrollViewCarouselEffectSetup(void); +extern int UtcDaliScrollViewDepthEffectSetup(void); +extern int UtcDaliScrollViewPageCubeEffectTest(void); +extern int UtcDaliScrollViewPageCarouselEffectTest(void); +extern int UtcDaliScrollViewCarouselEffectTest(void); +extern int UtcDaliScrollViewDepthEffectTest(void); +extern int UtcDaliTextInputSetActiveStyle(void); +extern int UtcDaliTextInputApplyStyleToSelectedText(void); +extern int UtcDaliTextInputApplyStyleToAll(void); +extern int UtcDaliTextInputGetStyleAtCursor(void); +extern int UtcDaliTextInputSetAndGetTextAlignment(void); +extern int UtcDaliTextInputSetAndGetMultilinePolicy(void); +extern int UtcDaliTextInputSetAndGetExceedEnabled(void); + +testcase tc_array[] = { + {"UtcDaliAlbumLayoutNew", UtcDaliAlbumLayoutNew, album_layout_startup, album_layout_cleanup}, + {"UtcDaliAlbumSetAndGetItemSizeFunction", UtcDaliAlbumSetAndGetItemSizeFunction, album_layout_startup, album_layout_cleanup}, + {"UtcDaliAlbumSetAndGetScrollSpeedFactor", UtcDaliAlbumSetAndGetScrollSpeedFactor, album_layout_startup, album_layout_cleanup}, + {"UtcDaliAlbumSetAndGetMaximumSwipeSpeed", UtcDaliAlbumSetAndGetMaximumSwipeSpeed, album_layout_startup, album_layout_cleanup}, + {"UtcDaliAlbumLayoutSetAndGetItemFlickAnimationDuration", UtcDaliAlbumLayoutSetAndGetItemFlickAnimationDuration, album_layout_startup, album_layout_cleanup}, + {"UtcDaliAlbumSetNumOfItems", UtcDaliAlbumSetNumOfItems, album_layout_startup, album_layout_cleanup}, + {"UtcDaliAlbumSetStackNum", UtcDaliAlbumSetStackNum, album_layout_startup, album_layout_cleanup}, + {"UtcDaliAlbumSetPosition", UtcDaliAlbumSetPosition, album_layout_startup, album_layout_cleanup}, + {"UtcDaliAlbumSetRotationX", UtcDaliAlbumSetRotationX, album_layout_startup, album_layout_cleanup}, + {"UtcDaliAlbumSetRotationZ", UtcDaliAlbumSetRotationZ, album_layout_startup, album_layout_cleanup}, + {"UtcDaliAlbumSetScale", UtcDaliAlbumSetScale, album_layout_startup, album_layout_cleanup}, + {"UtcDaliAlbumSetColor", UtcDaliAlbumSetColor, album_layout_startup, album_layout_cleanup}, + {"UtcDaliAlbumSetCenterPosition", UtcDaliAlbumSetCenterPosition, album_layout_startup, album_layout_cleanup}, + {"UtcDaliAlbumSetSetCenterScale", UtcDaliAlbumSetSetCenterScale, album_layout_startup, album_layout_cleanup}, + {"UtcDaliAlbumSetSetCenterColor", UtcDaliAlbumSetSetCenterColor, album_layout_startup, album_layout_cleanup}, + {"UtcDaliAlbumSetStackPosition", UtcDaliAlbumSetStackPosition, album_layout_startup, album_layout_cleanup}, + {"UtcDaliAlbumSetSetStackScale", UtcDaliAlbumSetSetStackScale, album_layout_startup, album_layout_cleanup}, + {"UtcDaliAlbumSetStackColor", UtcDaliAlbumSetStackColor, album_layout_startup, album_layout_cleanup}, + {"UtcDaliBendyUninitializedEffect", UtcDaliBendyUninitializedEffect, bendy_effect_startup, bendy_effect_cleanup}, + {"UtcDaliBendyPropertyNamesEffect", UtcDaliBendyPropertyNamesEffect, bendy_effect_startup, bendy_effect_cleanup}, + {"UtcDaliBendyDefaultValuesEffect", UtcDaliBendyDefaultValuesEffect, bendy_effect_startup, bendy_effect_cleanup}, + {"UtcDaliBendyCustomValuesEffect", UtcDaliBendyCustomValuesEffect, bendy_effect_startup, bendy_effect_cleanup}, + {"UtcDaliBlindEffectUninitialized", UtcDaliBlindEffectUninitialized, blind_effect_startup, blind_effect_cleanup}, + {"UtcDaliBlindEffectPropertyNames", UtcDaliBlindEffectPropertyNames, blind_effect_startup, blind_effect_cleanup}, + {"UtcDaliBlindEffectDefaultValues", UtcDaliBlindEffectDefaultValues, blind_effect_startup, blind_effect_cleanup}, + {"UtcDaliBlindEffectCustomValues", UtcDaliBlindEffectCustomValues, blind_effect_startup, blind_effect_cleanup}, + {"UtcDaliBloomViewUninitialized", UtcDaliBloomViewUninitialized, bloom_view_startup, bloom_view_cleanup}, + {"UtcDaliBloomViewNew", UtcDaliBloomViewNew, bloom_view_startup, bloom_view_cleanup}, + {"UtcDaliBloomViewDownCast", UtcDaliBloomViewDownCast, bloom_view_startup, bloom_view_cleanup}, + {"UtcDaliBloomViewPropertyNames", UtcDaliBloomViewPropertyNames, bloom_view_startup, bloom_view_cleanup}, + {"UtcDaliBloomViewAddRemove", UtcDaliBloomViewAddRemove, bloom_view_startup, bloom_view_cleanup}, + {"UtcDaliBloomActivateDeactivate", UtcDaliBloomActivateDeactivate, bloom_view_startup, bloom_view_cleanup}, + {"UtcDaliBuilderTextActorCreateFromStyle", UtcDaliBuilderTextActorCreateFromStyle, builder_startup, builder_cleanup}, + {"UtcDaliBuilderTextActorCreateAnimation", UtcDaliBuilderTextActorCreateAnimation, builder_startup, builder_cleanup}, + {"UtcDaliBuilderTextActorApplyFromStyle", UtcDaliBuilderTextActorApplyFromStyle, builder_startup, builder_cleanup}, + {"UtcDaliBuilderAddActors", UtcDaliBuilderAddActors, builder_startup, builder_cleanup}, + {"UtcDaliBuilderAddActorsOther", UtcDaliBuilderAddActorsOther, builder_startup, builder_cleanup}, + {"UtcDaliBuilderStyles", UtcDaliBuilderStyles, builder_startup, builder_cleanup}, + {"UtcDaliBuilderSetProperty", UtcDaliBuilderSetProperty, builder_startup, builder_cleanup}, + {"UtcDaliCarouselEffectUninitialized", UtcDaliCarouselEffectUninitialized, carousel_effect_startup, carousel_effect_cleanup}, + {"UtcDaliCarouselEffectPropertyNames", UtcDaliCarouselEffectPropertyNames, carousel_effect_startup, carousel_effect_cleanup}, + {"UtcDaliCarouselEffectDefaultValues", UtcDaliCarouselEffectDefaultValues, carousel_effect_startup, carousel_effect_cleanup}, + {"UtcDaliCarouselEffectCustomValues", UtcDaliCarouselEffectCustomValues, carousel_effect_startup, carousel_effect_cleanup}, + {"UtcDaliCheckBoxButtonSetGetChecked", UtcDaliCheckBoxButtonSetGetChecked, checkbox_button_startup, checkbox_button_cleanup}, + {"UtcDaliCheckBoxButtonSetImages", UtcDaliCheckBoxButtonSetImages, checkbox_button_startup, checkbox_button_cleanup}, + {"UtcDaliClusterNew", UtcDaliClusterNew, cluster_startup, cluster_cleanup}, + {"UtcDaliClusterDownCast", UtcDaliClusterDownCast, cluster_startup, cluster_cleanup}, + {"UtcDaliClusterAddAndRemoveChild", UtcDaliClusterAddAndRemoveChild, cluster_startup, cluster_cleanup}, + {"UtcDaliClusterExpandAndCollapseChild", UtcDaliClusterExpandAndCollapseChild, cluster_startup, cluster_cleanup}, + {"UtcDaliClusterSetAndGetStyle", UtcDaliClusterSetAndGetStyle, cluster_startup, cluster_cleanup}, + {"UtcDaliCubeTransitionWaveEffectNew", UtcDaliCubeTransitionWaveEffectNew, cube_transition_effect_startup, cube_transition_effect_cleanup}, + {"UtcDaliCubeTransitionCrossEffectNew", UtcDaliCubeTransitionCrossEffectNew, cube_transition_effect_startup, cube_transition_effect_cleanup}, + {"UtcDaliCubeTransitionFoldEffectNew", UtcDaliCubeTransitionFoldEffectNew, cube_transition_effect_startup, cube_transition_effect_cleanup}, + {"UtcDaliCubeTransitionEffectSetGetTransitionDuration", UtcDaliCubeTransitionEffectSetGetTransitionDuration, cube_transition_effect_startup, cube_transition_effect_cleanup}, + {"UtcDaliCubeTransitionEffectSetGetCubeDisplacement", UtcDaliCubeTransitionEffectSetGetCubeDisplacement, cube_transition_effect_startup, cube_transition_effect_cleanup}, + {"UtcDaliCubeTransitionEffectGetRoot", UtcDaliCubeTransitionEffectGetRoot, cube_transition_effect_startup, cube_transition_effect_cleanup}, + {"UtcDaliCubeTransitionEffectIsTransiting", UtcDaliCubeTransitionEffectIsTransiting, cube_transition_effect_startup, cube_transition_effect_cleanup}, + {"UtcDaliCubeTransitionEffectSetCurrentImage", UtcDaliCubeTransitionEffectSetCurrentImage, cube_transition_effect_startup, cube_transition_effect_cleanup}, + {"UtcDaliCubeTransitionEffectSetTargetImage", UtcDaliCubeTransitionEffectSetTargetImage, cube_transition_effect_startup, cube_transition_effect_cleanup}, + {"UtcDaliCubeTransitionWaveEffectStartTransition", UtcDaliCubeTransitionWaveEffectStartTransition, cube_transition_effect_startup, cube_transition_effect_cleanup}, + {"UtcDaliCubeTransitionCrossEffectStartTransition", UtcDaliCubeTransitionCrossEffectStartTransition, cube_transition_effect_startup, cube_transition_effect_cleanup}, + {"UtcDaliCubeTransitionFoldEffectStartTransition", UtcDaliCubeTransitionFoldEffectStartTransition, cube_transition_effect_startup, cube_transition_effect_cleanup}, + {"UtcDaliCubeTransitionEffectSignalTransitionCompleted", UtcDaliCubeTransitionEffectSignalTransitionCompleted, cube_transition_effect_startup, cube_transition_effect_cleanup}, + {"UtcDaliCubeTransitionEffectPauseResumeTransition", UtcDaliCubeTransitionEffectPauseResumeTransition, cube_transition_effect_startup, cube_transition_effect_cleanup}, + {"UtcDaliCubeTransitionWaveEffectStopTransition", UtcDaliCubeTransitionWaveEffectStopTransition, cube_transition_effect_startup, cube_transition_effect_cleanup}, + {"UtcDaliCubeTransitionCrossEffectStopTransition", UtcDaliCubeTransitionCrossEffectStopTransition, cube_transition_effect_startup, cube_transition_effect_cleanup}, + {"UtcDaliCubeTransitionFoldEffectStopTransition", UtcDaliCubeTransitionFoldEffectStopTransition, cube_transition_effect_startup, cube_transition_effect_cleanup}, + {"UtcDaliDepthLayoutNew", UtcDaliDepthLayoutNew, depth_layout_startup, depth_layout_cleanup}, + {"UtcDaliDepthLayoutSetAndGetNumberOfColumns", UtcDaliDepthLayoutSetAndGetNumberOfColumns, depth_layout_startup, depth_layout_cleanup}, + {"UtcDaliDepthLayoutSetAndGetNumberOfRows", UtcDaliDepthLayoutSetAndGetNumberOfRows, depth_layout_startup, depth_layout_cleanup}, + {"UtcDaliDepthLayoutSetAndGetRowSpacing", UtcDaliDepthLayoutSetAndGetRowSpacing, depth_layout_startup, depth_layout_cleanup}, + {"UtcDaliDepthLayoutSetAndGetTiltAngle", UtcDaliDepthLayoutSetAndGetTiltAngle, depth_layout_startup, depth_layout_cleanup}, + {"UtcDaliDepthLayoutSetAndGetItemSizeFunction", UtcDaliDepthLayoutSetAndGetItemSizeFunction, depth_layout_startup, depth_layout_cleanup}, + {"UtcDaliDepthLayoutSetAndGetBottomMarginFunction", UtcDaliDepthLayoutSetAndGetBottomMarginFunction, depth_layout_startup, depth_layout_cleanup}, + {"UtcDaliDepthLayoutSetAndGetItemTiltAngle", UtcDaliDepthLayoutSetAndGetItemTiltAngle, depth_layout_startup, depth_layout_cleanup}, + {"UtcDaliDepthLayoutSetAndGetColumnPositionFunction", UtcDaliDepthLayoutSetAndGetColumnPositionFunction, depth_layout_startup, depth_layout_cleanup}, + {"UtcDaliDepthLayoutSetAndGetScrollSpeedFactor", UtcDaliDepthLayoutSetAndGetScrollSpeedFactor, depth_layout_startup, depth_layout_cleanup}, + {"UtcDaliDepthLayoutSetAndGetMaximumSwipeSpeed", UtcDaliDepthLayoutSetAndGetMaximumSwipeSpeed, depth_layout_startup, depth_layout_cleanup}, + {"UtcDaliDepthLayoutSetAndGetItemFlickAnimationDuration", UtcDaliDepthLayoutSetAndGetItemFlickAnimationDuration, depth_layout_startup, depth_layout_cleanup}, + {"UtcDaliDepthLayoutConstraintLeft", UtcDaliDepthLayoutConstraintLeft, depth_layout_startup, depth_layout_cleanup}, + {"UtcDaliDepthLayoutConstraintRight", UtcDaliDepthLayoutConstraintRight, depth_layout_startup, depth_layout_cleanup}, + {"UtcDaliDepthLayoutConstraintUp", UtcDaliDepthLayoutConstraintUp, depth_layout_startup, depth_layout_cleanup}, + {"UtcDaliDepthLayoutConstraintDown", UtcDaliDepthLayoutConstraintDown, depth_layout_startup, depth_layout_cleanup}, + {"UtcDaliDepthLayoutGetScrollToPosition", UtcDaliDepthLayoutGetScrollToPosition, depth_layout_startup, depth_layout_cleanup}, + {"UtcDaliDepthLayoutScrollDirection", UtcDaliDepthLayoutScrollDirection, depth_layout_startup, depth_layout_cleanup}, + {"UtcDaliDisplacementEffectUninitialized", UtcDaliDisplacementEffectUninitialized, utc_displacement_startup, utc_displacement_cleanup}, + {"UtcDaliDisplacementEffectNew", UtcDaliDisplacementEffectNew, utc_displacement_startup, utc_displacement_cleanup}, + {"UtcDaliDisplacementEffectPropertyNames", UtcDaliDisplacementEffectPropertyNames, utc_displacement_startup, utc_displacement_cleanup}, + {"UtcDaliDisplacementEffectTestSetProperty", UtcDaliDisplacementEffectTestSetProperty, utc_displacement_startup, utc_displacement_cleanup}, + {"UtcDaliDistanceFieldEffectUninitialized", UtcDaliDistanceFieldEffectUninitialized, utc_distance_field_effect_startup, utc_distance_field_effect_cleanup}, + {"UtcDaliDistanceFieldEffectPropertyNames", UtcDaliDistanceFieldEffectPropertyNames, utc_distance_field_effect_startup, utc_distance_field_effect_cleanup}, + {"UtcDaliDistanceFieldEffectDefaultValues", UtcDaliDistanceFieldEffectDefaultValues, utc_distance_field_effect_startup, utc_distance_field_effect_cleanup}, + {"UtcDaliDistanceFieldEffectCustomValues", UtcDaliDistanceFieldEffectCustomValues, utc_distance_field_effect_startup, utc_distance_field_effect_cleanup}, + {"UtcDaliGaussianBlurViewUninitialized", UtcDaliGaussianBlurViewUninitialized, utc_gaussian_blur_view_startup, utc_gaussian_blur_view_cleanup}, + {"UtcDaliGaussianBlurViewNew", UtcDaliGaussianBlurViewNew, utc_gaussian_blur_view_startup, utc_gaussian_blur_view_cleanup}, + {"UtcDaliGaussianBlurViewDownCast", UtcDaliGaussianBlurViewDownCast, utc_gaussian_blur_view_startup, utc_gaussian_blur_view_cleanup}, + {"UtcDaliGaussianBlurViewPropertyNames", UtcDaliGaussianBlurViewPropertyNames, utc_gaussian_blur_view_startup, utc_gaussian_blur_view_cleanup}, + {"UtcDaliGaussianBlurViewAddRemove", UtcDaliGaussianBlurViewAddRemove, utc_gaussian_blur_view_startup, utc_gaussian_blur_view_cleanup}, + {"UtcDaliGaussianBlurActivateDeactivate", UtcDaliGaussianBlurActivateDeactivate, utc_gaussian_blur_view_startup, utc_gaussian_blur_view_cleanup}, + {"UtcDaliGaussianBlurViewSetGetBackgroundColor", UtcDaliGaussianBlurViewSetGetBackgroundColor, utc_gaussian_blur_view_startup, utc_gaussian_blur_view_cleanup}, + {"UtcDaliGaussianBlurViewSetGetRenderTarget", UtcDaliGaussianBlurViewSetGetRenderTarget, utc_gaussian_blur_view_startup, utc_gaussian_blur_view_cleanup}, + {"UtcDaliJsonParserMethod01", UtcDaliJsonParserMethod01, utc_json_parser_startup, utc_json_parser_cleanup}, + {"UtcDaliJsonParserMethod02", UtcDaliJsonParserMethod02, utc_json_parser_startup, utc_json_parser_cleanup}, + {"UtcDaliJsonParserMethod03", UtcDaliJsonParserMethod03, utc_json_parser_startup, utc_json_parser_cleanup}, + {"UtcDaliJsonParserMethod04", UtcDaliJsonParserMethod04, utc_json_parser_startup, utc_json_parser_cleanup}, + {"UtcDaliJsonParserMethod05", UtcDaliJsonParserMethod05, utc_json_parser_startup, utc_json_parser_cleanup}, + {"UtcDaliJsonParserMethod06", UtcDaliJsonParserMethod06, utc_json_parser_startup, utc_json_parser_cleanup}, + {"UtcDaliJsonParserMethod07", UtcDaliJsonParserMethod07, utc_json_parser_startup, utc_json_parser_cleanup}, + {"UtcDaliJsonParserMethod08", UtcDaliJsonParserMethod08, utc_json_parser_startup, utc_json_parser_cleanup}, + {"UtcDaliJsonParserMethod09", UtcDaliJsonParserMethod09, utc_json_parser_startup, utc_json_parser_cleanup}, + {"UtcDaliJsonParserMethod10", UtcDaliJsonParserMethod10, utc_json_parser_startup, utc_json_parser_cleanup}, + {"UtcDaliKeyInputFocusManagerGet", UtcDaliKeyInputFocusManagerGet, key_input_focus_manager_startup, key_input_focus_manager_cleanup}, + {"UtcDaliKeyInputFocusManagerSetFocus", UtcDaliKeyInputFocusManagerSetFocus, key_input_focus_manager_startup, key_input_focus_manager_cleanup}, + {"UtcDaliKeyInputFocusManagerGetCurrentFocusControl", UtcDaliKeyInputFocusManagerGetCurrentFocusControl, key_input_focus_manager_startup, key_input_focus_manager_cleanup}, + {"UtcDaliKeyInputFocusManagerRemoveFocus", UtcDaliKeyInputFocusManagerRemoveFocus, key_input_focus_manager_startup, key_input_focus_manager_cleanup}, + {"UtcDaliKeyInputFocusManagerIsKeyboardListener", UtcDaliKeyInputFocusManagerIsKeyboardListener, key_input_focus_manager_startup, key_input_focus_manager_cleanup}, + {"UtcDaliKeyInputFocusManagerSignalKeyInputFocusChanged", UtcDaliKeyInputFocusManagerSignalKeyInputFocusChanged, key_input_focus_manager_startup, key_input_focus_manager_cleanup}, + {"UtcDaliKeyInputFocusManagerSignalUnhandledKeyEvent", UtcDaliKeyInputFocusManagerSignalUnhandledKeyEvent, key_input_focus_manager_startup, key_input_focus_manager_cleanup}, + {"UtcDaliNavigationControlNew", UtcDaliNavigationControlNew, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliNavigationControlDownCast", UtcDaliNavigationControlDownCast, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliNavigationControlPushItem", UtcDaliNavigationControlPushItem, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliNavigationControlPopItem", UtcDaliNavigationControlPopItem, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliNavigationControlGetItemCount", UtcDaliNavigationControlGetItemCount, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliNavigationControlGetItem", UtcDaliNavigationControlGetItem, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliNavigationControlGetCurrentItem", UtcDaliNavigationControlGetCurrentItem, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliNavigationControlSetBackground", UtcDaliNavigationControlSetBackground, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliNavigationControlCreateNavigationToolBar", UtcDaliNavigationControlCreateNavigationToolBar, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliNavigationControlCreateNavigationTitleBar", UtcDaliNavigationControlCreateNavigationTitleBar, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliNavigationLayoutNew", UtcDaliNavigationLayoutNew, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliNavigationLayoutColumns", UtcDaliNavigationLayoutColumns, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliNavigationLayoutSetGetOrientation", UtcDaliNavigationLayoutSetGetOrientation, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliNavigationLayoutTestConstraintLeft", UtcDaliNavigationLayoutTestConstraintLeft, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliNavigationLayoutTestConstraintRight", UtcDaliNavigationLayoutTestConstraintRight, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliNavigationLayoutTestConstraintUp", UtcDaliNavigationLayoutTestConstraintUp, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliNavigationLayoutTestConstraintDown", UtcDaliNavigationLayoutTestConstraintDown, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliNavigationLayoutScrollDirection", UtcDaliNavigationLayoutScrollDirection, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliNavigationLayoutSetGetColumnSpacing", UtcDaliNavigationLayoutSetGetColumnSpacing, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliNavigationLayoutSetGetTopMargin", UtcDaliNavigationLayoutSetGetTopMargin, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliNavigationLayoutSetGetBottomMargin", UtcDaliNavigationLayoutSetGetBottomMargin, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliNavigationLayoutSetGetScrollSpeedFactor", UtcDaliNavigationLayoutSetGetScrollSpeedFactor, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliNavigationLayoutSetGetMaximumSwipeSpeed", UtcDaliNavigationLayoutSetGetMaximumSwipeSpeed, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliNavigationLayoutSetAndGetItemFlickAnimationDuration", UtcDaliNavigationLayoutSetAndGetItemFlickAnimationDuration, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliNavigationLayoutGetScrollToPosition", UtcDaliNavigationLayoutGetScrollToPosition, navigation_control_startup, navigation_control_cleanup}, + {"UtcDaliOverlayConstructor", UtcDaliOverlayConstructor, overlay_effect_startup, overlay_effect_cleanup}, + {"UtcDaliOverlayUninitializedEffect", UtcDaliOverlayUninitializedEffect, overlay_effect_startup, overlay_effect_cleanup}, + {"UtcDaliPageNew", UtcDaliPageNew, dali_page_startup, dali_page_cleanup}, + {"UtcDaliPageDownCast", UtcDaliPageDownCast, dali_page_startup, dali_page_cleanup}, + {"UtcDaliPageSetGetTitle", UtcDaliPageSetGetTitle, dali_page_startup, dali_page_cleanup}, + {"UtcDaliPageSetGetSubTitle", UtcDaliPageSetGetSubTitle, dali_page_startup, dali_page_cleanup}, + {"UtcDaliPageSetGetTitleIcon", UtcDaliPageSetGetTitleIcon, dali_page_startup, dali_page_cleanup}, + {"UtcDaliPageAddGetToolBarControl", UtcDaliPageAddGetToolBarControl, dali_page_startup, dali_page_cleanup}, + {"UtcDaliPageAddGetTitleBarControl", UtcDaliPageAddGetTitleBarControl, dali_page_startup, dali_page_cleanup}, + {"UtcDaliPageSetGetPopupMenu", UtcDaliPageSetGetPopupMenu, dali_page_startup, dali_page_cleanup}, + {"UtcDaliPageTurnEffectApply", UtcDaliPageTurnEffectApply, page_turn_effect_startup, page_turn_effect_cleanup}, + {"UtcDaliPageTurnEffectConstruct", UtcDaliPageTurnEffectConstruct, page_turn_effect_startup, page_turn_effect_cleanup}, + {"UtcDaliPageTurnPortraitViewNew", UtcDaliPageTurnPortraitViewNew, dali_page_turn_view_startup, dali_page_turn_view_cleanup}, + {"UtcDaliPageTurnLandscapeViewNew", UtcDaliPageTurnLandscapeViewNew, dali_page_turn_view_startup, dali_page_turn_view_cleanup}, + {"UtcDaliPageTurnViewSetAndGetSpineShadowParameter", UtcDaliPageTurnViewSetAndGetSpineShadowParameter, dali_page_turn_view_startup, dali_page_turn_view_cleanup}, + {"UtcDaliPageTurnViewGoToPageAndGetCurrentPage", UtcDaliPageTurnViewGoToPageAndGetCurrentPage, dali_page_turn_view_startup, dali_page_turn_view_cleanup}, + {"UtcDaliPageTurnViewEnterLeaveEditMode", UtcDaliPageTurnViewEnterLeaveEditMode, dali_page_turn_view_startup, dali_page_turn_view_cleanup}, + {"UtcDaliPageTurnViewGetHitActor", UtcDaliPageTurnViewGetHitActor, dali_page_turn_view_startup, dali_page_turn_view_cleanup}, + {"UtcDaliPageTurnViewRefresh", UtcDaliPageTurnViewRefresh, dali_page_turn_view_startup, dali_page_turn_view_cleanup}, + {"UtcDaliPageTurnViewSignals", UtcDaliPageTurnViewSignals, dali_page_turn_view_startup, dali_page_turn_view_cleanup}, + {"UtcDaliRollLayoutNew", UtcDaliRollLayoutNew, dali_roll_layout_startup, dali_roll_layout_cleanup}, + {"UtcDaliRollLayoutSetAndGetRowSpacing", UtcDaliRollLayoutSetAndGetRowSpacing, dali_roll_layout_startup, dali_roll_layout_cleanup}, + {"UtcDaliRollLayoutSetAndGetItemSizeFunction", UtcDaliRollLayoutSetAndGetItemSizeFunction, dali_roll_layout_startup, dali_roll_layout_cleanup}, + {"UtcDaliRollLayoutSetAndGetScrollSpeedFactor", UtcDaliRollLayoutSetAndGetScrollSpeedFactor, dali_roll_layout_startup, dali_roll_layout_cleanup}, + {"UtcDaliRollLayoutSetAndGetMaximumSwipeSpeed", UtcDaliRollLayoutSetAndGetMaximumSwipeSpeed, dali_roll_layout_startup, dali_roll_layout_cleanup}, + {"UtcDaliRollLayoutSetAndGetItemFlickAnimationDuration", UtcDaliRollLayoutSetAndGetItemFlickAnimationDuration, dali_roll_layout_startup, dali_roll_layout_cleanup}, + {"UtcDaliRollLayoutConstraintLeft", UtcDaliRollLayoutConstraintLeft, dali_roll_layout_startup, dali_roll_layout_cleanup}, + {"UtcDaliRollLayoutConstraintRight", UtcDaliRollLayoutConstraintRight, dali_roll_layout_startup, dali_roll_layout_cleanup}, + {"UtcDaliRollLayoutConstraintUp", UtcDaliRollLayoutConstraintUp, dali_roll_layout_startup, dali_roll_layout_cleanup}, + {"UtcDaliRollLayoutConstraintDown", UtcDaliRollLayoutConstraintDown, dali_roll_layout_startup, dali_roll_layout_cleanup}, + {"UtcDaliRollLayoutScrollDirection", UtcDaliRollLayoutScrollDirection, dali_roll_layout_startup, dali_roll_layout_cleanup}, + {"UtcDaliRotatingSelectorNew", UtcDaliRotatingSelectorNew, rotating_selector_startup, rotating_selector_cleanup}, + {"UtcDaliRotatingSelectorSetSelected", UtcDaliRotatingSelectorSetSelected, rotating_selector_startup, rotating_selector_cleanup}, + {"UtcDaliRotatingSelectorSetSelectedAndUnSelectedActor", UtcDaliRotatingSelectorSetSelectedAndUnSelectedActor, rotating_selector_startup, rotating_selector_cleanup}, + {"UtcDaliRotatingSelectorSetSelectable", UtcDaliRotatingSelectorSetSelectable, rotating_selector_startup, rotating_selector_cleanup}, + {"UtcDaliRotatingSelectorSignalSelected", UtcDaliRotatingSelectorSignalSelected, rotating_selector_startup, rotating_selector_cleanup}, + {"UtcDaliScrollViewNew", UtcDaliScrollViewNew, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewDownCast", UtcDaliScrollViewDownCast, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewScrollToPosition", UtcDaliScrollViewScrollToPosition, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewScrollToPage", UtcDaliScrollViewScrollToPage, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewScrollToActor", UtcDaliScrollViewScrollToActor, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewScrollToSnapPoint", UtcDaliScrollViewScrollToSnapPoint, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewRulerScale", UtcDaliScrollViewRulerScale, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewTransformTo", UtcDaliScrollViewTransformTo, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewRefreshInterval", UtcDaliScrollViewRefreshInterval, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewWrapMode", UtcDaliScrollViewWrapMode, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewActorAutoSnap", UtcDaliScrollViewActorAutoSnap, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewSignalsStartComplete", UtcDaliScrollViewSignalsStartComplete, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewSignalsUpdate", UtcDaliScrollViewSignalsUpdate, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewSignalsClamped", UtcDaliScrollViewSignalsClamped, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewScrollSensitive", UtcDaliScrollViewScrollSensitive, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewTouchesRequired", UtcDaliScrollViewTouchesRequired, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewAxisAutoLock", UtcDaliScrollViewAxisAutoLock, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewAxisAutoLockGradient", UtcDaliScrollViewAxisAutoLockGradient, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewConstraints", UtcDaliScrollViewConstraints, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewBind", UtcDaliScrollViewBind, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliRulerEnableDisable", UtcDaliRulerEnableDisable, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliRulerDomainEnableDisable", UtcDaliRulerDomainEnableDisable, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliRulerSnapAndClamp", UtcDaliRulerSnapAndClamp, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliRulerFixedRulerSpacing", UtcDaliRulerFixedRulerSpacing, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewOvershoot", UtcDaliScrollViewOvershoot, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewSnapAlphaFunction", UtcDaliScrollViewSnapAlphaFunction, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewSnapDuration", UtcDaliScrollViewSnapDuration, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewSignalsSnapStart", UtcDaliScrollViewSignalsSnapStart, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewSetMouseWheelScrollDistanceStep", UtcDaliScrollViewSetMouseWheelScrollDistanceStep, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliScrollViewGetSet", UtcDaliScrollViewGetSet, scroll_view_startup, scroll_view_cleanup}, + {"UtcDaliShadowViewUninitialized", UtcDaliShadowViewUninitialized, shadow_view_startup, shadow_view_cleanup}, + {"UtcDaliShadowViewNew", UtcDaliShadowViewNew, shadow_view_startup, shadow_view_cleanup}, + {"UtcDaliShadowViewDownCast", UtcDaliShadowViewDownCast, shadow_view_startup, shadow_view_cleanup}, + {"UtcDaliShadowViewPropertyNames", UtcDaliShadowViewPropertyNames, shadow_view_startup, shadow_view_cleanup}, + {"UtcDaliShadowViewAddRemove", UtcDaliShadowViewAddRemove, shadow_view_startup, shadow_view_cleanup}, + {"UtcDaliShadowViewActivateDeactivate", UtcDaliShadowViewActivateDeactivate, shadow_view_startup, shadow_view_cleanup}, + {"UtcDaliShearEffectUninitialized", UtcDaliShearEffectUninitialized, shear_effect_startup, shear_effect_cleanup}, + {"UtcDaliShearEffectPropertyNames", UtcDaliShearEffectPropertyNames, shear_effect_startup, shear_effect_cleanup}, + {"UtcDaliShearEffectDefaultValues", UtcDaliShearEffectDefaultValues, shear_effect_startup, shear_effect_cleanup}, + {"UtcDaliShearEffectCustomValues", UtcDaliShearEffectCustomValues, shear_effect_startup, shear_effect_cleanup}, + {"UtcDaliSliderNew", UtcDaliSliderNew, dali_slider_startup, dali_slider_cleanup}, + {"UtcDaliSliderDestructor", UtcDaliSliderDestructor, dali_slider_startup, dali_slider_cleanup}, + {"UtcDaliSliderDownCast", UtcDaliSliderDownCast, dali_slider_startup, dali_slider_cleanup}, + {"UtcDaliSliderSignals", UtcDaliSliderSignals, dali_slider_startup, dali_slider_cleanup}, + {"UtcDaliSoftButtonEffectUninitialized", UtcDaliSoftButtonEffectUninitialized, soft_button_effect_startup, soft_button_effect_cleanup}, + {"UtcDaliSoftButtonEffectNew", UtcDaliSoftButtonEffectNew, soft_button_effect_startup, soft_button_effect_cleanup}, + {"UtcDaliSoftButtonEffectPropertyNames", UtcDaliSoftButtonEffectPropertyNames, soft_button_effect_startup, soft_button_effect_cleanup}, + {"UtcDaliSpiralLayoutNew", UtcDaliSpiralLayoutNew, spiral_layout_startup, spiral_layout_cleanup}, + {"UtcDaliSpiralSetAndGetItemSizeFunction", UtcDaliSpiralSetAndGetItemSizeFunction, spiral_layout_startup, spiral_layout_cleanup}, + {"UtcDaliSpiralSetAndGetItemSpacing", UtcDaliSpiralSetAndGetItemSpacing, spiral_layout_startup, spiral_layout_cleanup}, + {"UtcDaliSpiralSetAndGetRevolutionDistance", UtcDaliSpiralSetAndGetRevolutionDistance, spiral_layout_startup, spiral_layout_cleanup}, + {"UtcDaliSpiralSetAndGetSpiralRadiusFunction", UtcDaliSpiralSetAndGetSpiralRadiusFunction, spiral_layout_startup, spiral_layout_cleanup}, + {"UtcDaliSpiralSetAndGetTopItemAlignment", UtcDaliSpiralSetAndGetTopItemAlignment, spiral_layout_startup, spiral_layout_cleanup}, + {"UtcDaliSpiralSetAndGetScrollSpeedFactor", UtcDaliSpiralSetAndGetScrollSpeedFactor, spiral_layout_startup, spiral_layout_cleanup}, + {"UtcDaliSpiralSetAndGetMaximumSwipeSpeed", UtcDaliSpiralSetAndGetMaximumSwipeSpeed, spiral_layout_startup, spiral_layout_cleanup}, + {"UtcDaliSpiralLayoutSetAndGetItemFlickAnimationDuration", UtcDaliSpiralLayoutSetAndGetItemFlickAnimationDuration, spiral_layout_startup, spiral_layout_cleanup}, + {"UtcDaliSpiralLayoutConstraintLeft", UtcDaliSpiralLayoutConstraintLeft, spiral_layout_startup, spiral_layout_cleanup}, + {"UtcDaliSpiralLayoutConstraintRight", UtcDaliSpiralLayoutConstraintRight, spiral_layout_startup, spiral_layout_cleanup}, + {"UtcDaliSpiralLayoutConstraintUp", UtcDaliSpiralLayoutConstraintUp, spiral_layout_startup, spiral_layout_cleanup}, + {"UtcDaliSpiralLayoutConstraintDown", UtcDaliSpiralLayoutConstraintDown, spiral_layout_startup, spiral_layout_cleanup}, + {"UtcDaliSpiralLayoutScrollDirection", UtcDaliSpiralLayoutScrollDirection, spiral_layout_startup, spiral_layout_cleanup}, + {"UtcDaliSpiralLayoutGetScrollToPosition", UtcDaliSpiralLayoutGetScrollToPosition, spiral_layout_startup, spiral_layout_cleanup}, + {"UtcDaliSpotUninitializedEffect", UtcDaliSpotUninitializedEffect, spot_effect_startup, spot_effect_cleanup}, + {"UtcDaliSpotPropertyNamesEffect", UtcDaliSpotPropertyNamesEffect, spot_effect_startup, spot_effect_cleanup}, + {"UtcDaliSpotDefaultValuesEffect", UtcDaliSpotDefaultValuesEffect, spot_effect_startup, spot_effect_cleanup}, + {"UtcDaliSpotCustomValuesEffect", UtcDaliSpotCustomValuesEffect, spot_effect_startup, spot_effect_cleanup}, + {"UtcDaliSquareDissolveEffectUninitialized", UtcDaliSquareDissolveEffectUninitialized, square_dissolve_effect_startup, square_dissolve_effect_cleanup}, + {"UtcDaliSquareDissolveEffectPropertyNames", UtcDaliSquareDissolveEffectPropertyNames, square_dissolve_effect_startup, square_dissolve_effect_cleanup}, + {"UtcDaliSquareDissolveEffectDefaultValues", UtcDaliSquareDissolveEffectDefaultValues, square_dissolve_effect_startup, square_dissolve_effect_cleanup}, + {"UtcDaliSquareDissolveEffectCustomValues", UtcDaliSquareDissolveEffectCustomValues, square_dissolve_effect_startup, square_dissolve_effect_cleanup}, + {"UtcDaliTableViewNew", UtcDaliTableViewNew, dali_tableview_startup, dali_tableview_cleanup}, + {"UtcDaliTableViewMetricsPadding", UtcDaliTableViewMetricsPadding, dali_tableview_startup, dali_tableview_cleanup}, + {"UtcDaliTableViewMetricsFixed", UtcDaliTableViewMetricsFixed, dali_tableview_startup, dali_tableview_cleanup}, + {"UtcDaliTableViewMetricsRelative", UtcDaliTableViewMetricsRelative, dali_tableview_startup, dali_tableview_cleanup}, + {"UtcDaliTableViewAnimation", UtcDaliTableViewAnimation, dali_tableview_startup, dali_tableview_cleanup}, + {"UtcDaliTableViewChild", UtcDaliTableViewChild, dali_tableview_startup, dali_tableview_cleanup}, + {"UtcDaliTableViewAdd", UtcDaliTableViewAdd, dali_tableview_startup, dali_tableview_cleanup}, + {"UtcDaliTableViewCells", UtcDaliTableViewCells, dali_tableview_startup, dali_tableview_cleanup}, + {"UtcDaliTableViewChildAssert", UtcDaliTableViewChildAssert, dali_tableview_startup, dali_tableview_cleanup}, + {"UtcDaliTableViewMetricsAssert", UtcDaliTableViewMetricsAssert, dali_tableview_startup, dali_tableview_cleanup}, + {"UtcDaliToolBarNew", UtcDaliToolBarNew, dali_toolbar_startup, dali_toolbar_cleanup}, + {"UtcDaliToolBarSetBackground", UtcDaliToolBarSetBackground, dali_toolbar_startup, dali_toolbar_cleanup}, + {"UtcDaliToolBarAddControl01", UtcDaliToolBarAddControl01, dali_toolbar_startup, dali_toolbar_cleanup}, + {"UtcDaliToolBarAddControl02", UtcDaliToolBarAddControl02, dali_toolbar_startup, dali_toolbar_cleanup}, + {"UtcDaliToolBarRemoveControl01", UtcDaliToolBarRemoveControl01, dali_toolbar_startup, dali_toolbar_cleanup}, + {"UtcDaliToolBarRemoveControl02", UtcDaliToolBarRemoveControl02, dali_toolbar_startup, dali_toolbar_cleanup}, + {"UtcDaliViewNew", UtcDaliViewNew, dali_view_startup, dali_view_cleanup}, + {"UtcDaliViewAddGetRemoveContentLayer01", UtcDaliViewAddGetRemoveContentLayer01, dali_view_startup, dali_view_cleanup}, + {"UtcDaliViewAddGetRemoveContentLayer02", UtcDaliViewAddGetRemoveContentLayer02, dali_view_startup, dali_view_cleanup}, + {"UtcDaliViewSetGetBackgroundLayer01", UtcDaliViewSetGetBackgroundLayer01, dali_view_startup, dali_view_cleanup}, + {"UtcDaliViewSetGetBackgroundLayer02", UtcDaliViewSetGetBackgroundLayer02, dali_view_startup, dali_view_cleanup}, + {"UtcDaliViewSetOrientationFunction", UtcDaliViewSetOrientationFunction, dali_view_startup, dali_view_cleanup}, + {"UtcDaliViewOrientationChanged", UtcDaliViewOrientationChanged, dali_view_startup, dali_view_cleanup}, + {"UtcSetAutoRotate", UtcSetAutoRotate, dali_view_startup, dali_view_cleanup}, + {"UtcDaliWaterEffectUninitialized", UtcDaliWaterEffectUninitialized, dali_water_effect_startup, dali_water_effect_cleanup}, + {"UtcDaliWaterEffectPropertyNames", UtcDaliWaterEffectPropertyNames, dali_water_effect_startup, dali_water_effect_cleanup}, + {"UtcDaliWaterEffectOutOfBounds", UtcDaliWaterEffectOutOfBounds, dali_water_effect_startup, dali_water_effect_cleanup}, + {"UtcDaliWaterEffectDefaultValues", UtcDaliWaterEffectDefaultValues, dali_water_effect_startup, dali_water_effect_cleanup}, + {"UtcDaliWaterEffectCustomValues", UtcDaliWaterEffectCustomValues, dali_water_effect_startup, dali_water_effect_cleanup}, + {"UtcDaliWaterEffectGetAmplitudePositive", UtcDaliWaterEffectGetAmplitudePositive, dali_water_effect_startup, dali_water_effect_cleanup}, + {"UtcDaliWaterEffectGetAmplitudeNegative", UtcDaliWaterEffectGetAmplitudeNegative, dali_water_effect_startup, dali_water_effect_cleanup}, + {"UtcDaliWaterEffectGetCenterPositive", UtcDaliWaterEffectGetCenterPositive, dali_water_effect_startup, dali_water_effect_cleanup}, + {"UtcDaliWaterEffectGetCenterNegative", UtcDaliWaterEffectGetCenterNegative, dali_water_effect_startup, dali_water_effect_cleanup}, + {"UtcDaliWaterEffectGetPropagationPositive", UtcDaliWaterEffectGetPropagationPositive, dali_water_effect_startup, dali_water_effect_cleanup}, + {"UtcDaliWaterEffectGetPropagationNegative", UtcDaliWaterEffectGetPropagationNegative, dali_water_effect_startup, dali_water_effect_cleanup}, + {"UtcDaliButtonNew", UtcDaliButtonNew, dali_button_startup, dali_button_cleanup}, + {"UtcDaliButtonProperties", UtcDaliButtonProperties, dali_button_startup, dali_button_cleanup}, + {"UtcDaliButtonSetGetDimmed", UtcDaliButtonSetGetDimmed, dali_button_startup, dali_button_cleanup}, + {"UtcDaliControlImplTypeRegistry", UtcDaliControlImplTypeRegistry, control_impl_startup, control_impl_cleanup}, + {"UtcDaliControlImplMouseWheelEvent", UtcDaliControlImplMouseWheelEvent, control_impl_startup, control_impl_cleanup}, + {"UtcDaliDefaultControlsCreateCheckBoxButton", UtcDaliDefaultControlsCreateCheckBoxButton, dali_default_controls_startup, dali_default_controls_cleanup}, + {"UtcDaliItemViewAddAndGetLayout", UtcDaliItemViewAddAndGetLayout, dali_default_controls_startup, dali_default_controls_cleanup}, + {"UtcDaliItemViewAddAndRemoveLayout", UtcDaliItemViewAddAndRemoveLayout, dali_default_controls_startup, dali_default_controls_cleanup}, + {"UtcDaliItemViewActivateLayoutAndGetActiveLayout", UtcDaliItemViewActivateLayoutAndGetActiveLayout, dali_default_controls_startup, dali_default_controls_cleanup}, + {"UtcDaliKeyboardFocusManagerGet", UtcDaliKeyboardFocusManagerGet, dali_keyboard_focus_manager_startup, dali_keyboard_focus_manager_cleanup}, + {"UtcDaliKeyboardFocusManagerMoveFocus", UtcDaliKeyboardFocusManagerMoveFocus, dali_keyboard_focus_manager_startup, dali_keyboard_focus_manager_cleanup}, + {"UtcDaliKeyboardFocusManagerSignalFocusGroupChanged", UtcDaliKeyboardFocusManagerSignalFocusGroupChanged, dali_keyboard_focus_manager_startup, dali_keyboard_focus_manager_cleanup}, + {"UtcDaliScrollViewPageCubeEffectSetup", UtcDaliScrollViewPageCubeEffectSetup, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup}, + {"UtcDaliScrollViewPageCarouselEffectSetup", UtcDaliScrollViewPageCarouselEffectSetup, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup}, + {"UtcDaliScrollViewCarouselEffectSetup", UtcDaliScrollViewCarouselEffectSetup, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup}, + {"UtcDaliScrollViewDepthEffectSetup", UtcDaliScrollViewDepthEffectSetup, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup}, + {"UtcDaliScrollViewPageCubeEffectTest", UtcDaliScrollViewPageCubeEffectTest, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup}, + {"UtcDaliScrollViewPageCarouselEffectTest", UtcDaliScrollViewPageCarouselEffectTest, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup}, + {"UtcDaliScrollViewCarouselEffectTest", UtcDaliScrollViewCarouselEffectTest, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup}, + {"UtcDaliScrollViewDepthEffectTest", UtcDaliScrollViewDepthEffectTest, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup}, + {"UtcDaliTextInputSetActiveStyle", UtcDaliTextInputSetActiveStyle, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup}, + {"UtcDaliTextInputApplyStyleToSelectedText", UtcDaliTextInputApplyStyleToSelectedText, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup}, + {"UtcDaliTextInputApplyStyleToAll", UtcDaliTextInputApplyStyleToAll, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup}, + {"UtcDaliTextInputGetStyleAtCursor", UtcDaliTextInputGetStyleAtCursor, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup}, + {"UtcDaliTextInputSetAndGetTextAlignment", UtcDaliTextInputSetAndGetTextAlignment, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup}, + {"UtcDaliTextInputSetAndGetMultilinePolicy", UtcDaliTextInputSetAndGetMultilinePolicy, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup}, + {"UtcDaliTextInputSetAndGetExceedEnabled", UtcDaliTextInputSetAndGetExceedEnabled, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup}, + {NULL, NULL} +}; + +#endif // __TCT_DALI_TOOLKIT_UNMANAGED_CORE_H__ diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-AlbumLayout.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-AlbumLayout.cpp new file mode 100644 index 0000000..138a426 --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-AlbumLayout.cpp @@ -0,0 +1,360 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include +#include + +using namespace Dali; + +using namespace Toolkit; + +using namespace std; + + +namespace +{ + +Vector3 AlbumLayoutItemSizeFunction(const Vector3& layoutSize) +{ + float width = layoutSize.width * 0.2f; + return Vector3(width, width, width); +} + +float AlbumLayoutAlbumRadiusFunction(const Vector3& layoutSize) +{ + return layoutSize.width * 0.5f; +} +} // namespace + + +void album_layout_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void album_layout_cleanup(void) +{ + test_return_value = TET_PASS; +} + +int UtcDaliAlbumLayoutNew(void) +{ + ToolkitTestApplication application; + + // Create a album layout + AlbumLayoutPtr albumLayout = AlbumLayout::New(); + + DALI_TEST_CHECK(albumLayout); + END_TEST; +} + +int UtcDaliAlbumSetAndGetItemSizeFunction(void) +{ + ToolkitTestApplication application; + + // Create a album layout + AlbumLayoutPtr albumLayout = AlbumLayout::New(); + + // Set the item size function + albumLayout->SetItemSizeFunction(AlbumLayoutItemSizeFunction); + + // Check whether we get the correct item size function + DALI_TEST_CHECK(albumLayout->GetItemSizeFunction() == AlbumLayoutItemSizeFunction); + END_TEST; +} + +int UtcDaliAlbumSetAndGetScrollSpeedFactor(void) +{ + ToolkitTestApplication application; + + // Create a album layout + AlbumLayoutPtr albumLayout = AlbumLayout::New(); + + // Set the scroll speed factor + albumLayout->SetScrollSpeedFactor(0.05f); + + // Check whether we get the correct scroll speed factor + DALI_TEST_EQUALS( albumLayout->GetScrollSpeedFactor(), 0.05f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliAlbumSetAndGetMaximumSwipeSpeed(void) +{ + ToolkitTestApplication application; + + // Create a album layout + AlbumLayoutPtr albumLayout = AlbumLayout::New(); + + // Set the maximum swipe speed + albumLayout->SetMaximumSwipeSpeed(50.0f); + + // Check whether we get the correct maximum swipe speed + DALI_TEST_EQUALS( albumLayout->GetMaximumSwipeSpeed(), 50.0f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliAlbumLayoutSetAndGetItemFlickAnimationDuration(void) +{ + ToolkitTestApplication application; + + // Create a album layout + AlbumLayoutPtr albumLayout = AlbumLayout::New(); + + // Set the flick animaiton duration + albumLayout->SetItemFlickAnimationDuration(0.35f); + + // Check whether we get the correct flick animaiton duration + DALI_TEST_EQUALS( albumLayout->GetItemFlickAnimationDuration(), 0.35f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliAlbumSetNumOfItems(void) +{ + AlbumLayoutPtr albumLayout = AlbumLayout::New(); + + albumLayout->SetNumOfItems(15); + + DALI_TEST_CHECK(albumLayout->GetNumOfItems() == 15); + END_TEST; +} + +int UtcDaliAlbumSetStackNum(void) +{ + AlbumLayoutPtr albumLayout = AlbumLayout::New(); + + albumLayout->SetStackNum(30); + + DALI_TEST_CHECK(albumLayout->GetStackNum() == 30); + END_TEST; +} + +int UtcDaliAlbumSetPosition(void) +{ + AlbumLayoutPtr albumLayout = AlbumLayout::New(); + + std::vector position_list; + + /*(0.0f)*/ + Vector3 pos = Vector3(850.0f,-250.0f,0.0); + position_list.push_back(pos); + + /*(1.0f)*/ + pos = Vector3(700.0f,50.0f,0.0); + position_list.push_back(pos); + + /*(2.0f)*/ + pos = Vector3(440.0f,227.0f,0.0); + position_list.push_back(pos); + + /*(4.0f)*/ + pos = Vector3(-440.0f,227.0f,0.0); + position_list.push_back(pos); + + /*(5.0f)*/ + pos = Vector3(-700.0f,50.0f,0.0); + position_list.push_back(pos); + + /*(6.0f)*/ + pos = Vector3(-850.0f,-250.0f,0.0); + position_list.push_back(pos); + + albumLayout->SetPosition(position_list); + + DALI_TEST_CHECK(albumLayout->GetPosition() == position_list); + END_TEST; +} + +int UtcDaliAlbumSetRotationX(void) +{ + AlbumLayoutPtr albumLayout = AlbumLayout::New(); + + albumLayout->SetRotationX(Math::PI/4.0f); + + DALI_TEST_CHECK(albumLayout->GetRotationX() == Math::PI/4.0f); + END_TEST; +} + +int UtcDaliAlbumSetRotationZ(void) +{ + AlbumLayoutPtr albumLayout = AlbumLayout::New(); + + std::vector rotation_list; + + /*(0.0f)*/ + float rotate = Math::PI/6.0f; + rotation_list.push_back(rotate); + + /*(1.0f)*/ + rotate = 0.0f; + rotation_list.push_back(rotate); + + /*(2.0f)*/ + rotate = Math::PI/6.0f; + rotation_list.push_back(rotate); + + /*(4.0f)*/ + rotate = -Math::PI/6.0f; + rotation_list.push_back(rotate); + + /*(5.0f)*/ + rotate = 0.0f; + rotation_list.push_back(rotate); + + /*(6.0f)*/ + rotate = -Math::PI/6.0f; + rotation_list.push_back(rotate); + + albumLayout->SetRotationZ(rotation_list); + + DALI_TEST_CHECK(albumLayout->GetRotationZ() == rotation_list); + END_TEST; +} + +int UtcDaliAlbumSetScale(void) +{ + AlbumLayoutPtr albumLayout = AlbumLayout::New(); + + std::vector scale_list; + + /*(0.0f)*/ + float scale = 1.0f; + scale_list.push_back(scale); + + /*(1.0f)*/ + scale = 0.0f; + scale_list.push_back(scale); + + /*(2.0f)*/ + scale = Math::PI/6.0f; + scale_list.push_back(scale); + + /*(4.0f)*/ + scale = -Math::PI/6.0f; + scale_list.push_back(scale); + + /*(5.0f)*/ + scale = 0.0f; + scale_list.push_back(scale); + + /*(6.0f)*/ + scale = -Math::PI/6.0f; + scale_list.push_back(scale); + + albumLayout->SetScale(scale_list); + + DALI_TEST_CHECK(albumLayout->GetScale() == scale_list); + END_TEST; +} + +int UtcDaliAlbumSetColor(void) +{ + // Create a album layout + AlbumLayoutPtr albumLayout = AlbumLayout::New(); + + std::vector color_list; + + /*(0.0f)*/ + Vector2 color = Vector2(1.0f,1.0f); + color_list.push_back(color); + + /*(1.0f)*/ + color = Vector2(1.0f,1.0f); + color_list.push_back(color); + + /*(2.0f)*/ + color = Vector2(1.0f,1.0f); + color_list.push_back(color); + + /*(4.0f)*/ + color = Vector2(1.0f,1.0f); + color_list.push_back(color); + + /*(5.0f)*/ + color = Vector2(1.0f,1.0f); + color_list.push_back(color); + + /*(6.0f)*/ + color = Vector2(1.0f,1.0f); + color_list.push_back(color); + + albumLayout->SetColor(color_list); + + DALI_TEST_CHECK(albumLayout->GetColor() == color_list); + END_TEST; +} + +int UtcDaliAlbumSetCenterPosition(void) +{ + AlbumLayoutPtr albumLayout = AlbumLayout::New(); + + albumLayout->SetCenterPosition(Vector3( 0.0f,-80.0f,100.0f)); + + DALI_TEST_CHECK(albumLayout->GetCenterPosition() == Vector3( 0.0f,-80.0f,100.0f)); + END_TEST; +} + +int UtcDaliAlbumSetSetCenterScale(void) +{ + AlbumLayoutPtr albumLayout = AlbumLayout::New(); + + albumLayout->SetCenterScale(1.75f); + + DALI_TEST_CHECK(albumLayout->GetCenterScale() == 1.75f); + END_TEST; +} + +int UtcDaliAlbumSetSetCenterColor(void) +{ + AlbumLayoutPtr albumLayout = AlbumLayout::New(); + + albumLayout->SetCenterColor(Vector2(1.0f,1.0f)); + + DALI_TEST_CHECK(albumLayout->GetCenterColor() == Vector2(1.0f,1.0f)); + END_TEST; +} + +int UtcDaliAlbumSetStackPosition(void) +{ + AlbumLayoutPtr albumLayout = AlbumLayout::New(); + + albumLayout->SetStackPosition(Vector3(750.0f,-500.0f,0.0f),Vector3(-750.0f,-500.0f,0.0f)); + + DALI_TEST_CHECK(albumLayout->GetRightStackPosition() == Vector3(750.0f,-500.0f,0.0f) && albumLayout->GetLeftStackPosition() == Vector3(-750.0f,-500.0f,0.0f)); + END_TEST; +} + +int UtcDaliAlbumSetSetStackScale(void) +{ + AlbumLayoutPtr albumLayout = AlbumLayout::New(); + + albumLayout->SetStackScale(1.0f,1.0f); + + DALI_TEST_CHECK(albumLayout->GetRightStackScale() == 1.0f && albumLayout->GetLeftStackScale() == 1.0f); + END_TEST; +} + +int UtcDaliAlbumSetStackColor(void) +{ + AlbumLayoutPtr albumLayout = AlbumLayout::New(); + + albumLayout->SetStackColor(Vector2(1.0f,1.0f),Vector2(1.0f,1.0f)); + + DALI_TEST_CHECK(albumLayout->GetRightStackColor() == Vector2(1.0f,1.0f) && albumLayout->GetLeftStackColor() == Vector2(1.0f,1.0f)); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-BendyEffect.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-BendyEffect.cpp new file mode 100644 index 0000000..a38be7c --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-BendyEffect.cpp @@ -0,0 +1,154 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + + +using namespace Dali; + + +void bendy_effect_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void bendy_effect_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +int UtcDaliBendyUninitializedEffect(void) +{ + ToolkitTestApplication application; + + Toolkit::BendyEffect effect; + + try + { + // New() must be called to create a BendyEffect or it wont be valid. + effect.SetRadius( 2.0f ); + DALI_TEST_CHECK( false ); + } + catch (Dali::DaliException& e) + { + // Tests that a negative test of an assertion succeeds + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_CHECK(!effect); + } + END_TEST; +} + +int UtcDaliBendyPropertyNamesEffect(void) +{ + ToolkitTestApplication application; + + Toolkit::BendyEffect effect = Toolkit::BendyEffect::New(); + + // Check the names, this names are used in the shaders code, + // if they change the shader code has to be updated + DALI_TEST_EQUALS( effect.GetCenterPropertyName(), "uCenter", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetDirectionPropertyName(), "uDirection", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetRadiusPropertyName(), "uRadius", TEST_LOCATION ); + END_TEST; +} + +int UtcDaliBendyDefaultValuesEffect(void) +{ + ToolkitTestApplication application; + + Toolkit::BendyEffect effect = Toolkit::BendyEffect::New(); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + Vector2 topLeft( Stage::GetCurrent().GetSize() * 0.5f ); + topLeft.y = -topLeft.y; + + // Gets converted to opengl view space + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetCenterPropertyName().c_str(), + topLeft ) ); + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetDirectionPropertyName().c_str(), + Vector2(0.0f, 0.0f) ) ); + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetRadiusPropertyName().c_str(), + 0.0f ) ); + END_TEST; +} + +int UtcDaliBendyCustomValuesEffect(void) +{ + ToolkitTestApplication application; + + Toolkit::BendyEffect effect = Toolkit::BendyEffect::New(); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + + Vector2 direction(1.0f, 1.0f); + effect.SetCenter( Vector2(480.0f, 800.0f) ); + effect.SetDirection( direction ); + effect.SetRadius( 2.0f ); + + actor.SetShaderEffect(effect); + Stage::GetCurrent().Add(actor); + + application.SendNotification(); + application.Render(); + + Vector2 bottomRight( Stage::GetCurrent().GetSize() * 0.5f ); + bottomRight.x = -bottomRight.x; + + // Gets converted to opengl viewport coordinates + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetCenterPropertyName().c_str(), + bottomRight ) ); + + direction.Normalize(); + direction.x *= -1.0f; + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetDirectionPropertyName().c_str(), + direction ) ); + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetRadiusPropertyName().c_str(), + 2.0f ) ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-BlindEffect.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-BlindEffect.cpp new file mode 100644 index 0000000..b2c59b0 --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-BlindEffect.cpp @@ -0,0 +1,122 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 + +#include +#include +#include + + +using namespace Dali; + + +void blind_effect_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void blind_effect_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +int UtcDaliBlindEffectUninitialized(void) +{ + ToolkitTestApplication application; + + Toolkit::BlindEffect effect; + + try + { + // New() must be called to create a BlindEffect or it wont be valid. + effect.SetStep( 2.0f ); + DALI_TEST_CHECK( false ); + } + catch (Dali::DaliException& e) + { + // Tests that a negative test of an assertion succeeds + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_CHECK(!effect); + } + END_TEST; +} + +int UtcDaliBlindEffectPropertyNames(void) +{ + ToolkitTestApplication application; + + Toolkit::BlindEffect effect = Toolkit::BlindEffect::New(); + + // Check the names, this names are used in the shaders code, + // if they change the shader code has to be updated + DALI_TEST_EQUALS( effect.GetStepPropertyName(), "uStep", TEST_LOCATION ); + END_TEST; +} + +int UtcDaliBlindEffectDefaultValues(void) +{ + ToolkitTestApplication application; + + Toolkit::BlindEffect effect = Toolkit::BlindEffect::New(); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + // Gets converted to opengl viewport coordinates + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetStepPropertyName().c_str(), + 0.0f ) ); + END_TEST; +} + +int UtcDaliBlindEffectCustomValues(void) +{ + ToolkitTestApplication application; + + Toolkit::BlindEffect effect = Toolkit::BlindEffect::New(); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + + effect.SetStep( 2.0f ); + + actor.SetShaderEffect(effect); + Stage::GetCurrent().Add(actor); + + application.SendNotification(); + application.Render(); + + // Gets converted to opengl viewport coordinates + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetStepPropertyName().c_str(), + 2.0f ) ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-BloomView.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-BloomView.cpp new file mode 100644 index 0000000..c797f06 --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-BloomView.cpp @@ -0,0 +1,163 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + +using namespace Dali; +using namespace Dali::Toolkit; + + +void bloom_view_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void bloom_view_cleanup(void) +{ + test_return_value = TET_PASS; +} + +// Negative test case for a method +int UtcDaliBloomViewUninitialized(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliBloomViewUninitialized"); + + Toolkit::BloomView view; + + try + { + // New() must be called to create a BloomView or it wont be valid. + Actor a = Actor::New(); + view.Add( a ); + DALI_TEST_CHECK( false ); + } + catch (Dali::DaliException& e) + { + // Tests that a negative test of an assertion succeeds + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_CHECK(!view); + } + END_TEST; +} + +// Positive test case for a method +int UtcDaliBloomViewNew(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliBloomViewNew"); + + Toolkit::BloomView view = Toolkit::BloomView::New(); + DALI_TEST_CHECK( view ); + + Toolkit::BloomView view2 = Toolkit::BloomView::New(10, 1.0f, Pixel::RGB888, 0.5f, 0.5f); + DALI_TEST_CHECK( view2 ); + END_TEST; +} + +// Positive test case for a method +int UtcDaliBloomViewDownCast(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliBloomViewDownCast"); + + Toolkit::BloomView view = Toolkit::BloomView::New(); + BaseHandle handle(view); + + Toolkit::BloomView bloomView = Toolkit::BloomView::DownCast( handle ); + DALI_TEST_CHECK( view ); + DALI_TEST_CHECK( bloomView ); + DALI_TEST_CHECK( bloomView == view ); + END_TEST; +} + + +// Positive test case for a method +int UtcDaliBloomViewPropertyNames(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliBloomViewPropertyNames"); + + Toolkit::BloomView view = Toolkit::BloomView::New(); + DALI_TEST_CHECK( view ); + + // Check the names, this names are used in the shader code, + // if they change in the shader code, then it has to be updated here. + DALI_TEST_EQUALS( view.GetBloomThresholdPropertyIndex(), view.GetPropertyIndex("uBloomThreshold"), TEST_LOCATION ); + DALI_TEST_EQUALS( view.GetBlurStrengthPropertyIndex(), view.GetPropertyIndex("BlurStrengthProperty"), TEST_LOCATION ); + DALI_TEST_EQUALS( view.GetBloomIntensityPropertyIndex(), view.GetPropertyIndex("uBloomIntensity"), TEST_LOCATION ); + DALI_TEST_EQUALS( view.GetBloomSaturationPropertyIndex(), view.GetPropertyIndex("uBloomSaturation"), TEST_LOCATION ); + DALI_TEST_EQUALS( view.GetImageIntensityPropertyIndex(), view.GetPropertyIndex("uImageIntensity"), TEST_LOCATION ); + DALI_TEST_EQUALS( view.GetImageSaturationPropertyIndex(), view.GetPropertyIndex("uImageSaturation"), TEST_LOCATION ); + END_TEST; +} + +// Positive test case for a method +int UtcDaliBloomViewAddRemove(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliBloomViewAddRemove"); + + Toolkit::BloomView view = Toolkit::BloomView::New(); + DALI_TEST_CHECK( view ); + + Actor actor = Actor::New(); + DALI_TEST_CHECK( !actor.OnStage() ); + + + view.SetParentOrigin(ParentOrigin::CENTER); + view.SetSize(Stage::GetCurrent().GetSize()); + view.Add(actor); + Stage::GetCurrent().Add(view); + + DALI_TEST_CHECK( actor.OnStage() ); + + view.Remove(actor); + + DALI_TEST_CHECK( !actor.OnStage() ); + END_TEST; +} + +// Positive test case for a method +int UtcDaliBloomActivateDeactivate(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliBloomActivateDeactivate"); + + Toolkit::BloomView view = Toolkit::BloomView::New(); + DALI_TEST_CHECK( view ); + + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + DALI_TEST_CHECK( 1u == taskList.GetTaskCount() ); + + view.SetParentOrigin(ParentOrigin::CENTER); + view.SetSize(Stage::GetCurrent().GetSize()); + view.Add(Actor::New()); + Stage::GetCurrent().Add(view); + view.Activate(); + + RenderTaskList taskList2 = Stage::GetCurrent().GetRenderTaskList(); + DALI_TEST_CHECK( 1u != taskList2.GetTaskCount() ); + + view.Deactivate(); + + RenderTaskList taskList3 = Stage::GetCurrent().GetRenderTaskList(); + DALI_TEST_CHECK( 1u == taskList3.GetTaskCount() ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-Builder.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-Builder.cpp new file mode 100644 index 0000000..2399c98 --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-Builder.cpp @@ -0,0 +1,396 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + +using namespace Dali; +using namespace Toolkit; + +namespace +{ +// +// Note: To avoid escaping double quotes single quotes are used and then replaced +// before parsing. JSON uses double quotes +// + std::string JSON_TEXTSTYLE_ONLY("\ +{ \ + 'text-styles': \ + { \ + 'title-text-style':{'font-name': 'Vera', \ + 'font-style': 'Bold', \ + 'point-size': 12.0, \ + 'weight': 'light', \ + 'text-color': [0.0,0.5,0.5,1], \ + 'italic': false, \ + 'underline': false, \ + 'shadow': true, \ + 'glow': true, \ + 'outline': true, \ + 'shadow-color': [0.0,1.0,0.0,1.0], \ + 'shadow-offset': [3.0,2.0], \ + 'shadow-size': 2.0, \ + 'glow-color': [0.9,0.6,0.3,1.0], \ + 'glow-intensity':0.1, \ + 'smooth-edge': 0.45, \ + 'outline-color': [1.0,0.5,0.0,1.0], \ + 'outline-thickness': [0.7,0.6] \ + } \ + } \ +} \ +"); + + std::string JSON_TEXT_ACTOR("\ +{ \ + 'styles': \ + { \ + 'basic-text': \ + { \ + 'type':'TextActor', \ + 'text':'Hello', \ + 'font':'', \ + 'parent-origin':[0.0,0.0,0], \ + 'anchor-point' :[0.5,0.5,0], \ + 'size': [150,170,1], \ + 'position':[-10,10,0] \ + } \ + }, \ + 'animations': \ + { \ + 'rotate': \ + { \ + 'duration': 10, \ + 'properties': \ + [ \ + { \ + 'actor':'text', \ + 'property':'rotation', \ + 'value':[0, 3, 0, 0], \ + 'alpha-function': 'EASE_IN_OUT', \ + 'time-period': {'delay': 0, 'duration': 3 } \ + } \ + ] \ + } \ + }, \ + 'stage': \ + [ \ + { \ + 'name':'text', \ + 'type':'basic-text', \ + 'text':'Hello' \ + }, \ + { \ + 'name':'text2', \ + 'type':'basic-text', \ + 'text':'Hello', \ + 'signals': \ + [ \ + { 'name': 'on-stage', 'action':'set', 'actor':'text2', 'property':'text', 'value':'Jaylo' } \ + ] \ + } \ + ], \ + 'other': \ + [ \ + { \ + 'name':'other-text', \ + 'type':'basic-text', \ + 'text':'Hello' \ + } \ + ] \ +} \ +"); + + + std::string JSON_CORE_ACTOR_TREE("\ +{ \ + 'styles': \ + { \ + 'my-camera': { \ + 'type':'CameraActor', \ + 'camera-type':'FreeLook', \ + 'field-of-view': 0.125, \ + 'aspect-ratio':5.0, \ + 'near-plane-distance': 100, \ + 'far-plane-distance': 200 \ + }, \ + 'basic-text': { \ + 'type':'TextActor', \ + 'text':'Hello', \ + 'font':'Freesans', \ + 'smooth-edge':0.2, \ + 'position': [-10.0, 10.0, -1000.0], \ + 'size': [300.0, 250.0, 0.0] \ + }, \ + 'theme2-text': { \ + 'type':'TextActor', \ + 'text':'Hello', \ + 'font':'Freesans', \ + 'smooth-edge':0.8 \ + } \ + }, \ + 'stage': \ + [ \ + {'name':'txt1', \ + 'type':'TextActor', \ + 'text':'Hello World', \ + 'font':'freesans', \ + 'parent-origin':'CENTER', \ + 'actors': \ + [ \ + { 'type':'basic-text', 'text':'Hello', 'position-y':50 }, \ + { 'type':'basic-text', 'text':'Hello', 'position-y':100 }, \ + { 'type':'basic-text', 'text':'Hello', 'position-y':150 }, \ + { 'type':'basic-text', 'text':'Hello', 'position-y':200 }, \ + { 'type':'basic-text', 'text':'Hello', 'position-y':250 } \ + ] \ + } \ + ] \ +} \ +"); + + +std::string ReplaceQuotes(const std::string &in_s) +{ + std::string s(in_s); + // wrong as no embedded quote but had regex link problems + std::replace(s.begin(), s.end(), '\'', '"'); + return s; +} + +} // namespace + + + +void builder_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void builder_cleanup(void) +{ + test_return_value = TET_PASS; +} + +int UtcDaliBuilderTextActorCreateFromStyle(void) +{ + ToolkitTestApplication application; + Stage stage = Stage::GetCurrent(); + + tet_infoline(" UtcDaliBuilderTextActorCreateFromStyle"); + + Builder builder = Builder::New(); + + builder.LoadFromString(ReplaceQuotes(JSON_TEXT_ACTOR)); + + TextActor actor( TextActor::DownCast( builder.CreateFromStyle("basic-text") ) ); + + DALI_TEST_CHECK( actor ); + + stage.GetRootLayer().Add( actor ); + + application.SendNotification(); + application.Render(); + + Vector3 v; + + v = actor.GetCurrentPosition(); + DALI_TEST_CHECK(v.x == -10.0); + DALI_TEST_CHECK(v.y == 10.0); + DALI_TEST_CHECK(v.z == 0.0); + + v = actor.GetCurrentSize(); + DALI_TEST_CHECK(v.x == 150.0); + DALI_TEST_CHECK(v.y == 170.0); + DALI_TEST_CHECK(v.z == 1.0); + + DALI_TEST_CHECK(actor.GetText() == "Hello"); + + actor = TextActor::DownCast( builder.CreateFromStyle("*(&^") ); + DALI_TEST_CHECK(!actor); + + END_TEST; +} + +int UtcDaliBuilderTextActorCreateAnimation(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliBuilderTextActorCreateAnimation"); + + Builder builder = Builder::New(); + + builder.LoadFromString(ReplaceQuotes(JSON_TEXT_ACTOR)); + + builder.AddActors( Stage::GetCurrent().GetRootLayer() ); + + Animation anim = builder.CreateAnimation("rotate"); + DALI_TEST_CHECK( anim ); + + DALI_TEST_CHECK( 10.0f == anim.GetDuration() ); + + END_TEST; +} + +int UtcDaliBuilderTextActorApplyFromStyle(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliBuilderTextActorApplyFromStyle"); + + Builder builder = Builder::New(); + + builder.LoadFromString(ReplaceQuotes(JSON_TEXT_ACTOR)); + + TextActor actor = TextActor::New("a"); + + builder.ApplyStyle("basic-text", actor); + + DALI_TEST_CHECK( actor ); + + Stage::GetCurrent().GetRootLayer().Add( actor ); + + application.SendNotification(); + application.Render(); + + Vector3 v; + + v = actor.GetCurrentPosition(); + DALI_TEST_CHECK(v.x == -10.0); + DALI_TEST_CHECK(v.y == 10.0); + DALI_TEST_CHECK(v.z == 0.0); + + v = actor.GetCurrentSize(); + DALI_TEST_CHECK(v.x == 150.0); + DALI_TEST_CHECK(v.y == 170.0); + DALI_TEST_CHECK(v.z == 1.0); + + DALI_TEST_CHECK(actor.GetText() == "Hello"); + + END_TEST; +} + +int UtcDaliBuilderAddActors(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliBuilderAddActors"); + + Builder builder = Builder::New(); + + builder.LoadFromString(ReplaceQuotes(JSON_TEXT_ACTOR)); + + builder.AddActors( Stage::GetCurrent().GetRootLayer() ); + + application.SendNotification(); + application.Render(); + + TextActor actor = TextActor::DownCast( Stage::GetCurrent().GetRootLayer().FindChildByName("text") ); + + DALI_TEST_CHECK( actor ); + DALI_TEST_CHECK(actor.GetText() == "Hello"); + + END_TEST; +} + +int UtcDaliBuilderAddActorsOther(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliBuilderAddActorsOther"); + + Actor rootActor = Stage::GetCurrent().GetRootLayer(); + + Builder builder = Builder::New(); + + builder.LoadFromString(ReplaceQuotes(JSON_TEXT_ACTOR)); + + builder.AddActors( "other", rootActor ); + + application.SendNotification(); + application.Render(); + + TextActor actor = TextActor::DownCast( Stage::GetCurrent().GetRootLayer().FindChildByName("other-text") ); + + DALI_TEST_CHECK( actor ); + DALI_TEST_CHECK(actor.GetText() == "Hello"); + + END_TEST; +} + + +int UtcDaliBuilderStyles(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliBuilderStyles"); + + Builder builder = Builder::New(); + + builder.LoadFromString(ReplaceQuotes(JSON_CORE_ACTOR_TREE)); + + BaseHandle handle = builder.CreateFromStyle("my-camera"); + CameraActor camera = CameraActor::DownCast(handle); + + DALI_TEST_CHECK(camera); + + Property::Value v; + + v = camera.GetProperty( camera.GetPropertyIndex("field-of-view") ); + DALI_TEST_CHECK( 0.125f == v.Get() ); + + v = camera.GetProperty( camera.GetPropertyIndex("aspect-ratio") ); + DALI_TEST_CHECK( 5.0f == v.Get() ); + + handle = builder.CreateFromStyle("basic-text"); + TextActor textActor = TextActor::DownCast(handle); + + v = textActor.GetProperty( textActor.GetPropertyIndex("smooth-edge") ); + + DALI_TEST_CHECK( 0.2f == v.Get() ); + + // test ApplyStyle another + builder.ApplyStyle("theme2-text", textActor); + + v = textActor.GetProperty( textActor.GetPropertyIndex("smooth-edge") ); + DALI_TEST_CHECK( 0.8f == v.Get() ); + + END_TEST; +} + +int UtcDaliBuilderSetProperty(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliBuilderSetProperty"); + + Builder builder = Builder::New(); + + builder.LoadFromString(ReplaceQuotes(JSON_TEXT_ACTOR)); + + builder.AddActors( Stage::GetCurrent().GetRootLayer() ); + + application.SendNotification(); + application.Render(); + + TextActor actor = TextActor::DownCast( Stage::GetCurrent().GetRootLayer().FindChildByName("text2") ); + + DALI_TEST_CHECK( actor ); + DALI_TEST_CHECK( actor.GetText() == "Jaylo" ); + + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-Button.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-Button.cpp new file mode 100644 index 0000000..d19761b --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-Button.cpp @@ -0,0 +1,134 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include +#include + +using namespace Dali; +using namespace Toolkit; + +void dali_button_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void dali_button_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +namespace +{ +const Dali::TouchPoint pointDownInside( 0, TouchPoint::Down, 240, 400 ); +const Dali::TouchPoint pointUpInside( 0, TouchPoint::Up, 240, 400 ); +const Dali::TouchPoint pointLeave( 0, TouchPoint::Leave, 240, 400 ); +const Dali::TouchPoint pointEnter( 0, TouchPoint::Motion, 240, 400 ); +const Dali::TouchPoint pointDownOutside( 0, TouchPoint::Down, 10, 10 ); +const Dali::TouchPoint pointUpOutside( 0, TouchPoint::Up, 10, 10 ); + +static bool gObjectCreatedCallBackCalled; + +static void TestObjectCreatedCallback(BaseHandle handle) +{ + gObjectCreatedCallBackCalled = true; +} + +} // namespace + + + +// Positive test case for a method +int UtcDaliButtonNew(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliButtonNew"); + + CheckBoxButton checkBoxButton = CheckBoxButton::New(); + DALI_TEST_CHECK( checkBoxButton ); + + CheckBoxButton checkBoxButton2( checkBoxButton ); + DALI_TEST_CHECK( checkBoxButton2 ); + checkBoxButton2 = NULL; + + + //Additional check to ensure object is created by checking if it's registered + ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + DALI_TEST_CHECK( registry ); + + gObjectCreatedCallBackCalled = false; + registry.ObjectCreatedSignal().Connect( &TestObjectCreatedCallback ); + { + CheckBoxButton checkBoxButton = CheckBoxButton::New(); + } + DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + + gObjectCreatedCallBackCalled = false; + registry.ObjectCreatedSignal().Connect( &TestObjectCreatedCallback ); + { + PushButton pushButton = PushButton::New(); + } + DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + + // Test down cast + Handle handleButton = checkBoxButton; + Button downCastCheckBoxButton = Button::DownCast( handleButton ); + DALI_TEST_CHECK( downCastCheckBoxButton ); + CheckBoxButton downCastCheckBoxButton2 = CheckBoxButton::DownCast( handleButton ); + DALI_TEST_CHECK( downCastCheckBoxButton2 ); + END_TEST; +} + +int UtcDaliButtonProperties(void) +{ + tet_infoline("UtcDaliButtonSetProperty: "); + ToolkitTestApplication application; + + CheckBoxButton checkBoxButton = CheckBoxButton::New(); + PushButton pushButton = PushButton::New(); + + //Test various properties + checkBoxButton.SetProperty( checkBoxButton.GetPropertyIndex("dimmed"), false ); + DALI_TEST_CHECK( false == checkBoxButton.IsDimmed() ); + + checkBoxButton.SetProperty( checkBoxButton.GetPropertyIndex("dimmed"), true ); + DALI_TEST_CHECK( true == checkBoxButton.IsDimmed() ); + END_TEST; +} + +int UtcDaliButtonSetGetDimmed(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliButtonSetGetDimmed"); + + CheckBoxButton checkBoxButton = CheckBoxButton::New(); + checkBoxButton.SetDimmed( true ); + + DALI_TEST_CHECK( checkBoxButton.IsDimmed() ); + checkBoxButton.SetDimmed( false ); + + DALI_TEST_CHECK( !checkBoxButton.IsDimmed() ); + checkBoxButton.SetDimmed( true ); + + DALI_TEST_CHECK( checkBoxButton.IsDimmed() ); + checkBoxButton.SetDimmed( false ); + + DALI_TEST_CHECK( !checkBoxButton.IsDimmed() ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-CarouselEffect.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-CarouselEffect.cpp new file mode 100644 index 0000000..1475a69 --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-CarouselEffect.cpp @@ -0,0 +1,131 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + +using namespace Dali; + + +void carousel_effect_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void carousel_effect_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +int UtcDaliCarouselEffectUninitialized(void) +{ + ToolkitTestApplication application; + + Toolkit::CarouselEffect effect; + + try + { + // New() must be called to create a CarouselEffect or it wont be valid. + effect.SetRadius( 100.0f ); + DALI_TEST_CHECK( false ); + } + catch (Dali::DaliException& e) + { + // Tests that a negative test of an assertion succeeds + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_CHECK(!effect); + } + END_TEST; +} + +int UtcDaliCarouselEffectPropertyNames(void) +{ + ToolkitTestApplication application; + + Toolkit::CarouselEffect effect = Toolkit::CarouselEffect::New(); + + // Check the names, these names are used in the shaders code, + // if they change the shader code has to be updated + DALI_TEST_EQUALS( effect.GetRadiusPropertyName(), "uRadius", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetCenterPropertyName(), "uCenter", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetAnglePerUnitPropertyName(), "uAnglePerUnit", TEST_LOCATION ); + END_TEST; +} + +int UtcDaliCarouselEffectDefaultValues(void) +{ + ToolkitTestApplication application; + + Toolkit::CarouselEffect effect = Toolkit::CarouselEffect::New(); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + + const float radiusValue(0.0f); + const Vector2 centerValue(0.0f, 0.0f); + const Vector2 anglePerUnitValue(0.0f, 0.0f); + + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + TestGlAbstraction& gl = application.GetGlAbstraction(); + DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetRadiusPropertyName().c_str(), radiusValue ) ); + DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetCenterPropertyName().c_str(), centerValue ) ); + DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetAnglePerUnitPropertyName().c_str(), anglePerUnitValue ) ); + END_TEST; +} + +int UtcDaliCarouselEffectCustomValues(void) +{ + ToolkitTestApplication application; + + Toolkit::CarouselEffect effect = Toolkit::CarouselEffect::New(); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + + const float radiusValue(100.0f); + const Vector2 centerValue(150.0f, 200.0f); + const Vector2 anglePerUnitValue(0.1f, 0.25f); + + effect.SetRadius( radiusValue ); + effect.SetCenter( centerValue ); + effect.SetAnglePerUnit( anglePerUnitValue ); + + actor.SetShaderEffect(effect); + Stage::GetCurrent().Add(actor); + + application.SendNotification(); + application.Render(); + + TestGlAbstraction& gl = application.GetGlAbstraction(); + DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetRadiusPropertyName().c_str(), radiusValue ) ); + DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetCenterPropertyName().c_str(), centerValue ) ); + DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetAnglePerUnitPropertyName().c_str(), anglePerUnitValue ) ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-CheckBoxButton.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-CheckBoxButton.cpp new file mode 100644 index 0000000..96c468a --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-CheckBoxButton.cpp @@ -0,0 +1,210 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + +using namespace Dali; +using namespace Toolkit; + +namespace +{ + +static bool gCheckBoxButtonState = false; +bool CheckBoxButtonClicked( Button button ) +{ + gCheckBoxButtonState = static_cast( button ).IsChecked(); + return true; +} + + + +Image CreateSolidColorImage( const Vector4& color, unsigned int width, unsigned int height ) +{ + BitmapImage imageData = BitmapImage::New( width, height, Pixel::RGBA8888 ); + + // Create the image + PixelBuffer* pixbuf = imageData.GetBuffer(); + unsigned int size = width * height; + + for( size_t i = 0; i < size; i++ ) + { + pixbuf[i*4+0] = 0xFF * color.r; + pixbuf[i*4+1] = 0xFF * color.g; + pixbuf[i*4+2] = 0xFF * color.b; + pixbuf[i*4+3] = 0xFF * color.a; + } + + imageData.Update(); + + return imageData; +} + +} // namespace + + +void checkbox_button_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void checkbox_button_cleanup(void) +{ + test_return_value = TET_PASS; +} + +int UtcDaliCheckBoxButtonSetGetChecked(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliCheckBoxButtonSetGetChecked"); + + CheckBoxButton checkBoxButton = CheckBoxButton::New(); + checkBoxButton.ClickedSignal().Connect( &CheckBoxButtonClicked ); + + // global var used to check if CheckBoxButtonClicked is called; + gCheckBoxButtonState = false; + + checkBoxButton.SetChecked( true ); + + DALI_TEST_CHECK( checkBoxButton.IsChecked() ); + DALI_TEST_CHECK( gCheckBoxButtonState ); + + checkBoxButton.SetChecked( false ); + + DALI_TEST_CHECK( !checkBoxButton.IsChecked() ); + DALI_TEST_CHECK( !gCheckBoxButtonState ); + + checkBoxButton.SetChecked( true ); + + DALI_TEST_CHECK( checkBoxButton.IsChecked() ); + DALI_TEST_CHECK( gCheckBoxButtonState ); + END_TEST; +} + +int UtcDaliCheckBoxButtonSetImages(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliCheckBoxButtonSetImages"); + + Actor imageActor; + + Image image01 = CreateSolidColorImage( Color::RED, 10, 10 ); + ImageActor imageActor01 = CreateSolidColorActor( Color::RED ); + imageActor01.SetSize( 20, 20 ); + + Image image02 = CreateSolidColorImage( Color::RED, 30, 30 ); + ImageActor imageActor02 = CreateSolidColorActor( Color::RED ); + imageActor02.SetSize( 40, 40 ); + + Image image03 = CreateSolidColorImage( Color::RED, 50, 50 ); + ImageActor imageActor03 = CreateSolidColorActor( Color::RED ); + imageActor03.SetSize( 60, 60 ); + + Image image04 = CreateSolidColorImage( Color::RED, 70, 70 ); + ImageActor imageActor04 = CreateSolidColorActor( Color::RED ); + imageActor04.SetSize( 80, 80 ); + + Vector3 size; + CheckBoxButton checkBoxButton = CheckBoxButton::New(); + + application.SendNotification(); + application.Render(); + + // Just check if check box button size changes when a bigger image is set. + + checkBoxButton.SetBackgroundImage( image01 ); + + application.SendNotification(); + application.Render(); + + size = checkBoxButton.GetBackgroundImage().GetCurrentSize(); + + DALI_TEST_EQUALS( size.width, 10.f, TEST_LOCATION ); + DALI_TEST_EQUALS( size.height, 10.f, TEST_LOCATION ); + + checkBoxButton.SetBackgroundImage( imageActor01 ); + + application.SendNotification(); + application.Render(); + + size = checkBoxButton.GetBackgroundImage().GetCurrentSize(); + + DALI_TEST_EQUALS( size.width, 20.f, TEST_LOCATION ); + DALI_TEST_EQUALS( size.height, 20.f, TEST_LOCATION ); + + checkBoxButton.SetCheckedImage( image02 ); + + application.SendNotification(); + application.Render(); + + size = checkBoxButton.GetCheckedImage().GetCurrentSize(); + + DALI_TEST_EQUALS( size.width, 30.f, TEST_LOCATION ); + DALI_TEST_EQUALS( size.height, 30.f, TEST_LOCATION ); + + checkBoxButton.SetCheckedImage( imageActor02 ); + + application.SendNotification(); + application.Render(); + + size = checkBoxButton.GetCheckedImage().GetCurrentSize(); + + DALI_TEST_EQUALS( size.width, 40.f, TEST_LOCATION ); + DALI_TEST_EQUALS( size.height, 40.f, TEST_LOCATION ); + + checkBoxButton.SetDimmedBackgroundImage( image03 ); + + application.SendNotification(); + application.Render(); + + size = checkBoxButton.GetDimmedBackgroundImage().GetCurrentSize(); + + DALI_TEST_EQUALS( size.width, 50.f, TEST_LOCATION ); + DALI_TEST_EQUALS( size.height, 50.f, TEST_LOCATION ); + + checkBoxButton.SetDimmedBackgroundImage( imageActor03 ); + + application.SendNotification(); + application.Render(); + + size = checkBoxButton.GetDimmedBackgroundImage().GetCurrentSize(); + + DALI_TEST_EQUALS( size.width, 60.f, TEST_LOCATION ); + DALI_TEST_EQUALS( size.height, 60.f, TEST_LOCATION ); + + checkBoxButton.SetDimmedCheckedImage( image04 ); + + application.SendNotification(); + application.Render(); + + size = checkBoxButton.GetDimmedCheckedImage().GetCurrentSize(); + + DALI_TEST_EQUALS( size.width, 70.f, TEST_LOCATION ); + DALI_TEST_EQUALS( size.height, 70.f, TEST_LOCATION ); + + checkBoxButton.SetDimmedCheckedImage( imageActor04 ); + + application.SendNotification(); + application.Render(); + + size = checkBoxButton.GetDimmedCheckedImage().GetCurrentSize(); + + DALI_TEST_EQUALS( size.width, 80.f, TEST_LOCATION ); + DALI_TEST_EQUALS( size.height, 80.f, TEST_LOCATION ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-Cluster.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-Cluster.cpp new file mode 100644 index 0000000..381d1cd --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-Cluster.cpp @@ -0,0 +1,201 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + + +using namespace Dali; +using namespace Dali::Toolkit; + +namespace +{ + +static bool gObjectCreatedCallBackCalled; + +static void TestCallback(BaseHandle handle) +{ + gObjectCreatedCallBackCalled = true; +} + +} // namespace + + +void cluster_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void cluster_cleanup(void) +{ + test_return_value = TET_PASS; +} + +int UtcDaliClusterNew(void) +{ + ToolkitTestApplication application; + + // Create the Cluster actor + ClusterStyle style = ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle1); + Cluster cluster = Cluster::New(style); + + DALI_TEST_CHECK(cluster); + + //Additional check to ensure object is created by checking if it's registered + ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + DALI_TEST_CHECK( registry ); + + gObjectCreatedCallBackCalled = false; + registry.ObjectCreatedSignal().Connect(&TestCallback); + { + ClusterStyle style = ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle1); + Cluster cluster = Cluster::New(style); + } + DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + END_TEST; +} + +int UtcDaliClusterDownCast(void) +{ + ToolkitTestApplication application; + + // Create the Cluster actor + ClusterStyle style = ClusterStyleRandom::New(); + const Cluster clusterConst = Cluster::New(style); + Cluster cluster(clusterConst); + + BaseHandle handle(cluster); + + Cluster newCluster = Cluster::DownCast( handle ); + DALI_TEST_CHECK( cluster ); + DALI_TEST_CHECK( newCluster == cluster ); + END_TEST; +} + +int UtcDaliClusterAddAndRemoveChild(void) +{ + ToolkitTestApplication application; + + // Create the Cluster actor + ClusterStyle style = ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle1); + Cluster cluster = Cluster::New(style); + + Actor childActor1 = Actor::New(); + Actor childActor2 = Actor::New(); + Actor childActor3 = Actor::New(); + Actor childActor4 = Actor::New(); + + // Add the first child and check it is added to the end + cluster.AddChild(childActor1); + DALI_TEST_CHECK( cluster.GetChildAt(0) == childActor1); + DALI_TEST_CHECK( !cluster.GetChildAt(1) ); + DALI_TEST_CHECK( cluster.GetTotalCount() == 1 ); + + // Add the second child to the given position and check it is added + cluster.AddChild(childActor2, 1); + DALI_TEST_CHECK( cluster.GetChildAt(1) == childActor2); + DALI_TEST_CHECK( cluster.GetTotalCount() == 2 ); + + // Add the third child with depth index 1 and check it is added to the end + cluster.AddChildAt(childActor3, 1); + DALI_TEST_CHECK( cluster.GetChildAt(2) == childActor3); + DALI_TEST_CHECK( cluster.GetTotalCount() == 3 ); + + // Add the fourth child with depth index 2 to the given position and check it is added + cluster.AddChildAt(childActor4, 2, 3); + DALI_TEST_CHECK( cluster.GetChildAt(3) == childActor4); + DALI_TEST_CHECK( cluster.GetTotalCount() == 4 ); + + // Remove the child in the given position and check it's removed + cluster.RemoveChildAt(3); + DALI_TEST_CHECK( !cluster.GetChildAt(3) ); + DALI_TEST_CHECK( cluster.GetTotalCount() == 3 ); + END_TEST; +} + +int UtcDaliClusterExpandAndCollapseChild(void) +{ + ToolkitTestApplication application; + + // Create the Cluster actor + ClusterStyle style = ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle1); + Cluster cluster = Cluster::New(style); + + Actor childActor1 = Actor::New(); + Actor childActor2 = Actor::New(); + Actor childActor3 = Actor::New(); + Actor childActor4 = Actor::New(); + + // Add the child actors + cluster.AddChild(childActor1); + cluster.AddChild(childActor2); + cluster.AddChildAt(childActor3, 1); + cluster.AddChildAt(childActor4, 2, 3); + + // Expand child actor 3 + cluster.ExpandChild(2); + DALI_TEST_CHECK( cluster.GetExpandedCount() == 1 ); + + // Expand child actor 4 + cluster.ExpandChild(3); + DALI_TEST_CHECK( cluster.GetExpandedCount() == 2 ); + + // Collapse child actor 3 + cluster.CollapseChild(2); + DALI_TEST_CHECK( cluster.GetExpandedCount() == 1 ); + + // Expand all children + cluster.ExpandAllChildren(); + DALI_TEST_CHECK( cluster.GetExpandedCount() == 4 ); + + // Collpase all children + cluster.CollapseAllChildren(); + DALI_TEST_CHECK( cluster.GetExpandedCount() == 0 ); + + // Transform and restore the child + cluster.TransformChild(1, Vector3(10.0f, 10.0f, 1.0f), Vector3(1.0f, 1.0f, 1.0f), Quaternion(0.0f, Vector3::YAXIS), AlphaFunctions::EaseOut, 0.5f); + cluster.RestoreChild(1, AlphaFunctions::EaseOut, 0.25f, true); + END_TEST; +} + +int UtcDaliClusterSetAndGetStyle(void) +{ + ToolkitTestApplication application; + + // Create the default cluster style + ClusterStyle defaultStyle = ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle1); + DALI_TEST_CHECK( defaultStyle.GetMaximumNumberOfChildren() > 0 ); + + // Add style to background and title + Actor background = Actor::New(); + Actor title = Actor::New(); + defaultStyle.ApplyStyleToBackground(background, AlphaFunctions::EaseOut, 1.0f); + defaultStyle.ApplyStyleToTitle(title, AlphaFunctions::EaseOut, 1.0f); + + // Create the Cluster actor with the default style + Cluster cluster = Cluster::New(defaultStyle); + DALI_TEST_CHECK( cluster.GetStyle() == defaultStyle ); + cluster.SetBackgroundImage(background); + cluster.SetTitle(title); + + // Create a new style and apply it to the cluster + ClusterStyle newStyle = ClusterStyleRandom::New(); + cluster.SetStyle(newStyle); + DALI_TEST_CHECK( cluster.GetStyle() == newStyle ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-ControlImpl.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-ControlImpl.cpp new file mode 100644 index 0000000..281ec90 --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-ControlImpl.cpp @@ -0,0 +1,127 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "dummy-control.h" + +using namespace Dali; +using namespace Dali::Toolkit; + + +void control_impl_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void control_impl_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +int UtcDaliControlImplTypeRegistry(void) +{ + ToolkitTestApplication application; + + // Register Type + TypeInfo type; + type = TypeRegistry::Get().GetTypeInfo( "Control" ); + DALI_TEST_CHECK( type ); + BaseHandle handle = type.CreateInstance(); + DALI_TEST_CHECK( handle ); + + // Check if it's a control + DALI_TEST_CHECK( Control::DownCast(handle) ); + END_TEST; +} + + +/////////////////////////////////////////////////////////////////////////////////////////////////// +namespace +{ +static bool MouseWheelEventCallback(Actor actor, const MouseWheelEvent& event) +{ + return false; +} +} + +int UtcDaliControlImplMouseWheelEvent(void) +{ + ToolkitTestApplication application; + + { + DummyControl dummy = DummyControl::New( true ); + DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation()); + + dummy.SetSize(100.0f, 100.0f); + dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); + Stage::GetCurrent().Add(dummy); + + dummy.MouseWheelEventSignal().Connect(&MouseWheelEventCallback); + + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + + DALI_TEST_EQUALS( dummyImpl.mouseWheelEventCalled, false, TEST_LOCATION ); + + // simulate a mouse wheel event + Vector2 screenCoordinates( 10.0f, 10.0f ); + Integration::MouseWheelEvent event(0, 0u, screenCoordinates, 1, 1000u); + application.ProcessEvent(event); + DALI_TEST_EQUALS( dummyImpl.mouseWheelEventCalled, true, TEST_LOCATION ); + + Stage::GetCurrent().Remove(dummy); + } + + // Ensure full code coverage + { + DummyControl dummy = DummyControl::New(); + + dummy.SetSize(100.0f, 100.0f); + dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); + Stage::GetCurrent().Add(dummy); + + dummy.MouseWheelEventSignal().Connect(&MouseWheelEventCallback); + + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + + // simulate a mouse wheel event + Vector2 screenCoordinates( 20.0f, 20.0f ); + Integration::MouseWheelEvent event(0, 0u, screenCoordinates, 1, 1000u); + application.ProcessEvent(event); + + Stage::GetCurrent().Remove(dummy); + } + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-CubeTransitionEffect.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-CubeTransitionEffect.cpp new file mode 100644 index 0000000..c08582a --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-CubeTransitionEffect.cpp @@ -0,0 +1,922 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + +using namespace Dali; +using namespace Dali::Toolkit; + + +namespace +{ +const unsigned int NUM_ROWS = 16; +const unsigned int NUM_COLUMNS = 10; +const Vector2 VIEW_AREA_SIZE( 480.0f, 800.0f ); +const float TRANSITION_DURATION = 0.5f; +const float CUBE_DISPLACEMENT = 55.f; +const Vector2 PAN_POSITION1( VIEW_AREA_SIZE.x * 0.75f, VIEW_AREA_SIZE.y * 0.25f ); +const Vector2 PAN_DISPLACEMENT1( -5.f, 5.f ); +const Vector2 PAN_POSITION2( VIEW_AREA_SIZE.x * 0.25f, VIEW_AREA_SIZE.y * 0.75f ); +const Vector2 PAN_DISPLACEMENT2( 5.f, 5.f ); +const int RENDER_FRAME_INTERVAL = 16; +static const float ROTATION_EPSILON = 0.0001f; +const float OFFSCREEN_RENDER_DURATION = 0.05f; + +static bool gObjectCreatedCallBackCalled; +static void TestCallback(BaseHandle handle) +{ + gObjectCreatedCallBackCalled = true; +} + +/** + * Simulate time passed by, waiting for certain process to finish + * @param[in] application Test application instance + * @param[in] durationToPass Time to pass in milliseconds. + */ +void Wait(ToolkitTestApplication& application, float durationToPass) +{ + int duration = static_cast(durationToPass*1000.f); + // wait 2 more frames to compensate the two frames used by the bitmapImage waiting for the loading succeeded signal + for(int i = 0; i <= duration/RENDER_FRAME_INTERVAL+2 ; i++) + { + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + } +} + + + +//Callback class to test whether transition completed signal is emitted when the transition animation is finished +class TransitionCompletedCallback : public Dali::ConnectionTracker +{ +public: + TransitionCompletedCallback( bool& signalReceived, CubeTransitionEffect& effect, ImageActor& imageActor ) + : mSignalVerified( signalReceived ), + mCurrentEffect( effect ), + mActorTransitTo( imageActor ) + { + } + + void Callback( CubeTransitionEffect effect, ImageActor imageActor ) + { + tet_infoline( "Verifying TransitionCompletedSignal" ); + + if( mCurrentEffect == effect && mActorTransitTo == imageActor ) + { + mSignalVerified = true; + } + } + + void Reset() + { + mSignalVerified = false; + } + + bool& mSignalVerified; + CubeTransitionEffect& mCurrentEffect; + ImageActor& mActorTransitTo; +}; + +} // namespace + + + +void cube_transition_effect_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void cube_transition_effect_cleanup(void) +{ + test_return_value = TET_PASS; +} + +int UtcDaliCubeTransitionWaveEffectNew(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliCubeTransitionWaveEffectNew "); + + CubeTransitionEffect waveEffect; + + DALI_TEST_CHECK( !waveEffect ); + + waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + + DALI_TEST_CHECK( waveEffect ); + + waveEffect = NULL; + + //Additional check to ensure object is created by checking if it's registered + ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + DALI_TEST_CHECK( registry ); + + gObjectCreatedCallBackCalled = false; + registry.ObjectCreatedSignal().Connect( &TestCallback ); + { + CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + } + DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + END_TEST; +} + +int UtcDaliCubeTransitionCrossEffectNew(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliCubeTransitionCrossEffectNew "); + + CubeTransitionEffect crossEffect; + + DALI_TEST_CHECK( !crossEffect ); + + crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + + DALI_TEST_CHECK( crossEffect ); + + crossEffect = NULL; + + //Additional check to ensure object is created by checking if it's registered + ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + DALI_TEST_CHECK( registry ); + + gObjectCreatedCallBackCalled = false; + registry.ObjectCreatedSignal().Connect( &TestCallback ); + { + CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + } + DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + END_TEST; +} + +int UtcDaliCubeTransitionFoldEffectNew(void) +{ + ToolkitTestApplication application; + tet_infoline( " UtcDaliCubeTransitionFoldEffectNew " ); + + CubeTransitionEffect foldEffect; + + DALI_TEST_CHECK( !foldEffect ); + + foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + + DALI_TEST_CHECK( foldEffect ); + + foldEffect = NULL; + + //Additional check to ensure object is created by checking if it is registered + ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + DALI_TEST_CHECK( registry ); + + gObjectCreatedCallBackCalled = false; + registry.ObjectCreatedSignal().Connect( &TestCallback ); + { + CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + } + DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + END_TEST; +} + +int UtcDaliCubeTransitionEffectSetGetTransitionDuration(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliCubeTransitionEffectSetGetTransitionDuration "); + + CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + waveEffect.SetTransitionDuration( TRANSITION_DURATION ); + DALI_TEST_EQUALS( TRANSITION_DURATION, waveEffect.GetTransitionDuration(), TEST_LOCATION ); + + CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + crossEffect.SetTransitionDuration( TRANSITION_DURATION ); + DALI_TEST_EQUALS( TRANSITION_DURATION, crossEffect.GetTransitionDuration(), TEST_LOCATION ); + + CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + foldEffect.SetTransitionDuration( TRANSITION_DURATION ); + DALI_TEST_EQUALS( TRANSITION_DURATION, foldEffect.GetTransitionDuration(), TEST_LOCATION ); + END_TEST; +} + +int UtcDaliCubeTransitionEffectSetGetCubeDisplacement(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliCubeTransitionEffectSetGetTransitionDuration "); + + CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT ); + DALI_TEST_EQUALS( CUBE_DISPLACEMENT, waveEffect.GetCubeDisplacement(), TEST_LOCATION ); + + CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT ); + DALI_TEST_EQUALS( CUBE_DISPLACEMENT, crossEffect.GetCubeDisplacement(), TEST_LOCATION ); + + //Cube displacement is not used in CubeTransitionFoldEffect + END_TEST; +} + +//Test common codes in base class +int UtcDaliCubeTransitionEffectGetRoot(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliCubeTransitionEffectGetRoot "); + + unsigned int totalNum = NUM_ROWS*NUM_COLUMNS; + + CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + Actor rootActor = waveEffect.GetRoot(); + + // check that we have a total of NUM_ROWS*NUM_COLUMNS cubes; + DALI_TEST_CHECK( totalNum == rootActor.GetChildCount() ); + + // check that every cube has two children + DALI_TEST_CHECK( 2 == rootActor.GetChildAt(0).GetChildCount() ); + DALI_TEST_CHECK( 2 == rootActor.GetChildAt(totalNum/2).GetChildCount() ); + DALI_TEST_CHECK( 2 == rootActor.GetChildAt(totalNum-1).GetChildCount() ); + END_TEST; +} + +int UtcDaliCubeTransitionEffectIsTransiting(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliCubeTransitionEffectIsTransiting "); + + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE ); + ImageActor imageActor = CreateSolidColorImageActor(application, Color::BLUE,30,30); + + CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + Actor rootActor = waveEffect.GetRoot(); + Stage::GetCurrent().Add( rootActor ); + + waveEffect.SetTransitionDuration( TRANSITION_DURATION ); + waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT ); + DALI_TEST_CHECK( !waveEffect.IsTransiting() ); + + waveEffect.SetCurrentImage(imageActor); + waveEffect.SetTargetImage(imageActor); + //transition is started + waveEffect.StartTransition(); + DALI_TEST_CHECK( waveEffect.IsTransiting() ); + //transition is finished + Wait( application, TRANSITION_DURATION ); + DALI_TEST_CHECK( !waveEffect.IsTransiting() ); + + CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + crossEffect.SetTransitionDuration( TRANSITION_DURATION ); + crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT ); + DALI_TEST_CHECK( !crossEffect.IsTransiting() ); + + crossEffect.SetCurrentImage(imageActor); + crossEffect.SetTargetImage(imageActor); + //transition is started + crossEffect.StartTransition(false); + DALI_TEST_CHECK( crossEffect.IsTransiting() ); + //transition is finished + Wait( application, TRANSITION_DURATION ); + DALI_TEST_CHECK( !crossEffect.IsTransiting() ); + + CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + foldEffect.SetTransitionDuration( TRANSITION_DURATION ); + DALI_TEST_CHECK( !foldEffect.IsTransiting() ); + + foldEffect.SetCurrentImage( imageActor ); + foldEffect.SetTargetImage( imageActor ); + //transition is started + foldEffect.StartTransition(true); + DALI_TEST_CHECK(foldEffect.IsTransiting() ); + //transition is finished + Wait( application, TRANSITION_DURATION ); + DALI_TEST_CHECK( !foldEffect.IsTransiting() ); + + END_TEST; +} + +//Test common codes in base class +int UtcDaliCubeTransitionEffectSetCurrentImage(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliCubeTransitionEffectSetCurrentImage "); + + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE ); + ImageActor imageActor = CreateSolidColorImageActor(application, Color::BLUE,40,40) ; + + CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + waveEffect.SetCurrentImage( imageActor ); + + // the current image content is set to the tiles facing the camera + ImageActor tile = ImageActor::DownCast( (waveEffect.GetRoot().GetChildAt(0).GetChildAt(0))); + + //check the pixel area set to the cube + ImageActor::PixelArea pixelAreaDef( 0, 0, VIEW_AREA_SIZE.x / NUM_COLUMNS, VIEW_AREA_SIZE.y / NUM_ROWS); + ImageActor::PixelArea pixelArea = tile.GetPixelArea(); + DALI_TEST_CHECK ( pixelAreaDef == pixelArea ); + + //check the size of the off screen rendered image + Wait( application, OFFSCREEN_RENDER_DURATION ); + ImageAttributes attributes( tile.GetImage().GetAttributes() ); + DALI_TEST_EQUALS( static_cast(attributes.GetWidth()), VIEW_AREA_SIZE.x, TEST_LOCATION ); + DALI_TEST_EQUALS( static_cast(attributes.GetHeight()), VIEW_AREA_SIZE.y, TEST_LOCATION ); + END_TEST; +} + +//Test common codes in base class +int UtcDaliCubeTransitionEffectSetTargetImage(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliCubeTransitionEffectSetTargetImage "); + + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE ); + ImageActor imageActor = CreateSolidColorImageActor(application, Color::BLUE,30,30); + + CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + Actor rootActor = waveEffect.GetRoot(); + Stage::GetCurrent().Add( rootActor ); + + waveEffect.SetCurrentImage( imageActor ); + waveEffect.SetTargetImage( imageActor ); + + // the target image content is set to the tiles currently invisible to the camera + ImageActor tile = ImageActor::DownCast( (rootActor.GetChildAt(0).GetChildAt(1))); + + //check the pixel area set to the cube + ImageActor::PixelArea pixelAreaDef( 0, 0, VIEW_AREA_SIZE.x / NUM_COLUMNS, VIEW_AREA_SIZE.y / NUM_ROWS); + ImageActor::PixelArea pixelArea = tile.GetPixelArea(); + DALI_TEST_CHECK ( pixelAreaDef == pixelArea ); + + //check the size of the off screen rendered image + Wait( application, OFFSCREEN_RENDER_DURATION ); + ImageAttributes attributes( tile.GetImage().GetAttributes() ); + DALI_TEST_EQUALS( static_cast(attributes.GetWidth()), VIEW_AREA_SIZE.x, TEST_LOCATION ); + DALI_TEST_EQUALS( static_cast(attributes.GetHeight()), VIEW_AREA_SIZE.y, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliCubeTransitionWaveEffectStartTransition(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliCubeTransitionWaveEffectStartTransition "); + + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE ); + ImageActor imageActor = CreateSolidColorImageActor(application, Color::BLUE,30,30); + + CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + waveEffect.SetTransitionDuration( TRANSITION_DURATION ); + waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT ); + Actor rootActor = waveEffect.GetRoot(); + Stage::GetCurrent().Add( rootActor ); + Actor cube = rootActor.GetChildAt(0); + + waveEffect.SetCurrentImage( imageActor ); + + Vector4 fullBrightness = Vector4(1.f,1.f,1.f,1.f); + Vector4 halfBrightness = Vector4(0.5f, 0.5f, 0.5f, 1.f); + + //check the cube rotation value and color values after different transitions + waveEffect.SetTargetImage( imageActor ); + waveEffect.StartTransition(true); + Wait( application, TRANSITION_DURATION ); + DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_CHECK( cube.GetChildAt(0).GetCurrentColor() == halfBrightness ); + DALI_TEST_CHECK( cube.GetChildAt(1).GetCurrentColor() == fullBrightness ); + + waveEffect.SetTargetImage( imageActor ); + waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1); + Wait( application, TRANSITION_DURATION ); + DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_CHECK( cube.GetChildAt(0).GetCurrentColor() == fullBrightness ); + DALI_TEST_CHECK( cube.GetChildAt(1).GetCurrentColor() == halfBrightness ); + + waveEffect.SetTargetImage( imageActor ); + waveEffect.StartTransition(false); + Wait( application, TRANSITION_DURATION ); + DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_CHECK( cube.GetChildAt(0).GetCurrentColor() == halfBrightness ); + DALI_TEST_CHECK( cube.GetChildAt(1).GetCurrentColor() == fullBrightness ); + + waveEffect.SetTargetImage( imageActor ); + waveEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2); + Wait( application, TRANSITION_DURATION ); + DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_CHECK( cube.GetChildAt(0).GetCurrentColor() == fullBrightness ); + DALI_TEST_CHECK( cube.GetChildAt(1).GetCurrentColor() == halfBrightness ); + END_TEST; +} + +int UtcDaliCubeTransitionCrossEffectStartTransition(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliCubeTransitionCrossEffectStartTransition "); + + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE ); + ImageActor imageActor = CreateSolidColorImageActor(application, Color::BLUE,30,30); + + CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + crossEffect.SetTransitionDuration( TRANSITION_DURATION ); + crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT ); + Actor rootActor = crossEffect.GetRoot(); + Stage::GetCurrent().Add( rootActor ); + crossEffect.SetCurrentImage( imageActor ); + Actor cube0 = rootActor.GetChildAt(0); + Actor cube1 = rootActor.GetChildAt(1); + + Vector4 fullBrightness = Vector4(1.f,1.f,1.f,1.f); + Vector4 halfBrightness = Vector4(0.5f, 0.5f, 0.5f, 1.f); + + //check the cube rotation values and color values after different transitions + crossEffect.SetTargetImage( imageActor ); + crossEffect.StartTransition(true); + Wait( application, TRANSITION_DURATION ); + DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::XAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == halfBrightness ); + DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == fullBrightness ); + + crossEffect.SetTargetImage( imageActor ); + crossEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1); + Wait( application, TRANSITION_DURATION ); + DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 2.f*Math::PI_2, Vector3::XAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == fullBrightness ); + DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == halfBrightness ); + + + crossEffect.SetTargetImage( imageActor ); + crossEffect.StartTransition(false); + Wait( application, TRANSITION_DURATION ); + DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::XAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == halfBrightness ); + DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == fullBrightness ); + + crossEffect.SetTargetImage( imageActor ); + crossEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2); + Wait( application, TRANSITION_DURATION ); + DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 0.f, Vector3::XAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == fullBrightness ); + DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == halfBrightness ); + END_TEST; +} + +int UtcDaliCubeTransitionFoldEffectStartTransition(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliCubeTransitionFoldEffectStartTransition "); + + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE ); + ImageActor imageActor = CreateSolidColorImageActor(application, Color::BLUE,30,30); + + CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + foldEffect.SetTransitionDuration( TRANSITION_DURATION ); + Actor rootActor = foldEffect.GetRoot(); + Stage::GetCurrent().Add( rootActor ); + foldEffect.SetCurrentImage( imageActor ); + Actor cube0 = rootActor.GetChildAt(0); + Actor cube1 = rootActor.GetChildAt(1); + + Vector4 fullBrightness = Vector4(1.f,1.f,1.f,1.f); + Vector4 halfBrightness = Vector4(0.5f, 0.5f, 0.5f, 1.f); + + //check the cube rotation values and color values after different transitions + foldEffect.SetTargetImage( imageActor ); + foldEffect.StartTransition(true); + Wait( application, TRANSITION_DURATION ); + DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == halfBrightness ); + DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == fullBrightness ); + + foldEffect.SetTargetImage( imageActor ); + foldEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1); + Wait( application, TRANSITION_DURATION ); + DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 2.f*Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == fullBrightness ); + DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == halfBrightness ); + + + foldEffect.SetTargetImage( imageActor ); + foldEffect.StartTransition(false); + Wait( application, TRANSITION_DURATION ); + DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == halfBrightness ); + DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == fullBrightness ); + + foldEffect.SetTargetImage( imageActor ); + foldEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2); + Wait( application, TRANSITION_DURATION ); + DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == fullBrightness ); + DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == halfBrightness ); + END_TEST; +} + +int UtcDaliCubeTransitionEffectSignalTransitionCompleted(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliCubeTransitionEffectSignalTransitionCompleted "); + + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE ); + ImageActor firstImageActor = CreateSolidColorImageActor(application, Color::RED,30,30); + ImageActor secondImageActor = CreateSolidColorImageActor(application, Color::GREEN,20,20); + ImageActor thirdImageActor = CreateSolidColorImageActor(application, Color::BLUE,40,40); + + CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + waveEffect.SetTransitionDuration( TRANSITION_DURATION ); + waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT ); + Actor rootActor = waveEffect.GetRoot(); + Stage::GetCurrent().Add( rootActor ); + + CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + crossEffect.SetTransitionDuration( TRANSITION_DURATION ); + crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT ); + rootActor = crossEffect.GetRoot(); + Stage::GetCurrent().Add( rootActor ); + + CubeTransitionEffect foldEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + foldEffect.SetTransitionDuration( TRANSITION_DURATION ); + rootActor = foldEffect.GetRoot(); + Stage::GetCurrent().Add( rootActor ); + + bool signalVerified = false; + CubeTransitionEffect currentEffect; + ImageActor actorTransitTo; + TransitionCompletedCallback callback(signalVerified, currentEffect, actorTransitTo); + waveEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback ); + crossEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback ); + foldEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback ); + + //check that the wave effect is used to transit to secondImageActor + currentEffect = waveEffect; + actorTransitTo = secondImageActor; + waveEffect.SetCurrentImage( firstImageActor ); + waveEffect.SetTargetImage( secondImageActor ); + waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1); + Wait( application, TRANSITION_DURATION ); + DALI_TEST_CHECK(callback.mSignalVerified); + callback.Reset(); + + //check that the wave effect is used to transit to thirdImageActor + actorTransitTo = thirdImageActor; + waveEffect.SetTargetImage( thirdImageActor ); + waveEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2); + Wait( application, TRANSITION_DURATION ); + DALI_TEST_CHECK(callback.mSignalVerified); + callback.Reset(); + + //check that the cross effect is used to transit to secondImageActor + currentEffect = crossEffect; + actorTransitTo = secondImageActor; + crossEffect.SetCurrentImage( thirdImageActor ); + crossEffect.SetTargetImage( secondImageActor ); + crossEffect.StartTransition(true); + Wait( application, TRANSITION_DURATION ); + DALI_TEST_CHECK(callback.mSignalVerified); + callback.Reset(); + + //check that the cross effect is used to transit to firstImageActor + actorTransitTo = firstImageActor; + crossEffect.SetTargetImage( firstImageActor ); + crossEffect.StartTransition(false); + Wait( application, TRANSITION_DURATION ); + DALI_TEST_CHECK(callback.mSignalVerified); + callback.Reset(); + + //check that the fold effect is used to transit to secondImageActor + currentEffect = foldEffect; + actorTransitTo = secondImageActor; + foldEffect.SetCurrentImage( firstImageActor ); + foldEffect.SetTargetImage( secondImageActor ); + foldEffect.StartTransition(); + Wait( application, TRANSITION_DURATION ); + DALI_TEST_CHECK( callback.mSignalVerified ); + callback.Reset(); + + //check that the fold effect is used to transit to thirdImageActor + actorTransitTo = thirdImageActor; + foldEffect.SetTargetImage( thirdImageActor ); + foldEffect.StartTransition( false ); + Wait( application, TRANSITION_DURATION ); + DALI_TEST_CHECK( callback.mSignalVerified ); + END_TEST; +} + +int UtcDaliCubeTransitionEffectPauseResumeTransition(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliCubeTransitionEffectPauseResumeTransition "); + + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE ); + ImageActor firstImageActor = CreateSolidColorImageActor(application, Color::RED,30,30); + ImageActor secondImageActor = CreateSolidColorImageActor(application, Color::GREEN,20,20); + + CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + waveEffect.SetTransitionDuration( TRANSITION_DURATION ); + waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT ); + Actor rootActor = waveEffect.GetRoot(); + Stage::GetCurrent().Add( rootActor ); + + CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + crossEffect.SetTransitionDuration( TRANSITION_DURATION ); + crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT ); + rootActor = crossEffect.GetRoot(); + Stage::GetCurrent().Add( rootActor ); + + CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + foldEffect.SetTransitionDuration( TRANSITION_DURATION ); + rootActor = crossEffect.GetRoot(); + Stage::GetCurrent().Add( rootActor ); + + bool signalVerified = false; + CubeTransitionEffect currentEffect; + ImageActor actorTransitTo; + TransitionCompletedCallback callback(signalVerified, currentEffect, actorTransitTo); + waveEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback ); + crossEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback ); + foldEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback ); + + currentEffect = waveEffect; + actorTransitTo = secondImageActor; + waveEffect.SetCurrentImage( firstImageActor ); + waveEffect.SetTargetImage( secondImageActor ); + // start transition; transit for 0.5*duration; pause for 0.5*duration; + // resume for 0.25*duration; pause for 0.25*duration; resume for another 0.25*duration; + // only until now the transition finished signal can be received + waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1); + Wait( application, TRANSITION_DURATION*0.5f ); + DALI_TEST_CHECK(!callback.mSignalVerified); + waveEffect.PauseTransition(); + Wait( application, TRANSITION_DURATION*0.5f ); + DALI_TEST_CHECK(!callback.mSignalVerified); + waveEffect.ResumeTransition(); + Wait( application, TRANSITION_DURATION*0.25f ); + DALI_TEST_CHECK(!callback.mSignalVerified); + waveEffect.PauseTransition(); + Wait( application, TRANSITION_DURATION*0.25f ); + DALI_TEST_CHECK(!callback.mSignalVerified); + waveEffect.ResumeTransition(); + Wait( application, TRANSITION_DURATION*0.25f ); + DALI_TEST_CHECK(callback.mSignalVerified); + callback.Reset(); + + currentEffect = crossEffect; + actorTransitTo = firstImageActor; + crossEffect.SetCurrentImage( secondImageActor ); + crossEffect.SetTargetImage( firstImageActor ); + // start transition; transit for 0.25*duration; pause for 0.2*duration; + // resume for 0.5*duration; pause for 0.2*duration; resume for another 0.25*duration; + // only until now the transition finished signal can be received + crossEffect.StartTransition(false); + Wait( application, TRANSITION_DURATION*0.25f ); + DALI_TEST_CHECK(!callback.mSignalVerified); + crossEffect.PauseTransition(); + Wait( application, TRANSITION_DURATION*0.2f ); + DALI_TEST_CHECK(!callback.mSignalVerified); + crossEffect.ResumeTransition(); + Wait( application, TRANSITION_DURATION*0.5f ); + DALI_TEST_CHECK(!callback.mSignalVerified); + crossEffect.PauseTransition(); + Wait( application, TRANSITION_DURATION*0.2f ); + DALI_TEST_CHECK(!callback.mSignalVerified); + crossEffect.ResumeTransition(); + Wait( application, TRANSITION_DURATION*0.25f ); + DALI_TEST_CHECK(callback.mSignalVerified); + callback.Reset(); + + currentEffect = foldEffect; + actorTransitTo = secondImageActor; + foldEffect.SetCurrentImage( firstImageActor ); + foldEffect.SetTargetImage( secondImageActor ); + // start transition; transit for 0.5*duration; pause for 0.5*duration; + // resume for 0.25*duration; pause for 0.25*duration; resume for another 0.25*duration; + // only until now the transition finished signal can be received + foldEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1); + Wait( application, TRANSITION_DURATION*0.5f ); + DALI_TEST_CHECK(!callback.mSignalVerified); + foldEffect.PauseTransition(); + Wait( application, TRANSITION_DURATION*0.5f ); + DALI_TEST_CHECK(!callback.mSignalVerified); + foldEffect.ResumeTransition(); + Wait( application, TRANSITION_DURATION*0.25f ); + DALI_TEST_CHECK(!callback.mSignalVerified); + foldEffect.PauseTransition(); + Wait( application, TRANSITION_DURATION*0.25f ); + DALI_TEST_CHECK(!callback.mSignalVerified); + foldEffect.ResumeTransition(); + Wait( application, TRANSITION_DURATION*0.25f ); + DALI_TEST_CHECK(callback.mSignalVerified); + END_TEST; +} + +int UtcDaliCubeTransitionWaveEffectStopTransition(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliCubeTransitionWaveEffectStopTransition "); + + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE ); + ImageActor firstImageActor = CreateSolidColorImageActor(application, Color::RED,30,30); + ImageActor secondImageActor = CreateSolidColorImageActor(application, Color::GREEN,20,20); + + CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + waveEffect.SetTransitionDuration( TRANSITION_DURATION ); + waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT ); + Actor rootActor = waveEffect.GetRoot(); + Stage::GetCurrent().Add( rootActor ); + Actor cube = rootActor.GetChildAt(0); + waveEffect.SetCurrentImage( firstImageActor ); + + Vector4 fullBrightness = Vector4(1.f,1.f,1.f,1.f); + Vector4 halfBrightness = Vector4(0.5f, 0.5f, 0.5f, 1.f); + + //check the cube rotation value and color values after stopping different transitions in the middle + waveEffect.SetTargetImage( secondImageActor ); + waveEffect.StartTransition(true); + Wait( application, TRANSITION_DURATION*0.2f ); + waveEffect.StopTransition(); + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_CHECK( cube.GetChildAt(0).GetCurrentColor() == halfBrightness ); + DALI_TEST_CHECK( cube.GetChildAt(1).GetCurrentColor() == fullBrightness ); + + waveEffect.SetTargetImage( firstImageActor ); + waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1); + Wait( application, TRANSITION_DURATION*0.4f ); + waveEffect.StopTransition(); + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_CHECK( cube.GetChildAt(0).GetCurrentColor() == fullBrightness ); + DALI_TEST_CHECK( cube.GetChildAt(1).GetCurrentColor() == halfBrightness ); + + waveEffect.SetTargetImage( secondImageActor ); + waveEffect.StartTransition(false); + Wait( application, TRANSITION_DURATION*0.6f ); + waveEffect.StopTransition(); + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_CHECK( cube.GetChildAt(0).GetCurrentColor() == halfBrightness ); + DALI_TEST_CHECK( cube.GetChildAt(1).GetCurrentColor() == fullBrightness ); + + waveEffect.SetTargetImage( firstImageActor ); + waveEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2); + Wait( application, TRANSITION_DURATION*0.8f ); + waveEffect.StopTransition(); + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_CHECK( cube.GetChildAt(0).GetCurrentColor() == fullBrightness ); + DALI_TEST_CHECK( cube.GetChildAt(1).GetCurrentColor() == halfBrightness ); + END_TEST; +} + +int UtcDaliCubeTransitionCrossEffectStopTransition(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliCubeTransitionCrossEffectStopTransition "); + + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE ); + ImageActor firstImageActor = CreateSolidColorImageActor(application, Color::RED,30,30); + ImageActor secondImageActor = CreateSolidColorImageActor(application, Color::GREEN,20,20); + + CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + crossEffect.SetTransitionDuration( TRANSITION_DURATION ); + crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT ); + Actor rootActor = crossEffect.GetRoot(); + Stage::GetCurrent().Add( rootActor ); + crossEffect.SetCurrentImage( firstImageActor ); + Actor cube0 = rootActor.GetChildAt(0); + Actor cube1 = rootActor.GetChildAt(1); + + Vector4 fullBrightness = Vector4(1.f,1.f,1.f,1.f); + Vector4 halfBrightness = Vector4(0.5f, 0.5f, 0.5f, 1.f); + + //check the cube rotation values and color values after stop the different transitions in the middle + crossEffect.SetTargetImage( secondImageActor ); + crossEffect.StartTransition(true); + Wait( application, TRANSITION_DURATION*0.2f ); + crossEffect.StopTransition(); + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::XAXIS), ROTATION_EPSILON, TEST_LOCATION ); + + DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == halfBrightness ); + DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == fullBrightness ); + + crossEffect.SetTargetImage( firstImageActor ); + crossEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1); + Wait( application, TRANSITION_DURATION*0.4f ); + crossEffect.StopTransition(); + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 2.f*Math::PI_2, Vector3::XAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == fullBrightness ); + DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == halfBrightness ); + + crossEffect.SetTargetImage( secondImageActor ); + crossEffect.StartTransition(false); + Wait( application, TRANSITION_DURATION*0.6f ); + crossEffect.StopTransition(); + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::XAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == halfBrightness ); + DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == fullBrightness ); + + crossEffect.SetTargetImage( firstImageActor ); + crossEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2); + Wait( application, TRANSITION_DURATION*0.8f ); + crossEffect.StopTransition(); + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 0.f, Vector3::XAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == fullBrightness ); + DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == halfBrightness ); + END_TEST; +} + +int UtcDaliCubeTransitionFoldEffectStopTransition(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliCubeTransitionFoldEffectStopTransition "); + + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE ); + ImageActor firstImageActor = CreateSolidColorImageActor(application, Color::RED,30,30); + ImageActor secondImageActor = CreateSolidColorImageActor(application, Color::GREEN,20,20); + + CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE ); + foldEffect.SetTransitionDuration( TRANSITION_DURATION ); + Actor rootActor = foldEffect.GetRoot(); + Stage::GetCurrent().Add( rootActor ); + foldEffect.SetCurrentImage( firstImageActor ); + Actor cube0 = rootActor.GetChildAt(0); + Actor cube1 = rootActor.GetChildAt(1); + + Vector4 fullBrightness = Vector4(1.f,1.f,1.f,1.f); + Vector4 halfBrightness = Vector4(0.5f, 0.5f, 0.5f, 1.f); + + //check the cube rotation values and color values after stop the different transitions in the middle + foldEffect.SetTargetImage( secondImageActor ); + foldEffect.StartTransition(true); + Wait( application, TRANSITION_DURATION*0.2f ); + foldEffect.StopTransition(); + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == halfBrightness ); + DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == fullBrightness ); + + foldEffect.SetTargetImage( firstImageActor ); + foldEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1); + Wait( application, TRANSITION_DURATION*0.4f ); + foldEffect.StopTransition(); + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 2.f*Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == fullBrightness ); + DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == halfBrightness ); + + foldEffect.SetTargetImage( secondImageActor ); + foldEffect.StartTransition(false); + Wait( application, TRANSITION_DURATION*0.6f ); + foldEffect.StopTransition(); + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == halfBrightness ); + DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == fullBrightness ); + + foldEffect.SetTargetImage( firstImageActor ); + foldEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2); + Wait( application, TRANSITION_DURATION*0.8f ); + foldEffect.StopTransition(); + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == fullBrightness ); + DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == halfBrightness ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-DefaultControls.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-DefaultControls.cpp new file mode 100644 index 0000000..f6222be --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-DefaultControls.cpp @@ -0,0 +1,127 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + +using namespace Dali; +using namespace Toolkit; + +void dali_default_controls_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void dali_default_controls_cleanup(void) +{ + test_return_value = TET_PASS; +} + + + +int UtcDaliDefaultControlsCreateCheckBoxButton(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliDefaultControlsCreateCheckBoxButton"); + + const std::string imagePath( "Facke image path" ); + const std::string voidImagePath( "" ); + + ImageActor image = CreateSolidColorActor( Color::RED ); + ImageActor voidImage; + + CheckBoxButton button0, button1, button2, button3, button4, button5; + + try + { + button0 = CreateCheckBoxButton( voidImagePath, voidImagePath, voidImagePath, voidImagePath ); + button1 = CreateCheckBoxButton( imagePath, voidImagePath, voidImagePath, voidImagePath ); + button2 = CreateCheckBoxButton( voidImagePath, imagePath, voidImagePath, voidImagePath ); + button3 = CreateCheckBoxButton( voidImagePath, voidImagePath, imagePath, voidImagePath ); + button4 = CreateCheckBoxButton( voidImagePath, voidImagePath, voidImagePath, imagePath ); + button5 = CreateCheckBoxButton( imagePath, imagePath, imagePath, imagePath ); + } + catch( ... ) + { + tet_result( TET_FAIL ); + } + + DALI_TEST_CHECK( button0 ); + DALI_TEST_CHECK( button1 ); + DALI_TEST_CHECK( button2 ); + DALI_TEST_CHECK( button3 ); + DALI_TEST_CHECK( button4 ); + DALI_TEST_CHECK( button5 ); + + try + { + button0 = CreateCheckBoxButton( voidImage, voidImage, voidImage, voidImage ); + button1 = CreateCheckBoxButton( image, voidImage, voidImage, voidImage ); + button2 = CreateCheckBoxButton( voidImage, image, voidImage, voidImage ); + button3 = CreateCheckBoxButton( voidImage, voidImage, image, voidImage ); + button4 = CreateCheckBoxButton( voidImage, voidImage, voidImage, image ); + button5 = CreateCheckBoxButton( image, image, image, image ); + } + catch( ... ) + { + tet_result( TET_FAIL ); + } + + DALI_TEST_CHECK( button0 ); + DALI_TEST_CHECK( button1 ); + DALI_TEST_CHECK( button2 ); + DALI_TEST_CHECK( button3 ); + DALI_TEST_CHECK( button4 ); + DALI_TEST_CHECK( button5 ); + + try + { + button0 = CreateCheckBoxButton( voidImagePath, voidImagePath ); + button1 = CreateCheckBoxButton( voidImagePath, imagePath ); + button2 = CreateCheckBoxButton( imagePath, voidImagePath ); + button3 = CreateCheckBoxButton( imagePath, imagePath ); + } + catch( ... ) + { + tet_result( TET_FAIL ); + } + + DALI_TEST_CHECK( button0 ); + DALI_TEST_CHECK( button1 ); + DALI_TEST_CHECK( button2 ); + DALI_TEST_CHECK( button3 ); + + try + { + button0 = CreateCheckBoxButton( voidImage, voidImage ); + button2 = CreateCheckBoxButton( voidImage, image ); + button3 = CreateCheckBoxButton( voidImage, image ); + button4 = CreateCheckBoxButton( image, image ); + } + catch( ... ) + { + tet_result( TET_FAIL ); + } + + DALI_TEST_CHECK( button0 ); + DALI_TEST_CHECK( button1 ); + DALI_TEST_CHECK( button2 ); + DALI_TEST_CHECK( button3 ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-DepthLayout.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-DepthLayout.cpp new file mode 100644 index 0000000..f7eecad --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-DepthLayout.cpp @@ -0,0 +1,618 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include // for FLT_MAX +#include +#include +#include +#include + +using namespace Dali; +using namespace Toolkit; + +namespace +{ +const unsigned int TOTAL_ITEM_NUMBER = 200; + +Vector3 DepthLayoutItemSizeFunction(unsigned int numberOfColumns, float layoutWidth) +{ + float width = (layoutWidth / static_cast(numberOfColumns + 1)) * 0.8f; + return Vector3(width, width, width); +} + +float DepthLayoutBottomMarginFunction(float layoutHeight) +{ + return layoutHeight * 0.25f; +} + +float DepthLayoutColumnPositionFunction(unsigned int numberOfColumns, unsigned int columnNumber, const Vector3& itemSize, float layoutWidth) +{ + float availableSpace = layoutWidth - itemSize.width * numberOfColumns; + float leftMargin = availableSpace / numberOfColumns * 0.5f; + float columnPosition = leftMargin + itemSize.width * 0.5f + columnNumber * (itemSize.width + availableSpace / numberOfColumns); + return columnPosition - layoutWidth * 0.5f; +} +} // namespace + + +// Implementation of ItemFactory for providing actors to ItemView +class TestItemFactory : public ItemFactory +{ +public: + + /** + * Constructor + * @param application class, stored as reference + */ + TestItemFactory() + { + } + +public: // From ItemFactory + + /** + * Query the number of items available from the factory. + * The maximum available item has an ID of GetNumberOfItems() - 1. + */ + virtual unsigned int GetNumberOfItems() + { + return TOTAL_ITEM_NUMBER; + } + + /** + * Create an Actor to represent a visible item. + * @param itemId + * @return the created actor. + */ + virtual Actor NewItem(unsigned int itemId) + { + // Create an test actor for this item + ImageActor actor = CreateSolidColorActor(Color::RED); + actor.SetSize(64.0f, 64.0f); + + return actor; + } +}; + + +void depth_layout_startup(void) +{ +} + +void depth_layout_cleanup(void) +{ +} + +int UtcDaliDepthLayoutNew(void) +{ + ToolkitTestApplication application; + + // Create a depth layout + DepthLayoutPtr depthLayout = DepthLayout::New(); + + DALI_TEST_CHECK(depthLayout); + END_TEST; +} + +int UtcDaliDepthLayoutSetAndGetNumberOfColumns(void) +{ + ToolkitTestApplication application; + + // Create a depth layout + DepthLayoutPtr depthLayout = DepthLayout::New(); + + // Set the number of columns + depthLayout->SetNumberOfColumns(5); + + // Check whether we get the correct number of columns + DALI_TEST_CHECK(depthLayout->GetNumberOfColumns() == 5); + END_TEST; +} + +int UtcDaliDepthLayoutSetAndGetNumberOfRows(void) +{ + ToolkitTestApplication application; + + // Create a depth layout + DepthLayoutPtr depthLayout = DepthLayout::New(); + + // Set the number of rows + depthLayout->SetNumberOfRows(15); + + // Check whether we get the correct number of rows + DALI_TEST_CHECK(depthLayout->GetNumberOfRows() == 15); + END_TEST; +} + +int UtcDaliDepthLayoutSetAndGetRowSpacing(void) +{ + ToolkitTestApplication application; + + // Create a depth layout + DepthLayoutPtr depthLayout = DepthLayout::New(); + + // Set the row spacing + depthLayout->SetRowSpacing(30.0f); + + // Check whether we get the correct row spacing + DALI_TEST_EQUALS(depthLayout->GetRowSpacing(), 30.0f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliDepthLayoutSetAndGetTiltAngle(void) +{ + ToolkitTestApplication application; + + // Create a depth layout + DepthLayoutPtr depthLayout = DepthLayout::New(); + + // Set the tilt angle + depthLayout->SetTiltAngle(Degree(25.0f)); + + // Check whether we get the correct tilt angle + DALI_TEST_EQUALS(float(depthLayout->GetTiltAngle()), 25.0f, 0.001f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliDepthLayoutSetAndGetItemSizeFunction(void) +{ + ToolkitTestApplication application; + + // Create a depth layout + DepthLayoutPtr depthLayout = DepthLayout::New(); + + // Set the item size function + depthLayout->SetItemSizeFunction(DepthLayoutItemSizeFunction); + + // Check whether we get the correct item size function + DALI_TEST_CHECK(depthLayout->GetItemSizeFunction() == DepthLayoutItemSizeFunction); + END_TEST; +} + +int UtcDaliDepthLayoutSetAndGetBottomMarginFunction(void) +{ + ToolkitTestApplication application; + + // Create a depth layout + DepthLayoutPtr depthLayout = DepthLayout::New(); + + // Set the bottom margin function + depthLayout->SetBottomMarginFunction(DepthLayoutBottomMarginFunction); + + // Check whether we get the correct bottom margin function + DALI_TEST_CHECK(depthLayout->GetBottomMarginFunction() == DepthLayoutBottomMarginFunction); + END_TEST; +} + +int UtcDaliDepthLayoutSetAndGetItemTiltAngle(void) +{ + ToolkitTestApplication application; + + // Create a depth layout + DepthLayoutPtr depthLayout = DepthLayout::New(); + + // Set the item's tilt angle + depthLayout->SetItemTiltAngle(Degree(5.0f)); + + // Check whether we get the correct item's tilt angle + DALI_TEST_EQUALS(float(depthLayout->GetItemTiltAngle()), 5.0f, 0.001f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliDepthLayoutSetAndGetColumnPositionFunction(void) +{ + ToolkitTestApplication application; + + // Create a depth layout + DepthLayoutPtr depthLayout = DepthLayout::New(); + + // Set the column position function + depthLayout->SetColumnPositionFunction(DepthLayoutColumnPositionFunction); + + // Check whether we get the correct column position function + DALI_TEST_CHECK(depthLayout->GetColumnPositionFunction() == DepthLayoutColumnPositionFunction); + END_TEST; +} + +int UtcDaliDepthLayoutSetAndGetScrollSpeedFactor(void) +{ + ToolkitTestApplication application; + + // Create a depth layout + DepthLayoutPtr depthLayout = DepthLayout::New(); + + // Set the scroll speed factor + depthLayout->SetScrollSpeedFactor(0.05f); + + // Check whether we get the correct scroll speed factor + DALI_TEST_EQUALS(depthLayout->GetScrollSpeedFactor(), 0.05f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliDepthLayoutSetAndGetMaximumSwipeSpeed(void) +{ + ToolkitTestApplication application; + + // Create a depth layout + DepthLayoutPtr depthLayout = DepthLayout::New(); + + // Set the maximum swipe speed + depthLayout->SetMaximumSwipeSpeed(50.0f); + + // Check whether we get the correct maximum swipe speed + DALI_TEST_EQUALS(depthLayout->GetMaximumSwipeSpeed(), 50.0f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliDepthLayoutSetAndGetItemFlickAnimationDuration(void) +{ + ToolkitTestApplication application; + + // Create a depth layout + DepthLayoutPtr depthLayout = DepthLayout::New(); + + // Set the flick animaiton duration + depthLayout->SetItemFlickAnimationDuration(0.35f); + + // Check whether we get the correct flick animaiton duration + DALI_TEST_EQUALS( depthLayout->GetItemFlickAnimationDuration(), 0.35f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliDepthLayoutConstraintLeft(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + DepthLayoutPtr navigationLayout = DepthLayout::New(); + navigationLayout->SetNumberOfColumns(6); + + view.SetName("view actor"); + view.AddLayout(*navigationLayout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + navigationLayout->SetOrientation(ControlOrientation::Left); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + // Confirm: we have actors in the view and they are positioned some distance from the origin. + int nonZeroCount = 0; + int elementsFound = 0; + for(unsigned int i = 0; i < 10; i++) + { + Actor testActor = view.GetItem(i); + if (testActor) + { + elementsFound++; + Vector3 pos = testActor.GetCurrentPosition(); + + if (pos.LengthSquared() > 0.0f) + { + nonZeroCount++; + } + } + } + + DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound)); + Stage::GetCurrent().Remove(view); + END_TEST; +} + +int UtcDaliDepthLayoutConstraintRight(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + DepthLayoutPtr navigationLayout = DepthLayout::New(); + navigationLayout->SetNumberOfColumns(6); + + view.SetName("view actor"); + view.AddLayout(*navigationLayout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + navigationLayout->SetOrientation(ControlOrientation::Right); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + // Confirm: we have actors in the view and they are positioned some distance from the origin. + int nonZeroCount = 0; + int elementsFound = 0; + for(unsigned int i = 0; i < 10; i++) + { + Actor testActor = view.GetItem(i); + if (testActor) + { + elementsFound++; + Vector3 pos = testActor.GetCurrentPosition(); + + if (pos.LengthSquared() > 0.0f) + { + nonZeroCount++; + } + } + } + + DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound)); + Stage::GetCurrent().Remove(view); + END_TEST; +} + +int UtcDaliDepthLayoutConstraintUp(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + DepthLayoutPtr navigationLayout = DepthLayout::New(); + navigationLayout->SetNumberOfColumns(6); + + view.SetName("view actor"); + view.AddLayout(*navigationLayout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + navigationLayout->SetOrientation(ControlOrientation::Up); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + // Confirm: we have actors in the view and they are positioned some distance from the origin. + int nonZeroCount = 0; + int elementsFound = 0; + for(unsigned int i = 0; i < 10; i++) + { + Actor testActor = view.GetItem(i); + if (testActor) + { + elementsFound++; + Vector3 pos = testActor.GetCurrentPosition(); + + if (pos.LengthSquared() > 0.0f) + { + nonZeroCount++; + } + } + } + + DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound)); + Stage::GetCurrent().Remove(view); + END_TEST; +} + +int UtcDaliDepthLayoutConstraintDown(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + DepthLayoutPtr navigationLayout = DepthLayout::New(); + navigationLayout->SetNumberOfColumns(6); + + view.SetName("view actor"); + view.AddLayout(*navigationLayout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + navigationLayout->SetOrientation(ControlOrientation::Down); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + // Confirm: we have actors in the view and they are positioned some distance from the origin. + int nonZeroCount = 0; + int elementsFound = 0; + for(unsigned int i = 0; i < 10; i++) + { + Actor testActor = view.GetItem(i); + if (testActor) + { + elementsFound++; + Vector3 pos = testActor.GetCurrentPosition(); + + if (pos.LengthSquared() > 0.0f) + { + nonZeroCount++; + } + } + } + + DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound)); + Stage::GetCurrent().Remove(view); + END_TEST; +} + +int UtcDaliDepthLayoutGetScrollToPosition(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + DepthLayoutPtr layout = DepthLayout::New(); + + view.SetName("view actor"); + view.AddLayout(*layout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + layout->SetOrientation(ControlOrientation::Up); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + // Confirm: we have actors in the view. + std::vector indices; + for(unsigned int i = 0; i < 10; i++) + { + Actor testActor = view.GetItem(i); + if (testActor) + { + indices.push_back(i); + } + } + + try + { + if (!indices.empty()) + { + const unsigned int firstTargetIndex = indices[indices.size()-1]; + // scroll to last item + view.ScrollToItem(firstTargetIndex, 0.00f); + application.Render(16); // 60hz frames + + std::size_t moveCount = 0; + for(std::size_t i = 0; i < indices.size(); i++) + { + float layoutPosBefore = view.GetCurrentLayoutPosition(i); + view.ScrollToItem(indices[i], 0.0f); + + application.Render(16); // 60hz frame + + float layoutPosAfter = view.GetCurrentLayoutPosition(i); + + if (fabs(layoutPosBefore-layoutPosAfter) <= FLT_EPSILON) + { + ++moveCount; + } + } + + DALI_TEST_CHECK((moveCount == indices.size())); + } + } + catch(...) + { + tet_result(TET_FAIL); + } + + Stage::GetCurrent().Remove(view); + END_TEST; +} + +int UtcDaliDepthLayoutScrollDirection(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + DepthLayoutPtr navigationLayout = DepthLayout::New(); + + view.SetName("view actor"); + view.AddLayout(*navigationLayout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + navigationLayout->SetOrientation(ControlOrientation::Left); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + ItemLayoutPtr layout = navigationLayout; + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + navigationLayout->SetOrientation(ControlOrientation::Up); + view.ActivateLayout(0, vec, 0.0f); + application.SendNotification(); + application.Render(); + + Degree deg = layout->GetScrollDirection(); + DALI_TEST_CHECK(deg == 180.0f); + + navigationLayout->SetOrientation(ControlOrientation::Down); + view.ActivateLayout(0, vec, 0.0f); + application.SendNotification(); + application.Render(); + + deg = layout->GetScrollDirection(); + DALI_TEST_CHECK((deg == 0.0f)); + + layout->SetOrientation(ControlOrientation::Left); + view.ActivateLayout(0, vec, 0.0f); + application.SendNotification(); + application.Render(); + + deg = layout->GetScrollDirection(); + DALI_TEST_CHECK(deg == 270.0f); + + navigationLayout->SetOrientation(ControlOrientation::Right); + view.ActivateLayout(0, vec, 0.0f); + application.SendNotification(); + application.Render(); + + deg = layout->GetScrollDirection(); + DALI_TEST_CHECK(deg == 90.0f); + + Stage::GetCurrent().Remove(view); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-DisplacementEffect.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-DisplacementEffect.cpp new file mode 100644 index 0000000..bd68477 --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-DisplacementEffect.cpp @@ -0,0 +1,148 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + +using namespace Dali; +using namespace Dali::Toolkit; + +namespace +{ +const char* TEST_IMAGE_FILE_NAME = "gallery_image_01.jpg"; +} // namespace + + +void utc_displacement_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_displacement_cleanup(void) +{ + test_return_value = TET_PASS; +} + +// Negative test case for a method +int UtcDaliDisplacementEffectUninitialized(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliDisplacementEffectUninitialized"); + + Toolkit::DisplacementEffect effect; + + try + { + // New() must be called to create a GaussianBlurView or it wont be valid. + effect.SetStateProperty( 1.0f ); + DALI_TEST_CHECK( false ); + } + catch (Dali::DaliException& e) + { + // Tests that a negative test of an assertion succeeds + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_CHECK(!effect); + } + END_TEST; +} + +// Positive test case for a method +int UtcDaliDisplacementEffectNew(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliDisplacementEffectNew"); + + Toolkit::DisplacementEffect effect = Toolkit::DisplacementEffect::New(Toolkit::DisplacementEffect::DISPLACED); + DALI_TEST_CHECK( effect ); + + Toolkit::DisplacementEffect effect2 = Toolkit::DisplacementEffect::New(Toolkit::DisplacementEffect::FIXED); + DALI_TEST_CHECK( effect2 ); + END_TEST; +} + +// Positive test case for a method +int UtcDaliDisplacementEffectPropertyNames(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliDisplacementEffectPropertyNames"); + + Toolkit::DisplacementEffect effect = Toolkit::DisplacementEffect::New(Toolkit::DisplacementEffect::DISPLACED); + DALI_TEST_CHECK( effect ); + + // Check the names, this names are used in the shaders code, + // if they change the shader code has to be updated + DALI_TEST_EQUALS( effect.GetLightDirectionPropertyName(), "uLightDirection", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetAmbientLightColorPropertyName(), "uAmbientLightColor", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetDiffuseLightColorPropertyName(), "uDiffuseLightColor", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetLightingMultiplierPropertyName(), "uLightMultiplier", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetStatePropertyName(), "uState", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetHeightScalePropertyName(), "uHightScale", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetFixedNormalPropertyName(), "uFixedNormal", TEST_LOCATION ); + END_TEST; +} + +// Positive test case for a method +int UtcDaliDisplacementEffectTestSetProperty(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliDisplacementEffectTestSetProperty"); + + Toolkit::DisplacementEffect effect = Toolkit::DisplacementEffect::New(Toolkit::DisplacementEffect::DISPLACED); + DALI_TEST_CHECK( effect ); + + ImageActor actor = ImageActor::New( Image::New(TEST_IMAGE_FILE_NAME) ); + actor.SetSize( 100.0f, 100.0f ); + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + Toolkit::DisplacementEffect effect2 = Toolkit::DisplacementEffect::New(Toolkit::DisplacementEffect::FIXED); + DALI_TEST_CHECK( effect ); + + ImageActor actor2 = ImageActor::New( Image::New(TEST_IMAGE_FILE_NAME) ); + actor2.SetSize( 100.0f, 100.0f ); + actor2.SetShaderEffect( effect2 ); + Stage::GetCurrent().Add( actor2 ); + + Vector3 testVector3 = Vector3(45.0f, 55.0f, 65.0f); + float testFloat = 0.623f; + effect.SetLightDirection(testVector3); + effect.SetAmbientLightColorProperty(testVector3); + effect.SetDiffuseLightColorProperty(testVector3); + effect.SetStateProperty(testFloat); + effect.SetLightingMultiplierProperty(testFloat); + effect.SetHeightScaleProperty(testFloat); + + effect2.SetFixedNormalProperty(testVector3); + + application.SendNotification(); + application.Render(0); + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetLightDirectionPropertyName() ) ).Get(), testVector3, TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetAmbientLightColorPropertyName() ) ).Get(), testVector3, TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetDiffuseLightColorPropertyName() ) ).Get(), testVector3, TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetStatePropertyName().c_str() ) ).Get(), testFloat, TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetLightingMultiplierPropertyName().c_str() ) ).Get(), testFloat, TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetHeightScalePropertyName().c_str() ) ).Get(), testFloat, TEST_LOCATION ); + + Vector3 normalizedVector3(testVector3); + normalizedVector3.Normalize(); + DALI_TEST_EQUALS( effect2.GetProperty( effect2.GetPropertyIndex( effect2.GetFixedNormalPropertyName() ) ).Get(), normalizedVector3, TEST_LOCATION ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-DistanceFieldEffect.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-DistanceFieldEffect.cpp new file mode 100644 index 0000000..36c6078 --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-DistanceFieldEffect.cpp @@ -0,0 +1,173 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + +using namespace Dali; + +void utc_distance_field_effect_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_distance_field_effect_cleanup(void) +{ + test_return_value = TET_PASS; +} + +namespace +{ +// Create bitmap image +BitmapImage CreateDistanceField() +{ + BitmapImage image = BitmapImage::New(256, 256, Pixel::RGBA8888); + BitmapImage distanceFieldImage = BitmapImage::New(256, 256, Pixel::L8); + + PixelBuffer* pixbuf = image.GetBuffer(); + + for(size_t i=0; i<16; i++) + { + pixbuf[i*4+0] = 0xFF; + pixbuf[i*4+1] = 0xFF; + pixbuf[i*4+2] = 0xFF; + pixbuf[i*4+3] = 0xFF; + } + + // GenerateDistanceFieldMap(distanceFieldImage.GetBuffer(), Size(256, 256), pixbuf, Size(256, 256), 8, 4); + + return distanceFieldImage; +} +} + +int UtcDaliDistanceFieldEffectUninitialized(void) +{ + ToolkitTestApplication application; + + Toolkit::DistanceFieldEffect effect; + + try + { + // New() must be called to create a DistanceField effect or it wont be valid. + effect.SetShadow( true ); + DALI_TEST_CHECK( false ); + } + catch (Dali::DaliException& e) + { + // Tests that a negative test of an assertion succeeds + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_CHECK(!effect); + } + END_TEST; +} + +int UtcDaliDistanceFieldEffectPropertyNames(void) +{ + ToolkitTestApplication application; + + Toolkit::DistanceFieldEffect effect = Toolkit::DistanceFieldEffect::New(); + + // Check the names, this names are used in the shaders code, + // if they change the shader code has to be updated + DALI_TEST_EQUALS( effect.GetColorPropertyName(), "uColor", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetSmoothingPropertyName(), "uSmoothing", TEST_LOCATION ); + + // control flags + DALI_TEST_EQUALS( effect.GetOutlineEnablePropertyName(), "uDoOutline", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetGlowEnablePropertyName(), "uDoGlow", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetShadowEnablePropertyName(), "uDoShadow", TEST_LOCATION ); + + DALI_TEST_EQUALS( effect.GetGlowBoundaryPropertyName(), "uGlowBoundary", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetGlowColorPropertyName(), "uGlowColor", TEST_LOCATION ); + + DALI_TEST_EQUALS( effect.GetOutlineColorPropertyName(), "uOutlineColor", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetOutlineSizePropertyName(), "uOutlineParams", TEST_LOCATION ); + + DALI_TEST_EQUALS( effect.GetShadowColorPropertyName(), "uShadowColor", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetShadowOffsetPropertyName(), "uShadowOffset", TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliDistanceFieldEffectDefaultValues(void) +{ + ToolkitTestApplication application; + + Toolkit::DistanceFieldEffect effect = Toolkit::DistanceFieldEffect::New(); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateDistanceField(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetOutlineEnablePropertyName().c_str(), + 0.0f )); + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetGlowEnablePropertyName().c_str(), + 0.0f )); + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetShadowEnablePropertyName().c_str(), + 0.0f )); + END_TEST; +} + +int UtcDaliDistanceFieldEffectCustomValues(void) +{ + ToolkitTestApplication application; + + Toolkit::DistanceFieldEffect effect = Toolkit::DistanceFieldEffect::New(); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateDistanceField(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + + effect.SetShadowColor(Color::YELLOW); + effect.SetGlowColor(Color::BLUE); + + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + // Gets converted to opengl viewport coordinates + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetShadowColorPropertyName().c_str(), + Color::YELLOW ) ); + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetGlowColorPropertyName().c_str(), + Color::BLUE ) ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-GaussianBlurView.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-GaussianBlurView.cpp new file mode 100644 index 0000000..4232f72 --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-GaussianBlurView.cpp @@ -0,0 +1,200 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + +using namespace Dali; +using namespace Dali::Toolkit; + +namespace +{ +const char* TEST_IMAGE_FILE_NAME = "gallery_image_01.jpg"; +} // namespace + +void utc_gaussian_blur_view_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_gaussian_blur_view_cleanup(void) +{ + test_return_value = TET_PASS; +} + + + +// Negative test case for a method +int UtcDaliGaussianBlurViewUninitialized(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliGaussianBlurViewUninitialized"); + + Toolkit::GaussianBlurView view; + + try + { + // New() must be called to create a GaussianBlurView or it wont be valid. + Actor a = Actor::New(); + view.Add( a ); + DALI_TEST_CHECK( false ); + } + catch (Dali::DaliException& e) + { + // Tests that a negative test of an assertion succeeds + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_CHECK(!view); + } + END_TEST; +} + +// Positive test case for a method +int UtcDaliGaussianBlurViewNew(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliGaussianBlurViewNew"); + + Toolkit::GaussianBlurView view = Toolkit::GaussianBlurView::New(); + DALI_TEST_CHECK( view ); + + Toolkit::GaussianBlurView view2 = Toolkit::GaussianBlurView::New(5, 1.5f, Pixel::RGB888, 0.5f, 0.5f, false); + DALI_TEST_CHECK( view2 ); + END_TEST; +} + +// Positive test case for a method +int UtcDaliGaussianBlurViewDownCast(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliGaussianBlurViewDownCast"); + + Toolkit::GaussianBlurView view = Toolkit::GaussianBlurView::New(); + BaseHandle handle(view); + + Toolkit::GaussianBlurView gaussianBlurView = Toolkit::GaussianBlurView::DownCast( handle ); + DALI_TEST_CHECK( view ); + DALI_TEST_CHECK( gaussianBlurView ); + DALI_TEST_CHECK( gaussianBlurView == view ); + END_TEST; +} + + +// Positive test case for a method +int UtcDaliGaussianBlurViewPropertyNames(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliGaussianBlurViewPropertyNames"); + + Toolkit::GaussianBlurView view = Toolkit::GaussianBlurView::New(); + DALI_TEST_CHECK( view ); + + // Check the names, this names are used in the shader code, + // if they change in the shader code, then it has to be updated here. + DALI_TEST_EQUALS( view.GetBlurStrengthPropertyIndex(), view.GetPropertyIndex("GaussianBlurStrengthPropertyName"), TEST_LOCATION ); + END_TEST; +} + +// Positive test case for a method +int UtcDaliGaussianBlurViewAddRemove(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliGaussianBlurViewAddRemove"); + + Toolkit::GaussianBlurView view = Toolkit::GaussianBlurView::New(); + DALI_TEST_CHECK( view ); + + Actor actor = Actor::New(); + DALI_TEST_CHECK( !actor.OnStage() ); + + + view.SetParentOrigin(ParentOrigin::CENTER); + view.SetSize(Stage::GetCurrent().GetSize()); + view.Add(actor); + Stage::GetCurrent().Add(view); + + DALI_TEST_CHECK( actor.OnStage() ); + + view.Remove(actor); + + DALI_TEST_CHECK( !actor.OnStage() ); + END_TEST; +} + +// Positive test case for a method +int UtcDaliGaussianBlurActivateDeactivate(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliGaussianBlurActivateDeactivate"); + + Toolkit::GaussianBlurView view = Toolkit::GaussianBlurView::New(); + DALI_TEST_CHECK( view ); + + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + DALI_TEST_CHECK( 1u == taskList.GetTaskCount() ); + + view.SetParentOrigin(ParentOrigin::CENTER); + view.SetSize(Stage::GetCurrent().GetSize()); + view.Add(Actor::New()); + Stage::GetCurrent().Add(view); + view.Activate(); + + RenderTaskList taskList2 = Stage::GetCurrent().GetRenderTaskList(); + DALI_TEST_CHECK( 1u != taskList2.GetTaskCount() ); + + view.Deactivate(); + + RenderTaskList taskList3 = Stage::GetCurrent().GetRenderTaskList(); + DALI_TEST_CHECK( 1u == taskList3.GetTaskCount() ); + END_TEST; +} + +// Positive test case for a method +int UtcDaliGaussianBlurViewSetGetBackgroundColor(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliGaussianBlurViewSetGetBackgroundColor"); + + Toolkit::GaussianBlurView view = Toolkit::GaussianBlurView::New(); + DALI_TEST_CHECK( view ); + + view.SetBackgroundColor(Dali::Color::RED); + Vector4 color = view.GetBackgroundColor(); + DALI_TEST_CHECK( color == Dali::Color::RED ); + END_TEST; +} + +// Positive test case for a method +int UtcDaliGaussianBlurViewSetGetRenderTarget(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliGaussianBlurViewSetGetRenderTarget"); + + Toolkit::GaussianBlurView view = Toolkit::GaussianBlurView::New(5, 1.5f, Pixel::RGB888, 0.5f, 0.5f, true); + DALI_TEST_CHECK( view ); + + view.SetParentOrigin(ParentOrigin::CENTER); + view.SetSize(Stage::GetCurrent().GetSize()); + view.Add(Actor::New()); + Stage::GetCurrent().Add(view); + view.Activate(); + + FrameBufferImage renderTarget = FrameBufferImage::New( 480.0f, 800.0f, Pixel::RGB888 ); + view.SetUserImageAndOutputRenderTarget(Image::New(TEST_IMAGE_FILE_NAME), renderTarget); + DALI_TEST_CHECK( view.GetBlurredRenderTarget() == renderTarget ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-ItemView.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-ItemView.cpp new file mode 100644 index 0000000..4209b4f --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-ItemView.cpp @@ -0,0 +1,199 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include // for FLT_MAX +#include +#include + +using namespace Dali; +using namespace Toolkit; + +namespace +{ +const unsigned int TOTAL_ITEM_NUMBER = 100; +const char* TEST_IMAGE_FILE_NAME = "gallery_image_01.jpg"; + + +// Implementation of ItemFactory for providing actors to ItemView +class TestItemFactory : public ItemFactory +{ +public: + + /** + * Constructor + * @param application class, stored as reference + */ + TestItemFactory() + { + } + +public: // From ItemFactory + + /** + * Query the number of items available from the factory. + * The maximum available item has an ID of GetNumberOfItems() - 1. + */ + virtual unsigned int GetNumberOfItems() + { + return TOTAL_ITEM_NUMBER; + } + + /** + * Create an Actor to represent a visible item. + * @param itemId + * @return the created actor. + */ + virtual Actor NewItem(unsigned int itemId) + { + // Create an image actor for this item + Image image = Image::New( TEST_IMAGE_FILE_NAME ); + Actor actor = ImageActor::New(image); + + return actor; + } +}; + +} // namespace + + + +int UtcDaliItemViewAddAndGetLayout(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + + // Create a grid layout and add it to ItemView + GridLayoutPtr gridLayout = GridLayout::New(); + view.AddLayout(*gridLayout); + + // As we have added one layout, check the number of layout is now 1 + DALI_TEST_CHECK(view.GetLayoutCount() == 1); + + // Create a depth layout and add it to ItemView + DepthLayoutPtr depthLayout = DepthLayout::New(); + view.AddLayout(*depthLayout); + + // As we have added another layout, check the number of layout is now 2 + DALI_TEST_CHECK(view.GetLayoutCount() == 2); + + // Create a spiral layout and add it to ItemView + SpiralLayoutPtr spiralLayout = SpiralLayout::New(); + view.AddLayout(*spiralLayout); + + // As we have added another layout, check the number of layout is now 3 + DALI_TEST_CHECK(view.GetLayoutCount() == 3); + + // Check we are getting the correct layout from ItemView + DALI_TEST_CHECK(view.GetLayout(0) == gridLayout); + DALI_TEST_CHECK(view.GetLayout(1) == depthLayout); + DALI_TEST_CHECK(view.GetLayout(2) == spiralLayout); + END_TEST; +} + +int UtcDaliItemViewAddAndRemoveLayout(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + + // Create a grid layout and add it to ItemView + GridLayoutPtr gridLayout = GridLayout::New(); + view.AddLayout(*gridLayout); + + // As we have added one layout, check the number of layout is now 1 + DALI_TEST_CHECK(view.GetLayoutCount() == 1); + + // Create a depth layout and add it to ItemView + DepthLayoutPtr depthLayout = DepthLayout::New(); + view.AddLayout(*depthLayout); + + // As we have added another layout, check the number of layout is now 2 + DALI_TEST_CHECK(view.GetLayoutCount() == 2); + + // Check we are getting the correct layout from ItemView + DALI_TEST_CHECK(view.GetLayout(0) == gridLayout); + DALI_TEST_CHECK(view.GetLayout(1) == depthLayout); + + // Remove the grid layout + view.RemoveLayout(0); + + // As we have removed the grid layout, check the number of layout is now 1 + DALI_TEST_CHECK(view.GetLayoutCount() == 1); + + // Check we are getting the correct layout from ItemView + DALI_TEST_CHECK(view.GetLayout(0) == depthLayout); + + // Remove the depth layout + view.RemoveLayout(0); + + // As we also removed the depth layout, check the number of layout is now 0 + DALI_TEST_CHECK(view.GetLayoutCount() == 0); + END_TEST; +} + +int UtcDaliItemViewActivateLayoutAndGetActiveLayout(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + + // Create a grid layout and add it to ItemView + GridLayoutPtr gridLayout = GridLayout::New(); + view.AddLayout(*gridLayout); + + // Create a depth layout and add it to ItemView + DepthLayoutPtr depthLayout = DepthLayout::New(); + view.AddLayout(*depthLayout); + + // Create a spiral layout and add it to ItemView + SpiralLayoutPtr spiralLayout = SpiralLayout::New(); + view.AddLayout(*spiralLayout); + + // As we have added three layouts, check the number of layout is now 3 + DALI_TEST_CHECK(view.GetLayoutCount() == 3); + + // Check there is no active layout at the moment + DALI_TEST_CHECK(view.GetActiveLayout() == NULL); + + // Activate the depth layout + Vector3 stageSize(Dali::Stage::GetCurrent().GetSize()); + view.ActivateLayout(1, stageSize, 0.5f); + + // Check the current active layout is the depth layout + DALI_TEST_CHECK(view.GetActiveLayout() == depthLayout); + + // Activate the grid layout + view.ActivateLayout(0, stageSize, 0.5f); + + // Check the current active layout is the grid layout + DALI_TEST_CHECK(view.GetActiveLayout() == gridLayout); + + // Activate the spiral layout + view.ActivateLayout(2, stageSize, 0.5f); + + // Check the current active layout is the spiral layout + DALI_TEST_CHECK(view.GetActiveLayout() == spiralLayout); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-JsonParser.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-JsonParser.cpp new file mode 100644 index 0000000..4864733 --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-JsonParser.cpp @@ -0,0 +1,627 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include +#include + +using namespace Dali; +using namespace Dali::Toolkit; + +void utc_json_parser_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_json_parser_cleanup(void) +{ + test_return_value = TET_PASS; +} + +namespace +{ + +std::string ReplaceQuotes(const std::string &in_s) +{ + std::string s(in_s); + // wrong as no embedded quote but had regex link problems + std::replace(s.begin(), s.end(), '\'', '"'); + return s; +} +} + + +int UtcDaliJsonParserMethod01(void) +{ + ToolkitTestApplication application; + + tet_infoline("JSON basic test"); + + std::string s1( ReplaceQuotes( +"{ \ + 'string':'value2', \ + 'integer':2, \ + 'float':2.0, \ + 'boolean':true, \ + 'nil':null, \ + 'array':[1,2,3], \ + 'object':{'key':'value'} \ +END_TEST; \ +}")); + + JsonParser parser = JsonParser::New(); + + parser.Parse( s1 ); + + if(parser.ParseError()) + { + std::cout << "Error: " << parser.GetErrorDescription() << std::endl; + std::cout << " at: " << parser.GetErrorLineNumber() << "(" << parser.GetErrorPosition() << ")" << std::endl; + } + + DALI_TEST_CHECK(!parser.ParseError()); + + const TreeNode* root = parser.GetRoot(); + + DALI_TEST_CHECK(root); + + DALI_TEST_CHECK(root->Size()); + + TreeNode::ConstIterator iter = root->CBegin(); + DALI_TEST_CHECK(iter != root->CEnd()); + + const TreeNode* node = NULL; + + node = &((*iter).second); + DALI_TEST_CHECK(node); + DALI_TEST_CHECK(node->GetType() == TreeNode::STRING); + DALI_TEST_CHECK(std::string((*iter).first) == std::string("string")); + DALI_TEST_CHECK(std::string(node->GetString()) == std::string("value2")); + + ++iter; + DALI_TEST_CHECK(iter != root->CEnd()); + node = &((*iter).second); + DALI_TEST_CHECK(node); + DALI_TEST_CHECK(node->GetType() == TreeNode::INTEGER); + DALI_TEST_CHECK(std::string((*iter).first) == std::string("integer")); + DALI_TEST_CHECK(node->GetInteger() == 2); + + ++iter; + DALI_TEST_CHECK(iter != root->CEnd()); + node = &((*iter).second); + DALI_TEST_CHECK(node); + DALI_TEST_CHECK(node->GetType() == TreeNode::FLOAT); + DALI_TEST_CHECK(std::string((*iter).first) == std::string("float")); + DALI_TEST_CHECK(node->GetFloat() == 2.0); + + ++iter; + DALI_TEST_CHECK(iter != root->CEnd()); + node = &((*iter).second); + DALI_TEST_CHECK(node); + DALI_TEST_CHECK(node->GetType() == TreeNode::BOOLEAN); + DALI_TEST_CHECK(std::string((*iter).first) == std::string("boolean")); + DALI_TEST_CHECK(node->GetBoolean()); + + ++iter; + DALI_TEST_CHECK(iter != root->CEnd()); + node = &((*iter).second); + DALI_TEST_CHECK(node); + DALI_TEST_CHECK(node->GetType() == TreeNode::IS_NULL); + DALI_TEST_CHECK(std::string((*iter).first) == std::string("nil")); + + ++iter; + DALI_TEST_CHECK(iter != root->CEnd()); + node = &((*iter).second); + DALI_TEST_CHECK(node); + DALI_TEST_CHECK(node->GetType() == TreeNode::ARRAY); + DALI_TEST_CHECK(node->Size() == 3); + TreeNode::ConstIterator iterArray = node->CBegin(); + + DALI_TEST_CHECK(iterArray != node->CEnd()); + DALI_TEST_CHECK( ((*iterArray).second).GetType() == TreeNode::INTEGER); + DALI_TEST_CHECK( (*iterArray).first == NULL ); + DALI_TEST_CHECK( ((*iterArray).second).GetInteger() == 1); + + ++iterArray; + DALI_TEST_CHECK(iterArray != node->CEnd()); + DALI_TEST_CHECK( ((*iterArray).second).GetType() == TreeNode::INTEGER); + DALI_TEST_CHECK( (*iterArray).first == NULL ); + DALI_TEST_CHECK( ((*iterArray).second).GetInteger() == 2); + + ++iterArray; + DALI_TEST_CHECK(iterArray != node->CEnd()); + DALI_TEST_CHECK( ((*iterArray).second).GetType() == TreeNode::INTEGER); + DALI_TEST_CHECK( (*iterArray).first == NULL ); + DALI_TEST_CHECK( ((*iterArray).second).GetInteger() == 3); + + ++iter; + DALI_TEST_CHECK(iter != root->CEnd()); + node = &((*iter).second); + DALI_TEST_CHECK(node); + DALI_TEST_CHECK(node->GetType() == TreeNode::OBJECT); + DALI_TEST_CHECK(node->Size() == 1); + + TreeNode::ConstIterator iterObject = node->CBegin(); + DALI_TEST_CHECK(iterObject != node->CEnd()); + DALI_TEST_CHECK( ((*iterObject).second).GetType() == TreeNode::STRING); + DALI_TEST_CHECK( std::string((*iterObject).first) == std::string("key" )); + DALI_TEST_CHECK( std::string(((*iterObject).second).GetString()) == std::string("value")); + + tet_result(TET_PASS); + END_TEST; +} + +int UtcDaliJsonParserMethod02(void) +{ + ToolkitTestApplication application; + + tet_infoline("JSON Comments"); + + std::string s1( ReplaceQuotes(" \ +// some comments with empty line above \n\ +{ \ + // inline comments \n\ + 'key':'value', // endline comments \n\ + // more inline comments \n\ + 'key2':'value2' \ +} \ +")); + + JsonParser parser = JsonParser::New(); + + parser.Parse( s1 ); + + if(parser.ParseError()) + { + std::cout << "Error: " << parser.GetErrorDescription() << std::endl; + std::cout << " at: " << parser.GetErrorLineNumber() << "(" << parser.GetErrorPosition() << ")" << std::endl; + } + + DALI_TEST_CHECK(!parser.ParseError()); + + const TreeNode* root = parser.GetRoot(); + + DALI_TEST_CHECK(root); + + DALI_TEST_CHECK(root->Size()); + + const TreeNode& node = (*root->CBegin()).second; + + DALI_TEST_CHECK(node.GetType() == TreeNode::STRING); + + DALI_TEST_CHECK(node.GetString() == std::string("value")); + + DALI_TEST_CHECK((*root->CBegin()).first == std::string("key")); + + tet_result(TET_PASS); + END_TEST; +} + + +int UtcDaliJsonParserMethod03(void) +{ + ToolkitTestApplication application; + + tet_infoline("JSON Empty line comment"); + + std::string s1( ReplaceQuotes( +"/*\n" \ +"c comment\n" \ +"*/"\ +"// next empty line comment\n"\ +"//\n"\ +"{\n"\ +" 'key':'value'\n"\ +"}\n"\ +)); + + JsonParser parser = JsonParser::New(); + + parser.Parse( s1 ); + + if(parser.ParseError()) + { + std::cout << "Error: " << parser.GetErrorDescription() << std::endl; + std::cout << " at: " << parser.GetErrorLineNumber() << "(" << parser.GetErrorPosition() << ")" << std::endl; + } + + DALI_TEST_CHECK(!parser.ParseError()); + + const TreeNode* root = parser.GetRoot(); + + DALI_TEST_CHECK(root); + + DALI_TEST_CHECK(root->Size()); + + const TreeNode& node = (*root->CBegin()).second; + + DALI_TEST_CHECK(node.GetType() == TreeNode::STRING); + + DALI_TEST_CHECK(node.GetString() == std::string("value")); + + DALI_TEST_CHECK((*root->CBegin()).first == std::string("key")); + + tet_result(TET_PASS); + END_TEST; +} + +int UtcDaliJsonParserMethod04(void) +{ + ToolkitTestApplication application; + + tet_infoline("JSON Merge"); + + std::string s1( ReplaceQuotes(" \ +{ \ + 'animations': \ + { \ + 'bump': \ + { \ + 'properties': \ + [ \ + { \ + 'actor':'bump-image', \ + 'property':'uLightPosition', \ + 'value':[0.8, 0.0, -1.5], \ + 'alpha-function': 'BOUNCE', \ + 'time-period': { 'duration': 2.5 } \ + } \ + ] \ + } \ + } \ +} \ +")); + + std::string s2( ReplaceQuotes(" \ +{ \ + 'animations': \ + { \ + 'bump': \ + { \ + 'duration': 5.0, \ + 'loop': true, \ + 'end-action':'DISCARD' \ + } \ + } \ +} \ +")); + + JsonParser parser = JsonParser::New(); + + parser.Parse( s1 ); + + if(parser.ParseError()) + { + std::cout << "Error: " << parser.GetErrorDescription() << std::endl; + std::cout << " at: " << parser.GetErrorLineNumber() << "(" << parser.GetErrorPosition() << ")" << std::endl; + } + DALI_TEST_CHECK(!parser.ParseError()); + + parser.Parse( s2 ); + + if(parser.ParseError()) + { + std::cout << "Error: " << parser.GetErrorDescription() << std::endl; + std::cout << " at: " << parser.GetErrorLineNumber() << "(" << parser.GetErrorPosition() << ")" << std::endl; + } + + DALI_TEST_CHECK(!parser.ParseError()); + + const TreeNode* root = parser.GetRoot(); + DALI_TEST_CHECK(root); + + const TreeNode *node = root->Find("bump"); + DALI_TEST_CHECK(node); + + DALI_TEST_CHECK(static_cast(node->Size()) == 4); + + DALI_TEST_CHECK( node->GetChild("duration") ); + DALI_TEST_CHECK( node->GetChild("loop") ); + DALI_TEST_CHECK( node->GetChild("properties") ); + + + tet_result(TET_PASS); + END_TEST; +} + +int UtcDaliJsonParserMethod05(void) +{ + ToolkitTestApplication application; + + tet_infoline("JSON Pack & Write"); + + std::string s1( ReplaceQuotes(" \ +{ \ + 'animations': \ + { \ + 'bump': \ + { \ + 'properties': \ + [ \ + { \ + 'actor':'bump-image', \ + 'property':'uLightPosition', \ + 'value':[0.8, 0.0, -1.5], \ + 'alpha-function': 'BOUNCE', \ + 'time-period': { 'duration': 2.5 } \ + } \ + ] \ + } \ + } \ +} \ +")); + + JsonParser parser = JsonParser::New(); + + parser.Parse( s1 ); + + if(parser.ParseError()) + { + std::cout << "Error: " << parser.GetErrorDescription() << std::endl; + std::cout << " at: " << parser.GetErrorLineNumber() << "(" << parser.GetErrorPosition() << ")" << std::endl; + } + DALI_TEST_CHECK(!parser.ParseError()); + + std::stringstream a; + parser.Write(a, 2); + + parser.Pack(); + + std::stringstream b; + parser.Write(b, 2); + + DALI_TEST_CHECK( a.str() == b.str() ); + + tet_result(TET_PASS); + END_TEST; +} + +namespace +{ + +static const int NUMBER_OK_TESTS = 36; +const char *TEST_OK[NUMBER_OK_TESTS] = { + "{ 'hex': '\u0123\u4567\u89AB\uCDEF\uabcd\uef4A' }", + "{ 'special': '`1~!@#$%^&*()_+-={:[,]}|;.?' }", + "{ 'slash': '/ & \' }", + "{'object with 1 member':['array with 1 element']}", + "[{}, [], -42, true, false, null]", + "{ 'integer': 1234567890 }", + "{ 'integer': 1234567890 }", + "{ 'real': -9876.543210 }", + "{ 'e': 0.123456789e-12 }", + "{ 'E': 1.234567890E+34 }", + "{ '': 23456789012E66 }", + "{ 'zero': 0 }", + "{ 'one': 1 }", + "{ 'space': ' ' }", + "{ 'backslash': '\' }", + "{ 'controls': '\\b\\f\\n\\r\\t' }", + "{ 'alpha': 'abcdefghijklmnopqrstuvwyz' }", + "{ 'ALPHA': 'ABCDEFGHIJKLMNOPQRSTUVWYZ' }", + "{ 'digit': '0123456789' }", + "{ '0123456789': 'digit' }", + "{ 'true': true }", + "{ 'false': false }", + "{ 'null': null }", + "{ 'array':[ ] }", + "{ 'object':{ } }", + "{ 'address': '1 Communication Centre. South Street' }", + "{ 'url': 'http://www.JSON.org/' }", + "{ 'comment': '// /* */': ' ' }", + "{ ' s p a c e d ' :[1,2 , 3,4 , 5 , 6 ,7 ]}", + "{ 'compact':[1,2,3,4,5,6,7]}", + "{ 'quotes': '" \\u0022 %22 0x22 034 "' }", + "{ '\\uCAFE\\uBABE\\uAB98\\uFCDE\\ubcda\\uef4A\\b\\f\\n\\r\\t`1~!@#$%^&*()_+-=[]{}|;:': 'A key can be any string'}", + "[ 0.5 ,98.6, 99.44,1066,1e1,0.1e1,1e-1,1e00,2e+00,2e-00, 'rosebud']", + "{'JSON Test Pattern pass3': { 'The outermost value': 'must be an object or array.', 'In this test': 'It is an object.' } }", + "[[[[[[[[[[[[[[[[[[['Not too deep']]]]]]]]]]]]]]]]]]]", +}; +} + + +int UtcDaliJsonParserMethod06(void) +{ + ToolkitTestApplication application; + + tet_infoline("JSON Parse Success"); + + JsonParser parser = JsonParser::New(); + + for(int i = 0; i < NUMBER_OK_TESTS; ++i) + { + parser = JsonParser::New(); + + parser.Parse( ReplaceQuotes(TEST_OK[i]) ); + + if(parser.ParseError()) + { + tet_printf("Valid JSON parse test %d Failed", i); + tet_printf("%s", ReplaceQuotes(TEST_OK[i]).c_str()); + + tet_printf("JSON Error %d:%d: %s (%d)", parser.GetErrorLineNumber(), parser.GetErrorColumn(), parser.GetErrorDescription().c_str(), parser.GetErrorPosition()); + } + + DALI_TEST_CHECK(!parser.ParseError()); + } + + tet_result(TET_PASS); + END_TEST; +} + +namespace +{ + +static const int NUMBER_FAIL_TESTS = 32; +const char *TEST_FAIL[] = { + "[' tab\t character \t in\t string ']", + "['Extra close']]", + "['Colon instead of comma': false]", + "{'Numbers cannot have leading zeroes': 013}", + "['Bad value', truth]", + "['Illegal backslash escape: \017']", + "['Bad value', truth]['Illegal backslash escape: \017']", + "{'Comma instead if closing brace': true,", + "{'Double colon':: null}", + "{'Extra comma': true,}", + "['Unclosed array'", + "{'Illegal invocation': alert()}", + "{'Missing colon' null}", + "[0e]", + "{unquoted_key: 'keys must be quoted'}", + "'A JSON payload should be an object or array, not a string.'", + "[\naked]", + "{'Illegal expression': 1 + 2}", + "{'Extra value after close': true} 'misplaced quoted value'", + "[0e+]", + "[+23456789012E66]", + "['extra comma',]", + "['Comma after the close'],", + "['double extra comma',,]", + "['Illegal backslash escape: \x15']", + "['line\nbreak']", + "{'Comma instead of colon', null}", + "['mismatch'}", + "['line\nbreak']", + "[0e+-1]", + "{'Numbers cannot be hex': 0x14}", + "[ , '<-- missing value']", +}; +} + +int UtcDaliJsonParserMethod07(void) +{ + ToolkitTestApplication application; + + tet_infoline("JSON Fail"); + + JsonParser parser = JsonParser::New(); + + for(int i = 0; i < NUMBER_FAIL_TESTS; ++i) + { + parser = JsonParser::New(); + + parser.Parse( ReplaceQuotes(TEST_FAIL[i]) ); + + if(!parser.ParseError()) + { + tet_printf("Invalid JSON parse test %d Failed", i); + tet_printf("%s", ReplaceQuotes(TEST_FAIL[i]).c_str()); + tet_printf("JSON Error %d:%d %s (%s)", parser.GetErrorLineNumber(), parser.GetErrorColumn(), + parser.GetErrorDescription().c_str(), parser.GetErrorPosition()); + } + + DALI_TEST_CHECK(parser.ParseError()); + } + + + parser = JsonParser::New(); + + parser.Parse( "['single quote']" ); + + if(!parser.ParseError()) + { + tet_printf("['single quote']"); + } + + DALI_TEST_CHECK(parser.ParseError()); + + tet_result(TET_PASS); + END_TEST; +} + +int UtcDaliJsonParserMethod08(void) +{ + ToolkitTestApplication application; + + tet_infoline("JSON error reporting"); + + std::string s1( ReplaceQuotes("\ +{ \n\ + 'float':,], \n\ +} \n\ +")); + + JsonParser parser = JsonParser::New(); + + parser.Parse( s1 ); + + DALI_TEST_CHECK(parser.ParseError()); + + DALI_TEST_CHECK(1 == parser.GetErrorLineNumber()); + DALI_TEST_CHECK(53 == parser.GetErrorPosition()); + DALI_TEST_CHECK(11 == parser.GetErrorColumn()); + + tet_result(TET_PASS); + END_TEST; +} + +int UtcDaliJsonParserMethod09(void) +{ + ToolkitTestApplication application; + + tet_infoline("JSON Pack()"); + + std::string s1( ReplaceQuotes("\ +{ \ + 'string':'value2', \ + 'integer':2, \ + 'float':2.3, \ + 'boolean':true, \ + 'nil':null, \ + 'array':[1,2,3], \ + 'object':{'key':'value'} \ +} \ +")); + + JsonParser parser = JsonParser::New(); + + parser.Parse( s1 ); + + std::stringstream ss1; + parser.Write(ss1, 2); + + parser.Pack(); // Pack() moves strings + + std::stringstream ss2; + parser.Write(ss2, 2); + + DALI_TEST_CHECK(ss1.str() == ss2.str()); + + tet_result(TET_PASS); + END_TEST; +} + +int UtcDaliJsonParserMethod10(void) +{ + ToolkitTestApplication application; + + tet_infoline("JSON basic test"); + + std::string s1( "" ); + + JsonParser parser = JsonParser::New(); + + parser.Parse( s1 ); + + DALI_TEST_CHECK(parser.ParseError()); + + tet_result(TET_PASS); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-KeyInputFocusManager.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-KeyInputFocusManager.cpp new file mode 100644 index 0000000..5dd331e --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-KeyInputFocusManager.cpp @@ -0,0 +1,310 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include +#include + + +using namespace Dali; +using namespace Toolkit; + +namespace +{ + +/** + * Callback class for KeyInputFocusChanged signal. + */ +class KeyInputFocusChangedCallback : public Dali::ConnectionTracker +{ +public: + /** + * Constructor + * @param[in] gainActor Ref to the actor that should be set as the one that gains key input focus. + * @param[in] lostActor Ref to the actor that should be set as the one that loses key input focus. + */ + KeyInputFocusChangedCallback( Control& gainActor, Control& lostActor ) + : mActorGain( gainActor ), + mActorLost( lostActor ) + { + } + + void Callback( Control gainingActor, Control lostActor ) + { + mActorGain = gainingActor; + mActorLost = lostActor; + } + + Control& mActorGain; + Control& mActorLost; +}; + +// Stores data that is populated in the callback and will be read by the TET cases +struct SignalData +{ + SignalData() + : functorCalled(false) + {} + + void Reset() + { + functorCalled = false; + + receivedKeyEvent.keyModifier = 0; + receivedKeyEvent.keyPressedName.clear(); + receivedKeyEvent.keyPressed.clear(); + + } + + bool functorCalled; + KeyEvent receivedKeyEvent; +}; + +/** + * Callback class to test SignalUnhandledKeyEvent signal + */ +class SignalUnhandledKeyEventCallback : public Dali::ConnectionTracker +{ +public: + SignalUnhandledKeyEventCallback( SignalData& data ) : mSignalData( data ) { } + + void Callback(const KeyEvent& event) + { + mSignalData.functorCalled = true; + mSignalData.receivedKeyEvent = event; + } + + SignalData& mSignalData; +}; + +} // namespace + +void key_input_focus_manager_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void key_input_focus_manager_cleanup(void) +{ + test_return_value = TET_PASS; +} + +int UtcDaliKeyInputFocusManagerGet(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliKeyInputFocusManagerGet"); + + KeyInputFocusManager manager; + { + manager = KeyInputFocusManager::Get(); + DALI_TEST_CHECK(manager); + } + + KeyInputFocusManager newManager = KeyInputFocusManager::Get(); + DALI_TEST_CHECK(newManager); + + // Check that focus manager is a singleton + DALI_TEST_CHECK(manager == newManager); + END_TEST; +} + +int UtcDaliKeyInputFocusManagerSetFocus(void) +{ + ToolkitTestApplication application; + Stage stage = Stage::GetCurrent(); + + tet_infoline(" UtcDaliKeyInputFocusManagerSetFocus"); + + KeyInputFocusManager manager = KeyInputFocusManager::Get(); + DALI_TEST_CHECK(manager); + + PushButton pushButton1 = PushButton::New(); + stage.Add( pushButton1 ); + + manager.SetFocus(pushButton1); + DALI_TEST_CHECK(pushButton1.HasKeyInputFocus()); + END_TEST; +} + +int UtcDaliKeyInputFocusManagerGetCurrentFocusControl(void) +{ + ToolkitTestApplication application; + Stage stage = Stage::GetCurrent(); + + tet_infoline(" UtcDaliKeyInputFocusManagerGetCurrentFocusControl"); + + KeyInputFocusManager manager = KeyInputFocusManager::Get(); + DALI_TEST_CHECK(manager); + + PushButton pushButton1 = PushButton::New(); + PushButton pushButton2 = PushButton::New(); + stage.Add( pushButton1 ); + stage.Add( pushButton2 ); + + manager.SetFocus(pushButton1); + DALI_TEST_CHECK(pushButton1 == manager.GetCurrentFocusControl()); + + manager.SetFocus(pushButton2); + DALI_TEST_CHECK(pushButton2 == manager.GetCurrentFocusControl()); + + manager.SetFocus(pushButton1); + DALI_TEST_CHECK(pushButton1 == manager.GetCurrentFocusControl()); + END_TEST; +} + +int UtcDaliKeyInputFocusManagerRemoveFocus(void) +{ + ToolkitTestApplication application; + Stage stage = Stage::GetCurrent(); + + tet_infoline(" UtcDaliKeyInputFocusManagerRemoveFocus"); + + KeyInputFocusManager manager = KeyInputFocusManager::Get(); + DALI_TEST_CHECK(manager); + + PushButton pushButton1 = PushButton::New(); + PushButton pushButton2 = PushButton::New(); + stage.Add( pushButton1 ); + stage.Add( pushButton2 ); + + manager.SetFocus(pushButton1); + DALI_TEST_CHECK(pushButton1 == manager.GetCurrentFocusControl()); + + manager.SetFocus(pushButton2); + DALI_TEST_CHECK(pushButton2 == manager.GetCurrentFocusControl()); + + manager.RemoveFocus(pushButton2); + DALI_TEST_CHECK(pushButton1 == manager.GetCurrentFocusControl()); + + manager.RemoveFocus(pushButton1); + DALI_TEST_CHECK(Control() == manager.GetCurrentFocusControl()); + END_TEST; +} + +int UtcDaliKeyInputFocusManagerIsKeyboardListener(void) +{ + ToolkitTestApplication application; + Stage stage = Stage::GetCurrent(); + + tet_infoline(" UtcDaliKeyInputFocusManagerIsKeyboardListener"); + + KeyInputFocusManager manager = KeyInputFocusManager::Get(); + DALI_TEST_CHECK(manager); + + PushButton pushButton1 = PushButton::New(); + PushButton pushButton2 = PushButton::New(); + stage.Add( pushButton1 ); + stage.Add( pushButton2 ); + + manager.SetFocus(pushButton1); + DALI_TEST_CHECK(pushButton1 == manager.GetCurrentFocusControl()); + + manager.SetFocus(pushButton2); + DALI_TEST_CHECK(pushButton2 == manager.GetCurrentFocusControl()); + + DALI_TEST_CHECK(manager.IsKeyboardListener(pushButton1)); + DALI_TEST_CHECK(manager.IsKeyboardListener(pushButton2)); + + manager.RemoveFocus(pushButton2); + DALI_TEST_CHECK(!manager.IsKeyboardListener(pushButton2)); + + manager.RemoveFocus(pushButton1); + DALI_TEST_CHECK(!manager.IsKeyboardListener(pushButton1)); + + manager.SetFocus(pushButton2); + DALI_TEST_CHECK(manager.IsKeyboardListener(pushButton2)); + pushButton2.ClearKeyInputFocus(); + DALI_TEST_CHECK(!manager.IsKeyboardListener(pushButton2)); + END_TEST; +} + +int UtcDaliKeyInputFocusManagerSignalKeyInputFocusChanged(void) +{ + ToolkitTestApplication application; + KeyInputFocusManager manager = KeyInputFocusManager::Get(); + Stage stage = Stage::GetCurrent(); + + tet_infoline(" UtcDaliKeyInputFocusManagerSignalKeyInputFocusChanged"); + + PushButton pushButton1 = PushButton::New(); + PushButton pushButton2 = PushButton::New(); + + stage.Add( pushButton1 ); + stage.Add( pushButton2 ); + + PushButton gainActor, lostActor; + KeyInputFocusChangedCallback callback( gainActor, lostActor ); + manager.KeyInputFocusChangedSignal().Connect( &callback, &KeyInputFocusChangedCallback::Callback ); + + manager.SetFocus(pushButton1); + + DALI_TEST_CHECK( gainActor == pushButton1 ); + DALI_TEST_CHECK( lostActor == Control() ); + + gainActor = lostActor = NULL; + + manager.SetFocus(pushButton2); + + DALI_TEST_CHECK( gainActor == pushButton2 ); + DALI_TEST_CHECK( lostActor == pushButton1 ); + + gainActor = lostActor = NULL; + + // Removing the focus actor from the stage would also result in signal emission. + stage.Remove( pushButton1 ); + stage.Remove( pushButton2 ); + + DALI_TEST_CHECK( gainActor == Control() ); + DALI_TEST_CHECK( lostActor == Control() ); + END_TEST; +} + +int UtcDaliKeyInputFocusManagerSignalUnhandledKeyEvent(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliKeyInputFocusManagerSignalUnhandledKeyEvent"); + + SignalData data; + SignalUnhandledKeyEventCallback callback( data ); + + KeyInputFocusManager manager = KeyInputFocusManager::Get(); + manager.UnhandledKeyEventSignal().Connect( &callback, &SignalUnhandledKeyEventCallback::Callback ); + + + Integration::KeyEvent event("a", "a", 0, 0, 0, Integration::KeyEvent::Up); + application.ProcessEvent(event); + + DALI_TEST_CHECK(data.functorCalled); + DALI_TEST_CHECK(event.keyName == data.receivedKeyEvent.keyPressedName ); + DALI_TEST_CHECK(event.keyCode == data.receivedKeyEvent.keyCode); + DALI_TEST_CHECK(event.keyString == data.receivedKeyEvent.keyPressed ); + DALI_TEST_CHECK(event.state == data.receivedKeyEvent.state ); + + data.Reset(); + + Integration::KeyEvent event2("v", "v", 0, 0, 0, Integration::KeyEvent::Up); + application.ProcessEvent(event2); + + DALI_TEST_CHECK(data.functorCalled); + DALI_TEST_CHECK(event2.keyName == data.receivedKeyEvent.keyPressedName ); + DALI_TEST_CHECK(event2.keyCode == data.receivedKeyEvent.keyCode); + DALI_TEST_CHECK(event2.keyString == data.receivedKeyEvent.keyPressed ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-KeyboardFocusManager.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-KeyboardFocusManager.cpp new file mode 100644 index 0000000..6cdfd8d --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-KeyboardFocusManager.cpp @@ -0,0 +1,406 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include +#include + + +using namespace Dali; +using namespace Dali::Toolkit; + +void dali_keyboard_focus_manager_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void dali_keyboard_focus_manager_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +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) + : mSignalVerified(signalReceived), + mCurrentFocusedActor(), + mProposedActorToFocus(), + mDirection(Control::Left) + { + } + + Actor Callback(Actor currentFocusedActor, Actor proposedActorToFocus, Control::KeyboardFocusNavigationDirection direction) + { + tet_infoline("Verifying PreFocusChangeCallback()"); + + mSignalVerified = true; + + mCurrentFocusedActor = currentFocusedActor; + mProposedActorToFocus = proposedActorToFocus; + mDirection = direction; + + return mProposedActorToFocus; + } + + void Reset() + { + mSignalVerified = false; + mCurrentFocusedActor = Actor(); + mProposedActorToFocus = Actor(); + mDirection = Control::Left; + } + + bool& mSignalVerified; + Actor mCurrentFocusedActor; + Actor mProposedActorToFocus; + Control::KeyboardFocusNavigationDirection 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; +}; + +// Functors to test whether focus group changed signal is emitted when the keyboard focus group is changed +class FocusGroupChangedCallback : public Dali::ConnectionTracker +{ +public: + FocusGroupChangedCallback(bool& signalReceived) + : mSignalVerified(signalReceived), + mCurrentFocusedActor(), + mForward(true) + { + } + + void Callback(Actor currentFocusedActor, bool forward) + { + tet_infoline("Verifying FocusGroupChangedCallback()"); + + mSignalVerified = true; + + mCurrentFocusedActor = currentFocusedActor; + mForward = forward; + } + + void Reset() + { + mSignalVerified = false; + } + + bool& mSignalVerified; + Actor mCurrentFocusedActor; + bool mForward; +}; + +// Functors to test whether focused actor activated signal is emitted when the focused actor is activated +class FocusedActorActivatedCallback : public Dali::ConnectionTracker +{ +public: + FocusedActorActivatedCallback(bool& signalReceived) + : mSignalVerified(signalReceived), + mActivatedActor() + { + } + + void Callback(Actor activatedActor) + { + tet_infoline("Verifying FocusedActorActivatedCallback()"); + + mSignalVerified = true; + + mActivatedActor = activatedActor; + } + + void Reset() + { + mSignalVerified = false; + } + + bool& mSignalVerified; + Actor mActivatedActor; +}; + +} // namespace + + + +int UtcDaliKeyboardFocusManagerGet(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliKeyboardKeyboardFocusManagerGet"); + + // Register Type + TypeInfo type; + type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" ); + DALI_TEST_CHECK( type ); + BaseHandle handle = type.CreateInstance(); + DALI_TEST_CHECK( handle ); + + KeyboardFocusManager manager; + + manager = KeyboardFocusManager::Get(); + DALI_TEST_CHECK(manager); + + KeyboardFocusManager newManager = KeyboardFocusManager::Get(); + DALI_TEST_CHECK(newManager); + + // Check that focus manager is a singleton + DALI_TEST_CHECK(manager == newManager); + END_TEST; +} + + + +int UtcDaliKeyboardFocusManagerMoveFocus(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliKeyboardFocusManagerMoveFocus"); + + // Register Type + TypeInfo type; + type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" ); + DALI_TEST_CHECK( type ); + BaseHandle handle = type.CreateInstance(); + DALI_TEST_CHECK( handle ); + + KeyboardFocusManager manager = KeyboardFocusManager::Get(); + DALI_TEST_CHECK(manager); + + bool preFocusChangeSignalVerified = false; + PreFocusChangeCallback preFocusChangeCallback(preFocusChangeSignalVerified); + manager.PreFocusChangeSignal().Connect( &preFocusChangeCallback, &PreFocusChangeCallback::Callback ); + + bool focusChangedSignalVerified = false; + FocusChangedCallback focusChangedCallback(focusChangedSignalVerified); + manager.FocusChangedSignal().Connect( &focusChangedCallback, &FocusChangedCallback::Callback ); + + // Create the first actor and add it to the stage + Actor first = Actor::New(); + first.SetKeyboardFocusable(true); + Stage::GetCurrent().Add(first); + + // Create the second actor and add it to the stage + Actor second = Actor::New(); + second.SetKeyboardFocusable(true); + Stage::GetCurrent().Add(second); + + // Move the focus to the right + DALI_TEST_CHECK(manager.MoveFocus(Control::Right) == false); + + // Because no layout control in the stage and no actor is focused, it should emit the PreFocusChange signal + DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified); + DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == Actor()); + DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor()); + DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::Right); + preFocusChangeCallback.Reset(); + + // Check that the focus is set on the first actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); + DALI_TEST_CHECK(focusChangedCallback.mSignalVerified); + DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == Actor()); + DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first); + focusChangedCallback.Reset(); + + // Move the focus towards right + DALI_TEST_CHECK(manager.MoveFocus(Control::Right) == false); + + // Because no layout control in the stage and the first actor is focused, it should emit the PreFocusChange signal + DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified); + DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == first); + DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor()); + DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::Right); + preFocusChangeCallback.Reset(); + + // Check that the focus is set on the second actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second); + DALI_TEST_CHECK(focusChangedCallback.mSignalVerified); + DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first); + DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == second); + focusChangedCallback.Reset(); + + // Move the focus towards up + DALI_TEST_CHECK(manager.MoveFocus(Control::Up) == false); + + // Because no layout control in the stage and no actor is focused, it should emit the PreFocusChange signal + DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified); + DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == second); + DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor()); + DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::Up); + preFocusChangeCallback.Reset(); + DALI_TEST_CHECK(!focusChangedCallback.mSignalVerified); + + // Create a 2x2 table view and try to move focus inside it + TableView tableView = TableView::New( 2, 2 ); + Stage::GetCurrent().Add(tableView); + + // Create the third actor + Actor third = Actor::New(); + third.SetKeyboardFocusable(true); + + // Create the fourth actor + Actor fourth = Actor::New(); + fourth.SetKeyboardFocusable(true); + + // Add the four children to table view + tableView.AddChild(first, TableView::CellPosition(0, 0)); + tableView.AddChild(second, TableView::CellPosition(0, 1)); + tableView.AddChild(third, TableView::CellPosition(1, 0)); + tableView.AddChild(fourth, TableView::CellPosition(1, 1)); + + // Set the focus to the first actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); + DALI_TEST_CHECK(focusChangedCallback.mSignalVerified); + DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == second); + DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first); + focusChangedCallback.Reset(); + + // Move the focus towards right + DALI_TEST_CHECK(manager.MoveFocus(Control::Right) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second); + DALI_TEST_CHECK(focusChangedCallback.mSignalVerified); + DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first); + DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == second); + focusChangedCallback.Reset(); + + // Move the focus towards down + DALI_TEST_CHECK(manager.MoveFocus(Control::Down) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == fourth); + DALI_TEST_CHECK(focusChangedCallback.mSignalVerified); + DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == second); + DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == fourth); + focusChangedCallback.Reset(); + + // Move the focus towards left + DALI_TEST_CHECK(manager.MoveFocus(Control::Left) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third); + DALI_TEST_CHECK(focusChangedCallback.mSignalVerified); + DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == fourth); + DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == third); + focusChangedCallback.Reset(); + + // Move the focus towards up + DALI_TEST_CHECK(manager.MoveFocus(Control::Up) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); + DALI_TEST_CHECK(focusChangedCallback.mSignalVerified); + DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == third); + DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first); + focusChangedCallback.Reset(); + + // Move the focus towards left. The focus move will fail as no way to move it upwards + DALI_TEST_CHECK(manager.MoveFocus(Control::Left) == false); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); + DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified); + DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == first); + DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor()); + DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::Left); + preFocusChangeCallback.Reset(); + DALI_TEST_CHECK(!focusChangedCallback.mSignalVerified); + + // Enable the loop + manager.SetFocusGroupLoop(true); + DALI_TEST_CHECK(manager.GetFocusGroupLoop() == true); + + // Move the focus towards left again. The focus should move to the fourth actor. + DALI_TEST_CHECK(manager.MoveFocus(Control::Left) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == fourth); + DALI_TEST_CHECK(focusChangedCallback.mSignalVerified); + DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first); + DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == fourth); + focusChangedCallback.Reset(); + END_TEST; +} + + +int UtcDaliKeyboardFocusManagerSignalFocusGroupChanged(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliKeyboardFocusManagerSignalFocusGroupChanged"); + + // Register Type + TypeInfo type; + type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" ); + DALI_TEST_CHECK( type ); + BaseHandle handle = type.CreateInstance(); + DALI_TEST_CHECK( handle ); + + KeyboardFocusManager manager = KeyboardFocusManager::Get(); + DALI_TEST_CHECK(manager); + + bool focusGroupChangedSignalVerified = false; + FocusGroupChangedCallback focusGroupChangedCallback(focusGroupChangedSignalVerified); + manager.FocusGroupChangedSignal().Connect( &focusGroupChangedCallback, &FocusGroupChangedCallback::Callback ); + + Integration::KeyEvent tabEvent("Tab", "", 0, 0, 0, Integration::KeyEvent::Down); + Integration::KeyEvent shiftTabEvent("Tab", "", 1, 0, 0, Integration::KeyEvent::Down); + + // Send the tab event to change focus group in the forward direction + application.ProcessEvent(tabEvent); + DALI_TEST_CHECK(focusGroupChangedCallback.mSignalVerified); + DALI_TEST_CHECK(focusGroupChangedCallback.mCurrentFocusedActor == Actor()); + DALI_TEST_CHECK(focusGroupChangedCallback.mForward == true); + focusGroupChangedCallback.Reset(); + + // Send the shift tab event to change focus group in the backward direction + application.ProcessEvent(shiftTabEvent); + DALI_TEST_CHECK(focusGroupChangedCallback.mSignalVerified); + DALI_TEST_CHECK(focusGroupChangedCallback.mCurrentFocusedActor == Actor()); + DALI_TEST_CHECK(focusGroupChangedCallback.mForward == false); + focusGroupChangedCallback.Reset(); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-NavigationControl.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-NavigationControl.cpp new file mode 100644 index 0000000..7382bcd --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-NavigationControl.cpp @@ -0,0 +1,354 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + + +using namespace Dali; +using namespace Dali::Toolkit; + +namespace +{ + +static bool gObjectCreatedCallBackCalled; +static void TestCallback(BaseHandle handle) +{ + gObjectCreatedCallBackCalled = true; +} + +} + + +void navigation_control_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void navigation_control_cleanup(void) +{ + test_return_value = TET_PASS; +} + +int UtcDaliNavigationControlNew(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliNavigationControlNew"); + + NavigationControl naviControl; + // Check that this handle is uninitialized + DALI_TEST_CHECK( !naviControl ); + + naviControl = NavigationControl::New(); + // Check that the Dali resource is successfully created + DALI_TEST_CHECK( naviControl ); + + NavigationControl naviControl2( naviControl ); + DALI_TEST_CHECK( naviControl2 == naviControl ); + + //Additional check to ensure object is created by checking whether it is registered + ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + DALI_TEST_CHECK( registry ); + gObjectCreatedCallBackCalled = false; + registry.ObjectCreatedSignal().Connect( TestCallback ); + { + NavigationControl naviControl = NavigationControl::New(); + } + DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + END_TEST; +} + +int UtcDaliNavigationControlDownCast(void) +{ + ToolkitTestApplication application; + tet_infoline( "UtcDaliNavigationControlDownCast" ); + + NavigationControl naviControl = NavigationControl::New(); + BaseHandle handle( naviControl ); + + NavigationControl newNaviControl = NavigationControl::DownCast( handle ); + DALI_TEST_CHECK( naviControl ); + DALI_TEST_CHECK( newNaviControl == naviControl ); + END_TEST; +} + +int UtcDaliNavigationControlPushItem(void) +{ + ToolkitTestApplication application; + tet_infoline( "UtcDaliNavigationControlPushItem" ); + + // Create a NavigationControl object, and add it to stage + NavigationControl naviControl = NavigationControl::New(); + Stage::GetCurrent().Add(naviControl); + // Check there is no item in the stack + DALI_TEST_CHECK( naviControl.GetItemCount() == 0 ); + + // Create two NavigationItem objects + Page firstItem = Page::New(); + Page secondItem = Page::New(); + + // Push the first item into stack + naviControl.PushItem( firstItem ); + // Check the item count in stack + DALI_TEST_CHECK( naviControl.GetItemCount() == 1 ); + // Check the current item + DALI_TEST_CHECK( naviControl.GetCurrentItem() == firstItem ); + // Check that the newly pushed item is displayed on stage + DALI_TEST_CHECK( firstItem.OnStage() ); + + // Push the second item into stack + naviControl.PushItem( secondItem ); + // Check the item count in stack + DALI_TEST_CHECK( naviControl.GetItemCount() == 2 ); + // Check the current item + DALI_TEST_CHECK( naviControl.GetCurrentItem() == secondItem ); + // Check the bottom item in the stack + DALI_TEST_CHECK( naviControl.GetItem(0) == firstItem ); + // Check that the previous item is off stage + DALI_TEST_CHECK( !firstItem.OnStage() ); + // Check that the newly pushed item is displayed on stage + DALI_TEST_CHECK( secondItem.OnStage() ); + + Page thirdItem; + Page fourthItem(secondItem); + naviControl.PushItem( thirdItem ); + // Check that an uninitialized item cannot be pushed into the stack + DALI_TEST_CHECK( naviControl.GetItemCount() == 2 ); + naviControl.PushItem( fourthItem ); + // Check that an duplicated item with the current item cannot be pushed into the stack + DALI_TEST_CHECK( naviControl.GetItemCount() == 2 ); + // Check that the current item and the item on the stage is still the secondItem + DALI_TEST_CHECK( naviControl.GetCurrentItem() == secondItem ); + DALI_TEST_CHECK( secondItem.OnStage() ); + END_TEST; +} + +int UtcDaliNavigationControlPopItem(void) +{ + ToolkitTestApplication application; + tet_infoline( "UtcDaliNavigationControlPopItem" ); + + // Create a NavigationControl object, and add it to stage + NavigationControl naviControl = NavigationControl::New(); + Stage::GetCurrent().Add(naviControl); + // Create three NavigationItem objects + Page firstItem = Page::New(); + Page secondItem = Page::New(); + Page thirdItem = Page::New(); + naviControl.PushItem( firstItem ); + naviControl.PushItem( secondItem ); + naviControl.PushItem( thirdItem ); + + DALI_TEST_CHECK( naviControl.GetItemCount() == 3 ); + + // pop an item out from the stack + Page poppedItem = naviControl.PopItem(); + // check that the item count is decrease by one + DALI_TEST_CHECK( naviControl.GetItemCount() == 2 ); + // check that the item popped out is the thirdItem + DALI_TEST_CHECK( poppedItem == thirdItem ); + // check that the item popped out is disappeared from the stage + DALI_TEST_CHECK( !poppedItem.OnStage() ); + // check that the new top item is displayed on the stage + DALI_TEST_CHECK( secondItem.OnStage() ); + + // repeat the above steps again + poppedItem = naviControl.PopItem(); + DALI_TEST_CHECK( naviControl.GetItemCount() == 1 ); + DALI_TEST_CHECK( poppedItem == secondItem ); + DALI_TEST_CHECK( !poppedItem.OnStage() ); + DALI_TEST_CHECK( firstItem.OnStage() ); + + // check that the bottom-most item can not be popped out from the stack + poppedItem = naviControl.PopItem(); + // when trying to pop the bottom-most item, it returns an uninitialized handle and does nothing else + DALI_TEST_CHECK( !poppedItem ); + DALI_TEST_CHECK( naviControl.GetItemCount() == 1 ); + DALI_TEST_CHECK( firstItem.OnStage() ); + END_TEST; +} + +int UtcDaliNavigationControlGetItemCount(void) +{ + ToolkitTestApplication application; + tet_infoline( "UtcDaliNavigationControlGetItemCount" ); + + // Create a NavigationControl object + NavigationControl naviControl = NavigationControl::New(); + // Create three NavigationItem objects + Page firstItem = Page::New(); + Page secondItem = Page::New(); + Page thirdItem = Page::New(); + + DALI_TEST_CHECK( naviControl.GetItemCount() == 0 ); + naviControl.PushItem( firstItem ); + DALI_TEST_CHECK( naviControl.GetItemCount() == 1 ); + naviControl.PushItem( secondItem ); + DALI_TEST_CHECK( naviControl.GetItemCount() == 2 ); + naviControl.PushItem( thirdItem ); + DALI_TEST_CHECK( naviControl.GetItemCount() == 3 ); + naviControl.PopItem(); + DALI_TEST_CHECK( naviControl.GetItemCount() == 2 ); + naviControl.PopItem(); + DALI_TEST_CHECK( naviControl.GetItemCount() == 1 ); + END_TEST; +} + +int UtcDaliNavigationControlGetItem(void) +{ + ToolkitTestApplication application; + tet_infoline( "UtcDaliNavigationControlGetItem" ); + + // Create a NavigationControl object + NavigationControl naviControl = NavigationControl::New(); + // Create three NavigationItem objects and push them into stack + Page firstItem = Page::New(); + Page secondItem = Page::New(); + Page thirdItem = Page::New(); + naviControl.PushItem( firstItem ); + naviControl.PushItem( secondItem ); + naviControl.PushItem( thirdItem ); + + // check every item by get it by index + DALI_TEST_CHECK( naviControl.GetItem(0) == firstItem ); + DALI_TEST_CHECK( naviControl.GetItem(1) == secondItem ); + DALI_TEST_CHECK( naviControl.GetItem(2) == thirdItem); + END_TEST; +} + +int UtcDaliNavigationControlGetCurrentItem(void) +{ + ToolkitTestApplication application; + tet_infoline( "UtcDaliNavigationControlGetCurrentItem" ); + + // Create a NavigationControl object + NavigationControl naviControl = NavigationControl::New(); + // Create three NavigationItem objects + Page firstItem = Page::New(); + Page secondItem = Page::New(); + Page thirdItem = Page::New(); + + naviControl.PushItem( firstItem ); + DALI_TEST_CHECK( naviControl.GetCurrentItem() == firstItem ); + naviControl.PushItem( secondItem ); + DALI_TEST_CHECK( naviControl.GetCurrentItem() == secondItem ); + naviControl.PushItem( thirdItem ); + DALI_TEST_CHECK( naviControl.GetCurrentItem() == thirdItem ); + naviControl.PopItem(); + DALI_TEST_CHECK( naviControl.GetCurrentItem() == secondItem ); + naviControl.PopItem(); + DALI_TEST_CHECK( naviControl.GetCurrentItem() == firstItem ); + END_TEST; +} + +int UtcDaliNavigationControlSetBackground(void) +{ + ToolkitTestApplication application; + tet_infoline( "UtcDaliNavigationControlSetBackground" ); + + try + { + NavigationControl naviControl = NavigationControl::New(); + Stage::GetCurrent().Add( naviControl ); + + ImageActor background = CreateSolidColorActor( Color::RED ); + naviControl.SetBackground( background ); + } + catch (Dali::DaliException& e) + { + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_EQUALS(e.mCondition, "segmentIndex+1 < mKnots.size() && segmentIndex < mKnots.size()", TEST_LOCATION); + tet_result(TET_FAIL); + } + + tet_result(TET_PASS); + END_TEST; +} + +int UtcDaliNavigationControlCreateNavigationToolBar(void) +{ + ToolkitTestApplication application; + tet_infoline( "UtcDaliNavigationControlCreateNavigationToolBar" ); + + ImageActor background = CreateSolidColorActor( Color::RED ); + Stage stage = Stage::GetCurrent(); + + NavigationControl naviControl = NavigationControl::New(); + stage.Add( naviControl ); + + Toolkit::NaviToolBarStyle toolbarStyle( background, 720, 98, 496, 182, 72, 16, 63, 26); + + naviControl.CreateNavigationToolBar( toolbarStyle, toolbarStyle); + + Page naviItem = Page::New(); + PushButton firstControl = PushButton::New(); + naviItem.AddControlToToolBar(firstControl, Alignment::HorizontalLeft); + PushButton secondControl = PushButton::New(); + naviItem.AddControlToToolBar(secondControl, Alignment::HorizontalCenter); + PushButton thirdControl = PushButton::New(); + naviItem.AddControlToToolBar(thirdControl, Alignment::HorizontalCenter); + PushButton fourthControl = PushButton::New(); + naviItem.AddControlToToolBar(fourthControl, Alignment::HorizontalRight); + PushButton fifthControl = PushButton::New(); + naviItem.AddControlToToolBar(fifthControl, Alignment::HorizontalRight); + + naviControl.PushItem( naviItem ); + + DALI_TEST_CHECK( firstControl.OnStage() ); + // Can add multiple controls to the central group + DALI_TEST_CHECK( secondControl.OnStage() ); + DALI_TEST_CHECK( thirdControl.OnStage() ); + // Can only have one control in the side groups + DALI_TEST_CHECK( !fourthControl.OnStage() ); + DALI_TEST_CHECK( fifthControl.OnStage() ); + + END_TEST; +} + +int UtcDaliNavigationControlCreateNavigationTitleBar(void) +{ + ToolkitTestApplication application; + tet_infoline( "UtcDaliNavigationControlCreateNavigationTitleBar" ); + + ImageActor background = CreateSolidColorActor( Color::RED ); + TextStyle textStyle; + Stage stage = Stage::GetCurrent(); + + NavigationControl naviControl = NavigationControl::New(); + stage.Add( naviControl ); + + Toolkit::NaviTitleBarStyle titleBarStyle( background, textStyle, textStyle, 720, 111, 68, 48, 34, 16, 11, 45, 63, 26, 14, 22 ); + naviControl.CreateNavigationTitleBar( titleBarStyle, titleBarStyle ); + + Page naviItem = Page::New(); + + PushButton firstControl = PushButton::New(); + naviItem.AddControlToTitleBar( firstControl ); + PushButton secondControl = PushButton::New(); + naviItem.AddControlToTitleBar( secondControl ); + + Actor titleIcon = Actor::New(); + naviItem.SetTitleIcon( titleIcon ); + + naviControl.PushItem( naviItem ); + + DALI_TEST_CHECK( firstControl.OnStage() ); + DALI_TEST_CHECK( secondControl.OnStage() ); + DALI_TEST_CHECK( titleIcon.OnStage() ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-NavigationLayout.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-NavigationLayout.cpp new file mode 100644 index 0000000..6534d6e --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-NavigationLayout.cpp @@ -0,0 +1,565 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include // for FLT_MAX +#include +#include + +using namespace Dali; +using namespace Toolkit; + +namespace +{ +const unsigned int TOTAL_ITEM_NUMBER = 200; + + +// Implementation of ItemFactory for providing actors to ItemView +class TestItemFactory : public ItemFactory +{ +public: + + /** + * Constructor + * @param application class, stored as reference + */ + TestItemFactory() + { + } + +public: // From ItemFactory + + /** + * Query the number of items available from the factory. + * The maximum available item has an ID of GetNumberOfItems() - 1. + */ + virtual unsigned int GetNumberOfItems() + { + return TOTAL_ITEM_NUMBER; + } + + /** + * Create an Actor to represent a visible item. + * @param itemId + * @return the created actor. + */ + virtual Actor NewItem(unsigned int itemId) + { + // Create an test actor for this item + ImageActor actor = CreateSolidColorActor(Color::RED); + actor.SetSize(64.0f, 64.0f); + + return actor; + } +}; +} // namespace + + +// Positive test case for a method +int UtcDaliNavigationLayoutNew(void) +{ + ToolkitTestApplication application; + + // Create a navigation layout + NavigationLayoutPtr navigationLayout = NavigationLayout::New(); + navigationLayout->SetNumberOfColumns(6); + DALI_TEST_CHECK(navigationLayout); + END_TEST; +} + +int UtcDaliNavigationLayoutColumns(void) +{ + ToolkitTestApplication application; + NavigationLayoutPtr navigationLayout = NavigationLayout::New(); + + navigationLayout->SetNumberOfColumns(6); + // Check whether we get the correct number of columns + DALI_TEST_CHECK(navigationLayout->GetNumberOfColumns() == 6); + END_TEST; +} + +int UtcDaliNavigationLayoutSetGetOrientation(void) +{ + ToolkitTestApplication application; + NavigationLayoutPtr navigationLayout = NavigationLayout::New(); + + navigationLayout->SetNumberOfColumns(6); + navigationLayout->SetOrientation(ControlOrientation::Right); + DALI_TEST_CHECK(navigationLayout->GetOrientation() == ControlOrientation::Right); + END_TEST; +} + +int UtcDaliNavigationLayoutTestConstraintLeft(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + NavigationLayoutPtr navigationLayout = NavigationLayout::New(); + navigationLayout->SetNumberOfColumns(6); + + view.SetName("view actor"); + view.AddLayout(*navigationLayout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + navigationLayout->SetOrientation(ControlOrientation::Left); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + // Confirm: we have actors in the view and all of them is positioned at X = 0 + // and the series is monotonely decreasing. + int nonZeroXCount = 0; + int elementsFound = 0; + int wrongDirectionCount = 0; + float prevY = FLT_MAX; + for(unsigned int i = 0; i < 10; i++) + { + Actor testActor = view.GetItem(i); + if (testActor) + { + elementsFound++; + Vector3 pos = testActor.GetCurrentPosition(); + + if (pos.x != 0.0f) + { + nonZeroXCount++; + } + + if (pos.y >= prevY) + { + wrongDirectionCount++; + } + + prevY = pos.y; + } + } + + DALI_TEST_CHECK((elementsFound > 0) && (nonZeroXCount == 0) && (wrongDirectionCount == 0)); + Stage::GetCurrent().Remove(view); + END_TEST; +} + +int UtcDaliNavigationLayoutTestConstraintRight(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + NavigationLayoutPtr navigationLayout = NavigationLayout::New(); + navigationLayout->SetNumberOfColumns(6); + + view.SetName("view actor"); + view.AddLayout(*navigationLayout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + navigationLayout->SetOrientation(ControlOrientation::Right); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + // Confirm: we have actors in the view and all of them is positioned at X = 0 + // and the series is monotonely increasing. + int nonZeroXCount = 0; + int elementsFound = 0; + int wrongDirectionCount = 0; + float prevY = -FLT_MAX; + for(unsigned int i = 0; i < 10; i++) + { + Actor testActor = view.GetItem(i); + if (testActor) + { + elementsFound++; + Vector3 pos = testActor.GetCurrentPosition(); + + if (pos.x != 0.0f) + { + nonZeroXCount++; + } + + if (pos.y <= prevY) + { + wrongDirectionCount++; + } + + prevY = pos.y; + } + } + + DALI_TEST_CHECK((elementsFound > 0) && (nonZeroXCount == 0) && (wrongDirectionCount == 0)); + Stage::GetCurrent().Remove(view); + END_TEST; +} + +int UtcDaliNavigationLayoutTestConstraintUp(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + NavigationLayoutPtr navigationLayout = NavigationLayout::New(); + navigationLayout->SetNumberOfColumns(6); + + view.SetName("view actor"); + view.AddLayout(*navigationLayout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + navigationLayout->SetOrientation(ControlOrientation::Up); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + // Confirm: we have actors in the view and all of them is positioned at X = 0 + // and the series is monotonely decreasing. + int nonZeroYCount = 0; + int elementsFound = 0; + int wrongDirectionCount = 0; + float prevX = -FLT_MAX; + for(unsigned int i = 0; i < 10; i++) + { + Actor testActor = view.GetItem(i); + if (testActor) + { + elementsFound++; + Vector3 pos = testActor.GetCurrentPosition(); + + if (pos.y != 0.0f) + { + nonZeroYCount++; + } + + if (pos.x <= prevX) + { + wrongDirectionCount++; + } + + prevX = pos.x; + } + } + + DALI_TEST_CHECK((elementsFound > 0) && (nonZeroYCount == 0) && (wrongDirectionCount == 0)); + Stage::GetCurrent().Remove(view); + END_TEST; +} + +int UtcDaliNavigationLayoutTestConstraintDown(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + NavigationLayoutPtr navigationLayout = NavigationLayout::New(); + navigationLayout->SetNumberOfColumns(6); + + view.SetName("view actor"); + view.AddLayout(*navigationLayout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + navigationLayout->SetOrientation(ControlOrientation::Down); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + // Confirm: we have actors in the view and all of them is positioned at X = 0 + // and the series is monotonely decreasing. + int nonZeroYCount = 0; + int elementsFound = 0; + int wrongDirectionCount = 0; + float prevX = FLT_MAX; + for(unsigned int i = 0; i < 10; i++) + { + Actor testActor = view.GetItem(i); + if (testActor) + { + elementsFound++; + Vector3 pos = testActor.GetCurrentPosition(); + + if (pos.y != 0.0f) + { + nonZeroYCount++; + } + + if (pos.x > prevX) + { + wrongDirectionCount++; + } + + prevX = pos.x; + } + } + + DALI_TEST_CHECK((elementsFound > 0) && (nonZeroYCount == 0) && (wrongDirectionCount == 0)); + Stage::GetCurrent().Remove(view); + END_TEST; +} + + +int UtcDaliNavigationLayoutScrollDirection(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + NavigationLayoutPtr navigationLayout = NavigationLayout::New(); + navigationLayout->SetNumberOfColumns(6); + + view.SetName("view actor"); + view.AddLayout(*navigationLayout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + navigationLayout->SetOrientation(ControlOrientation::Left); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + ItemLayoutPtr layout = navigationLayout; + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + navigationLayout->SetOrientation(ControlOrientation::Up); + view.ActivateLayout(0, vec, 0.0f); + application.SendNotification(); + application.Render(); + + Degree deg = layout->GetScrollDirection(); + DALI_TEST_CHECK(deg == (180.0f - 45.0f)); + + navigationLayout->SetOrientation(ControlOrientation::Down); + view.ActivateLayout(0, vec, 0.0f); + application.SendNotification(); + application.Render(); + + deg = layout->GetScrollDirection(); + DALI_TEST_CHECK((deg == -45.0f)); + + layout->SetOrientation(ControlOrientation::Left); + view.ActivateLayout(0, vec, 0.0f); + application.SendNotification(); + application.Render(); + + deg = layout->GetScrollDirection(); + DALI_TEST_CHECK(deg == (270.0f - 45.0f)); + + navigationLayout->SetOrientation(ControlOrientation::Right); + view.ActivateLayout(0, vec, 0.0f); + application.SendNotification(); + application.Render(); + + deg = layout->GetScrollDirection(); + DALI_TEST_CHECK(deg == (90.0f - 45.0f)); + + Stage::GetCurrent().Remove(view); + END_TEST; +} + +int UtcDaliNavigationLayoutSetGetColumnSpacing(void) +{ + ToolkitTestApplication application; + NavigationLayoutPtr navigationLayout = NavigationLayout::New(); + const float testValue = 11.0f; + + navigationLayout->SetNumberOfColumns(6); + navigationLayout->SetColumnSpacing(testValue); + DALI_TEST_CHECK(navigationLayout->GetColumnSpacing() == testValue); + END_TEST; +} + +int UtcDaliNavigationLayoutSetGetTopMargin(void) +{ + ToolkitTestApplication application; + NavigationLayoutPtr navigationLayout = NavigationLayout::New(); + const float testValue = 11.0f; + + navigationLayout->SetNumberOfColumns(6); + navigationLayout->SetTopMargin(testValue); + DALI_TEST_CHECK(navigationLayout->GetTopMargin() == testValue); + END_TEST; +} + +int UtcDaliNavigationLayoutSetGetBottomMargin(void) +{ + ToolkitTestApplication application; + NavigationLayoutPtr navigationLayout = NavigationLayout::New(); + const float testValue = 12.0f; + + navigationLayout->SetNumberOfColumns(6); + navigationLayout->SetBottomMargin(testValue); + DALI_TEST_CHECK(navigationLayout->GetBottomMargin() == testValue); + END_TEST; +} + +int UtcDaliNavigationLayoutSetGetScrollSpeedFactor(void) +{ + ToolkitTestApplication application; + NavigationLayoutPtr navigationLayout = NavigationLayout::New(); + const float testValue = 15.0f; + + navigationLayout->SetNumberOfColumns(6); + navigationLayout->SetScrollSpeedFactor(testValue); + DALI_TEST_CHECK(navigationLayout->GetScrollSpeedFactor() == testValue); + END_TEST; +} + +int UtcDaliNavigationLayoutSetGetMaximumSwipeSpeed(void) +{ + ToolkitTestApplication application; + NavigationLayoutPtr navigationLayout = NavigationLayout::New(); + const float testValue = 10.0f; + + navigationLayout->SetNumberOfColumns(6); + navigationLayout->SetMaximumSwipeSpeed(testValue); + DALI_TEST_CHECK(navigationLayout->GetMaximumSwipeSpeed() == testValue); + END_TEST; +} + +int UtcDaliNavigationLayoutSetAndGetItemFlickAnimationDuration(void) +{ + ToolkitTestApplication application; + + // Create a navigation layout + NavigationLayoutPtr navigationLayout = NavigationLayout::New(); + + // Set the flick animaiton duration + navigationLayout->SetItemFlickAnimationDuration(0.35f); + + // Check whether we get the correct flick animaiton duration + DALI_TEST_EQUALS( navigationLayout->GetItemFlickAnimationDuration(), 0.35f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliNavigationLayoutGetScrollToPosition(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + NavigationLayoutPtr layout = NavigationLayout::New(); + + view.SetName("view actor"); + view.AddLayout(*layout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + layout->SetOrientation(ControlOrientation::Up); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + // Confirm: we have actors in the view. + std::vector indices; + for(unsigned int i = 0; i < 10; i++) + { + Actor testActor = view.GetItem(i); + if (testActor) + { + indices.push_back(i); + } + } + + try + { + if (!indices.empty()) + { + const unsigned int firstTargetIndex = indices[indices.size()-1]; + // scroll to last item + view.ScrollToItem(firstTargetIndex, 0.00f); + application.Render(16); // 60hz frames + + std::size_t moveCount = 0; + for(std::size_t i = 0; i < indices.size(); i++) + { + float layoutPosBefore = view.GetCurrentLayoutPosition(i); + view.ScrollToItem(indices[i], 0.0f); + + application.Render(16); // 60hz frame + + float layoutPosAfter = view.GetCurrentLayoutPosition(i); + + if (fabs(layoutPosBefore-layoutPosAfter) <= FLT_EPSILON) + { + ++moveCount; + } + } + + DALI_TEST_CHECK((moveCount == indices.size())); + } + } + catch(...) + { + tet_result(TET_FAIL); + } + + Stage::GetCurrent().Remove(view); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-OverlayEffect.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-OverlayEffect.cpp new file mode 100644 index 0000000..13249b2 --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-OverlayEffect.cpp @@ -0,0 +1,78 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + + +using namespace Dali; +using namespace Dali::Toolkit; + +void overlay_effect_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void overlay_effect_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +int UtcDaliOverlayConstructor(void) +{ + ToolkitTestApplication application; + + BitmapImage image = CreateBitmapImage(); + + Toolkit::OverlayEffect effect = Toolkit::OverlayEffect::New( image ); + DALI_TEST_CHECK( effect ); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + END_TEST; +} + +int UtcDaliOverlayUninitializedEffect(void) +{ + ToolkitTestApplication application; + + Toolkit::OverlayEffect effect; + + try + { + BitmapImage image = CreateBitmapImage(); + + // New() must be called to create a OverlayEffect or it wont be valid. + effect.SetEffectImage( image ); + DALI_TEST_CHECK( false ); + } + catch (Dali::DaliException& e) + { + // Tests that a negative test of an assertion succeeds + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_CHECK(!effect); + } + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-Page.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-Page.cpp new file mode 100644 index 0000000..0856998 --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-Page.cpp @@ -0,0 +1,227 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + +using namespace Dali; +using namespace Dali::Toolkit; + +void dali_page_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void dali_page_cleanup(void) +{ + test_return_value = TET_PASS; +} + +namespace +{ +static bool gObjectCreatedCallBackCalled; +static void TestCallback(BaseHandle handle) +{ + gObjectCreatedCallBackCalled = true; +} + +} + + + +int UtcDaliPageNew(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliPageNew"); + + Page naviItem; + // Check that this handle is uninitialized + DALI_TEST_CHECK( !naviItem ); + + naviItem = Page::New(); + // Check that the Dali resource is successfully created + DALI_TEST_CHECK( naviItem ); + + Page naviItem2( naviItem ); + DALI_TEST_CHECK( naviItem2 == naviItem ); + + // Additional check to ensure the object is created by checking whether it is registered + ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + DALI_TEST_CHECK( registry ); + gObjectCreatedCallBackCalled = false; + registry.ObjectCreatedSignal().Connect( TestCallback ); + { + Page naviItem = Page::New(); + } + DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + END_TEST; +} + +int UtcDaliPageDownCast(void) +{ + ToolkitTestApplication application; + tet_infoline( "UtcDaliPageDownCast" ); + + Page naviItem = Page::New(); + BaseHandle handle( naviItem ); + + Page newNaviItem = Page::DownCast( handle ); + DALI_TEST_CHECK( naviItem ); + DALI_TEST_CHECK( newNaviItem == naviItem ); + END_TEST; +} + +int UtcDaliPageSetGetTitle(void) +{ + ToolkitTestApplication application; + tet_infoline( "UtcDaliPageSetGetTitle" ); + + Page naviItem = Page::New(); + DALI_TEST_CHECK( naviItem.GetTitle().empty() ); + + std::string str( "ItemTitle" ); + naviItem.SetTitle( str ); + DALI_TEST_CHECK( naviItem.GetTitle() == str ); + END_TEST; +} + +int UtcDaliPageSetGetSubTitle(void) +{ + ToolkitTestApplication application; + tet_infoline( "UtcDaliPageSetGetSubTitle" ); + + Page naviItem = Page::New(); + DALI_TEST_CHECK( naviItem.GetSubTitle().empty() ); + + std::string str( "ItemSubTitle" ); + naviItem.SetSubTitle( str ); + DALI_TEST_CHECK( naviItem.GetSubTitle() == str ); + END_TEST; +} + +int UtcDaliPageSetGetTitleIcon(void) +{ + ToolkitTestApplication application; + tet_infoline( "UtcDaliPageSetGetTitleIcon" ); + + Page naviItem = Page::New(); + DALI_TEST_CHECK( !naviItem.GetTitleIcon() ); + + Actor titleIcon = Actor::New(); + naviItem.SetTitleIcon( titleIcon ); + DALI_TEST_CHECK( naviItem.GetTitleIcon() == titleIcon ); + END_TEST; +} + +int UtcDaliPageAddGetToolBarControl(void) +{ + ToolkitTestApplication application; + tet_infoline( "UtcDaliPageAddGetToolBarControl" ); + + Page naviItem = Page::New(); + Page::ControlOnBarContainer container = naviItem.GetControlsOnToolBar(); + // Check that the container is empty in the beginning + DALI_TEST_CHECK( container.empty() ); + + // Add control, check whether adding successfully, also check the container size + PushButton firstControl = PushButton::New(); + DALI_TEST_CHECK( naviItem.AddControlToToolBar(firstControl, Alignment::HorizontalLeft) ); + container = naviItem.GetControlsOnToolBar(); + DALI_TEST_CHECK( container.size() == 1 ); + + // Add control, check whether adding successfully, also check the container size + PushButton secondControl = PushButton::New(); + DALI_TEST_CHECK( naviItem.AddControlToToolBar(secondControl, Alignment::HorizontalCenter) ); + container = naviItem.GetControlsOnToolBar(); + DALI_TEST_CHECK( container.size() == 2 ); + + // The control adding fails, as the alignment is not HorizontalLeft/HorizontalCenter/HorizontalRight + PushButton thirdControl = PushButton::New(); + DALI_TEST_CHECK( !naviItem.AddControlToToolBar(thirdControl, Alignment::VerticalCenter) ); + container = naviItem.GetControlsOnToolBar(); + DALI_TEST_CHECK( container.size() == 2 ); + + // Add control, check whether adding successfully, also check the container size + PushButton fourthControl = PushButton::New(); + DALI_TEST_CHECK( naviItem.AddControlToToolBar(fourthControl, Alignment::HorizontalRight) ); + container = naviItem.GetControlsOnToolBar(); + DALI_TEST_CHECK( container.size() == 3 ); + + // The control adding fails, as the control itself is uninitialized + PushButton fifthControl; + DALI_TEST_CHECK( !naviItem.AddControlToToolBar(fifthControl, Alignment::HorizontalCenter) ); + container = naviItem.GetControlsOnToolBar(); + DALI_TEST_CHECK( container.size() == 3 ); + + // check the content of the three successfully added ControlOnBar objects + DALI_TEST_CHECK( container[0]->control == firstControl ); + DALI_TEST_CHECK( container[0]->alignment == Alignment::HorizontalLeft ); + DALI_TEST_CHECK( container[1]->control == secondControl ); + DALI_TEST_CHECK( container[1]->alignment == Alignment::HorizontalCenter ); + DALI_TEST_CHECK( container[2]->control == fourthControl ); + DALI_TEST_CHECK( container[2]->alignment == Alignment::HorizontalRight ); + END_TEST; +} + +int UtcDaliPageAddGetTitleBarControl(void) +{ + ToolkitTestApplication application; + tet_infoline( "UtcDaliPageAddGetTitleBarControl" ); + + Page naviItem = Page::New(); + ActorContainer container = naviItem.GetControlsOnTitleBar(); + // Check that the container is empty in the beginning + DALI_TEST_CHECK( container.empty() ); + + // Add control, check whether adding successfully, also check the container size + PushButton firstControl = PushButton::New(); + DALI_TEST_CHECK( naviItem.AddControlToTitleBar(firstControl) ); + container = naviItem.GetControlsOnTitleBar(); + DALI_TEST_CHECK( container.size() == 1 ); + + // The control adding fails, as the control itself is uninitialized + PushButton secondControl; + DALI_TEST_CHECK( !naviItem.AddControlToTitleBar(secondControl) ); + container = naviItem.GetControlsOnTitleBar(); + DALI_TEST_CHECK( container.size() == 1 ); + + // Add control, check whether adding successfully, also check the container size + PushButton thirdControl = PushButton::New(); + DALI_TEST_CHECK( naviItem.AddControlToTitleBar(thirdControl) ); + container = naviItem.GetControlsOnTitleBar(); + DALI_TEST_CHECK( container.size() == 2 ); + + // check the content of the three successfully added Controls + DALI_TEST_CHECK( container[0] == firstControl ); + DALI_TEST_CHECK( container[1] == thirdControl ); + END_TEST; +} + +int UtcDaliPageSetGetPopupMenu(void) +{ + ToolkitTestApplication application; + tet_infoline( "UtcDaliPageSetGetPopupMenu" ); + + Page naviItem = Page::New(); + DALI_TEST_CHECK( !naviItem.GetPopupMenu() ); + + Toolkit::Popup menu = Toolkit::Popup::New(); + naviItem.SetPopupMenu( menu ); + DALI_TEST_CHECK( menu == naviItem.GetPopupMenu() ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-PageTurnEffect.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-PageTurnEffect.cpp new file mode 100644 index 0000000..533f467 --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-PageTurnEffect.cpp @@ -0,0 +1,87 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + + +using namespace Dali; + +void page_turn_effect_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void page_turn_effect_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +int UtcDaliPageTurnEffectApply(void) +{ + ToolkitTestApplication application; + + BitmapImage image = CreateBitmapImage(); + + Toolkit::PageTurnEffect pageTurnEffect = Toolkit::PageTurnEffect::New(); + Toolkit::PageTurnEffect pageTurnEffect2 = Toolkit::PageTurnEffect::New(false); + + ImageActor pageActor = ImageActor::New( image ); + ImageActor backPageActor = ImageActor::New( image ); + pageActor.Add( backPageActor ); + + pageTurnEffect.SetIsTurningBack( true ); + pageTurnEffect.SetShadowWidth( 0.0f ); + pageTurnEffect.SetSpineShadowParameter( Vector2( 0.0f, 0.0f ) ); + + pageActor.SetShaderEffect( pageTurnEffect ); + Stage::GetCurrent().Add( pageActor ); + + application.SendNotification(); + application.Render(); + + const Vector2 pageSize( 0.0f, 0.0f ); + pageTurnEffect.SetPageSize( pageSize ); + + const Vector2 originalCenter( 0.0f, 0.0f ); + pageTurnEffect.SetOriginalCenter( originalCenter ); + + const Vector2 currentCenter( 0.0f, 0.0f ); + pageTurnEffect.SetCurrentCenter( currentCenter ); + + application.SendNotification(); + application.Render(); + + TestGlAbstraction& gl = application.GetGlAbstraction(); + DALI_TEST_CHECK( gl.CheckUniformValue( pageTurnEffect.GetPageSizePropertyName().c_str(), pageSize ) ); + DALI_TEST_CHECK( gl.CheckUniformValue( pageTurnEffect.GetOriginalCenterPropertyName().c_str(), originalCenter ) ); + DALI_TEST_CHECK( gl.CheckUniformValue( pageTurnEffect.GetCurrentCenterPropertyName().c_str(), currentCenter ) ); + END_TEST; +} + +int UtcDaliPageTurnEffectConstruct(void) +{ + ToolkitTestApplication application; + + Toolkit::PageTurnEffect* effect = new Toolkit::PageTurnEffect(); + delete effect; + + DALI_TEST_CHECK( true ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-PageTurnView.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-PageTurnView.cpp new file mode 100644 index 0000000..07265ed --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-PageTurnView.cpp @@ -0,0 +1,611 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + +#include +#include + +using namespace Dali; +using namespace Dali::Toolkit; + +void dali_page_turn_view_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void dali_page_turn_view_cleanup(void) +{ + test_return_value = TET_PASS; +} + + + +namespace +{ +const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS) +const unsigned int TOTAL_PAGE_NUMBER = 20; +const Vector2 PAGE_SIZE( 300.f,400.f ); +const unsigned int IMAGE_WIDTH = 30; +const unsigned int IMAGE_HEIGHT = 30; +const Vector2 IMAGE_SIZE( static_cast( IMAGE_WIDTH ), static_cast(IMAGE_HEIGHT) ); +const Vector2 SPINE_SHADOW_PARAMETER( 60.0f, 30.0f ); + +static bool gObjectCreatedCallBackCalled; +static void TestCallback(BaseHandle handle) +{ + gObjectCreatedCallBackCalled = true; +} + +/* + * Simulate time passed by. + * + * @note this will always process at least 1 frame (1/60 sec) + * + * @param application Test application instance + * @param duration Time to pass in milliseconds. + * @return The actual time passed in milliseconds + */ +int Wait(ToolkitTestApplication& application, int duration = 0) +{ + int time = 0; + + for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++) + { + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + time += RENDER_FRAME_INTERVAL; + } + + return time; +} + +// Generate a PanGestureEvent to send to Core +Integration::PanGestureEvent GeneratePan( + Gesture::State state, + const Vector2& previousPosition, + const Vector2& currentPosition, + unsigned long timeDelta, + unsigned int numberOfTouches = 1) +{ + Integration::PanGestureEvent pan(state); + + pan.previousPosition = previousPosition; + pan.currentPosition = currentPosition; + pan.timeDelta = timeDelta; + pan.numberOfTouches = numberOfTouches; + + return pan; +} + +/** + * Helper to generate PanGestureEvent + * + * @param[in] application Application instance + * @param[in] state The Gesture State + * @param[in] pos The current position of touch. + */ +static void SendPan(ToolkitTestApplication& application, Gesture::State state, const Vector2& pos) +{ + static Vector2 last; + + if( (state == Gesture::Started) || + (state == Gesture::Possible) ) + { + last.x = pos.x; + last.y = pos.y; + } + + application.ProcessEvent(GeneratePan(state, last, pos, RENDER_FRAME_INTERVAL)); + + last.x = pos.x; + last.y = pos.y; +} + +static Vector2 PerformGestureDiagonalSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames, bool toStart = true, bool toFinish = true) +{ + // Now do a pan starting from (start) and heading (direction) + Vector2 pos(start); + + if( toStart ) + { + SendPan(application, Gesture::Possible, pos); + Wait(application); + SendPan(application, Gesture::Started, pos); + Wait(application); + } + + for(int i = 0;i( &(std::ostringstream() << pageId) )->str() ); + + actor.SetParentOrigin( ParentOrigin::CENTER ); + actor.SetAnchorPoint( AnchorPoint::CENTER ); + + SetActorHittability( actor, true ); + + mSourceActors[pageId] = actor; + } + + return mSourceActors[pageId]; + } + + void DeletePage( unsigned int pageId ) + { + mSourceActors.erase( mSourceActors.begin() + pageId ); + mTotalPageNumber--; + } + +private: + ToolkitTestApplication& mApplication; + std::vector mSourceActors; + unsigned int mTotalPageNumber; +}; + +}// namespace + + +int UtcDaliPageTurnPortraitViewNew(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliPageTurnViewNew "); + + // Test default constructor + PageTurnView portraitView; + DALI_TEST_CHECK( !portraitView ); + + // Test object creation + TestPageFactory factory(application); + portraitView = PageTurnPortraitView::New( factory, PAGE_SIZE ); + DALI_TEST_CHECK( portraitView ); + + //Additional check to ensure object is created by checking if it's registered + ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + DALI_TEST_CHECK( registry ); + + gObjectCreatedCallBackCalled = false; + registry.ObjectCreatedSignal().Connect( &TestCallback ); + { + TestPageFactory factory(application); + PageTurnView PortraitView = PageTurnPortraitView::New( factory, PAGE_SIZE ); + } + DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + + // Test copy constructor + PageTurnView viewCopy( portraitView ); + DALI_TEST_CHECK( viewCopy ); + + // Test down cast + Handle handleView; + handleView = portraitView; + PageTurnView downCastView = PageTurnView::DownCast( handleView ); + DALI_TEST_CHECK( downCastView ); + END_TEST; +} + +int UtcDaliPageTurnLandscapeViewNew(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliPageTurnViewNew "); + + //Test default constructor + PageTurnView landscapeView; + DALI_TEST_CHECK( !landscapeView ); + + // Test object creation + TestPageFactory factory(application); + landscapeView = PageTurnLandscapeView::New( factory, PAGE_SIZE ); + DALI_TEST_CHECK( landscapeView ); + + //Additional check to ensure object is created by checking if it's registered + ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + DALI_TEST_CHECK( registry ); + + gObjectCreatedCallBackCalled = false; + registry.ObjectCreatedSignal().Connect( &TestCallback ); + { + TestPageFactory factory(application); + PageTurnView landscapeView = PageTurnLandscapeView::New( factory, PAGE_SIZE ); + } + DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + + // Test copy constructor + PageTurnView viewCopy( landscapeView ); + DALI_TEST_CHECK( viewCopy ); + + // Test down cast + Handle handleView; + handleView = landscapeView; + PageTurnView downCastView = PageTurnView::DownCast( handleView ); + DALI_TEST_CHECK( downCastView ); + + END_TEST; +} + +int UtcDaliPageTurnViewSetAndGetSpineShadowParameter(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliPageTurnViewSetAndGetSpineShadowParameter "); + + TestPageFactory factory(application); + PageTurnView landscapeView = PageTurnLandscapeView::New( factory, PAGE_SIZE ); + DALI_TEST_CHECK( landscapeView.GetSpineShadowParameter() != SPINE_SHADOW_PARAMETER); + landscapeView.SetSpineShadowParameter(SPINE_SHADOW_PARAMETER); + DALI_TEST_CHECK( landscapeView.GetSpineShadowParameter() == SPINE_SHADOW_PARAMETER); + END_TEST; +} + +int UtcDaliPageTurnViewGoToPageAndGetCurrentPage(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliPageTurnViewGoToPageAndGetCurrentPage "); + + TestPageFactory factory(application); + PageTurnView portraitView = PageTurnPortraitView::New( factory, PAGE_SIZE ); + DALI_TEST_CHECK( portraitView.GetCurrentPage() == 0 ); + + portraitView.GoToPage( 10 ); + DALI_TEST_CHECK( portraitView.GetCurrentPage() == 10 ); + + portraitView.GoToPage( 5 ); + DALI_TEST_CHECK( portraitView.GetCurrentPage() == 5 ); + END_TEST; +} + +int UtcDaliPageTurnViewEnterLeaveEditMode(void) +{ + ToolkitTestApplication application; + + tet_infoline( " UtcDaliPageTurnViewEnterLeaveEditMode " ); + + TestPageFactory factory(application); + factory.EnableOffscreenRendering( ); + + PageTurnView pageTurnView = PageTurnLandscapeView::New( factory, PAGE_SIZE ); + pageTurnView.SetPositionInheritanceMode( USE_PARENT_POSITION ); + Stage::GetCurrent().Add( pageTurnView ); + + Vector2 size = Stage::GetCurrent().GetSize(); + + pageTurnView.GoToPage(5); + + // Render and notify + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + + Actor actor = pageTurnView.EnterEditMode(); + // Test that when entering edit mode, current page source actor is returned. + unsigned int pageId; + std::istringstream( actor.GetName() ) >> pageId; + DALI_TEST_CHECK( pageId == 5 ); + + bool signalVerified; + PageTurnView currentView; + unsigned int pageIndex; + bool isTurningForwards; + PageSignalCallback callbackPanStarted( signalVerified, currentView, pageIndex, isTurningForwards ); + pageTurnView.PagePanStartedSignal().Connect( &callbackPanStarted, &PageSignalCallback::PagePanSignalCallback ); + + currentView = pageTurnView; + pageIndex = 5; + DALI_TEST_CHECK( !callbackPanStarted.mSignalVerified ); + + // Test that the control does not receive pan gesture in edit-mode + PerformGestureDiagonalSwipe( application, Vector2(size*0.75f), Vector2(size*0.01f), 10, true, true); + DALI_TEST_CHECK( !callbackPanStarted.mSignalVerified ); + + pageTurnView.LeaveEditMode(); + // Test that the control receives pan gesture after leaving edit-mode + PerformGestureDiagonalSwipe( application, Vector2(size*0.75f), Vector2(size*0.01f), 10, true, true); + DALI_TEST_CHECK( callbackPanStarted.mSignalVerified ); + END_TEST; +} + +int UtcDaliPageTurnViewGetHitActor(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliPageTurnViewGetHitActor "); + + TestPageFactory factory(application); + factory.EnableOffscreenRendering( ); + + PageTurnView pageTurnView = PageTurnPortraitView::New( factory, PAGE_SIZE ); + pageTurnView.SetParentOrigin( ParentOrigin::TOP_LEFT ); + pageTurnView.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + Stage::GetCurrent().Add( pageTurnView ); + + // Render and notify + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + + pageTurnView.GoToPage(3); + + Vector2 localCoordinate = Vector2(); + Vector2 screenCoordinate = PAGE_SIZE*0.5f+Vector2(7.f,8.f); + Actor hitActor = pageTurnView.GetHitActor( screenCoordinate, localCoordinate ); + DALI_TEST_CHECK( hitActor ); + unsigned int pageId; + std::istringstream( hitActor.GetName() ) >> pageId; + DALI_TEST_CHECK( pageId == 3 ); + DALI_TEST_EQUALS( localCoordinate, IMAGE_SIZE*0.5f+Vector2(7.f,8.f), 0.1f, TEST_LOCATION ); + + screenCoordinate = PAGE_SIZE*0.5f+IMAGE_SIZE; + hitActor = pageTurnView.GetHitActor( screenCoordinate, localCoordinate ); + DALI_TEST_CHECK( !hitActor ); + END_TEST; +} + +int UtcDaliPageTurnViewRefresh(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliPageTurnViewRefresh "); + + TestPageFactory factory(application); + factory.EnableOffscreenRendering( ); + PageTurnView pageTurnView = PageTurnPortraitView::New( factory, PAGE_SIZE ); + pageTurnView.SetParentOrigin( ParentOrigin::TOP_LEFT ); + pageTurnView.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + Stage::GetCurrent().Add( pageTurnView ); + + // Render and notify + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + application.Render(RENDER_FRAME_INTERVAL); + application.SendNotification(); + + factory.DeletePage( 0 ); + + pageTurnView.RefreshCurrentPage(); + // simply calls the certain off screen render task to refresh + Vector2 localCoordinate = Vector2(); + Vector2 screenCoordinate = PAGE_SIZE*0.5f; + Actor hitActor = pageTurnView.GetHitActor( screenCoordinate, localCoordinate ); + unsigned int pageId; + std::istringstream( hitActor.GetName() ) >> pageId; + DALI_TEST_CHECK( pageId == 0 ); + + pageTurnView.RefreshAll(); + // re-parent all the source actors and refresh + hitActor = pageTurnView.GetHitActor( screenCoordinate, localCoordinate ); + std::istringstream( hitActor.GetName() ) >> pageId; + DALI_TEST_CHECK( pageId == 1 ); + END_TEST; +} + +int UtcDaliPageTurnViewSignals(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliPageTurnViewSignals "); + + TestPageFactory factory(application); + Vector2 size = Stage::GetCurrent().GetSize(); + PageTurnView portraitView = PageTurnPortraitView::New( factory, size ); + portraitView.SetPositionInheritanceMode( USE_PARENT_POSITION ); + Stage::GetCurrent().Add( portraitView ); + + // Render and notify + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + + // [0]: testing PageTurnStartedSignal; [1]: testing PageTurnFinishedSignal + // [2]: testing PagePanStartedSignal; [3]: testing PagePanFinishedSignal + bool signalVerified[4]; + PageTurnView currentView; + unsigned int pageIndex; + bool isTurningForwards; + + PageSignalCallback callbackTurnStarted( signalVerified[0], currentView, pageIndex, isTurningForwards ); + portraitView.PageTurnStartedSignal().Connect( &callbackTurnStarted, &PageSignalCallback::PageTurnSignalCallback ); + + PageSignalCallback callbackTurnFinished( signalVerified[1], currentView, pageIndex, isTurningForwards ); + portraitView.PageTurnFinishedSignal().Connect( &callbackTurnFinished, &PageSignalCallback::PageTurnSignalCallback ); + + PageSignalCallback callbackPanStarted( signalVerified[2], currentView, pageIndex, isTurningForwards ); + portraitView.PagePanStartedSignal().Connect( &callbackPanStarted, &PageSignalCallback::PagePanSignalCallback ); + + PageSignalCallback callbackPanFinished( signalVerified[3], currentView, pageIndex, isTurningForwards ); + portraitView.PagePanFinishedSignal().Connect( &callbackPanFinished, &PageSignalCallback::PagePanSignalCallback ); + + DALI_TEST_CHECK( !callbackTurnStarted.mSignalVerified ); + DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified ); + DALI_TEST_CHECK( !callbackPanStarted.mSignalVerified ); + DALI_TEST_CHECK( !callbackPanFinished.mSignalVerified ); + + currentView = portraitView; + + //-----Test 1: pan 10 frames from position(size * 0.75f) to position(size * 0.25f), page 0 will be turned forward---- + pageIndex = 0; + isTurningForwards = true; + // Do a pan moving up diagonally. + Vector2 start = size * 0.75f; + Vector2 direction = -size*0.05f; //-size*0.5f/10.f; + + DALI_TEST_CHECK( portraitView.GetCurrentPage() == 0); + PerformGestureDiagonalSwipe( application, start, direction, 5, true, false); + DALI_TEST_CHECK( callbackTurnStarted.mSignalVerified ); + DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified ); + DALI_TEST_CHECK( callbackPanStarted.mSignalVerified ); + DALI_TEST_CHECK( !callbackPanFinished.mSignalVerified ); + + PerformGestureDiagonalSwipe( application, start+direction*5.f, direction, 5, false, true); + DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified ); + DALI_TEST_CHECK( callbackPanFinished.mSignalVerified ); + + Wait(application, 1000); + DALI_TEST_CHECK( callbackTurnFinished.mSignalVerified ); + DALI_TEST_CHECK( portraitView.GetCurrentPage() == pageIndex+1); // the page is turn over + + //---Test 2: pan from position( size*0.5f ) to position( size.width, size.height*0.5f ) to position( size * 0.75f ), page 1 will bent then slid back--- + callbackTurnStarted.Reset(); + callbackTurnFinished.Reset(); + callbackPanStarted.Reset(); + callbackPanFinished.Reset(); + portraitView.GoToPage(5); + pageIndex = 5; + isTurningForwards = true; + + //pan 10 frames from position( size.width, size.height*0.5f ) to position( size * 0.75f ) + start = Vector2( size.width, size.height*0.5f ); + direction = Vector2(-size.width*0.025f, size.height*0.025f); + PerformGestureDiagonalSwipe( application, start, direction, 5, true, false); + DALI_TEST_CHECK( callbackPanStarted.mSignalVerified ); + DALI_TEST_CHECK( callbackTurnStarted.mSignalVerified ); + DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified ); + DALI_TEST_CHECK( !callbackPanFinished.mSignalVerified ); + + signalVerified[0] = false; + isTurningForwards = false; + PerformGestureDiagonalSwipe( application, start + direction*2 , direction, 5, false, true); + DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified ); + DALI_TEST_CHECK( callbackPanFinished.mSignalVerified ); + DALI_TEST_CHECK( callbackTurnStarted.mSignalVerified ); // start the sliding back + + Wait(application, 1000); + DALI_TEST_CHECK( callbackTurnFinished.mSignalVerified ); + DALI_TEST_CHECK( portraitView.GetCurrentPage() == pageIndex); // the page is not turned over + + // ----Test 3: pan 10 frames from position( size*0.25f ) to position( size.width*0.75f, size.height*0.25f ), the previous page will be turned backwards--- + callbackTurnStarted.Reset(); + callbackTurnFinished.Reset(); + callbackPanStarted.Reset(); + callbackPanFinished.Reset(); + portraitView.GoToPage(10); + pageIndex = 9; // will turn the previous page back + isTurningForwards = false; + start = size*0.25f; + direction = Vector2(size.x*0.05f, 0.f); + PerformGestureDiagonalSwipe( application, start, direction, 5, true, false); + DALI_TEST_CHECK( callbackPanStarted.mSignalVerified ); + DALI_TEST_CHECK( !callbackTurnStarted.mSignalVerified ); + DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified ); + DALI_TEST_CHECK( !callbackPanFinished.mSignalVerified ); + + PerformGestureDiagonalSwipe( application, start+direction*5.f, direction, 5, false, true); + DALI_TEST_CHECK( callbackTurnStarted.mSignalVerified ); + DALI_TEST_CHECK( callbackPanFinished.mSignalVerified ); + DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified ); + + Wait( application, 1000 ); + + DALI_TEST_CHECK( callbackTurnFinished.mSignalVerified ); + DALI_TEST_CHECK( portraitView.GetCurrentPage() == 9); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-RollLayout.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-RollLayout.cpp new file mode 100644 index 0000000..236c4b5 --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-RollLayout.cpp @@ -0,0 +1,436 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + +using namespace Dali; +using namespace Dali::Toolkit; + +namespace +{ +const unsigned int TOTAL_ITEM_NUMBER = 200; + +Vector3 RollLayoutItemSizeFunction(float layoutWidth, float layoutHeight, float rowSpacing) +{ + float height = (layoutHeight - rowSpacing) * 0.5f; + return Vector3(layoutWidth, height, height); +} + +} // namespace + + +// Implementation of ItemFactory for providing actors to ItemView +class TestItemFactory : public ItemFactory +{ +public: + + /** + * Constructor + */ + TestItemFactory() + { + } + +public: // From ItemFactory + + /** + * Query the number of items available from the factory. + * The maximum available item has an ID of GetNumberOfItems() - 1. + */ + virtual unsigned int GetNumberOfItems() + { + return TOTAL_ITEM_NUMBER; + } + + /** + * Create an Actor to represent a visible item. + * @param itemId + * @return the created actor. + */ + virtual Actor NewItem(unsigned int itemId) + { + // Create an test actor for this item + ImageActor actor = CreateSolidColorActor(Color::RED); + actor.SetSize(64.0f, 64.0f); + return actor; + } +}; + +void dali_roll_layout_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void dali_roll_layout_cleanup(void) +{ + test_return_value = TET_PASS; +} + + + +int UtcDaliRollLayoutNew(void) +{ + ToolkitTestApplication application; + + // Create a roll layout + RollLayoutPtr rollLayout = RollLayout::New(); + + DALI_TEST_CHECK(rollLayout); + END_TEST; +} + +int UtcDaliRollLayoutSetAndGetRowSpacing(void) +{ + ToolkitTestApplication application; + + // Create a roll layout + RollLayoutPtr rollLayout = RollLayout::New(); + + // Set the row spacing + rollLayout->SetRowSpacing(10.0f); + + // Check whether we get the correct row spacing + DALI_TEST_EQUALS(rollLayout->GetRowSpacing(), 10.0f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliRollLayoutSetAndGetItemSizeFunction(void) +{ + ToolkitTestApplication application; + + // Create a roll layout + RollLayoutPtr rollLayout = RollLayout::New(); + + // Set the item size function + rollLayout->SetItemSizeFunction(RollLayoutItemSizeFunction); + + // Check whether we get the correct item size function + DALI_TEST_CHECK(rollLayout->GetItemSizeFunction() == RollLayoutItemSizeFunction); + END_TEST; +} + +int UtcDaliRollLayoutSetAndGetScrollSpeedFactor(void) +{ + ToolkitTestApplication application; + + // Create a roll layout + RollLayoutPtr rollLayout = RollLayout::New(); + + // Set the scroll speed factor + rollLayout->SetScrollSpeedFactor(0.05f); + + // Check whether we get the correct scroll speed factor + DALI_TEST_EQUALS(rollLayout->GetScrollSpeedFactor(), 0.05f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliRollLayoutSetAndGetMaximumSwipeSpeed(void) +{ + ToolkitTestApplication application; + + // Create a roll layout + RollLayoutPtr rollLayout = RollLayout::New(); + + // Set the maximum swipe speed + rollLayout->SetMaximumSwipeSpeed(50.0f); + + // Check whether we get the correct maximum swipe speed + DALI_TEST_EQUALS(rollLayout->GetMaximumSwipeSpeed(), 50.0f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliRollLayoutSetAndGetItemFlickAnimationDuration(void) +{ + ToolkitTestApplication application; + + // Create a roll layout + RollLayoutPtr rollLayout = RollLayout::New(); + + // Set the flick animaiton duration + rollLayout->SetItemFlickAnimationDuration(0.35f); + + // Check whether we get the correct flick animaiton duration + DALI_TEST_EQUALS( rollLayout->GetItemFlickAnimationDuration(), 0.35f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliRollLayoutConstraintLeft(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + RollLayoutPtr rollLayout = RollLayout::New(); + + view.SetName("view actor"); + view.AddLayout(*rollLayout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + rollLayout->SetOrientation(ControlOrientation::Left); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + // Confirm: we have actors in the view and they are positioned some distance from the origin. + int nonZeroCount = 0; + int elementsFound = 0; + for(unsigned int i = 0; i < 10; i++) + { + Actor testActor = view.GetItem(i); + if (testActor) + { + elementsFound++; + Vector3 pos = testActor.GetCurrentPosition(); + + if (pos.LengthSquared() > 0.0f) + { + nonZeroCount++; + } + } + } + + DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound)); + Stage::GetCurrent().Remove(view); + END_TEST; +} + +int UtcDaliRollLayoutConstraintRight(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + RollLayoutPtr rollLayout = RollLayout::New(); + + view.SetName("view actor"); + view.AddLayout(*rollLayout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + rollLayout->SetOrientation(ControlOrientation::Right); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + // Confirm: we have actors in the view and they are positioned some distance from the origin. + int nonZeroCount = 0; + int elementsFound = 0; + for(unsigned int i = 0; i < 10; i++) + { + Actor testActor = view.GetItem(i); + if (testActor) + { + elementsFound++; + Vector3 pos = testActor.GetCurrentPosition(); + + if (pos.LengthSquared() > 0.0f) + { + nonZeroCount++; + } + } + } + + DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound)); + Stage::GetCurrent().Remove(view); + END_TEST; +} + +int UtcDaliRollLayoutConstraintUp(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + RollLayoutPtr rollLayout = RollLayout::New(); + + view.SetName("view actor"); + view.AddLayout(*rollLayout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + rollLayout->SetOrientation(ControlOrientation::Up); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + // Confirm: we have actors in the view and they are positioned some distance from the origin. + int nonZeroCount = 0; + int elementsFound = 0; + for(unsigned int i = 0; i < 10; i++) + { + Actor testActor = view.GetItem(i); + if (testActor) + { + elementsFound++; + Vector3 pos = testActor.GetCurrentPosition(); + + if (pos.LengthSquared() > 0.0f) + { + nonZeroCount++; + } + } + } + + DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound)); + Stage::GetCurrent().Remove(view); + END_TEST; +} + +int UtcDaliRollLayoutConstraintDown(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + RollLayoutPtr rollLayout = RollLayout::New(); + + view.SetName("view actor"); + view.AddLayout(*rollLayout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + rollLayout->SetOrientation(ControlOrientation::Down); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + // Confirm: we have actors in the view and they are positioned some distance from the origin. + int nonZeroCount = 0; + int elementsFound = 0; + for(unsigned int i = 0; i < 10; i++) + { + Actor testActor = view.GetItem(i); + if (testActor) + { + elementsFound++; + Vector3 pos = testActor.GetCurrentPosition(); + + if (pos.LengthSquared() > 0.0f) + { + nonZeroCount++; + } + } + } + + DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound)); + Stage::GetCurrent().Remove(view); + END_TEST; +} + +int UtcDaliRollLayoutScrollDirection(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + RollLayoutPtr rollLayout = RollLayout::New(); + + view.SetName("view actor"); + view.AddLayout(*rollLayout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + rollLayout->SetOrientation(ControlOrientation::Left); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + ItemLayoutPtr layout = rollLayout; + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + rollLayout->SetOrientation(ControlOrientation::Up); + view.ActivateLayout(0, vec, 0.0f); + application.SendNotification(); + application.Render(); + + Degree deg = layout->GetScrollDirection(); + DALI_TEST_CHECK(deg == 0.0f); + + rollLayout->SetOrientation(ControlOrientation::Down); + view.ActivateLayout(0, vec, 0.0f); + application.SendNotification(); + application.Render(); + + deg = layout->GetScrollDirection(); + DALI_TEST_CHECK((deg == 180.0f)); + + layout->SetOrientation(ControlOrientation::Left); + view.ActivateLayout(0, vec, 0.0f); + application.SendNotification(); + application.Render(); + + deg = layout->GetScrollDirection(); + DALI_TEST_CHECK(deg == 90.f); + + rollLayout->SetOrientation(ControlOrientation::Right); + view.ActivateLayout(0, vec, 0.0f); + application.SendNotification(); + application.Render(); + + deg = layout->GetScrollDirection(); + DALI_TEST_CHECK(deg == 270.0f); + + Stage::GetCurrent().Remove(view); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-RotatingSelector.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-RotatingSelector.cpp new file mode 100644 index 0000000..7f93b2b --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-RotatingSelector.cpp @@ -0,0 +1,256 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include +#include + + + +using namespace Dali; +using namespace Toolkit; + + +namespace +{ +static bool gObjectCreatedCallBackCalled; + +static void TestCallback(BaseHandle handle) +{ + gObjectCreatedCallBackCalled = true; +} + +static bool gSelectedSignalReceived = false; +static bool gSelected = false; + +const Dali::TouchPoint pointDownInside( 0, TouchPoint::Down, 240, 400 ); +const Dali::TouchPoint pointUpInside( 0, TouchPoint::Up, 240, 400 ); +} // namespace + + +void rotating_selector_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void rotating_selector_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +int UtcDaliRotatingSelectorNew(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliRotatingSelectorNew"); + RotatingSelector selector; + + DALI_TEST_CHECK(!selector); + + Actor unSelectedActor = Actor::New(); + Actor selectedActor = Actor::New(); + + selector = RotatingSelector::New(unSelectedActor, selectedActor); + + DALI_TEST_CHECK(selector); + + //Additional check to ensure object is created by checking if it's registered + ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + DALI_TEST_CHECK( registry ); + + gObjectCreatedCallBackCalled = false; + registry.ObjectCreatedSignal().Connect(&TestCallback); + { + RotatingSelector selector = RotatingSelector::New(unSelectedActor, selectedActor); + } + DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + END_TEST; +} + +namespace +{ + +// Callback test function +void OnSelectedSignal(RotatingSelector actor, bool selected) +{ + gSelectedSignalReceived = true; + gSelected = selected; +} + +} + + +int UtcDaliRotatingSelectorSetSelected(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliRotatingSelectorSetSelected"); + + BitmapImage img = BitmapImage::New( 1,1 ); + ImageActor unSelectedActor = ImageActor::New( img ); + ImageActor selectedActor = ImageActor::New( img ); + + RotatingSelector selector = RotatingSelector::New(unSelectedActor, selectedActor); + + selector.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + selector.SetParentOrigin( ParentOrigin::TOP_LEFT ); + selector.SetPosition( 240, 400 ); + selector.SetSize( 100, 100 ); + + // connect to its selected signal + selector.SelectedSignal().Connect( &OnSelectedSignal ); + + Stage::GetCurrent().Add( selector ); + + gSelectedSignalReceived = false; + gSelected = false; + + selector.SetSelected(true); + application.SendNotification(); + application.Render(1000); + application.SendNotification(); + application.Render(1000); + application.SendNotification(); + application.Render(1000); + + DALI_TEST_CHECK( selector.IsSelected() ); + DALI_TEST_CHECK( gSelectedSignalReceived ); + DALI_TEST_CHECK( gSelected ); + + gSelectedSignalReceived = false; + gSelected = false; + + selector.SetSelected(false); + application.SendNotification(); + application.Render(1000); + application.SendNotification(); + application.Render(1000); + application.SendNotification(); + application.Render(1000); + + DALI_TEST_CHECK( gSelectedSignalReceived ); + DALI_TEST_CHECK( !gSelected ); + DALI_TEST_CHECK( !selector.IsSelected() ); + END_TEST; +} + +int UtcDaliRotatingSelectorSetSelectedAndUnSelectedActor(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliRotatingSelectorSetSelectedAndUnSelectedActor"); + + BitmapImage img = BitmapImage::New( 1,1 ); + ImageActor actor1 = ImageActor::New( img ); + ImageActor actor2 = ImageActor::New( img ); + + RotatingSelector selector = RotatingSelector::New(actor1, actor2); + Stage::GetCurrent().Add( selector ); + + ImageActor unSelectedActor = ImageActor::New( img ); + ImageActor selectedActor = ImageActor::New( img ); + + selector.SetSelectedActor(selectedActor); + + Actor actor3 = selector.GetSelectedActor(); + DALI_TEST_CHECK( selectedActor == actor3 ); + + selector.SetUnSelectedActor(unSelectedActor); + + Actor actor4 = selector.GetUnSelectedActor(); + DALI_TEST_CHECK( unSelectedActor == actor4 ); + + END_TEST; +} + + +int UtcDaliRotatingSelectorSetSelectable(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliRotatingSelectorSetSelectable"); + + BitmapImage img = BitmapImage::New( 1,1 ); + ImageActor unSelectedActor = ImageActor::New( img ); + ImageActor selectedActor = ImageActor::New( img ); + + RotatingSelector selector = RotatingSelector::New(unSelectedActor, selectedActor); + + selector.SetSelectable(true); + DALI_TEST_CHECK( selector.IsSelectable() ); + + selector.SetSelectable(false); + DALI_TEST_CHECK( !selector.IsSelectable() ); + END_TEST; +} + +int UtcDaliRotatingSelectorSignalSelected(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliRotatingSelectorSignalSelected"); + + BitmapImage img = BitmapImage::New( 1,1 ); + ImageActor unSelectedActor = ImageActor::New( img ); + ImageActor selectedActor = ImageActor::New( img ); + + RotatingSelector selector = RotatingSelector::New(unSelectedActor, selectedActor); + + selector.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + selector.SetParentOrigin( ParentOrigin::TOP_LEFT ); + selector.SetPosition( 240, 400 ); + selector.SetSize( 100, 100 ); + + // connect to its selected signal + selector.SelectedSignal().Connect( &OnSelectedSignal ); + + Stage::GetCurrent().Add( selector ); + + DALI_TEST_CHECK( !selector.IsSelected() ); + + gSelectedSignalReceived = false; + gSelected = false; + + application.SendNotification(); + application.Render(1000); + application.SendNotification(); + application.Render(1000); + + //Test using touch event simulation + Dali::Integration::TouchEvent event; + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointDownInside ); + application.ProcessEvent( event ); + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointUpInside ); + application.ProcessEvent( event ); + + application.SendNotification(); + application.Render(1000); + application.SendNotification(); + application.Render(1000); + + DALI_TEST_CHECK( selector.IsSelected() ); + DALI_TEST_CHECK( gSelectedSignalReceived ); + DALI_TEST_CHECK( gSelected ); + + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-ScrollView.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-ScrollView.cpp new file mode 100644 index 0000000..0b53bff --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-ScrollView.cpp @@ -0,0 +1,1468 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include +#include +#include + +using namespace Dali; +using namespace Toolkit; + +void scroll_view_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void scroll_view_cleanup(void) +{ + test_return_value = TET_PASS; +} + +namespace +{ +static bool gObjectCreatedCallBackCalled; + +static void TestCallback(BaseHandle handle) +{ + gObjectCreatedCallBackCalled = true; +} + + +const int MILLISECONDS_PER_SECOND = 1000; +const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS) +const int RENDER_ANIMATION_TEST_DURATION_MS = 1000; ///< 1000ms to test animation +const int RENDER_DELAY_SCROLL = 1000; ///< duration to wait for any scroll to complete. + +// For Clamp Signal testing... +const float CLAMP_EXCESS_WIDTH = 200.0f; ///< Amount of width that can be panned outside scrollview +const float CLAMP_EXCESS_HEIGHT = 200.0f; ///< Amount of height that can be panned outside scrollview +const int CLAMP_STEP_0_CHECK_NOTCLAMPED = 0; ///< FSM: "First check that scrollview isn't clamped" +const int CLAMP_STEP_1_CHECK_CLAMPED_WEST = 1; ///< FSM: "Next check that scrollview clamps against left side" +const int CLAMP_STEP_2_CHECK_CLAMPED_SOUTH_WEST = 2; ///< FSM: "Then check that scrollview clamps against bottom-left side" +const int CLAMP_STEP_3_SUCCESS = 3; ///< FSM: "Finished (Success)" +const Vector3 CLAMP_START_SCROLL_POSITION(30.0f, 100.0f, 0.0f); ///< Scroll start position for the Clamping tests. +const Vector2 CLAMP_TOUCH_START( 100.0f, 100.0f ); ///< Start point to touch from for the Clamping tests. +const Vector2 CLAMP_TOUCH_MOVEMENT( 5.0f, -5.0f ); ///< Amount to move touch for each frame for the Clamping tests. +const int CLAMP_GESTURE_FRAMES = 100; ///< Number of Frames to synthesize a gesture for the Clamping tests. +const Vector3 TEST_ACTOR_POSITION(100.0f, 100.0f, 0.0f); ///< A Test actor position offset (arbitrary value) +const Vector3 TEST_CONSTRAINT_OFFSET(1.0f, 2.0f, 0.0f); ///< A Test constraint offset (arbitrary value to test effects) +const float TEST_RATIO_TOLERANCE = 0.05; ///< +/-5% tolerance for ratio comparisons. + +const int MAX_FRAMES_TO_TEST_OVERSHOOT = 600; ///< 10 seconds (at 60 frames per second). +const Vector3 OVERSHOOT_START_SCROLL_POSITION(100.0f, 100.0f, 0.0f); ///< Scroll start position for the Overshoot tests. +const float TEST_DEFAULT_SNAP_OVERSHOOT_DURATION = 0.25f; ///< 0.25 seconds should be default snap overshoot duration +const float TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION = 0.05f; ///< a Test duration +const float TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION = 1.5f; ///< another Test duration +const float TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION = TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION * 0.5f; // Same as above, but different alpha function. +const float TIME_TOLERANCE = 0.05f; ///< Allow testing tolerance between a 10th of second (+/- 3 frames) + + +// Generate a PanGestureEvent to send to Core +Integration::PanGestureEvent GeneratePan( + Gesture::State state, + const Vector2& previousPosition, + const Vector2& currentPosition, + unsigned long timeDelta, + unsigned int numberOfTouches = 1) +{ + Integration::PanGestureEvent pan(state); + + pan.previousPosition = previousPosition; + pan.currentPosition = currentPosition; + pan.timeDelta = timeDelta; + pan.numberOfTouches = numberOfTouches; + + return pan; +} + +/** + * Helper to generate PanGestureEvent + * + * @param[in] application Application instance + * @param[in] state The Gesture State + * @param[in] pos The current position of touch. + */ +static void SendPan(ToolkitTestApplication& application, Gesture::State state, const Vector2& pos) +{ + static Vector2 last; + + if( (state == Gesture::Started) || + (state == Gesture::Possible) ) + { + last.x = pos.x; + last.y = pos.y; + } + + application.ProcessEvent(GeneratePan(state, last, pos, RENDER_FRAME_INTERVAL)); + + last.x = pos.x; + last.y = pos.y; +} + +/* + * Simulate time passed by. + * + * @note this will always process at least 1 frame (1/60 sec) + * + * @param application Test application instance + * @param duration Time to pass in milliseconds. + * @return The actual time passed in milliseconds + */ +int Wait(ToolkitTestApplication& application, int duration = 0) +{ + int time = 0; + + for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++) + { + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + time += RENDER_FRAME_INTERVAL; + } + + return time; +} + +// Callback probes. + +static bool gOnScrollStartCalled; ///< Whether the OnScrollStart signal was invoked. +static bool gOnScrollUpdateCalled; ///< Whether the OnScrollUpdate signal was invoked. +static bool gOnScrollCompleteCalled; ///< Whether the OnScrollComplete signal was invoked. +static bool gOnScrollClampedCalled; ///< Whether the OnScrollClamped signal was invoked. +static bool gOnSnapStartCalled; ///< Whether the OnSnapStart signal was invoked. +static ClampState3 gLastClampPosition; ///< Clamping information from OnScrollClampedEvent. +static SnapType gLastSnapType; ///< Snaping information from SnapEvent. +static Vector3 gConstraintResult; ///< Result from constraint. + +/** + * Invoked when scrolling starts. + * + * @param[in] position The current scroll position. + */ +static void OnScrollStart( const Vector3& position ) +{ + gOnScrollStartCalled = true; +} + +/** + * Invoked when scrolling updates (via dragging) + * + * @param[in] position The current scroll position. + */ +static void OnScrollUpdate( const Vector3& position ) +{ + gOnScrollUpdateCalled = true; +} + +/** + * Invoked when scrolling finishes + * + * @param[in] position The current scroll position. + */ +static void OnScrollComplete( const Vector3& position ) +{ + gOnScrollCompleteCalled = true; +} + +/** + * Invoked when scrolling clamped. + * + * @param[in] event The position/scale/rotation axes that were clamped. + */ +static void OnScrollClamped( const ScrollView::ClampEvent& event ) +{ + gOnScrollClampedCalled = true; + gLastClampPosition = event.position; +} + +/** + * Invoked when a snap or flick started. + * + * @param[in] event The type of snap and the target position/scale/rotation. + */ +static void OnSnapStart( const ScrollView::SnapEvent& event ) +{ + gOnSnapStartCalled = true; + gLastSnapType = event.type; +} + +/** + * TestSumConstraint + * + * Summation of current value, property, and offset. + * + * current' = current + mOffset + property; + */ +struct TestSumConstraint +{ + /** + * @param[in] offset The offset to be added to current. + */ + TestSumConstraint(const Vector3& offset) + :mOffset(offset) + { + } + + /** + * @param[in] current The current base value + * @param[in] property The property to be added to current. + * @return The new current Vector. + */ + Vector3 operator()(const Vector3& current) + { + gConstraintResult = current + mOffset; + return gConstraintResult; + } + + /** + * @param[in] current The current base value + * @param[in] property The property to be added to current. + * @return The new current Vector. + */ + Vector3 operator()(const Vector3& current, + const PropertyInput& property) + { + gConstraintResult = current + property.GetVector3() + mOffset; + return gConstraintResult; + } + + Vector3 mOffset; + +}; + +/** + * @param[in] application The application instance + * @param[in] scrollView The scrollView instance + * @return The time taken for the overshoot to reach origin (zero) + */ +static float TestOvershootSnapDuration(ToolkitTestApplication &application, ScrollView scrollView) +{ + Property::Index overshootPropertyX = scrollView.GetPropertyIndex(ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME); + Property::Index overshootPropertyY = scrollView.GetPropertyIndex(ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME); + + int timeToReachOrigin = -1; + for(int i = 0;i(overshootPropertyX); + float overshootYValue = scrollView.GetProperty(overshootPropertyY); + if(overshootXValue == 0.0f && overshootYValue == 0.0f) + { + break; + } + + timeToReachOrigin += Wait(application); + } + + return static_cast(timeToReachOrigin) * 0.001f; // return in seconds not ms. +} + +/** + * y = 2x alpha function, which is clamped between 0.0f - 1.0f + * + * Animations should appear to finish (reach 100% point) + * at just half the time of a regular Linear AlphaFunction. + * + * @param[in] progress value (ranges from 0.0f - 1.0f) + * @return interpolation value (ranges from 0.0f - 1.0f) + */ +float TestAlphaFunction(float progress) +{ + return std::min( progress * 2.0f, 1.0f ); +} + +} // unnamed namespace + + +int UtcDaliScrollViewNew(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewNew"); + + ScrollView scrollView; + + DALI_TEST_CHECK( !scrollView ); + + scrollView = ScrollView::New(); + + DALI_TEST_CHECK( scrollView ); + + ScrollView scrollView2(scrollView); + + DALI_TEST_CHECK( scrollView2 == scrollView ); + + //Additional check to ensure object is created by checking if it's registered + ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + DALI_TEST_CHECK( registry ); + + gObjectCreatedCallBackCalled = false; + registry.ObjectCreatedSignal().Connect( &TestCallback ); + { + ScrollView scrollView = ScrollView::New(); + } + DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + END_TEST; +} + +int UtcDaliScrollViewDownCast(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewDownCast"); + + ScrollView scrollView = ScrollView::New(); + BaseHandle handle(scrollView); + + ScrollView newScrollView = ScrollView::DownCast( handle ); + DALI_TEST_CHECK( scrollView ); + DALI_TEST_CHECK( newScrollView == scrollView ); + END_TEST; +} + +int UtcDaliScrollViewScrollToPosition(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewScrollToPosition"); + + // Create the ScrollView actor + ScrollView scrollView = ScrollView::New(); + // Disable Refresh signal (TET environment cannot use adaptor's Timer) + scrollView.SetRefreshInterval(0); + Stage::GetCurrent().Add( scrollView ); + + const Vector3 target = Vector3(100.0f, 200.0f, 0.0f); + const Vector3 target2 = Vector3(300.0f, 100.0f, 0.0f); + + scrollView.ScrollTo( target, 0.0f ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION ); + scrollView.ScrollTo( target2 ); + Wait(application, RENDER_DELAY_SCROLL); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION ); + + Wait(application); + END_TEST; +} + +int UtcDaliScrollViewScrollToPage(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewScrollToPage"); + + ScrollView scrollView = ScrollView::New(); + // Disable Refresh signal (TET environment cannot use adaptor's Timer) + scrollView.SetRefreshInterval(0); + Stage::GetCurrent().Add( scrollView ); + RulerPtr rulerX = new FixedRuler( 100.0f ); + rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) ); + RulerPtr rulerY = new FixedRuler( 100.0f ); + rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) ); + + scrollView.SetRulerX( rulerX ); + scrollView.SetRulerY( rulerY ); + + scrollView.ScrollTo( 1, 0.0f ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION ); + + scrollView.ScrollTo( 5, 0.0f ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector3(500.0f, 0.0f, 0.0f), TEST_LOCATION ); + + scrollView.ScrollTo( 10, 0.0f ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector3(200.0f, 100.0f, 0.0f), TEST_LOCATION ); + + scrollView.ScrollTo( 15, 0.0f ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector3(700.0f, 100.0f, 0.0f), TEST_LOCATION ); + DALI_TEST_EQUALS( static_cast(scrollView.GetCurrentPage()), 15, TEST_LOCATION ); + + scrollView.ScrollTo( 3 ); + Wait(application, RENDER_DELAY_SCROLL); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector3(300.0f, 0.0f, 0.0f), TEST_LOCATION ); + DALI_TEST_EQUALS( static_cast(scrollView.GetCurrentPage()), 3, TEST_LOCATION ); + + scrollView.ScrollTo( 9 ); + Wait(application, RENDER_DELAY_SCROLL); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector3(100.0f, 100.0f, 0.0f), TEST_LOCATION ); + DALI_TEST_EQUALS( static_cast(scrollView.GetCurrentPage()), 9, TEST_LOCATION ); + + // Apply DefaultRulers instead and see what happens. + rulerX = new DefaultRuler(); + rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) ); + rulerY = new DefaultRuler(); + rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) ); + + scrollView.SetRulerX( rulerX ); + scrollView.SetRulerY( rulerY ); + + // This time should always scroll to origin (0.0f, 0.0f) + scrollView.ScrollTo( 1, 0.0f ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION ); + DALI_TEST_EQUALS( static_cast(scrollView.GetCurrentPage()), 0, TEST_LOCATION ); + + Wait(application); + END_TEST; +} + +int UtcDaliScrollViewScrollToActor(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewScrollToActor"); + + ScrollView scrollView = ScrollView::New(); + // Disable Refresh signal (TET environment cannot use adaptor's Timer) + scrollView.SetRefreshInterval(0); + Stage::GetCurrent().Add( scrollView ); + + Actor actorA = Actor::New(); + const Vector3 positionA = Vector3(100.0f, 400.0f, 0.0f); + actorA.SetPosition(positionA); + scrollView.Add(actorA); + + Actor actorB = Actor::New(); + const Vector3 positionB = Vector3(500.0f, 200.0f, 0.0f); + actorB.SetPosition(positionB); + scrollView.Add(actorB); + + Wait(application); + + scrollView.ScrollTo(actorA, 0.0f); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionA, TEST_LOCATION ); + + Wait(application); + scrollView.ScrollTo(actorB, 0.0f); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionB, TEST_LOCATION ); + + scrollView.ScrollTo(actorA); + Wait(application, RENDER_DELAY_SCROLL); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionA, TEST_LOCATION ); + + scrollView.ScrollTo(actorB); + Wait(application, RENDER_DELAY_SCROLL); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionB, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliScrollViewScrollToSnapPoint(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewScrollToSnapPoint"); + + ScrollView scrollView = ScrollView::New(); + // Disable Refresh signal (TET environment cannot use adaptor's Timer) + scrollView.SetRefreshInterval(0); + Stage::GetCurrent().Add( scrollView ); + RulerPtr rulerX = new FixedRuler( 100.0f ); + rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) ); + RulerPtr rulerY = new FixedRuler( 100.0f ); + rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) ); + + scrollView.SetRulerX( rulerX ); + scrollView.SetRulerY( rulerY ); + + scrollView.ScrollTo( Vector3(120.0f, 190.0f, 0.0f), 0.0f ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector3(120.0f, 190.0f, 0.0f), TEST_LOCATION ); + + scrollView.ScrollToSnapPoint(); + + Wait(application, RENDER_DELAY_SCROLL); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector3(100.0f, 200.0f, 0.0f), TEST_LOCATION ); + END_TEST; +} + +int UtcDaliScrollViewRulerScale(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewRulerScale"); + + ScrollView scrollView = ScrollView::New(); + // Disable Refresh signal (TET environment cannot use adaptor's Timer) + scrollView.SetRefreshInterval(0); + Stage::GetCurrent().Add( scrollView ); + + RulerPtr rulerScaleX = new FixedRuler(0.25f); + RulerPtr rulerScaleY = new DefaultRuler(); + rulerScaleX->SetDomain( RulerDomain(0.1f, 0.9f, true) ); + rulerScaleY->SetDomain( RulerDomain(0.1f, 2.0f, true) ); + scrollView.SetRulerScaleX(rulerScaleX); + scrollView.SetRulerScaleY(rulerScaleY); + + scrollView.Add(Actor::New()); + + // Scroll to a position, and then snap. + scrollView.ScaleTo(Vector3(1.95f, 1.4f, 1.0f), 0.0f); + scrollView.ScrollToSnapPoint(); + Wait(application, RENDER_DELAY_SCROLL); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollScale(), Vector3(0.9f, 1.4f, 1.0f), TEST_LOCATION ); + + // Scroll SLOWLY to another position, and then snap. + scrollView.ScaleTo(Vector3(0.45f, -1.0f, 1.0f)); + Wait(application, RENDER_DELAY_SCROLL); + scrollView.ScrollToSnapPoint(); + Wait(application, RENDER_DELAY_SCROLL); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollScale(), Vector3(0.5f, 0.1f, 1.0f), TEST_LOCATION ); + + // Scroll to another position, and then snap. + scrollView.ScaleTo(Vector3(0.71f, 0.71f, 1.0f), 0.0f); + scrollView.ScrollToSnapPoint(); + Wait(application, RENDER_DELAY_SCROLL); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollScale(), Vector3(0.75f, 0.71f, 1.0f), TEST_LOCATION ); + END_TEST; +} + +int UtcDaliScrollViewTransformTo(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewTransformTo"); + + ScrollView scrollView = ScrollView::New(); + // Disable Refresh signal (TET environment cannot use adaptor's Timer) + scrollView.SetRefreshInterval(0); + Stage::GetCurrent().Add( scrollView ); + + // Position rulers. + RulerPtr rulerX = new FixedRuler(50.0f); + RulerPtr rulerY = new FixedRuler(50.0f); + rulerX->SetDomain( RulerDomain(0.0f, 200.0f, true) ); + rulerY->SetDomain( RulerDomain(0.0f, 200.0f, true) ); + scrollView.SetRulerX(rulerX); + scrollView.SetRulerY(rulerY); + + // Scale rulers. + RulerPtr rulerScaleX = new FixedRuler(0.1f); + RulerPtr rulerScaleY = new FixedRuler(0.1f); + rulerScaleX->SetDomain( RulerDomain(0.0f, 1.0f, true) ); + rulerScaleY->SetDomain( RulerDomain(0.0f, 1.0f, true) ); + scrollView.SetRulerScaleX(rulerScaleX); + scrollView.SetRulerScaleY(rulerScaleY); + + // transform to a random position/scale + Vector3 targetPosition = Vector3(100.0f, 200.0f, 0.0f); + Vector3 targetScale = Vector3(0.44f, 0.58f, 1.0f); + float targetRotation = 0.0f; + scrollView.TransformTo(targetPosition, targetScale, targetRotation, 0.0f); + Wait(application); + + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollScale(), targetScale, TEST_LOCATION ); + + // transform to another random position/scale (SLOWLY) + targetPosition = Vector3(60.0f, 40.0f, 0.0f); + targetScale = Vector3(0.4f, 0.6f, 1.0f); + targetRotation = 0.0f; + scrollView.TransformTo(targetPosition, targetScale, targetRotation); + Wait(application, RENDER_DELAY_SCROLL); + + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollScale(), targetScale, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliScrollViewRefreshInterval(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewRefreshInterval"); + + ScrollView scrollView = ScrollView::New(); + // Disable Refresh signal (TET environment cannot use adaptor's Timer) + scrollView.SetRefreshInterval(0); + DALI_TEST_EQUALS( scrollView.GetRefreshInterval(), 0, TEST_LOCATION); + scrollView.SetRefreshInterval(10); + DALI_TEST_EQUALS( scrollView.GetRefreshInterval(), 10, TEST_LOCATION); + scrollView.SetRefreshInterval(1000); + DALI_TEST_EQUALS( scrollView.GetRefreshInterval(), 1000, TEST_LOCATION); + END_TEST; +} + +int UtcDaliScrollViewWrapMode(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewWrapMode"); + + ScrollView scrollView = ScrollView::New(); + Stage::GetCurrent().Add( scrollView ); + + // Position rulers. 4x4 grid. + RulerPtr rulerX = new FixedRuler(50.0f); + RulerPtr rulerY = new FixedRuler(50.0f); + rulerX->SetDomain( RulerDomain(0.0f, 200.0f, false) ); + rulerY->SetDomain( RulerDomain(0.0f, 200.0f, false) ); + scrollView.SetRulerX(rulerX); + scrollView.SetRulerY(rulerY); + + scrollView.SetWrapMode(false); + scrollView.ScrollTo(Vector3(225.0f, 125.0f, 0.0f), 0.0f); // 5th (1st) page across, and 3rd (3rd) page down. (wrapped) + Wait(application); + DALI_TEST_EQUALS( static_cast(scrollView.GetCurrentPage()), 17, TEST_LOCATION ); + scrollView.SetWrapMode(true); + DALI_TEST_EQUALS( static_cast(scrollView.GetCurrentPage()), 13, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliScrollViewActorAutoSnap(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewActorAutoSnap"); + + ScrollView scrollView = ScrollView::New(); + Stage::GetCurrent().Add( scrollView ); + // Disable Refresh signal (TET environment cannot use adaptor's Timer) + scrollView.SetRefreshInterval(0); + + // Position rulers. + RulerPtr rulerX = new DefaultRuler(); + RulerPtr rulerY = new DefaultRuler(); + rulerX->SetDomain( RulerDomain(0.0f, 1000.0f, false) ); + rulerY->SetDomain( RulerDomain(0.0f, 1000.0f, false) ); + scrollView.SetRulerX(rulerX); + scrollView.SetRulerY(rulerY); + + const Vector3 aPosition = Vector3(200.0f, 50.0f, 0.0f); + Actor a = Actor::New(); + scrollView.Add(a); + a.SetPosition(aPosition); + + const Vector3 bPosition = Vector3(600.0f, 600.0f, 0.0f); + Actor b = Actor::New(); + scrollView.Add(b); + b.SetPosition(bPosition); + + // Goto a random position, and execute snap (should not move) + Vector3 targetScroll = Vector3(500.0f, 500.0f, 0.0f); + scrollView.ScrollTo(targetScroll, 0.0f); + Wait(application); + scrollView.ScrollToSnapPoint(); + Wait(application, RENDER_DELAY_SCROLL); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), targetScroll, TEST_LOCATION ); + + // Enable ActorAutoSnap, and now try snapping. + scrollView.SetActorAutoSnap(true); + scrollView.ScrollToSnapPoint(); + Wait(application, RENDER_DELAY_SCROLL); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), bPosition, TEST_LOCATION ); + + scrollView.ScrollTo(Vector3(0.0f, 0.0f, 0.0f), 0.0f); + Wait(application); + scrollView.ScrollToSnapPoint(); + Wait(application, RENDER_DELAY_SCROLL); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), aPosition, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliScrollViewSignalsStartComplete(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewSignalsStartComplete"); + + gOnScrollStartCalled = false; + gOnScrollCompleteCalled = false; + + ScrollView scrollView = ScrollView::New(); + Stage::GetCurrent().Add( scrollView ); + // Disable Refresh signal (TET environment cannot use adaptor's Timer) + scrollView.SetRefreshInterval(0); + + // Position rulers. + RulerPtr rulerX = new DefaultRuler(); + RulerPtr rulerY = new DefaultRuler(); + rulerX->SetDomain( RulerDomain(0.0f, 1000.0f, false) ); + rulerY->SetDomain( RulerDomain(0.0f, 1000.0f, false) ); + scrollView.SetRulerX(rulerX); + scrollView.SetRulerY(rulerY); + scrollView.ScrollStartedSignal().Connect( &OnScrollStart ); + scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate ); + scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete ); + scrollView.ScrollTo( 100.0f, 100.0f ); + Wait(application, RENDER_DELAY_SCROLL); + + DALI_TEST_CHECK(gOnScrollStartCalled); + DALI_TEST_CHECK(gOnScrollCompleteCalled); + END_TEST; +} + +int UtcDaliScrollViewSignalsUpdate(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewSignalsUpdate"); + + gOnScrollStartCalled = false; + gOnScrollUpdateCalled = false; + gOnScrollCompleteCalled = false; + + ScrollView scrollView = ScrollView::New(); + Stage::GetCurrent().Add( scrollView ); + Vector2 stageSize = Stage::GetCurrent().GetSize(); + scrollView.SetSize(stageSize); + // Disable Refresh signal (TET environment cannot use adaptor's Timer) + scrollView.SetRefreshInterval(0); + scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT); + scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT); + + // Position rulers. + RulerPtr rulerX = new DefaultRuler(); + RulerPtr rulerY = new DefaultRuler(); + rulerX->SetDomain( RulerDomain(0.0f, 1000.0f, false) ); + rulerY->SetDomain( RulerDomain(0.0f, 1000.0f, false) ); + scrollView.SetRulerX(rulerX); + scrollView.SetRulerY(rulerY); + scrollView.ScrollStartedSignal().Connect( &OnScrollStart ); + scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate ); + scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete ); + + ImageActor image = CreateSolidColorActor( Color::RED ); + image.SetSize(stageSize); + image.SetParentOrigin(ParentOrigin::TOP_LEFT); + image.SetAnchorPoint(AnchorPoint::TOP_LEFT); + scrollView.Add(image); + + Wait(application); + + // Do a pan starting from 100,100 and moving down diagonally. + Vector2 pos(100.0f, 100.0f); + SendPan(application, Gesture::Possible, pos); + SendPan(application, Gesture::Started, pos); + pos.x += 5.0f; + pos.y += 5.0f; + Wait(application, 100); + + for(int i = 0;i<20;i++) + { + SendPan(application, Gesture::Continuing, pos); + pos.x += 5.0f; + pos.y += 5.0f; + Wait(application); + } + + SendPan(application, Gesture::Finished, pos); + Wait(application, RENDER_DELAY_SCROLL); + + DALI_TEST_CHECK(gOnScrollStartCalled); + DALI_TEST_CHECK(gOnScrollUpdateCalled); + DALI_TEST_CHECK(gOnScrollCompleteCalled); + END_TEST; +} + +// Creates a scroll domain slightly bigger than the stage size. +// ScrollView is scrolled to center, slightly to the left. +// Then a pan gesture is carried out causing the scrollview +// to pan South-West direction. Resulting in ClampEvents +// to fire (first Western boundary, then both Western and +// Southern boundary). +int UtcDaliScrollViewSignalsClamped(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewSignalsClamped"); + + gOnScrollUpdateCalled = false; + gOnScrollCompleteCalled = false; + + // Set up a scrollView... + ScrollView scrollView = ScrollView::New(); + Stage::GetCurrent().Add( scrollView ); + Vector2 stageSize = Stage::GetCurrent().GetSize(); + scrollView.SetSize(stageSize); + // Disable Refresh signal (TET environment cannot use adaptor's Timer) + scrollView.SetRefreshInterval(0); + scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT); + scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT); + + // Position rulers. + RulerPtr rulerX = new DefaultRuler(); + RulerPtr rulerY = new DefaultRuler(); + rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) ); + rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) ); + scrollView.SetRulerX(rulerX); + scrollView.SetRulerY(rulerY); + scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate ); + scrollView.ScrollClampedSignal().Connect( &OnScrollClamped ); + + scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little. + Wait(application); + + // Now do a pan starting from 100,100 and heading South-West + Vector2 pos(CLAMP_TOUCH_START); + SendPan(application, Gesture::Possible, pos); + SendPan(application, Gesture::Started, pos); + pos += CLAMP_TOUCH_MOVEMENT; // Move South-West a little + Wait(application); + + int step = CLAMP_STEP_0_CHECK_NOTCLAMPED; + // Move 500,500 pixels South-West + // should be initially not clamped (0) + // then it should clamp against West boundary (X Min) (1) + // then it should clamp against South-West boundary (X Min, Y Max) (2) + gLastClampPosition.x = Toolkit::NotClamped; + gLastClampPosition.y = Toolkit::NotClamped; + + for(int i = 0;iSetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) ); + rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) ); + scrollView.SetRulerX(rulerX); + scrollView.SetRulerY(rulerY); + scrollView.ScrollStartedSignal().Connect( &OnScrollStart ); + scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate ); + scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete ); + scrollView.SnapStartedSignal().Connect( &OnSnapStart ); + + scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little. + Wait(application); + + // First try insensitive swipe. + scrollView.SetScrollSensitive(false); + PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT, CLAMP_GESTURE_FRAMES, true); + + DALI_TEST_CHECK( !gOnScrollStartCalled ); + DALI_TEST_CHECK( !gOnScrollUpdateCalled ); + DALI_TEST_CHECK( !gOnScrollCompleteCalled ); + DALI_TEST_CHECK( !gOnSnapStartCalled ); + + // Second try sensitive swipe. + scrollView.SetScrollSensitive(true); + PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT, CLAMP_GESTURE_FRAMES, true); + + DALI_TEST_CHECK( gOnScrollStartCalled ); + DALI_TEST_CHECK( gOnScrollUpdateCalled ); + DALI_TEST_CHECK( gOnScrollCompleteCalled ); + DALI_TEST_CHECK( gOnSnapStartCalled ); + END_TEST; +} + +int UtcDaliScrollViewTouchesRequired(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewTouchesRequired"); + + // Set up a scrollView... + ScrollView scrollView = ScrollView::New(); + Stage::GetCurrent().Add( scrollView ); + Vector2 stageSize = Stage::GetCurrent().GetSize(); + scrollView.SetSize(stageSize); + // Disable Refresh signal (TET environment cannot use adaptor's Timer) + scrollView.SetRefreshInterval(0); + scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT); + scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT); + + // Position rulers. + RulerPtr rulerX = new DefaultRuler(); + RulerPtr rulerY = new DefaultRuler(); + rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) ); + rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) ); + scrollView.SetRulerX(rulerX); + scrollView.SetRulerY(rulerY); + scrollView.ScrollStartedSignal().Connect( &OnScrollStart ); + scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate ); + scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete ); + scrollView.SnapStartedSignal().Connect( &OnSnapStart ); + + scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little. + Wait(application); + + // First try touches required being a minimum and maximum of 2. + scrollView.SetTouchesRequiredForPanning(2, 2, true); + PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT, CLAMP_GESTURE_FRAMES, true); + + DALI_TEST_CHECK( !gOnScrollStartCalled ); + DALI_TEST_CHECK( !gOnScrollUpdateCalled ); + DALI_TEST_CHECK( !gOnScrollCompleteCalled ); + DALI_TEST_CHECK( !gOnSnapStartCalled ); + + // Second try touches required being a minimum and maximum of 1. + scrollView.SetTouchesRequiredForPanning(1, 1, true); + PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT, CLAMP_GESTURE_FRAMES, true); + + DALI_TEST_CHECK( gOnScrollStartCalled ); + DALI_TEST_CHECK( gOnScrollUpdateCalled ); + DALI_TEST_CHECK( gOnScrollCompleteCalled ); + DALI_TEST_CHECK( gOnSnapStartCalled ); + END_TEST; +} + +int UtcDaliScrollViewAxisAutoLock(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewAxisAutoLock"); + + // Set up a scrollView... + ScrollView scrollView = ScrollView::New(); + Stage::GetCurrent().Add( scrollView ); + Vector2 stageSize = Stage::GetCurrent().GetSize(); + scrollView.SetSize(stageSize); + // Disable Refresh signal (TET environment cannot use adaptor's Timer) + scrollView.SetRefreshInterval(0); + scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT); + scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT); + + // Position rulers. + RulerPtr rulerX = new DefaultRuler(); + RulerPtr rulerY = new DefaultRuler(); + rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) ); + rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) ); + scrollView.SetRulerX(rulerX); + scrollView.SetRulerY(rulerY); + scrollView.ScrollStartedSignal().Connect( &OnScrollStart ); + scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate ); + scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete ); + + // Normal + scrollView.ScrollTo(Vector3(100.0f, 100.0f, 0.0f), 0.0f); // move in a little. + Wait(application); + Vector3 startPosition = scrollView.GetCurrentScrollPosition(); + PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(5.0f, 1.0f), 50, true); // mostly horizontal + const Vector3 positionAfterNormal = scrollView.GetCurrentScrollPosition(); + + // Autolock + scrollView.SetAxisAutoLock(true); + DALI_TEST_CHECK(scrollView.GetAxisAutoLock()); + + scrollView.ScrollTo(Vector3(100.0f, 100.0f, 0.0f), 0.0f); // move in a little. + Wait(application); + PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(5.0f, 1.0f), 50, true); // mostly horizontal + const Vector3 positionAfterAutoLock = scrollView.GetCurrentScrollPosition(); + + // compare how much the Y position has deviated for normal and autolock. + const float devianceNormal = fabsf(startPosition.y - positionAfterNormal.y); + const float devianceAutoLock = fabsf(startPosition.y - positionAfterAutoLock.y); + + // in auto-lock it should be a mostly horizontal pan (thus deviance should be much lower) + DALI_TEST_CHECK(devianceAutoLock < devianceNormal); + + scrollView.SetAxisAutoLock(false); + DALI_TEST_CHECK(!scrollView.GetAxisAutoLock()); + END_TEST; +} + +int UtcDaliScrollViewAxisAutoLockGradient(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewAxisAutoLockGradient"); + + // Set up a scrollView... + ScrollView scrollView = ScrollView::New(); + scrollView.SetAxisAutoLockGradient(0.5f); + DALI_TEST_EQUALS(scrollView.GetAxisAutoLockGradient(), 0.5f, TEST_LOCATION); + scrollView.SetAxisAutoLockGradient(1.0f); + DALI_TEST_EQUALS(scrollView.GetAxisAutoLockGradient(), 1.0f, TEST_LOCATION); + END_TEST; +} + +int UtcDaliScrollViewConstraints(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewConstraints"); + + // Set up a scrollView... + ScrollView scrollView = ScrollView::New(); + Stage::GetCurrent().Add( scrollView ); + Vector2 stageSize = Stage::GetCurrent().GetSize(); + scrollView.SetSize(stageSize); + // Disable Refresh signal (TET environment cannot use adaptor's Timer) + scrollView.SetRefreshInterval(0); + scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT); + scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT); + + // Position rulers. + RulerPtr rulerX = new DefaultRuler(); + RulerPtr rulerY = new DefaultRuler(); + rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) ); + rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) ); + scrollView.SetRulerX(rulerX); + scrollView.SetRulerY(rulerY); + + // Add an Actor to ScrollView, + // Apply TestSumConstraint to ScrollView's children (includes this Actor) + gConstraintResult = Vector3::ZERO; + Actor a = Actor::New(); + scrollView.Add(a); + a.SetPosition( TEST_ACTOR_POSITION ); + Wait(application); + + Property::Index scrollPositionProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_POSITION_PROPERTY_NAME); + Constraint constraint = Constraint::New( Actor::POSITION, + Source(scrollView, scrollPositionProperty), + TestSumConstraint( TEST_CONSTRAINT_OFFSET ) ); + constraint.SetRemoveAction(Constraint::Discard); + scrollView.ApplyConstraintToChildren(constraint); + Wait(application); + + DALI_TEST_EQUALS( gConstraintResult, TEST_ACTOR_POSITION + TEST_CONSTRAINT_OFFSET, TEST_LOCATION ); + + gConstraintResult = Vector3::ZERO; + scrollView.RemoveConstraintsFromChildren(); + Wait(application); + + DALI_TEST_EQUALS( gConstraintResult, Vector3::ZERO, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliScrollViewBind(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewBind"); + + // Set up a scrollView... + ScrollView scrollView = ScrollView::New(); + Stage::GetCurrent().Add( scrollView ); + Vector2 stageSize = Stage::GetCurrent().GetSize(); + scrollView.SetSize(stageSize); + // Disable Refresh signal (TET environment cannot use adaptor's Timer) + scrollView.SetRefreshInterval(0); + scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT); + scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT); + + // Position rulers. + RulerPtr rulerX = new DefaultRuler(); + RulerPtr rulerY = new DefaultRuler(); + rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) ); + rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) ); + scrollView.SetRulerX(rulerX); + scrollView.SetRulerY(rulerY); + + // Add an Actor to ScrollView, + // Apply TestSumConstraint to ScrollView's children (includes this Actor) + + gConstraintResult = Vector3::ZERO; + Actor a = Actor::New(); + scrollView.Add(a); + a.SetPosition( TEST_ACTOR_POSITION ); + Wait(application); + + Property::Index scrollPositionProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_POSITION_PROPERTY_NAME); + // apply this constraint to scrollview + Constraint constraint = Constraint::New( Actor::POSITION, + Source(scrollView, scrollPositionProperty), + TestSumConstraint( TEST_CONSTRAINT_OFFSET ) ); + + constraint.SetRemoveAction(Constraint::Discard); + scrollView.ApplyConstraintToChildren(constraint); + + Wait(application); + // Defaulty Bound. + DALI_TEST_EQUALS( gConstraintResult, TEST_ACTOR_POSITION + TEST_CONSTRAINT_OFFSET, TEST_LOCATION ); + + // UnBind + gConstraintResult = Vector3::ZERO; + scrollView.UnbindActor( a ); + Wait(application); + DALI_TEST_EQUALS( gConstraintResult, Vector3::ZERO, TEST_LOCATION ); + + // Bind + gConstraintResult = Vector3::ZERO; + scrollView.BindActor( a ); + Wait(application); + DALI_TEST_EQUALS( gConstraintResult, TEST_ACTOR_POSITION + TEST_CONSTRAINT_OFFSET, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliRulerEnableDisable(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliRulerEnableDisable"); + + RulerPtr ruler = new DefaultRuler(); + + DALI_TEST_CHECK( ruler->IsEnabled() ); + ruler->Disable(); + DALI_TEST_CHECK( !ruler->IsEnabled() ); + ruler->Enable(); + DALI_TEST_CHECK( ruler->IsEnabled() ); + END_TEST; +} + +int UtcDaliRulerDomainEnableDisable(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliRulerDomainEnableDisable"); + + RulerPtr ruler = new DefaultRuler(); + DALI_TEST_EQUALS( ruler->GetDomain().GetSize(), 1.0f, TEST_LOCATION ); + + + ruler->SetDomain( RulerDomain(0.0f, 100.0f, true) ); + DALI_TEST_EQUALS( ruler->GetDomain().GetSize(), 100.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( ruler->Clamp(-200.0f), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( ruler->Clamp(200.0f), 100.0f, TEST_LOCATION ); + + ruler->DisableDomain(); + DALI_TEST_EQUALS( ruler->GetDomain().GetSize(), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( ruler->Clamp(-200.0f), -200.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( ruler->Clamp(200.0f), 200.0f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliRulerSnapAndClamp(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliRulerSnapAndClamp"); + + RulerPtr ruler = new FixedRuler( 50.0f ); + ruler->SetDomain( RulerDomain(0.0f, 400.0f, true) ); + + // default testing. (snap and clamp) + DALI_TEST_EQUALS( ruler->SnapAndClamp(50.0f), 50.0f, TEST_LOCATION); + DALI_TEST_EQUALS( ruler->SnapAndClamp(30.0f), 50.0f, TEST_LOCATION); + DALI_TEST_EQUALS( ruler->SnapAndClamp(10.0f), 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS( ruler->SnapAndClamp(-40.0f), 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS( ruler->SnapAndClamp(390.0f), 400.0f, TEST_LOCATION); + DALI_TEST_EQUALS( ruler->SnapAndClamp(430.0f), 400.0f, TEST_LOCATION); + + // bias testing. + DALI_TEST_EQUALS( ruler->SnapAndClamp(40.0f, 0.0f), 0.0f, TEST_LOCATION); // Flick Left + DALI_TEST_EQUALS( ruler->SnapAndClamp(40.0f, 0.5f), 50.0f, TEST_LOCATION); // No Flick + DALI_TEST_EQUALS( ruler->SnapAndClamp(40.0f, 1.0f), 50.0f, TEST_LOCATION); // Flick Right + + DALI_TEST_EQUALS( ruler->SnapAndClamp(20.0f, 0.0f), 0.0f, TEST_LOCATION); // Flick Left + DALI_TEST_EQUALS( ruler->SnapAndClamp(20.0f, 0.5f), 0.0f, TEST_LOCATION); // No Flick + DALI_TEST_EQUALS( ruler->SnapAndClamp(20.0f, 1.0f), 50.0f, TEST_LOCATION); // Flick Right + + // length testing. + DALI_TEST_EQUALS( ruler->SnapAndClamp(-10.0f, 0.5f, 10.0f), 0.0f, TEST_LOCATION); // 10 units long (over left boundary) + DALI_TEST_EQUALS( ruler->SnapAndClamp(-5.0f, 0.5f, 10.0f), 0.0f, TEST_LOCATION); // 10 units long (slightly ovr left boundary) + DALI_TEST_EQUALS( ruler->SnapAndClamp(300.0f, 0.5f, 10.0f), 300.0f, TEST_LOCATION); // 10 units long (not over a boundary) + DALI_TEST_EQUALS( ruler->SnapAndClamp(395.0f, 0.5f, 10.0f), 390.0f, TEST_LOCATION); // 10 units long (slightly over right boundary) + DALI_TEST_EQUALS( ruler->SnapAndClamp(500.0f, 0.5f, 10.0f), 390.0f, TEST_LOCATION); // 10 units long (over right boundary) + + // scale testing. + DALI_TEST_EQUALS( ruler->SnapAndClamp(-100.0f, 0.5f, 0.0f, 2.0f), 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS( ruler->SnapAndClamp(50.0f, 0.5f, 0.0f, 2.0f), 50.0f, TEST_LOCATION); + DALI_TEST_EQUALS( ruler->SnapAndClamp(700.0f, 0.5f, 0.0f, 2.0f), 700.0f, TEST_LOCATION); + DALI_TEST_EQUALS( ruler->SnapAndClamp(850.0f, 0.5f, 0.0f, 2.0f), 800.0f, TEST_LOCATION); + + // clamp state testing. + ClampState clamped; + DALI_TEST_EQUALS( ruler->SnapAndClamp(50.0f, 0.5f, 0.0f, 1.0f, clamped), 50.0f, TEST_LOCATION); + DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION ); + DALI_TEST_EQUALS( ruler->SnapAndClamp(30.0f, 0.5f, 0.0f, 1.0f, clamped), 50.0f, TEST_LOCATION); + DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION ); + DALI_TEST_EQUALS( ruler->SnapAndClamp(10.0f, 0.5f, 0.0f, 1.0f, clamped), 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION ); + DALI_TEST_EQUALS( ruler->SnapAndClamp(-40.0f, 0.5f, 0.0f, 1.0f, clamped), 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS( clamped, ClampedToMin, TEST_LOCATION ); + DALI_TEST_EQUALS( ruler->SnapAndClamp(390.0f, 0.5f, 0.0f, 1.0f, clamped), 400.0f, TEST_LOCATION); + DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION ); + DALI_TEST_EQUALS( ruler->SnapAndClamp(430.0f, 0.5f, 0.0f, 1.0f, clamped), 400.0f, TEST_LOCATION); + DALI_TEST_EQUALS( clamped, ClampedToMax, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliRulerFixedRulerSpacing(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliRulerFixedRulerSpacing"); + + RulerPtr rulerZero = new FixedRuler( 0.0f ); + rulerZero->SetDomain( RulerDomain(10.0f, 90.0f, true) ); + + RulerPtr rulerNormal = new FixedRuler( 25.0f ); + rulerNormal->SetDomain( RulerDomain(10.0f, 90.0f, true) ); + + unsigned int volume; + float position; + + position = rulerZero->GetPositionFromPage(1, volume, true); + DALI_TEST_EQUALS( position, 10.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( volume, 1u, TEST_LOCATION ); + + position = rulerNormal->GetPositionFromPage(1, volume, true); + DALI_TEST_EQUALS( position, 35.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( volume, 0u, TEST_LOCATION ); + + position = rulerZero->GetPositionFromPage(2, volume, true); + DALI_TEST_EQUALS( position, 10.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( volume, 2u, TEST_LOCATION ); + + position = rulerNormal->GetPositionFromPage(2, volume, true); + DALI_TEST_EQUALS( position, 60.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( volume, 0u, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliScrollViewOvershoot(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewOvershoot"); + + // Set up a scrollView... + ScrollView scrollView = ScrollView::New(); + Stage::GetCurrent().Add( scrollView ); + Vector2 stageSize = Stage::GetCurrent().GetSize(); + scrollView.SetSize(stageSize); + // Disable Refresh signal (TET environment cannot use adaptor's Timer) + scrollView.SetRefreshInterval(0); + scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT); + scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT); + + // Position rulers. + RulerPtr rulerX = new DefaultRuler(); + RulerPtr rulerY = new DefaultRuler(); + rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) ); + rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) ); + scrollView.SetRulerX(rulerX); + scrollView.SetRulerY(rulerY); + scrollView.ScrollStartedSignal().Connect( &OnScrollStart ); + scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate ); + scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete ); + + scrollView.ScrollTo(OVERSHOOT_START_SCROLL_POSITION, 0.0f); // move in a little. + Wait(application); + + // 1. Scroll page in NW (-500,-500 pixels), then inspect overshoot. (don't release touch) + Vector2 currentPos = Vector2(100.0f, 100.0f); + currentPos = PerformGestureDiagonalSwipe(application, currentPos, Vector2(5.0f, 5.0f), 100, false); + Property::Index overshootXProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME); + Property::Index overshootYProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME); + Property::Index scrollPositionProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_POSITION_PROPERTY_NAME); + float overshootXValue = scrollView.GetProperty(overshootXProperty); + float overshootYValue = scrollView.GetProperty(overshootYProperty); + Vector3 positionValue = scrollView.GetProperty(scrollPositionProperty); + DALI_TEST_EQUALS(overshootXValue, -1.0f, TEST_LOCATION); + DALI_TEST_EQUALS(overshootYValue, -1.0f, TEST_LOCATION); + DALI_TEST_EQUALS(positionValue, Vector3::ZERO, TEST_LOCATION); + + float timeToReachOrigin; + + // Now release touch. Overshoot should snap back to zero. + SendPan(application, Gesture::Finished, currentPos); + timeToReachOrigin = TestOvershootSnapDuration(application, scrollView); + + DALI_TEST_CHECK( (timeToReachOrigin > TEST_DEFAULT_SNAP_OVERSHOOT_DURATION - TIME_TOLERANCE) && + (timeToReachOrigin < TEST_DEFAULT_SNAP_OVERSHOOT_DURATION + TIME_TOLERANCE) ); + + // 2. Repeat Scroll, but this time change overshoot snap duration to shorter time + scrollView.SetSnapOvershootDuration(TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION); + + currentPos = PerformGestureDiagonalSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, false); + // Now release touch. Overshoot should snap back to zero. + SendPan(application, Gesture::Finished, currentPos); + timeToReachOrigin = TestOvershootSnapDuration(application, scrollView); + + DALI_TEST_CHECK( (timeToReachOrigin > TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION - TIME_TOLERANCE) && + (timeToReachOrigin < TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION + TIME_TOLERANCE) ); + + // 3. Repeat Scroll, but this time change overshoot snap duration to longer time. + scrollView.SetSnapOvershootDuration(TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION); + + currentPos = PerformGestureDiagonalSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, false); + // Now release touch. Overshoot should snap back to zero. + SendPan(application, Gesture::Finished, currentPos); + timeToReachOrigin = TestOvershootSnapDuration(application, scrollView); + + DALI_TEST_CHECK( (timeToReachOrigin > TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION - TIME_TOLERANCE) && + (timeToReachOrigin < TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION + TIME_TOLERANCE) ); + + // 4. Repeat Scroll, but this time change overshoot function. + scrollView.SetSnapOvershootAlphaFunction(TestAlphaFunction); + + currentPos = PerformGestureDiagonalSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, false); + // Now release touch. Overshoot should snap back to zero. + SendPan(application, Gesture::Finished, currentPos); + timeToReachOrigin = TestOvershootSnapDuration(application, scrollView); + + DALI_TEST_CHECK( (timeToReachOrigin > TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION - TIME_TOLERANCE) && + (timeToReachOrigin < TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION + TIME_TOLERANCE) ); + END_TEST; +} + +int UtcDaliScrollViewSnapAlphaFunction(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewSnapAlphaFunction"); + + // Set up a scrollView... + ScrollView scrollView = ScrollView::New(); + scrollView.SetScrollSnapAlphaFunction( AlphaFunctions::EaseIn ); + DALI_TEST_CHECK( scrollView.GetScrollSnapAlphaFunction() == AlphaFunctions::EaseIn ); + scrollView.SetScrollSnapAlphaFunction( AlphaFunctions::EaseOut ); + DALI_TEST_CHECK( scrollView.GetScrollSnapAlphaFunction() == AlphaFunctions::EaseOut ); + + scrollView.SetScrollFlickAlphaFunction( AlphaFunctions::Bounce ); + DALI_TEST_CHECK( scrollView.GetScrollFlickAlphaFunction() == AlphaFunctions::Bounce ); + scrollView.SetScrollFlickAlphaFunction( AlphaFunctions::BounceBack ); + DALI_TEST_CHECK( scrollView.GetScrollFlickAlphaFunction() == AlphaFunctions::BounceBack ); + END_TEST; +} + +int UtcDaliScrollViewSnapDuration(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewSnapDuration"); + + // Set up a scrollView... + ScrollView scrollView = ScrollView::New(); + scrollView.SetScrollSnapDuration( 1.0f ); + DALI_TEST_EQUALS( scrollView.GetScrollSnapDuration(), 1.0f, TEST_LOCATION ); + scrollView.SetScrollSnapDuration( 0.5f ); + DALI_TEST_EQUALS( scrollView.GetScrollSnapDuration(), 0.5f, TEST_LOCATION ); + + scrollView.SetScrollFlickDuration( 2.0f ); + DALI_TEST_EQUALS( scrollView.GetScrollFlickDuration(), 2.0f, TEST_LOCATION ); + scrollView.SetScrollFlickDuration( 1.5f ); + DALI_TEST_EQUALS( scrollView.GetScrollFlickDuration(), 1.5f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliScrollViewSignalsSnapStart(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewSignalsSnapStart"); + + // Set up a scrollView... + ScrollView scrollView = ScrollView::New(); + Stage::GetCurrent().Add( scrollView ); + Vector2 stageSize = Stage::GetCurrent().GetSize(); + scrollView.SetSize(stageSize); + // Disable Refresh signal (TET environment cannot use adaptor's Timer) + scrollView.SetRefreshInterval(0); + scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT); + scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT); + + // Position rulers. + RulerPtr rulerX = new DefaultRuler(); + RulerPtr rulerY = new DefaultRuler(); + rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) ); + rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) ); + scrollView.SetRulerX(rulerX); + scrollView.SetRulerY(rulerY); + scrollView.SnapStartedSignal().Connect( &OnSnapStart ); + + scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little. + Wait(application); + + DALI_TEST_CHECK( !gOnSnapStartCalled ); + + // First try a snap. + PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(0.5f, 0.0f), 60, true); + + DALI_TEST_CHECK( gOnSnapStartCalled ); + DALI_TEST_CHECK( gLastSnapType == Toolkit::Snap ); + + // Second try a swipe. + PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(20.0f, 0.0f), 60, true); + + DALI_TEST_CHECK( gOnSnapStartCalled ); + DALI_TEST_CHECK( gLastSnapType == Toolkit::Flick ); + END_TEST; +} + + +int UtcDaliScrollViewSetMouseWheelScrollDistanceStep(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewSetMouseWheelScrollDistanceStep"); + + ScrollView scrollView = ScrollView::New(); + // Disable Refresh signal (TET environment cannot use adaptor's Timer) + scrollView.SetMouseWheelScrollDistanceStep(Vector2(30.0f, 15.0f)); + DALI_TEST_EQUALS( scrollView.GetMouseWheelScrollDistanceStep(), Vector2(30.0f, 15.0f), TEST_LOCATION ); + scrollView.SetMouseWheelScrollDistanceStep(Vector2(60.0f, 30.0f)); + DALI_TEST_EQUALS( scrollView.GetMouseWheelScrollDistanceStep(), Vector2(60.0f, 30.0f), TEST_LOCATION); + END_TEST; +} + +int UtcDaliScrollViewGetSet(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewGetSet"); + ScrollView scrollView = ScrollView::New(); + scrollView.SetMaxOvershoot(50.0f, 50.0f); + scrollView.SetMaxFlickSpeed(0.5f); + DALI_TEST_EQUALS(scrollView.GetMaxFlickSpeed(), 0.5f, Math::MACHINE_EPSILON_0, TEST_LOCATION); + scrollView.SetFrictionCoefficient(0.6f); + DALI_TEST_EQUALS(scrollView.GetFrictionCoefficient(), 0.6f, Math::MACHINE_EPSILON_0, TEST_LOCATION); + scrollView.SetFlickSpeedCoefficient(0.7f); + DALI_TEST_EQUALS(scrollView.GetFlickSpeedCoefficient(), 0.7f, Math::MACHINE_EPSILON_0, TEST_LOCATION); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-ScrollViewEffect.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-ScrollViewEffect.cpp new file mode 100644 index 0000000..2a2f116 --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-ScrollViewEffect.cpp @@ -0,0 +1,446 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 + +#include +#include +#include +#include +#include + + +using namespace Dali; +using namespace Toolkit; + +void dali_scroll_view_effect_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void dali_scroll_view_effect_cleanup(void) +{ + test_return_value = TET_PASS; +} + +namespace +{ + +const int MILLISECONDS_PER_SECOND = 1000; +const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS) +const int RENDER_ANIMATION_TEST_DURATION_MS = 1000; ///< 1000ms to test animation +const int RENDER_DELAY_SCROLL = 1000; ///< duration to wait for any scroll to complete. + +/* + * Simulate time passed by. + * + * @note this will always process at least 1 frame (1/60 sec) + * + * @param application Test application instance + * @param duration Time to pass in milliseconds. + * @return The actual time passed in milliseconds + */ +int Wait(ToolkitTestApplication& application, int duration = 0) +{ + int time = 0; + + for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++) + { + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + time += RENDER_FRAME_INTERVAL; + } + + return time; +} + +/** + * Creates a Ruler that snaps to a specified grid size. + * If that grid size is 0.0 then this ruler does not + * snap. + * + * @param[in] gridSize (optional) The grid size for the ruler, + * (Default = 0.0 i.e. no snapping) + * @return The ruler is returned. + */ +RulerPtr CreateRuler(float gridSize = 0.0f) +{ + if(gridSize <= Math::MACHINE_EPSILON_0) + { + return new DefaultRuler(); + } + return new FixedRuler(gridSize); +} + +// Callback probes. + +static bool gOnScrollStartCalled; ///< Whether the OnScrollStart signal was invoked. +static bool gOnScrollUpdateCalled; ///< Whether the OnScrollUpdate signal was invoked. +static bool gOnScrollCompleteCalled; ///< Whether the OnScrollComplete signal was invoked. +static Vector3 gConstraintResult; ///< Result from constraint. + +static ActorContainer gPages; ///< Keeps track of all the pages for applying effects. + +static void ResetScrollCallbackResults() +{ + gOnScrollStartCalled = false; + gOnScrollUpdateCalled = false; + gOnScrollCompleteCalled = false; +} + +/** + * Invoked when scrolling starts. + * + * @param[in] position The current scroll position. + */ +static void OnScrollStart( const Vector3& position ) +{ + gOnScrollStartCalled = true; +} + +/** + * Invoked when scrolling updates (via dragging) + * + * @param[in] position The current scroll position. + */ +static void OnScrollUpdate( const Vector3& position ) +{ + gOnScrollUpdateCalled = true; +} + +/** + * Invoked when scrolling finishes + * + * @param[in] position The current scroll position. + */ +static void OnScrollComplete( const Vector3& position ) +{ + gOnScrollCompleteCalled = true; +} + + +ScrollView SetupTestScrollView(int rows, int columns, Vector2 size) +{ + ScrollView scrollView = ScrollView::New(); + scrollView.SetSize(size); + scrollView.SetAnchorPoint(AnchorPoint::CENTER); + scrollView.SetParentOrigin(ParentOrigin::CENTER); + scrollView.ApplyConstraint( Constraint::New( Dali::Actor::SIZE, Dali::ParentSource( Dali::Actor::SIZE ), Dali::EqualToConstraint() ) ); + // Disable Refresh signal (TET environment cannot use adaptor's Timer) + scrollView.SetWrapMode(false); + scrollView.SetRefreshInterval(0); + scrollView.ScrollStartedSignal().Connect( &OnScrollStart ); + scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate ); + scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete ); + Stage::GetCurrent().Add( scrollView ); + RulerPtr rulerX = CreateRuler(size.width); + RulerPtr rulerY = CreateRuler(size.height); + if(columns > 1) + { + rulerX->SetDomain(RulerDomain(0.0f, size.width * columns)); + } + else + { + rulerX->Disable(); + } + if(rows > 1) + { + rulerY->SetDomain(RulerDomain(0.0f, size.width * rows)); + } + else + { + rulerY->Disable(); + } + + scrollView.SetRulerX( rulerX ); + scrollView.SetRulerY( rulerY ); + Stage::GetCurrent().Add( scrollView ); + + Actor container = Actor::New(); + container.SetParentOrigin(ParentOrigin::CENTER); + container.SetAnchorPoint(AnchorPoint::CENTER); + container.SetSize( size ); + scrollView.Add( container ); + container.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + + gPages.clear(); + for(int row = 0;row( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + page.SetParentOrigin( ParentOrigin::CENTER ); + page.SetAnchorPoint( AnchorPoint::CENTER ); + page.SetPosition( column * size.x, row * size.y ); + container.Add(page); + + gPages.push_back(page); + } + } + + ResetScrollCallbackResults(); + return scrollView; +} + +void CleanupTest() +{ + gPages.clear(); + ResetScrollCallbackResults(); +} + +Actor AddActorToPage(Actor page, float x, float y, float cols, float rows) +{ + Stage stage = Stage::GetCurrent(); + Vector2 stageSize = stage.GetSize(); + + const float margin = 10.0f; + const Vector2 actorSize((stageSize.x / cols) - margin, (stageSize.y / rows) - margin); + + Actor actor = Actor::New(); + actor.SetParentOrigin( ParentOrigin::CENTER ); + actor.SetAnchorPoint( AnchorPoint::CENTER ); + + Vector3 position( margin * 0.5f + (actorSize.x + margin) * x - stageSize.width * 0.5f, + margin * 0.5f + (actorSize.y + margin) * y - stageSize.height * 0.5f, + 0.0f); + Vector3 positionEnd( margin * 0.5f + (actorSize.x + margin) * (x + cols) - stageSize.width * 0.5f - margin, + margin * 0.5f + (actorSize.y + margin) * (y + rows) - stageSize.height * 0.5f - margin, + 0.0f); + Vector3 size(positionEnd - position); + actor.SetPosition( position + size * 0.5f); + actor.SetSize( positionEnd - position ); + page.Add(actor); + return actor; +} + +} // unnamed namespace + + +int UtcDaliScrollViewPageCubeEffectSetup(void) +{ + tet_infoline(" UtcDaliScrollViewPageCubeEffectSetup"); + + ScrollViewPageCubeEffect effect; + + DALI_TEST_CHECK( !effect ); + + BaseHandle handle = ScrollViewPageCubeEffect::New(); + + DALI_TEST_CHECK( handle ); + + effect = ScrollViewPageCubeEffect::DownCast(handle); + + DALI_TEST_CHECK( effect ); + END_TEST; +} + + +int UtcDaliScrollViewPageCarouselEffectSetup(void) +{ + tet_infoline(" UtcDaliScrollViewCarouselEffectSetup"); + + ScrollViewPageCarouselEffect effect; + + DALI_TEST_CHECK( !effect ); + + BaseHandle handle = ScrollViewPageCarouselEffect::New(); + + DALI_TEST_CHECK( handle ); + + effect = ScrollViewPageCarouselEffect::DownCast(handle); + + DALI_TEST_CHECK( effect ); + END_TEST; +} + +int UtcDaliScrollViewCarouselEffectSetup(void) +{ + tet_infoline(" UtcDaliScrollViewCarouselEffectSetup"); + + ScrollViewCarouselEffect effect; + + DALI_TEST_CHECK( !effect ); + + BaseHandle handle = ScrollViewCarouselEffect::New(); + + DALI_TEST_CHECK( handle ); + + effect = ScrollViewCarouselEffect::DownCast(handle); + + DALI_TEST_CHECK( effect ); + END_TEST; +} + +int UtcDaliScrollViewDepthEffectSetup(void) +{ + tet_infoline(" UtcDaliScrollViewDepthEffectSetup"); + + ScrollViewDepthEffect effect; + + DALI_TEST_CHECK( !effect ); + + BaseHandle handle = ScrollViewDepthEffect::New(); + + DALI_TEST_CHECK( handle ); + + effect = ScrollViewDepthEffect::DownCast(handle); + + DALI_TEST_CHECK( effect ); + END_TEST; +} + + +int UtcDaliScrollViewPageCubeEffectTest(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewPageCubeEffectTest"); + + Vector2 size = Stage::GetCurrent().GetSize(); + + ScrollView scrollView = SetupTestScrollView(1, 3, size); + Actor testPage = gPages[1]; + Wait(application, 500); + + ScrollViewPageCubeEffect effect = ScrollViewPageCubeEffect::New(); + scrollView.ApplyEffect(effect); + + for(ActorIter pageIter = gPages.begin(); pageIter != gPages.end(); ++pageIter) + { + Actor page = *pageIter; + page.RemoveConstraints(); + page.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + effect.ApplyToPage(page, Vector2(Math::PI_2, 0.0f)); + } + Wait(application); + + scrollView.ScrollTo(1); + while(!gOnScrollCompleteCalled) + { + Wait(application); + } + // test that the first page has reached centre of screen + Vector3 pagePos = testPage.GetCurrentPosition(); + DALI_TEST_EQUALS(pagePos, Vector3::ZERO, Math::MACHINE_EPSILON_0, TEST_LOCATION); + CleanupTest(); + END_TEST; +} + +int UtcDaliScrollViewPageCarouselEffectTest(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewPageCarouselEffectTest"); + + Vector2 size = Stage::GetCurrent().GetSize(); + + ScrollView scrollView = SetupTestScrollView(1, 3, size); + Actor testPage = gPages[1]; + Wait(application, 500); + + ScrollViewPageCarouselEffect effect = ScrollViewPageCarouselEffect::New(); + scrollView.ApplyEffect(effect); + + for(ActorIter pageIter = gPages.begin(); pageIter != gPages.end(); ++pageIter) + { + Actor page = *pageIter; + page.RemoveConstraints(); + page.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + effect.ApplyToPage(page); + } + Wait(application); + + scrollView.ScrollTo(1, 0.5f, DirectionBiasNone); + while(!gOnScrollCompleteCalled) + { + Wait(application); + } + // test that the first page has reached centre of screen + Vector3 pagePos = testPage.GetCurrentPosition(); + DALI_TEST_EQUALS(pagePos, Vector3::ZERO, Math::MACHINE_EPSILON_0, TEST_LOCATION); + CleanupTest(); + END_TEST; +} + +int UtcDaliScrollViewCarouselEffectTest(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewCarouselEffectTest"); + + Vector2 size = Stage::GetCurrent().GetSize(); + + ScrollView scrollView = SetupTestScrollView(1, 3, size); + Actor testPage = gPages[1]; + Wait(application, 500); + + ScrollViewCarouselEffect effect = ScrollViewCarouselEffect::New(); + scrollView.ApplyEffect(effect); + + Actor actor = AddActorToPage(testPage, 0.5f, 0.5f, 3, 3); + Wait(application); + Vector3 actorPrePosition = actor.GetCurrentPosition(); + + effect.ApplyToActor( actor, Vector2(1.2f, 1.2f) ); + + scrollView.ScrollTo(Vector3(size.x, 0.0f, 0.0f), 0.5f, DirectionBiasNone, DirectionBiasNone); + while(!gOnScrollCompleteCalled) + { + Wait(application); + } + // test that the first page has reached centre of screen + Vector3 actorPostPosition = actor.GetCurrentPosition(); + // just check the actor has moved + DALI_TEST_CHECK((actorPostPosition - actorPrePosition).Length() > Math::MACHINE_EPSILON_1); + CleanupTest(); + END_TEST; +} + +int UtcDaliScrollViewDepthEffectTest(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewDepthEffectTest"); + + Vector2 size = Stage::GetCurrent().GetSize(); + + ScrollView scrollView = SetupTestScrollView(1, 3, size); + Actor testPage = gPages[1]; + Wait(application, 500); + + ScrollViewDepthEffect effect = ScrollViewDepthEffect::New(); + scrollView.ApplyEffect(effect); + + Actor actor = AddActorToPage(testPage, 0.5f, 0.5f, 3, 3); + Wait(application); + Vector3 actorPrePosition = actor.GetCurrentPosition(); + + const Vector2 positionExtent(0.5f, 2.5f); + const Vector2 offsetExtent(1.0f, 1.0f); + const float positionScale(1.5f); + const float scaleExtent(0.5f); + + effect.ApplyToActor( actor, positionExtent, offsetExtent, positionScale, scaleExtent ); + + scrollView.ScrollTo(1); + while(!gOnScrollCompleteCalled) + { + Wait(application); + } + // test that the first page has reached centre of screen + Vector3 actorPostPosition = actor.GetCurrentPosition(); + // just check the actor has moved + DALI_TEST_CHECK((actorPostPosition - actorPrePosition).Length() > Math::MACHINE_EPSILON_1); + CleanupTest(); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-ShadowView.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-ShadowView.cpp new file mode 100644 index 0000000..2643b0d --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-ShadowView.cpp @@ -0,0 +1,157 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + +using namespace Dali; +using namespace Dali::Toolkit; + +void shadow_view_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void shadow_view_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +// Negative test case for a method +int UtcDaliShadowViewUninitialized(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliShadowViewUninitialized"); + + Toolkit::ShadowView view; + try + { + // New() must be called to create a GaussianBlurView or it wont be valid. + Actor a = Actor::New(); + view.Add( a ); + DALI_TEST_CHECK( false ); + } + catch (Dali::DaliException& e) + { + // Tests that a negative test of an assertion succeeds + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_CHECK(!view); + } + END_TEST; +} + +// Positive test case for a method +int UtcDaliShadowViewNew(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliShadowViewNew"); + + Toolkit::ShadowView view = Toolkit::ShadowView::New(); + DALI_TEST_CHECK( view ); + + Toolkit::ShadowView view2 = Toolkit::ShadowView::New(1.0f, 1.0f); + DALI_TEST_CHECK( view2 ); + END_TEST; +} + +// Positive test case for a method +int UtcDaliShadowViewDownCast(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliShadowViewDownCast"); + + Toolkit::ShadowView view = Toolkit::ShadowView::New(); + BaseHandle handle(view); + + Toolkit::ShadowView shadowView = Toolkit::ShadowView::DownCast( handle ); + DALI_TEST_CHECK( view ); + DALI_TEST_CHECK( shadowView ); + DALI_TEST_CHECK( shadowView == view ); + END_TEST; +} + +// Positive test case for a method +int UtcDaliShadowViewPropertyNames(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliShadowViewPropertyNames"); + + Toolkit::ShadowView view = Toolkit::ShadowView::New(); + DALI_TEST_CHECK( view ); + + // Check the names, this names are used in the shader code, + // if they change in the shader code, then it has to be updated here. + DALI_TEST_EQUALS( view.GetBlurStrengthPropertyIndex(), view.GetPropertyIndex("BlurStrengthProperty"), TEST_LOCATION ); + DALI_TEST_EQUALS( view.GetShadowColorPropertyIndex(), view.GetPropertyIndex("ShadowColorProperty"), TEST_LOCATION ); + END_TEST; +} + +// Positive test case for a method +int UtcDaliShadowViewAddRemove(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliShadowViewAddRemove"); + + Toolkit::ShadowView view = Toolkit::ShadowView::New(); + DALI_TEST_CHECK( view ); + + Actor actor = Actor::New(); + DALI_TEST_CHECK( !actor.OnStage() ); + + + view.SetParentOrigin(ParentOrigin::CENTER); + view.SetSize(Stage::GetCurrent().GetSize()); + view.Add(actor); + Stage::GetCurrent().Add(view); + + DALI_TEST_CHECK( actor.OnStage() ); + + view.Remove(actor); + + DALI_TEST_CHECK( !actor.OnStage() ); + END_TEST; +} + +// Positive test case for a method +int UtcDaliShadowViewActivateDeactivate(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliShadowViewActivateDeactivate"); + + Toolkit::ShadowView view = Toolkit::ShadowView::New(); + DALI_TEST_CHECK( view ); + + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + DALI_TEST_CHECK( 1u == taskList.GetTaskCount() ); + + view.SetParentOrigin(ParentOrigin::CENTER); + view.SetSize(Stage::GetCurrent().GetSize()); + view.Add(Actor::New()); + Stage::GetCurrent().Add(view); + view.Activate(); + + RenderTaskList taskList2 = Stage::GetCurrent().GetRenderTaskList(); + DALI_TEST_CHECK( 1u != taskList2.GetTaskCount() ); + + view.Deactivate(); + + RenderTaskList taskList3 = Stage::GetCurrent().GetRenderTaskList(); + DALI_TEST_CHECK( 1u == taskList3.GetTaskCount() ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-ShearEffect.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-ShearEffect.cpp new file mode 100644 index 0000000..d472f50 --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-ShearEffect.cpp @@ -0,0 +1,150 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + +using namespace Dali; + +void shear_effect_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void shear_effect_cleanup(void) +{ + test_return_value = TET_PASS; +} + +int UtcDaliShearEffectUninitialized(void) +{ + ToolkitTestApplication application; + + Toolkit::ShearEffect effect; + + try + { + // New() must be called to create a ShearEffect or it wont be valid. + effect.SetAngleXAxis( 45.0f ); + DALI_TEST_CHECK( false ); + } + catch (Dali::DaliException& e) + { + // Tests that a negative test of an assertion succeeds + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_CHECK(!effect); + } + END_TEST; +} + +int UtcDaliShearEffectPropertyNames(void) +{ + ToolkitTestApplication application; + + Toolkit::ShearEffect effect = Toolkit::ShearEffect::New(); + + // Check the names, these names are used in the shaders code, + // if they change the shader code has to be updated + DALI_TEST_EQUALS( effect.GetAngleXAxisPropertyName(), "uAngleXAxis", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetAngleYAxisPropertyName(), "uAngleYAxis", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetCenterPropertyName(), "uCenter", TEST_LOCATION ); + END_TEST; +} + +namespace +{ + +/** + * Converts value to screen position in the same way that + * the core does under COORDINATE_TYPE_SCREEN_POSITION + * + * @param[in] value the input position value. + * @return The translated position value ready for gl. + */ +Vector2 ToScreenPosition(Vector2 value) +{ + Vector2 stageSize = Dali::Stage::GetCurrent().GetSize(); + value.x = stageSize.x * 0.5f - value.x; + value.y = value.y - stageSize.y * 0.5f; + + return value; +} + +}// namespace + +int UtcDaliShearEffectDefaultValues(void) +{ + ToolkitTestApplication application; + + Toolkit::ShearEffect effect = Toolkit::ShearEffect::New(); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + + const float angleXAxis(0.0f); + const float angleYAxis(0.0f); + const Vector2 centerValue(0.0f, 0.0f); + + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + TestGlAbstraction& gl = application.GetGlAbstraction(); + DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetAngleXAxisPropertyName().c_str(), angleXAxis ) ); + DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetAngleYAxisPropertyName().c_str(), angleYAxis ) ); + DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetCenterPropertyName().c_str(), ToScreenPosition(centerValue) ) ); + END_TEST; +} + +int UtcDaliShearEffectCustomValues(void) +{ + ToolkitTestApplication application; + + Toolkit::ShearEffect effect = Toolkit::ShearEffect::New(); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + + const float angleXAxis(10.0f); + const float angleYAxis(22.5f); + const Vector2 centerValue(50.0f, 100.0f); + + effect.SetAngleXAxis( angleXAxis ); + effect.SetAngleYAxis( angleYAxis ); + effect.SetCenter( centerValue ); + + actor.SetShaderEffect(effect); + Stage::GetCurrent().Add(actor); + + application.SendNotification(); + application.Render(); + + TestGlAbstraction& gl = application.GetGlAbstraction(); + DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetAngleXAxisPropertyName().c_str(), angleXAxis ) ); + DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetAngleYAxisPropertyName().c_str(), angleYAxis ) ); + DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetCenterPropertyName().c_str(), ToScreenPosition(centerValue) ) ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-Slider.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-Slider.cpp new file mode 100644 index 0000000..ea611ac --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-Slider.cpp @@ -0,0 +1,174 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include +#include + + +using namespace Dali; +using namespace Dali::Toolkit; + +void dali_slider_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void dali_slider_cleanup(void) +{ + test_return_value = TET_PASS; +} + +namespace +{ + +static bool gObjectCreatedCallBackCalled; + +static void TestCallback(BaseHandle handle) +{ + gObjectCreatedCallBackCalled = true; +} + +} + +int UtcDaliSliderNew(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliSliderNew"); + + // Create the Slider actor + Slider slider; + + DALI_TEST_CHECK( !slider ); + + slider = Slider::New(); + + DALI_TEST_CHECK( slider ); + + Slider slider2(slider); + + DALI_TEST_CHECK( slider2 == slider ); + + //Additional check to ensure object is created by checking if it's registered + ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + DALI_TEST_CHECK( registry ); + + gObjectCreatedCallBackCalled = false; + registry.ObjectCreatedSignal().Connect( &TestCallback ); + { + Slider slider = Slider::New(); + } + DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + END_TEST; +} + +int UtcDaliSliderDestructor(void) +{ + ToolkitTestApplication application; + + Slider* slider = new Slider(); + delete slider; + + DALI_TEST_CHECK( true ); + END_TEST; +} + +int UtcDaliSliderDownCast(void) +{ + ToolkitTestApplication application; + + Handle handle = Slider::New(); + + Slider slider = Slider::DownCast( handle ); + + DALI_TEST_CHECK( slider == handle ); + END_TEST; +} + +static bool gSliderValueChangedCallBackCalled; +static bool OnSliderValueChanged( Slider slider, float value ) +{ + gSliderValueChangedCallBackCalled = true; + return true; +} + +static bool gSliderMarkCallBackCalled; +static bool OnSliderMark( Slider slider, int value ) +{ + gSliderMarkCallBackCalled = true; + return true; +} + +int UtcDaliSliderSignals(void) +{ + ToolkitTestApplication application; // Exceptions require ToolkitTestApplication + tet_infoline(" UtcDaliSliderSignals"); + + // Create the Popup actor + Slider slider = Slider::New(); + Stage::GetCurrent().Add( slider ); + slider.SetParentOrigin(ParentOrigin::TOP_LEFT); + slider.SetAnchorPoint(ParentOrigin::TOP_LEFT); + slider.SetSize( 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.push_back( MIN_BOUND + ( static_cast(i) / ( NUM_MARKS - 1) ) * ( MAX_BOUND - MIN_BOUND ) ); + } + slider.SetProperty( slider.GetPropertyIndex( Slider::MARKS_PROPERTY_NAME ), marks ); + slider.SetProperty( slider.GetPropertyIndex( Slider::MARK_TOLERANCE_PROPERTY_NAME ), 0.1f ); + + slider.ValueChangedSignal().Connect( &OnSliderValueChanged ); + slider.MarkSignal().Connect( &OnSliderMark ); + + application.SendNotification(); + application.Render(); + + gSliderValueChangedCallBackCalled = false; + gSliderMarkCallBackCalled = false; + + Dali::Integration::TouchEvent event; + + event = Dali::Integration::TouchEvent(); + + const Dali::TouchPoint pointDown( 0, TouchPoint::Down, 10.0f, 10.0f ); + event.AddPoint( pointDown ); + + for( int i = 0; i < 5; ++i ) + { + const Dali::TouchPoint pointDown( 0, TouchPoint::Motion, 10.0f + i * 10.0f, 10.0f ); + event.AddPoint( pointDown ); + } + + const Dali::TouchPoint pointUp( 0, TouchPoint::Up, 50.0f, 10.0f ); + event.AddPoint( pointUp ); + + application.ProcessEvent( event ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK(gSliderValueChangedCallBackCalled); + DALI_TEST_CHECK(gSliderMarkCallBackCalled); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-SoftButtonEffect.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-SoftButtonEffect.cpp new file mode 100644 index 0000000..38c8d50 --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-SoftButtonEffect.cpp @@ -0,0 +1,81 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + +using namespace Dali; +using namespace Dali::Toolkit; + +void soft_button_effect_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void soft_button_effect_cleanup(void) +{ + test_return_value = TET_PASS; +} + +// Negative test case for a method +int UtcDaliSoftButtonEffectUninitialized(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliSoftButtonEffectUninitialized"); + + Toolkit::SoftButtonEffect effect; + + // New() must be called to create a SoftButtonEffect or it wont be valid. + + DALI_TEST_CHECK(!effect); + END_TEST; +} + +// Positive test case for a method +int UtcDaliSoftButtonEffectNew(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliGaussianBlurViewNew"); + + Toolkit::SoftButtonEffect effect = Toolkit::SoftButtonEffect::New(Toolkit::SoftButtonEffect::ELLIPTICAL); + DALI_TEST_CHECK( effect ); + END_TEST; +} + +// Positive test case for a method +int UtcDaliSoftButtonEffectPropertyNames(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliSoftButtonEffectPropertyNames"); + + Toolkit::SoftButtonEffect effect = Toolkit::SoftButtonEffect::New(Toolkit::SoftButtonEffect::ELLIPTICAL); + DALI_TEST_CHECK( effect ); + + // Check the names, this names are used in the shader code, + // if they change in the shader code, then it has to be updated here. + DALI_TEST_EQUALS( effect.GetLightingIndentationAmountPropertyName(), "uLightingIndentationAmount", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetTextureDistortionAmountPropertyName(), "uTextureDistortAmount", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetAmbientLightAmountPropertyName(), "uAmbientLight", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetDiffuseLightPropertyName(), "uDiffuseLight", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetLightingMultiplierPropertyName(), "uLightMultiplier", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetInsideShapeSizeScalePropertyName(), "uInsideCircleSizeScale", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetOutsideShapeDepthPropertyName(), "uOutsideCircleDepth", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetEffectPixelAreaPropertyName(), "uEffectRegion", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetRectangleSizeScalePropertyName(), "uRectangleSizeScale", TEST_LOCATION ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-SpiralLayout.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-SpiralLayout.cpp new file mode 100644 index 0000000..edc55c8 --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-SpiralLayout.cpp @@ -0,0 +1,569 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include // for FLT_MAX +#include +#include + + +using namespace Dali; +using namespace Toolkit; + +void spiral_layout_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void spiral_layout_cleanup(void) +{ + test_return_value = TET_PASS; +} + +namespace +{ +const unsigned int TOTAL_ITEM_NUMBER = 200; + +Vector3 SpiralLayoutItemSizeFunction(const Vector3& layoutSize) +{ + float width = layoutSize.width * 0.2f; + return Vector3(width, width, width); +} + +float SpiralLayoutSpiralRadiusFunction(const Vector3& layoutSize) +{ + return layoutSize.width * 0.5f; +} + + +// Implementation of ItemFactory for providing actors to ItemView +class TestItemFactory : public ItemFactory +{ +public: + + /** + * Constructor + * @param application class, stored as reference + */ + TestItemFactory() + { + } + +public: // From ItemFactory + + /** + * Query the number of items available from the factory. + * The maximum available item has an ID of GetNumberOfItems() - 1. + */ + virtual unsigned int GetNumberOfItems() + { + return TOTAL_ITEM_NUMBER; + } + + /** + * Create an Actor to represent a visible item. + * @param itemId + * @return the created actor. + */ + virtual Actor NewItem(unsigned int itemId) + { + // Create an test actor for this item + ImageActor actor = CreateSolidColorActor(Color::RED); + actor.SetSize(64.0f, 64.0f); + + return actor; + } +}; + +} // namespace + + +int UtcDaliSpiralLayoutNew(void) +{ + ToolkitTestApplication application; + + // Create a spiral layout + SpiralLayoutPtr spiralLayout = SpiralLayout::New(); + + DALI_TEST_CHECK(spiralLayout); + END_TEST; +} + +int UtcDaliSpiralSetAndGetItemSizeFunction(void) +{ + ToolkitTestApplication application; + + // Create a spiral layout + SpiralLayoutPtr spiralLayout = SpiralLayout::New(); + + // Set the item size function + spiralLayout->SetItemSizeFunction(SpiralLayoutItemSizeFunction); + + // Check whether we get the correct item size function + DALI_TEST_CHECK(spiralLayout->GetItemSizeFunction() == SpiralLayoutItemSizeFunction); + END_TEST; +} + +int UtcDaliSpiralSetAndGetItemSpacing(void) +{ + ToolkitTestApplication application; + + // Create a spiral layout + SpiralLayoutPtr spiralLayout = SpiralLayout::New(); + + // Set the item spacing + spiralLayout->SetItemSpacing(Radian(0.6f)); + + // Check whether we get the correct item spacing + DALI_TEST_EQUALS(spiralLayout->GetItemSpacing(), 0.6f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliSpiralSetAndGetRevolutionDistance(void) +{ + ToolkitTestApplication application; + + // Create a spiral layout + SpiralLayoutPtr spiralLayout = SpiralLayout::New(); + + // Set the revolution distance + spiralLayout->SetRevolutionDistance(150.0f); + + // Check whether we get the correct revolution distance + DALI_TEST_EQUALS(spiralLayout->GetRevolutionDistance(), 150.0f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliSpiralSetAndGetSpiralRadiusFunction(void) +{ + ToolkitTestApplication application; + + // Create a spiral layout + SpiralLayoutPtr spiralLayout = SpiralLayout::New(); + + // Set the spiral radius function + spiralLayout->SetSpiralRadiusFunction(SpiralLayoutSpiralRadiusFunction); + + // Check whether we get the correct spiral radius function + DALI_TEST_CHECK(spiralLayout->GetSpiralRadiusFunction() == SpiralLayoutSpiralRadiusFunction); + END_TEST; +} + +int UtcDaliSpiralSetAndGetTopItemAlignment(void) +{ + ToolkitTestApplication application; + + // Create a spiral layout + SpiralLayoutPtr spiralLayout = SpiralLayout::New(); + + // Set the alignment of the top item + spiralLayout->SetTopItemAlignment(-0.25f); + + // Check whether we get the correct alignment of the top item + DALI_TEST_EQUALS(spiralLayout->GetTopItemAlignment(), -0.25f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliSpiralSetAndGetScrollSpeedFactor(void) +{ + ToolkitTestApplication application; + + // Create a spiral layout + SpiralLayoutPtr spiralLayout = SpiralLayout::New(); + + // Set the scroll speed factor + spiralLayout->SetScrollSpeedFactor(0.05f); + + // Check whether we get the correct scroll speed factor + DALI_TEST_EQUALS(spiralLayout->GetScrollSpeedFactor(), 0.05f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliSpiralSetAndGetMaximumSwipeSpeed(void) +{ + ToolkitTestApplication application; + + // Create a spiral layout + SpiralLayoutPtr spiralLayout = SpiralLayout::New(); + + // Set the maximum swipe speed + spiralLayout->SetMaximumSwipeSpeed(50.0f); + + // Check whether we get the correct maximum swipe speed + DALI_TEST_EQUALS(spiralLayout->GetMaximumSwipeSpeed(), 50.0f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliSpiralLayoutSetAndGetItemFlickAnimationDuration(void) +{ + ToolkitTestApplication application; + + // Create a spiral layout + SpiralLayoutPtr spiralLayout = SpiralLayout::New(); + + // Set the flick animaiton duration + spiralLayout->SetItemFlickAnimationDuration(0.35f); + + // Check whether we get the correct flick animaiton duration + DALI_TEST_EQUALS( spiralLayout->GetItemFlickAnimationDuration(), 0.35f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliSpiralLayoutConstraintLeft(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + SpiralLayoutPtr layout = SpiralLayout::New(); + + view.SetName("view actor"); + view.AddLayout(*layout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + layout->SetOrientation(ControlOrientation::Left); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + // Confirm: we have actors in the view and they are positioned some distance from the origin. + int nonZeroCount = 0; + int elementsFound = 0; + for(unsigned int i = 0; i < 10; i++) + { + Actor testActor = view.GetItem(i); + if (testActor) + { + elementsFound++; + Vector3 pos = testActor.GetCurrentPosition(); + + if (pos.LengthSquared() > 0.0f) + { + nonZeroCount++; + } + } + } + + DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound)); + Stage::GetCurrent().Remove(view); + END_TEST; +} + +int UtcDaliSpiralLayoutConstraintRight(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + SpiralLayoutPtr layout = SpiralLayout::New(); + + view.SetName("view actor"); + view.AddLayout(*layout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + layout->SetOrientation(ControlOrientation::Right); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + // Confirm: we have actors in the view and they are positioned some distance from the origin. + int nonZeroCount = 0; + int elementsFound = 0; + for(unsigned int i = 0; i < 10; i++) + { + Actor testActor = view.GetItem(i); + if (testActor) + { + elementsFound++; + Vector3 pos = testActor.GetCurrentPosition(); + + if (pos.LengthSquared() > 0.0f) + { + nonZeroCount++; + } + } + } + + DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound)); + Stage::GetCurrent().Remove(view); + END_TEST; +} + +int UtcDaliSpiralLayoutConstraintUp(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + SpiralLayoutPtr layout = SpiralLayout::New(); + + view.SetName("view actor"); + view.AddLayout(*layout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + layout->SetOrientation(ControlOrientation::Up); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + // Confirm: we have actors in the view and they are positioned some distance from the origin. + int nonZeroCount = 0; + int elementsFound = 0; + for(unsigned int i = 0; i < 10; i++) + { + Actor testActor = view.GetItem(i); + if (testActor) + { + elementsFound++; + Vector3 pos = testActor.GetCurrentPosition(); + + if (pos.LengthSquared() > 0.0f) + { + nonZeroCount++; + } + } + } + + DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound)); + + layout->GetClosestOnScreenLayoutPosition(0, 0.0f, vec); + int nextItem = layout->GetNextFocusItemID(0, 10, Dali::Toolkit::Control::Right, false); + DALI_TEST_CHECK(nextItem == 1); + + Stage::GetCurrent().Remove(view); + END_TEST; +} + +int UtcDaliSpiralLayoutConstraintDown(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + SpiralLayoutPtr layout = SpiralLayout::New(); + + view.SetName("view actor"); + view.AddLayout(*layout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + layout->SetOrientation(ControlOrientation::Down); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + // Confirm: we have actors in the view and they are positioned some distance from the origin. + int nonZeroCount = 0; + int elementsFound = 0; + for(unsigned int i = 0; i < 10; i++) + { + Actor testActor = view.GetItem(i); + if (testActor) + { + elementsFound++; + Vector3 pos = testActor.GetCurrentPosition(); + + if (pos.LengthSquared() > 0.0f) + { + nonZeroCount++; + } + } + } + + DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound)); + Stage::GetCurrent().Remove(view); + END_TEST; +} + +int UtcDaliSpiralLayoutScrollDirection(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + SpiralLayoutPtr navigationLayout = SpiralLayout::New(); + + view.SetName("view actor"); + view.AddLayout(*navigationLayout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + navigationLayout->SetOrientation(ControlOrientation::Left); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + ItemLayoutPtr layout = navigationLayout; + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + navigationLayout->SetOrientation(ControlOrientation::Up); + view.ActivateLayout(0, vec, 0.0f); + application.SendNotification(); + application.Render(); + + Degree deg = layout->GetScrollDirection(); + DALI_TEST_CHECK(deg == -45.0f); + + navigationLayout->SetOrientation(ControlOrientation::Down); + view.ActivateLayout(0, vec, 0.0f); + application.SendNotification(); + application.Render(); + + deg = layout->GetScrollDirection(); + DALI_TEST_CHECK((deg == 180.0f - 45.0f)); + + layout->SetOrientation(ControlOrientation::Left); + view.ActivateLayout(0, vec, 0.0f); + application.SendNotification(); + application.Render(); + + deg = layout->GetScrollDirection(); + DALI_TEST_CHECK(deg == 45.0f); + + navigationLayout->SetOrientation(ControlOrientation::Right); + view.ActivateLayout(0, vec, 0.0f); + application.SendNotification(); + application.Render(); + + deg = layout->GetScrollDirection(); + DALI_TEST_CHECK(deg == (270.0f - 45.0f)); + + Stage::GetCurrent().Remove(view); + END_TEST; +} + +int UtcDaliSpiralLayoutGetScrollToPosition(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + SpiralLayoutPtr layout = SpiralLayout::New(); + + view.SetName("view actor"); + view.AddLayout(*layout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + layout->SetOrientation(ControlOrientation::Up); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + // Confirm: we have actors in the view. + std::vector indices; + for(unsigned int i = 0; i < 10; i++) + { + Actor testActor = view.GetItem(i); + if (testActor) + { + indices.push_back(i); + } + } + + try + { + if (!indices.empty()) + { + const unsigned int firstTargetIndex = indices[indices.size()-1]; + // scroll to last item + view.ScrollToItem(firstTargetIndex, 0.00f); + application.Render(16); // 60hz frames + + std::size_t moveCount = 0; + for(std::size_t i = 0; i < indices.size(); i++) + { + float layoutPosBefore = view.GetCurrentLayoutPosition(i); + view.ScrollToItem(indices[i], 0.0f); + + application.Render(16); // 60hz frame + + float layoutPosAfter = view.GetCurrentLayoutPosition(i); + + if (fabs(layoutPosBefore-layoutPosAfter) <= FLT_EPSILON) + { + ++moveCount; + } + } + + DALI_TEST_CHECK((moveCount == indices.size())); + } + } + catch(...) + { + tet_result(TET_FAIL); + } + + Stage::GetCurrent().Remove(view); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-SpotEffect.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-SpotEffect.cpp new file mode 100644 index 0000000..cacdb0d --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-SpotEffect.cpp @@ -0,0 +1,132 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + + +using namespace Dali; + +void spot_effect_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void spot_effect_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +int UtcDaliSpotUninitializedEffect(void) +{ + ToolkitTestApplication application; + + Toolkit::SpotEffect effect; + + try + { + // New() must be called to create a SpotEffect or it wont be valid. + effect.SetRadius( 0.5f ); + DALI_TEST_CHECK( false ); + } + catch (Dali::DaliException& e) + { + // Tests that a negative test of an assertion succeeds + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_CHECK(!effect); + } + END_TEST; +} + +int UtcDaliSpotPropertyNamesEffect(void) +{ + ToolkitTestApplication application; + + Toolkit::SpotEffect effect = Toolkit::SpotEffect::New(); + + // Check the names, this names are used in the shaders code, + // if they change the shader code has to be updated + DALI_TEST_EQUALS( effect.GetCenterPropertyName(), "uCenter", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetRadiusPropertyName(), "uRadius", TEST_LOCATION ); + END_TEST; +} + +int UtcDaliSpotDefaultValuesEffect(void) +{ + ToolkitTestApplication application; + + Toolkit::SpotEffect effect = Toolkit::SpotEffect::New(); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + // Gets converted to opengl viewport coordinates + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetCenterPropertyName().c_str(), + Vector2(0.0f, 0.0f) ) ); + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetRadiusPropertyName().c_str(), + 0.0f ) ); + END_TEST; +} + +int UtcDaliSpotCustomValuesEffect(void) +{ + ToolkitTestApplication application; + + Toolkit::SpotEffect effect = Toolkit::SpotEffect::New(); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + + effect.SetCenter( Vector2(480.0f, 800.0f) ); + effect.SetRadius( 5.0f ); + + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + // Gets converted to opengl viewport coordinates + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetCenterPropertyName().c_str(), + Vector2(480.0f, 800.0f) ) ); + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetRadiusPropertyName().c_str(), + 5.0f ) ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-SquareDissolveEffect.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-SquareDissolveEffect.cpp new file mode 100644 index 0000000..eee5f13 --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-SquareDissolveEffect.cpp @@ -0,0 +1,156 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + + +using namespace Dali; + +void square_dissolve_effect_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void square_dissolve_effect_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +int UtcDaliSquareDissolveEffectUninitialized(void) +{ + ToolkitTestApplication application; + + Toolkit::SquareDissolveEffect effect; + + try + { + // New() must be called to create a SquareDissolveEffect or it wont be valid. + effect.SetStep( 2.0f ); + DALI_TEST_CHECK( false ); + } + catch (Dali::DaliException& e) + { + // Tests that a negative test of an assertion succeeds + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_CHECK(!effect); + } + END_TEST; +} + +int UtcDaliSquareDissolveEffectPropertyNames(void) +{ + ToolkitTestApplication application; + + Toolkit::SquareDissolveEffect effect = Toolkit::SquareDissolveEffect::New(); + + // Check the names, this names are used in the shaders code, + // if they change the shader code has to be updated + DALI_TEST_EQUALS( effect.GetStepPropertyName(), "uStep", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetRowsPropertyName(), "uRows", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetColumnsPropertyName(), "uColumns", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetTexSizePropertyName(), "texSize", TEST_LOCATION ); + END_TEST; +} + +int UtcDaliSquareDissolveEffectDefaultValues(void) +{ + ToolkitTestApplication application; + + Toolkit::SquareDissolveEffect effect = Toolkit::SquareDissolveEffect::New(); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + // Gets converted to opengl viewport coordinates + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetStepPropertyName().c_str(), + 0.1f ) ); + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetRowsPropertyName().c_str(), + 25.0f ) ); + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetColumnsPropertyName().c_str(), + 25.0f ) ); + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetTexSizePropertyName().c_str(), + Vector2(1.0f, 1.0f) ) ); + END_TEST; +} + +int UtcDaliSquareDissolveEffectCustomValues(void) +{ + ToolkitTestApplication application; + + Toolkit::SquareDissolveEffect effect = Toolkit::SquareDissolveEffect::New(); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + + effect.SetStep( 2.0f ); + effect.SetRows( 3.0f ); + effect.SetColumns( 4.0f ); + effect.SetTextureSize( Vector2(12.0f, 13.0f) ); + + actor.SetShaderEffect(effect); + Stage::GetCurrent().Add(actor); + + application.SendNotification(); + application.Render(); + + // Gets converted to opengl viewport coordinates + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetStepPropertyName().c_str(), + 2.0f ) ); + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetRowsPropertyName().c_str(), + 3.0f ) ); + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetColumnsPropertyName().c_str(), + 4.0f ) ); + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetTexSizePropertyName().c_str(), + Vector2(12.0f, 13.0f) ) ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-TableView.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-TableView.cpp new file mode 100644 index 0000000..d46f57d --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-TableView.cpp @@ -0,0 +1,542 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + +using namespace Dali; +using namespace Toolkit; + +void dali_tableview_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void dali_tableview_cleanup(void) +{ + test_return_value = TET_PASS; +} + +namespace +{ +static bool gObjectCreatedCallBackCalled; + +static void TestCallback(BaseHandle handle) +{ + gObjectCreatedCallBackCalled = true; +} + + +struct Constraint100 +{ + Constraint100( ) + { + } + + /** + * function operator to apply the parent size + */ + Dali::Vector3 operator()(const Dali::Vector3& current) + { + return Dali::Vector3( 100.0f, 100.0f, 100.0f ); + } +}; + +// Convenience function to quickly set up a 10x10 table with each cell being 10x10 pixels in size by default. +static void SetupTableViewAndActors(TableView& tableView, Actor& actor1, Actor& actor2, Actor& actor3) +{ + tableView = TableView::New(10,10); // 10 by 10 grid. + DALI_TEST_CHECK(tableView); + + Stage::GetCurrent().Add( tableView ); + tableView.ApplyConstraint( Constraint::New( Actor::SIZE, Constraint100() ) ); + tableView.SetLayoutAnimationDuration(0.0f); + + actor1 = Actor::New(); + actor2 = Actor::New(); + actor3 = Actor::New(); + + actor1.SetSize(10,10); + actor2.SetSize(10,10); + actor3.SetSize(10,10); + + tableView.AddChild(actor1, TableView::CellPosition(0,0)); + tableView.AddChild(actor2, TableView::CellPosition(0,1)); + tableView.AddChild(actor3, TableView::CellPosition(1,0)); +} + +} // namespace + + +int UtcDaliTableViewNew(void) +{ + ToolkitTestApplication application; + + TableView tableView = TableView::New(10,10); + DALI_TEST_CHECK(tableView); + + //Additional check to ensure object is created by checking if it's registered + ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + DALI_TEST_CHECK( registry ); + + gObjectCreatedCallBackCalled = false; + registry.ObjectCreatedSignal().Connect(&TestCallback); + { + TableView tableView = TableView::New(10,10); + } + DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + END_TEST; +} + +// Test adjusting the metric values for the cell. +int UtcDaliTableViewMetricsPadding(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTableViewMetricsPadding"); + + TableView tableView; + Actor actor1; + Actor actor2; + Actor actor3; + + SetupTableViewAndActors(tableView, actor1, actor2, actor3); + + // 1. check that padding works. no padding: + tableView.SetCellPadding(Size(0.0f, 0.0f)); + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( tableView.GetCellPadding(), Size(0.0f, 0.0f), TEST_LOCATION ); + DALI_TEST_EQUALS( actor1.GetCurrentPosition(), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION ); + DALI_TEST_EQUALS( actor2.GetCurrentPosition(), Vector3(10.0f, 0.0f, 0.0f), TEST_LOCATION ); + DALI_TEST_EQUALS( actor3.GetCurrentPosition(), Vector3(0.0f, 10.0f, 0.0f), TEST_LOCATION ); + + // 1. check that padding works. some padding: + tableView.SetCellPadding(Size(5.0f, 10.0f)); + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( tableView.GetCellPadding(), Size(5.0f, 10.0f), TEST_LOCATION ); + DALI_TEST_EQUALS( actor1.GetCurrentPosition(), Vector3(5.0f, 10.0f, 0.0f), TEST_LOCATION ); + END_TEST; +} + +// Test adjusting the metric values for the cell. +int UtcDaliTableViewMetricsFixed(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTableViewMetricsFixed"); + + TableView tableView; + Actor actor1; + Actor actor2; + Actor actor3; + + SetupTableViewAndActors(tableView, actor1, actor2, actor3); + application.SendNotification(); + application.Render(); + + // 1. check that with no fixed width/heights, actors are in default position. + DALI_TEST_EQUALS( actor1.GetCurrentPosition(), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION ); + DALI_TEST_EQUALS( actor2.GetCurrentPosition(), Vector3(10.0f, 0.0f, 0.0f), TEST_LOCATION ); + DALI_TEST_EQUALS( actor3.GetCurrentPosition(), Vector3(0.0f, 10.0f, 0.0f), TEST_LOCATION ); + + // 2. check that with a fixed width & height, actors to the right and below are offsetted. + tableView.SetFixedWidth(0, 20.0f); + tableView.SetFixedHeight(0, 50.0f); + DALI_TEST_EQUALS( tableView.GetFixedWidth(0), 20.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( tableView.GetFixedHeight(0), 50.0f, TEST_LOCATION ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( actor1.GetCurrentPosition(), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION ); + DALI_TEST_EQUALS( actor2.GetCurrentPosition(), Vector3(20.0f, 0.0f, 0.0f), TEST_LOCATION ); + DALI_TEST_EQUALS( actor3.GetCurrentPosition(), Vector3(0.0f, 50.0f, 0.0f), TEST_LOCATION ); + END_TEST; +} + +// Test adjusting the metric values for the cell. +int UtcDaliTableViewMetricsRelative(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTableViewMetricsRelative"); + + TableView tableView; + Actor actor1; + Actor actor2; + Actor actor3; + + SetupTableViewAndActors(tableView, actor1, actor2, actor3); + application.SendNotification(); + application.Render(); + + // 1. check that with no relative width/heights, actors are in default position. + DALI_TEST_EQUALS( actor1.GetCurrentPosition(), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION ); + DALI_TEST_EQUALS( actor2.GetCurrentPosition(), Vector3(10.0f, 0.0f, 0.0f), TEST_LOCATION ); + DALI_TEST_EQUALS( actor3.GetCurrentPosition(), Vector3(0.0f, 10.0f, 0.0f), TEST_LOCATION ); + + // 2. check that with a relative width & height, actors to the right and below are offsetted. + tableView.SetRelativeWidth(0, 0.3f); // cell 0,0 occupies 30%x50% of the grid (i.e. 30x50 pixels) + tableView.SetRelativeHeight(0, 0.5f); + DALI_TEST_EQUALS( tableView.GetRelativeWidth(0), 0.3f, TEST_LOCATION ); + DALI_TEST_EQUALS( tableView.GetRelativeHeight(0), 0.5f, TEST_LOCATION ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( actor1.GetCurrentPosition(), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION ); + DALI_TEST_EQUALS( actor2.GetCurrentPosition(), Vector3(30.0f, 0.0f, 0.0f), TEST_LOCATION ); + DALI_TEST_EQUALS( actor3.GetCurrentPosition(), Vector3(0.0f, 50.0f, 0.0f), TEST_LOCATION ); + END_TEST; +} + + +// Test animation duration setting. +int UtcDaliTableViewAnimation(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTableViewAnimation"); + TableView tableView = TableView::New(10,10); + DALI_TEST_CHECK(tableView); + + tableView.SetLayoutAnimationDuration(5.0f); + DALI_TEST_EQUALS(tableView.GetLayoutAnimationDuration(), 5.0f, TEST_LOCATION); + + tableView.SetLayoutAnimationDuration(2.5f); + DALI_TEST_EQUALS(tableView.GetLayoutAnimationDuration(), 2.5f, TEST_LOCATION); + END_TEST; +} + +// Test Adding/Removing/Finding Children. +int UtcDaliTableViewChild(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTableViewChild"); + + // Create a 10x10 table-view + TableView tableView = TableView::New(10,10); + DALI_TEST_CHECK( tableView ); + + // Check if actor doesn't exist. + DALI_TEST_CHECK( !tableView.GetChildAt(TableView::CellPosition(0,0)) ); + + // Add an actor to it at 0,0 + Actor actor = Actor::New(); + tableView.AddChild(actor, TableView::CellPosition()); + + // Check if exists. + DALI_TEST_CHECK( tableView.GetChildAt(TableView::CellPosition(0,0)) ); + + // Remove this actor + tableView.RemoveChildAt(TableView::CellPosition()); + + // Check if actor no longer exists. + DALI_TEST_CHECK( !tableView.GetChildAt(TableView::CellPosition(0,0)) ); + + // Add actor to it again, but at 2,5 + tableView.AddChild(actor, TableView::CellPosition(2,5)); + + // Add another actor somewhere else 7,8 + Actor actor2 = Actor::New(); + tableView.AddChild(actor2, TableView::CellPosition(7,8)); + + Actor searchActor; + + // Check that no actor exists in a few random places. + DALI_TEST_CHECK( !tableView.GetChildAt(TableView::CellPosition(0,0)) ); + DALI_TEST_CHECK( !tableView.GetChildAt(TableView::CellPosition(2,1)) ); + DALI_TEST_CHECK( !tableView.GetChildAt(TableView::CellPosition(6,3)) ); + DALI_TEST_CHECK( !tableView.GetChildAt(TableView::CellPosition(9,5)) ); + + // Check for actors at actual positions. + searchActor = tableView.GetChildAt(TableView::CellPosition(2,5)); + DALI_TEST_CHECK( searchActor == actor); + + searchActor = tableView.GetChildAt(TableView::CellPosition(7,8)); + DALI_TEST_CHECK( searchActor == actor2); + + // Create a second table, and add already added Child to new one. + TableView tableView2 = TableView::New(5,5); + tableView2.AddChild(actor, TableView::CellPosition(2,2)); + DALI_TEST_CHECK( tableView2.GetChildAt(TableView::CellPosition(2,2)) ); + END_TEST; +} + +// Test calling Add on it's own (to invoke the OnChildAdd) +int UtcDaliTableViewAdd(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTableViewAdd"); + + // Create a 4x1 table-view, and just keep adding. + TableView tableView = TableView::New(1,4); + DALI_TEST_CHECK( tableView ); + + for(unsigned int i = 0;i<16;i++) + { + Actor currentActor = Actor::New(); + TableView::CellPosition position = TableView::CellPosition(); + tableView.Add( currentActor ); + tableView.FindChildPosition(currentActor, position); + tet_printf("%dx%d (%d,%d)\n", tableView.GetColumns(), tableView.GetRows(), position.columnIndex, position.rowIndex); + + DALI_TEST_EQUALS((position.rowIndex * 4 + position.columnIndex), i, TEST_LOCATION); + } + END_TEST; +} + +// Test cell modification. +int UtcDaliTableViewCells(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliTableViewCells"); + + // Create a 10x10 table-view + TableView tableView = TableView::New(10,10); + DALI_TEST_CHECK( tableView ); + + // Add a few actors to the table. + Actor actor1 = Actor::New(); + Actor actor2 = Actor::New(); + Actor actor3 = Actor::New(); + actor1.SetName("Actor1"); + actor2.SetName("Actor2"); + actor3.SetName("Actor3"); + + // note: positions are specified in reversed cartesian coords - row,col (i.e. y,x) + tableView.AddChild(actor1, TableView::CellPosition(0,0)); + tableView.AddChild(actor2, TableView::CellPosition(5,5)); + tableView.AddChild(actor3, TableView::CellPosition(7,2)); + + DALI_TEST_CHECK( tableView.GetRows() == 10 && tableView.GetColumns() == 10 ); + + // Add a row between actor1 and actor2 | insert column on actor1 and see what happens... + tableView.InsertRow(3); + tableView.InsertColumn(0); + DALI_TEST_CHECK( tableView.GetRows() == 11 && tableView.GetColumns() == 11 ); + + TableView::CellPosition cellPosition; + bool result; + + result = tableView.FindChildPosition(actor1, cellPosition); + DALI_TEST_CHECK( result && cellPosition.rowIndex == 0 && cellPosition.columnIndex == 1); + result = tableView.FindChildPosition(actor2, cellPosition); + DALI_TEST_CHECK( result && cellPosition.rowIndex == 6 && cellPosition.columnIndex == 6); + result = tableView.FindChildPosition(actor3, cellPosition); + DALI_TEST_CHECK( result && cellPosition.rowIndex == 8 && cellPosition.columnIndex == 3); + + // Delete a row between actor2 and actor3 | delete column on actor2 and see what happens... + tableView.DeleteRow(7); + tableView.DeleteColumn(6); + DALI_TEST_CHECK( tableView.GetRows() == 10 && tableView.GetColumns() == 10 ); + + result = tableView.FindChildPosition(actor1, cellPosition); + DALI_TEST_CHECK( result && cellPosition.rowIndex == 0 && cellPosition.columnIndex == 1); + result = tableView.FindChildPosition(actor2, cellPosition); + DALI_TEST_CHECK( !result ); + result = tableView.FindChildPosition(actor3, cellPosition); + DALI_TEST_CHECK( result && cellPosition.rowIndex == 7 && cellPosition.columnIndex == 3); + + // Delete the other two remaining actors by a row delete and a column delete. + std::vector actorsRemoved; + tableView.DeleteRow(0, actorsRemoved); + tet_printf("Row Delete >> Actors Removed: %d {", actorsRemoved.size()); + for(size_t i = 0;i %s, ", i, actorsRemoved[i].GetName().c_str()); + tet_printf("}\n"); + DALI_TEST_EQUALS( static_cast(actorsRemoved.size()), 1, TEST_LOCATION ); + DALI_TEST_CHECK( actorsRemoved[0] == actor1 ); + + actorsRemoved.clear(); + tableView.DeleteColumn(3, actorsRemoved); + tet_printf("Column Delete >> Actors Removed: %d {", actorsRemoved.size()); + for(size_t i = 0;i %s, ", i, actorsRemoved[i].GetName().c_str()); + tet_printf("}\n"); + DALI_TEST_EQUALS( static_cast(actorsRemoved.size()), 1, TEST_LOCATION ); + DALI_TEST_CHECK( actorsRemoved[0] == actor3 ); + + DALI_TEST_CHECK( tableView.GetRows() == 9 && tableView.GetColumns() == 9 ); + + tableView.AddChild(actor1, TableView::CellPosition(5,8)); + tableView.Resize(100,100); + DALI_TEST_CHECK( tableView.GetRows() == 100 && tableView.GetColumns() == 100 ); + + tableView.AddChild(actor2, TableView::CellPosition(69,57)); + DALI_TEST_CHECK( tableView.FindChildPosition(actor1, cellPosition) && tableView.FindChildPosition(actor2, cellPosition) ); + + tableView.Resize(20,20); + DALI_TEST_CHECK( tableView.FindChildPosition(actor1, cellPosition) && !tableView.FindChildPosition(actor2, cellPosition) ); + + actorsRemoved.clear(); + tableView.Resize(1,1, actorsRemoved); + DALI_TEST_CHECK( !tableView.FindChildPosition(actor1, cellPosition) && !tableView.FindChildPosition(actor2, cellPosition) ); + DALI_TEST_EQUALS( static_cast(actorsRemoved.size()), 1, TEST_LOCATION ); + DALI_TEST_CHECK( actorsRemoved[0] == actor1 ); + + // Add child outside table size, forcing a resize. + tableView.AddChild(actor1, TableView::CellPosition(100, 100, 1, 1)); + DALI_TEST_CHECK( tableView.GetRows() == 101 && tableView.GetColumns() == 101 ); + + // Add child outside table size, forcing a resize. + tableView.AddChild(actor1, TableView::CellPosition(110, 110, 5, 5)); + DALI_TEST_CHECK( tableView.GetRows() == 115 && tableView.GetColumns() == 115 ); + + DALI_TEST_CHECK( true ); + END_TEST; +} + +int UtcDaliTableViewChildAssert(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliTableViewChildAssert"); + + // Create a 10x10 table-view + TableView tableView = TableView::New(10,10); + DALI_TEST_CHECK( tableView ); + Actor childActor; + + try + { + tableView.AddChild( childActor, TableView::CellPosition(0,0,5,5) ); + // should assert + tet_result(TET_FAIL); + } + catch( Dali::DaliException &e ) + { + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_EQUALS(e.mCondition, "child", TEST_LOCATION); + } + END_TEST; +} + +int UtcDaliTableViewMetricsAssert(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliTableViewChildAssert"); + + // Create a 10x10 table-view + TableView tableView = TableView::New(10,10); + DALI_TEST_CHECK( tableView ); + + // fixeds... + + try + { + tableView.SetFixedHeight( 10, 1.0f ); + + tet_result(TET_FAIL); + } + catch( Dali::DaliException &e) + { + tet_printf("1. Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_EQUALS(e.mCondition, "rowIndex < mFixedHeights.size()", TEST_LOCATION); + } + + try + { + tableView.GetFixedHeight( 10 ); + + tet_result(TET_FAIL); + } + catch( Dali::DaliException &e) + { + tet_printf("2. Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_EQUALS(e.mCondition, "rowIndex < mFixedHeights.size()", TEST_LOCATION); + } + + try + { + tableView.SetFixedWidth( 10, 1.0f ); + + tet_result(TET_FAIL); + } + catch( Dali::DaliException &e) + { + tet_printf("3. Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_EQUALS(e.mCondition, "columnIndex < mFixedWidths.size()", TEST_LOCATION); + } + + try + { + tableView.GetFixedWidth( 10 ); + + tet_result(TET_FAIL); + } + catch( Dali::DaliException &e) + { + tet_printf("4. Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_EQUALS(e.mCondition, "columnIndex < mFixedWidths.size()", TEST_LOCATION); + } + + // relatives... + + try + { + tableView.SetRelativeHeight( 10, 0.1f ); + + tet_result(TET_FAIL); + } + catch( Dali::DaliException &e) + { + tet_printf("5. Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_EQUALS(e.mCondition, "rowIndex < mRelativeHeights.size()", TEST_LOCATION); + } + + try + { + tableView.GetRelativeHeight( 10 ); + + tet_result(TET_FAIL); + } + catch( Dali::DaliException &e) + { + tet_printf("6. Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_EQUALS(e.mCondition, "rowIndex < mRelativeHeights.size()", TEST_LOCATION); + } + + try + { + tableView.SetRelativeWidth( 10, 0.1f ); + + tet_result(TET_FAIL); + } + catch( Dali::DaliException &e) + { + tet_printf("7. Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_EQUALS(e.mCondition, "columnIndex < mRelativeWidths.size()", TEST_LOCATION); + } + + try + { + tableView.GetRelativeWidth( 10 ); + + tet_result(TET_FAIL); + } + catch( Dali::DaliException &e) + { + tet_printf("8. Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_EQUALS(e.mCondition, "columnIndex < mRelativeWidths.size()", TEST_LOCATION); + } + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-TextInput.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-TextInput.cpp new file mode 100644 index 0000000..177a44d --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-TextInput.cpp @@ -0,0 +1,266 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include +#include + +using namespace Dali; +using namespace Toolkit; + + +int UtcDaliTextInputSetActiveStyle(void) +{ + ToolkitTestApplication application; + + tet_infoline("Testing Setting of Style to newly added text"); + + TextInput textInput = TextInput::New(); // create empty TextInput + + Stage::GetCurrent().Add(textInput); + + const std::string styledString = "Test Stringab" ; + const std::string plainString = "Test String"; + textInput.SetInitialText( plainString ); + + application.SendNotification(); + application.Render(); + + textInput.SetEditable(true); + + std::string retreivedMarkupString = textInput.GetMarkupText(); + + tet_infoline("Confirm markup text is a plain string "); + DALI_TEST_EQUALS( plainString,textInput.GetText(), TEST_LOCATION); + + TextStyle style; + style.SetItalics( true ); + + tet_infoline("Apply style to TextInput"); + textInput.SetActiveStyle( style ); + + Integration::KeyEvent eventA("a", "a", 0, 0, 0, Integration::KeyEvent::Down ); + Integration::KeyEvent eventB("b", "b", 0, 0, 0, Integration::KeyEvent::Down ); + + application.SendNotification(); + application.Render(); + + application.ProcessEvent(eventA); + application.SendNotification(); + application.Render(); + + application.ProcessEvent(eventB); + application.SendNotification(); + application.Render(); + + retreivedMarkupString = textInput.GetMarkupText(); + + DALI_TEST_EQUALS( styledString, retreivedMarkupString, TEST_LOCATION); + END_TEST; +} + +int UtcDaliTextInputApplyStyleToSelectedText(void) +{ + ToolkitTestApplication application; + + tet_infoline("Testing application of style to selected text "); + + TextInput textInput = TextInput::New(); // create empty TextInput + + Stage::GetCurrent().Add(textInput); + + const std::string styledString = "Test String to style"; + const std::string plainString = "Test String to style"; + textInput.SetInitialText( plainString ); + + application.SendNotification(); + application.Render(); + + textInput.SetEditable(true); + + std::string retreivedMarkupString = textInput.GetMarkupText(); + + tet_infoline("Confirm markup text is a plain string "); + DALI_TEST_EQUALS( plainString,textInput.GetText(), TEST_LOCATION); + + TextStyle style; + style.SetItalics( true ); + + textInput.SelectText( 5, 11 ); + + tet_infoline("Apply style to selected text"); + textInput.ApplyStyle( style ); + + application.Render(); + + retreivedMarkupString = textInput.GetMarkupText(); + + DALI_TEST_EQUALS( styledString, retreivedMarkupString, TEST_LOCATION); + END_TEST; +} + +int UtcDaliTextInputApplyStyleToAll(void) +{ + ToolkitTestApplication application; + + tet_infoline("Testing application of style to all text "); + + TextInput textInput = TextInput::New(); // create empty TextInput + + Stage::GetCurrent().Add(textInput); + + const std::string styledString = "Test String to style"; + const std::string plainString = "Test String to style"; + textInput.SetInitialText( plainString ); + + application.SendNotification(); + application.Render(); + + textInput.SetEditable(true); + + std::string retreivedMarkupString = textInput.GetMarkupText(); + + tet_infoline("Confirm markup text is a plain string "); + DALI_TEST_EQUALS( plainString,textInput.GetText(), TEST_LOCATION); + + TextStyle style; + style.SetItalics( true ); + + tet_infoline("Apply style to all text"); + textInput.ApplyStyleToAll( style ); + + application.Render(); + + retreivedMarkupString = textInput.GetMarkupText(); + + DALI_TEST_EQUALS( styledString, retreivedMarkupString, TEST_LOCATION); + END_TEST; +} + +int UtcDaliTextInputGetStyleAtCursor(void) +{ + ToolkitTestApplication application; + + tet_infoline("Test getting style at cursor"); + + TextInput textInput = TextInput::New(); // create empty TextInput + + Stage::GetCurrent().Add(textInput); + + const std::string styledString = "Test Stringab" ; + const std::string plainString = "Test String"; + textInput.SetInitialText( plainString ); + + application.SendNotification(); + application.Render(); + + textInput.SetEditable(true); + + tet_infoline("Confirm style at cursor is default(plain)"); + TextStyle style; + Integration::KeyEvent eventA("a", "a", 0, 0, 0, Integration::KeyEvent::Down ); + application.ProcessEvent(eventA); + application.SendNotification(); + application.Render(); + + TextStyle retreivedStyleAtCursor = textInput.GetStyleAtCursor(); + + DALI_TEST_CHECK( style == retreivedStyleAtCursor ); + DALI_TEST_CHECK( !retreivedStyleAtCursor.GetItalics() ); + + tet_infoline("Set style before adding new character"); + style.SetItalics( true ); + textInput.SetActiveStyle( style ); + + Integration::KeyEvent eventB("b", "b", 0, 0, 0, Integration::KeyEvent::Down ); + application.ProcessEvent(eventB); + application.SendNotification(); + application.Render(); + + tet_infoline("Confirm style at cursor is correct style"); + retreivedStyleAtCursor = textInput.GetStyleAtCursor(); + + DALI_TEST_CHECK( retreivedStyleAtCursor.GetItalics() ); + + tet_infoline("Confirm style at cursor is not a style that was not set"); + DALI_TEST_CHECK( !retreivedStyleAtCursor.GetUnderline() ); + + tet_infoline("Confirm markup text is correct"); + DALI_TEST_EQUALS( styledString, textInput.GetMarkupText(), TEST_LOCATION); + + + + END_TEST; +} + +int UtcDaliTextInputSetAndGetTextAlignment(void) +{ + ToolkitTestApplication application; + + TextInput textInput = TextInput::New(); + textInput.SetTextAlignment(static_cast( Alignment::HorizontalCenter) ); + + bool result = ( textInput.GetTextAlignment() & Alignment::HorizontalCenter ) ; + + DALI_TEST_CHECK( result ); + + result = ( textInput.GetTextAlignment() & Alignment::HorizontalRight ); + + DALI_TEST_CHECK( !result ); + END_TEST; +} + +int UtcDaliTextInputSetAndGetMultilinePolicy(void) +{ + ToolkitTestApplication application; + + const TextView::MultilinePolicy MULTILINE_POLICIES[] = { TextView::SplitByNewLineChar, TextView::SplitByWord, TextView::SplitByChar }; + const unsigned int NUM_MULTILINE_POLICIES = sizeof( MULTILINE_POLICIES ) / sizeof( unsigned int ); + + TextInput textInput = TextInput::New(); + Stage::GetCurrent().Add(textInput); + textInput.SetInitialText( "Hello world!" ); + + for( unsigned int epIndex = 0; epIndex < NUM_MULTILINE_POLICIES; ++epIndex ) + { + textInput.SetMultilinePolicy( MULTILINE_POLICIES[epIndex] ); + + DALI_TEST_EQUALS( textInput.GetMultilinePolicy(), MULTILINE_POLICIES[epIndex], TEST_LOCATION ); + } + END_TEST; +} + +int UtcDaliTextInputSetAndGetExceedEnabled(void) +{ + ToolkitTestApplication application; + + const TextView::ExceedPolicy EXCEED_POLICIES[] = { TextView::Original, TextView::Fade, TextView::Split, TextView::ShrinkToFit }; + const unsigned int NUM_EXCEED_POLICIES = sizeof( EXCEED_POLICIES ) / sizeof( unsigned int ); + + TextInput textInput = TextInput::New(); + Stage::GetCurrent().Add(textInput); + textInput.SetInitialText( "Hello world!" ); + + for( unsigned int epIndex = 0; epIndex < NUM_EXCEED_POLICIES; ++epIndex ) + { + textInput.SetWidthExceedPolicy( EXCEED_POLICIES[epIndex] ); + + DALI_TEST_EQUALS( textInput.GetWidthExceedPolicy(), EXCEED_POLICIES[epIndex], TEST_LOCATION ); + } + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-ToolBar.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-ToolBar.cpp new file mode 100644 index 0000000..270882b --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-ToolBar.cpp @@ -0,0 +1,264 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include +#include + +using namespace Dali; +using namespace Toolkit; + +namespace +{ +static bool gObjectCreatedCallBackCalled; + +static void TestCallback(BaseHandle handle) +{ + gObjectCreatedCallBackCalled = true; +} +} // namespace + +void dali_toolbar_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void dali_toolbar_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +int UtcDaliToolBarNew(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliToolBarNew"); + + ToolBar toolbar; + + DALI_TEST_CHECK( !toolbar ); + + toolbar = ToolBar::New(); + + DALI_TEST_CHECK( toolbar ); + + ToolBar toolbar2(toolbar); + + DALI_TEST_CHECK( toolbar2 == toolbar ); + + //Additional check to ensure object is created by checking if it's registered + ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + DALI_TEST_CHECK( registry ); + + gObjectCreatedCallBackCalled = false; + registry.ObjectCreatedSignal().Connect(&TestCallback); + { + ToolBar toolbar = ToolBar::New(); + } + DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + + Actor actor = toolbar; + toolbar == ToolBar::DownCast( actor ); + + DALI_TEST_CHECK( toolbar ); + END_TEST; +} + +int UtcDaliToolBarSetBackground(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliToolBarSetBackground"); + + try + { + ImageActor toolBarBackground = CreateSolidColorActor( Color::RED ); + + ToolBar toolbar = ToolBar::New(); + toolbar.SetBackground( toolBarBackground ); + + Stage::GetCurrent().Add( toolbar ); + } + catch( ... ) + { + tet_result(TET_FAIL); + } + + tet_result(TET_PASS); + + application.SendNotification(); // VCC To be removed!! + application.Render(); // VCC To be removed!! + END_TEST; +} + +int UtcDaliToolBarAddControl01(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliToolBarAddControl01"); + + try + { + ImageActor control1 = CreateSolidColorActor( Color::RED ); + control1.SetSize( 100.f, 100.f ); + ImageActor control2 = CreateSolidColorActor( Color::RED ); + control2.SetSize( 100.f, 100.f ); + ImageActor control3 = CreateSolidColorActor( Color::RED ); + control3.SetSize( 100.f, 100.f ); + ImageActor control4 = CreateSolidColorActor( Color::RED ); + control4.SetSize( 100.f, 100.f ); + ImageActor control5 = CreateSolidColorActor( Color::RED ); + control5.SetSize( 100.f, 100.f ); + + ToolBar toolbar = ToolBar::New(); + toolbar.SetSize( 600.f, 100.f ); + + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + + toolbar.Add( control1 ); + toolbar.AddControl( control2, 0.1f, Alignment::HorizontalLeft, Alignment::Padding( 1.f, 1.f, 1.f, 1.f ) ); + toolbar.AddControl( control3, 0.1f, Alignment::HorizontalCenter, Alignment::Padding( 1.f, 1.f, 1.f, 1.f ) ); + toolbar.AddControl( control4, 0.1f, Alignment::HorizontalCenter, Alignment::Padding( 1.f, 1.f, 1.f, 1.f ) ); + toolbar.AddControl( control5, 0.1f, Alignment::HorizontalRight, Alignment::Padding( 1.f, 1.f, 1.f, 1.f ) ); + + ImageActor control6 = CreateSolidColorActor( Color::RED ); + control6.SetSize( 100.f, 100.f ); + ImageActor control7 = CreateSolidColorActor( Color::RED ); + control7.SetSize( 100.f, 100.f ); + ImageActor control8 = CreateSolidColorActor( Color::RED ); + control8.SetSize( 100.f, 100.f ); + + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + + toolbar.AddControl( control6, 0.4f, Alignment::HorizontalLeft, Alignment::Padding( 1.f, 1.f, 1.f, 1.f ) ); + toolbar.AddControl( control7, 0.2f, Alignment::HorizontalCenter, Alignment::Padding( 1.f, 1.f, 1.f, 1.f ) ); + toolbar.AddControl( control8, 0.2f, Alignment::HorizontalRight, Alignment::Padding( 1.f, 1.f, 1.f, 1.f ) ); + } + catch( ... ) + { + tet_result(TET_FAIL); + } + + tet_result(TET_PASS); + END_TEST; +} + +int UtcDaliToolBarAddControl02(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliToolBarAddControl02"); + + bool daliAssert = false; + + try + { + ImageActor control = CreateSolidColorActor( Color::RED ); + + ToolBar toolbar = ToolBar::New(); + + toolbar.AddControl( control, 0.1f, static_cast( 99 ), Alignment::Padding( 1.f, 1.f, 1.f, 1.f ) ); + } + catch( DaliException e ) + { + daliAssert = true; + tet_result(TET_PASS); + } + catch( ... ) + { + tet_result(TET_FAIL); + } + + if( !daliAssert ) + { + tet_result(TET_FAIL); + } + END_TEST; +} + +int UtcDaliToolBarRemoveControl01(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliToolBarRemoveControl01"); + + try + { + ImageActor control = CreateSolidColorActor( Color::RED ); + + ToolBar toolbar = ToolBar::New(); + toolbar.AddControl( control, 0.1f, Alignment::HorizontalLeft ); + + toolbar.RemoveControl( control ); + } + catch( ... ) + { + tet_result(TET_FAIL); + } + + tet_result(TET_PASS); + END_TEST; +} + +int UtcDaliToolBarRemoveControl02(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliToolBarRemoveControl02"); + + try + { + ImageActor control01 = CreateSolidColorActor( Color::RED ); + ImageActor control02 = CreateSolidColorActor( Color::RED ); + + ToolBar toolbar01 = ToolBar::New(); + ToolBar toolbar02 = ToolBar::New(); + toolbar01.AddControl( control01, 0.1f, Alignment::HorizontalLeft ); + toolbar02.AddControl( control02, 0.1f, Alignment::HorizontalLeft ); + + toolbar02.RemoveControl( control01 ); + } + catch( Dali::DaliException& e ) + { + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_EQUALS(e.mCondition, "false", TEST_LOCATION); + } + catch( ... ) + { + tet_result(TET_FAIL); + } + + try + { + ImageActor control = CreateSolidColorActor( Color::RED ); + + ToolBar toolbar = ToolBar::New(); + toolbar.AddControl( control, 0.1f, Alignment::HorizontalLeft ); + + toolbar.RemoveControl( control ); + toolbar.RemoveControl( control ); + } + catch( ... ) + { + tet_result(TET_FAIL); + } + + tet_result(TET_PASS); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-View.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-View.cpp new file mode 100644 index 0000000..80126c8 --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-View.cpp @@ -0,0 +1,390 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + +using namespace Dali; +using namespace Toolkit; + + +void dali_view_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void dali_view_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +namespace +{ + +static bool gAnimationStarted = false; + +void StartAnimation( View, Animation& animation, const Orientation& orientation ) +{ + gAnimationStarted = true; +} + + +static bool gObjectCreatedCallBackCalled; +static void TestCallback(BaseHandle handle) +{ + gObjectCreatedCallBackCalled = true; +} + + +} + + +int UtcDaliViewNew(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliViewNew"); + + View view1; + DALI_TEST_CHECK( !view1 ); + + view1 = View::New(); + DALI_TEST_CHECK( view1 ); + + View view2( view1 ); + DALI_TEST_CHECK( view2 ); + + View view3 = view2; + DALI_TEST_CHECK( view3 ); + + view1 = NULL; + view2 = NULL; + view3 = NULL; + + //Additional check to ensure object is created by checking if it's registered + ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + DALI_TEST_CHECK( registry ); + + gObjectCreatedCallBackCalled = false; + registry.ObjectCreatedSignal().Connect( &TestCallback ); + { + View view = View::New(); + } + DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + END_TEST; +} + +int UtcDaliViewAddGetRemoveContentLayer01(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliViewAddGetRemoveContentLayer01"); + + View view = View::New(); + Layer layer1; + Layer layer2; + Layer layer3; + Layer layer4; + + // Test: add and get layers. + try + { + layer1 = Layer::New(); + layer1.SetName( "Layer1" ); + layer2 = Layer::New(); + layer2.SetName( "Layer2" ); + + unsigned int layerId1 = view.AddContentLayer( layer1 ); + unsigned int layerId2 = view.AddContentLayer( layer2 ); + + layer3 = view.GetContentLayer( layerId1 ); + layer4 = view.GetContentLayer( layerId2 ); + + DALI_TEST_EQUALS( layer1.GetName(), layer3.GetName(), TEST_LOCATION ); + DALI_TEST_EQUALS( layer2.GetName(), layer4.GetName(), TEST_LOCATION ); + } + catch( ... ) + { + tet_printf( "UtcDaliViewAddGetRemoveContentLayer: Exception while adding and geting layers to/from view.\n" ); + tet_result(TET_FAIL); + } + + bool test1 = false; + bool test2 = false; + // Test: remove layers. + try + { + view.RemoveContentLayer( layer3 ); + view.RemoveContentLayer( layer4 ); + test1 = true; + } + catch( ... ) + { + tet_printf( "UtcDaliViewAddGetRemoveContentLayer: Exception while removing layers from view.\n" ); + tet_result(TET_FAIL); + } + + // Test: add same layers again. + try + { + view.AddContentLayer( layer1 ); + view.AddContentLayer( layer2 ); + test2 = true; + } + catch( ... ) + { + tet_printf( "UtcDaliViewAddGetRemoveContentLayer: Exception while adding layers from view after have been removed.\n" ); + tet_result(TET_FAIL); + } + + DALI_TEST_CHECK( test1 && test2 ); + END_TEST; +} + +int UtcDaliViewAddGetRemoveContentLayer02(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliViewAddGetRemoveContentLayer02"); + + View view = View::New(); + + Layer layer1 = Layer::New(); + layer1.SetName( "Layer1" ); + Layer layer2 = Layer::New(); + layer2.SetName( "Layer2" ); + + view.AddContentLayer( layer1 ); + view.AddContentLayer( layer2 ); + + // Test: add a layer twice. + try + { + view.AddContentLayer( layer1 ); + } + catch( ... ) + { + tet_result(TET_FAIL); + } + + // Test: add an unitialized layer. + try + { + Layer layer; + view.AddContentLayer( layer ); + } + catch( DaliException& e ) + { + tet_printf("Assertion %s failed at %s when an unitialized layer is added.\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_EQUALS( e.mCondition, "layer", TEST_LOCATION ); + } + + // Test: get a layer which was not added before. + Layer layer = view.GetContentLayer( 100 ); + DALI_TEST_CHECK( !layer ); + + // Test: Remove a layer which was not added before. + try + { + Layer layer = Layer::New(); + view.RemoveContentLayer( layer ); + } + catch( ... ) + { + tet_result(TET_FAIL); + } + + tet_result(TET_PASS); + END_TEST; +} + +int UtcDaliViewSetGetBackgroundLayer01(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliViewSetGetBackgroundLayer01"); + + View view; + Layer layer1, layer2; + + // Test with an actor. + + view = View::New(); + Stage::GetCurrent().Add( view ); + + ImageActor background = CreateSolidColorActor( Color::RED ); + + view.SetBackground( background ); + + layer1 = view.GetBackgroundLayer(); + + DALI_TEST_CHECK( layer1 ); + + background = CreateSolidColorActor( Color::GREEN ); + + view.SetBackground( background ); + + layer2 = view.GetBackgroundLayer(); + + DALI_TEST_CHECK( layer2 ); + + Stage::GetCurrent().Remove( view ); + END_TEST; +} + +int UtcDaliViewSetGetBackgroundLayer02(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliViewSetGetBackgroundLayer02"); + + bool assert = false; + + try + { + View view = View::New(); + + ImageActor background = CreateSolidColorActor( Color::RED ); + + view.SetBackground( background ); + } + catch( DaliException& e ) + { + tet_printf("Assertion %s failed at %s when trying to add background to the view and the view is not on the stage.\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_EQUALS( e.mCondition, "mBackgroundLayer.OnStage()", TEST_LOCATION ); + assert = true; + } + + DALI_TEST_CHECK( assert ); + END_TEST; +} + +int UtcDaliViewSetOrientationFunction(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliViewSetOrientationFunction"); + + // Test it doesn't crash + try + { + View view = View::New(); + Stage::GetCurrent().Add( view ); + + view.SetSize( 480, 800 ); + view.SetOrientationFunction( Degree( 0.f ), Degree( 90.f ), Degree( 180.f ), Degree( 270.f ) ); + } + catch( ... ) + { + tet_result(TET_FAIL); + } + + tet_result(TET_PASS); + END_TEST; +} + +int UtcDaliViewOrientationChanged(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliViewOrientationChanged"); + + gAnimationStarted = false; + + // Test it doesn't crash + try + { + View view = View::New(); + Stage::GetCurrent().Add( view ); + + view.SetSize( 480, 800 ); + + view.OrientationAnimationStartedSignal().Connect( &StartAnimation ); + + application.SendNotification(); // Remove these two lines causes + application.Render(); // ToolkitTestApplication destructor to crash + + //Orientation orientation = application.GetOrientation().GetHandle(); + //application.GetOrientation().SetDegrees( 90 ); + //view.OrientationChanged( orientation ); + } + catch( ... ) + { + tet_result(TET_FAIL); + } + + // Check the view animation started. + DALI_TEST_CHECK( gAnimationStarted ); + END_TEST; +} + +int UtcSetAutoRotate(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcSetAutoRotate"); + + gAnimationStarted = false; + + View view; + + // Test it doesn't crash + try + { + view = View::New(); + Stage::GetCurrent().Add( view ); + + view.SetSize( 480, 800 ); + + //view.OrientationAnimationStartedSignal().Connect( &StartAnimation ); + + application.SendNotification(); + application.Render(); + + //Orientation orientation = application.GetOrientation().GetHandle(); + //application.GetOrientation().SetDegrees( 90 ); + //view.OrientationChanged( orientation ); + } + catch( ... ) + { + tet_result(TET_FAIL); + } + + // Check the view animation started. + //DALI_TEST_CHECK( gAnimationStarted ); + + + gAnimationStarted = false; + + try + { + view = View::New(); + view.SetAutoRotate( false ); // Animation shouldn't start. + Stage::GetCurrent().Add( view ); + + view.SetSize( 480, 800 ); + + application.SendNotification(); + application.Render(); + + //Orientation orientation = application.GetOrientation().GetHandle(); + //application.GetOrientation().SetDegrees( 180 ); + //view.OrientationChanged( orientation ); + } + catch( ... ) + { + tet_result(TET_FAIL); + } + + // Check the view animation didn't start. + DALI_TEST_CHECK( !gAnimationStarted ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-WaterEffect.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-WaterEffect.cpp new file mode 100644 index 0000000..eba0dc8 --- /dev/null +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-WaterEffect.cpp @@ -0,0 +1,335 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include +#include + +using namespace Dali; + +void dali_water_effect_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void dali_water_effect_cleanup(void) +{ + test_return_value = TET_PASS; +} + + + +int UtcDaliWaterEffectUninitialized(void) +{ + ToolkitTestApplication application; + + Toolkit::WaterEffect effect; + + try + { + // New() must be called to create a RippleEffect or it wont be valid. + effect.SetAmplitude( 0, 0.5f ); + DALI_TEST_CHECK( false ); + } + catch (Dali::DaliException& e) + { + // Tests that a negative test of an assertion succeeds + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_CHECK(!effect); + } + END_TEST; +} + +int UtcDaliWaterEffectPropertyNames(void) +{ + ToolkitTestApplication application; + + Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4); + DALI_TEST_CHECK( effect ); + + // Check the names, this names are used in the shaders code, + // if they change the shader code has to be updated + DALI_TEST_EQUALS( effect.GetAmplitudePropertyName( 0 ), "uDrops[0].amplitude", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetCenterPropertyName( 0 ), "uDrops[0].center", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetPropagationPropertyName( 0 ), "uDrops[0].radius", TEST_LOCATION ); + END_TEST; +} + +int UtcDaliWaterEffectOutOfBounds(void) +{ + ToolkitTestApplication application; + + Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4); + DALI_TEST_CHECK( effect ); + + try + { + // the highest index acceptable is (GetNumberOfWaves() - 1) + effect.SetAmplitude( effect.GetNumberOfWaves(), 0 ); + DALI_TEST_CHECK( false ); + } + catch (Dali::DaliException& e) + { + // Tests that a negative test of an assertion succeeds + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_CHECK( true ); + } + END_TEST; +} + +int UtcDaliWaterEffectDefaultValues(void) +{ + ToolkitTestApplication application; + + Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4); + DALI_TEST_CHECK( effect ); + + // Check that the effect has the number of waves it was requested + DALI_TEST_CHECK( effect.GetNumberOfWaves() == 4 ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + Vector2 topLeft( Stage::GetCurrent().GetSize() * 0.5f ); + topLeft.y = -topLeft.y; + + for ( unsigned int i = 0; i < effect.GetNumberOfWaves(); ++i ) + { + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetAmplitudePropertyName(i).c_str(), + 0.0f ) ); + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetCenterPropertyName(i).c_str(), + topLeft ) ); + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetPropagationPropertyName(i).c_str(), + 0.0f ) ); + } + END_TEST; +} + +int UtcDaliWaterEffectCustomValues(void) +{ + ToolkitTestApplication application; + + Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + effect.SetAmplitude( 0, 0.5f ); + effect.SetCenter( 0, Vector2 ( 10.0f, 10.0f ) ); + effect.SetPropagation( 0, 2.0f ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetAmplitudePropertyName(0).c_str(), + 0.5f ) ); + + Vector2 centerPoint( Stage::GetCurrent().GetSize() * 0.5f ); + centerPoint.y = -centerPoint.y; + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetCenterPropertyName(0).c_str(), + Vector2( centerPoint.x - 10.0f, centerPoint.y + 10.0f ) ) ); + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetPropagationPropertyName(0).c_str(), + 2.0f ) ); + END_TEST; +} + +int UtcDaliWaterEffectGetAmplitudePositive(void) +{ + ToolkitTestApplication application; + + Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + float amplitude(0.5f); + DALI_TEST_CHECK(effect.GetAmplitude(0) != amplitude); + effect.SetAmplitude( 0, amplitude ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS(amplitude, effect.GetAmplitude(0), TEST_LOCATION); + END_TEST; +} + +int UtcDaliWaterEffectGetAmplitudeNegative(void) +{ + ToolkitTestApplication application; + + Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + try + { + effect.GetAmplitude(9999); + tet_result(TET_FAIL); + } + catch(DaliException& exception) + { + if (exception.mCondition == "index < mNumberOfWaves") + { + tet_result(TET_PASS); + } + } + END_TEST; +} + +int UtcDaliWaterEffectGetCenterPositive(void) +{ + ToolkitTestApplication application; + + Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + Vector2 center(10.0f, 20.0f); + DALI_TEST_CHECK(effect.GetCenter(0) != center); + effect.SetCenter( 0, center ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS(center, effect.GetCenter(0), TEST_LOCATION); + END_TEST; +} + +int UtcDaliWaterEffectGetCenterNegative(void) +{ + ToolkitTestApplication application; + + Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + try + { + effect.GetCenter(9999); + tet_result(TET_FAIL); + } + catch(DaliException& exception) + { + if (exception.mCondition == "index < mNumberOfWaves") + { + tet_result(TET_PASS); + } + } + END_TEST; +} + +int UtcDaliWaterEffectGetPropagationPositive(void) +{ + ToolkitTestApplication application; + + Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + float propagation(0.5f); + DALI_TEST_CHECK(effect.GetPropagation(0) != propagation); + effect.SetPropagation( 0, propagation ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS(propagation, effect.GetPropagation(0), TEST_LOCATION); + END_TEST; +} + +int UtcDaliWaterEffectGetPropagationNegative(void) +{ + ToolkitTestApplication application; + + Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + try + { + effect.GetPropagation(9999); + tet_result(TET_FAIL); + } + catch(DaliException& exception) + { + if (exception.mCondition == "index < mNumberOfWaves") + { + tet_result(TET_PASS); + } + } + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/CMakeLists.txt b/automated-tests/src/dali-toolkit/CMakeLists.txt new file mode 100644 index 0000000..a476f28 --- /dev/null +++ b/automated-tests/src/dali-toolkit/CMakeLists.txt @@ -0,0 +1,84 @@ +SET(PKG_NAME "dali-toolkit") + +SET(EXEC_NAME "tct-${PKG_NAME}-core") +SET(RPM_NAME "core-${PKG_NAME}-tests") + +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-BubbleEmitter.cpp + utc-Dali-Button.cpp + utc-Dali-Control.cpp + utc-Dali-ControlImpl.cpp + utc-Dali-DefaultControls.cpp + utc-Dali-DissolveEffect.cpp + utc-Dali-FocusManager.cpp + utc-Dali-GridLayout.cpp + utc-Dali-IrisEffect.cpp + utc-Dali-ItemLayout.cpp + utc-Dali-ItemView.cpp + utc-Dali-KeyboardFocusManager.cpp + utc-Dali-MarkupProcessor.cpp + utc-Dali-MaskEffect.cpp + utc-Dali-NinePatchMaskEffect.cpp + utc-Dali-Popup.cpp + utc-Dali-PushButton.cpp + utc-Dali-Ripple2DEffect.cpp + utc-Dali-RippleEffect.cpp + utc-Dali-ScrollViewEffect.cpp + utc-Dali-SuperBlurView.cpp + utc-Dali-SwirlEffect.cpp + utc-Dali-TextInput.cpp + utc-Dali-TextView.cpp +) + +# Append list of test harness files (Won't get parsed for test cases) +LIST(APPEND TC_SOURCES + dali-toolkit-test-utils/toolkit-accessibility-manager.cpp + dali-toolkit-test-utils/toolkit-adaptor.cpp + dali-toolkit-test-utils/toolkit-application.cpp + dali-toolkit-test-utils/toolkit-clipboard.cpp + dali-toolkit-test-utils/toolkit-imf-manager.cpp + dali-toolkit-test-utils/toolkit-physical-keyboard.cpp + dali-toolkit-test-utils/toolkit-style-monitor.cpp + dali-toolkit-test-utils/toolkit-timer.cpp + dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp + dali-toolkit-test-utils/dummy-control.cpp + dali-toolkit-test-utils/dali-test-suite-utils.cpp + dali-toolkit-test-utils/test-application.cpp + dali-toolkit-test-utils/test-platform-abstraction.cpp + dali-toolkit-test-utils/test-gesture-manager.cpp + dali-toolkit-test-utils/test-gl-abstraction.cpp + dali-toolkit-test-utils/test-gl-sync-abstraction.cpp + dali-toolkit-test-utils/test-render-controller.cpp + dali-toolkit-test-utils/test-trace-call-stack.cpp +) + + +PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED + dali-core + dali + dali-toolkit +) + +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb --coverage -Wall -Werror=return-type") + +FOREACH(directory ${${CAPI_LIB}_LIBRARY_DIRS}) + SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -L${directory}") +ENDFOREACH(directory ${CAPI_LIB_LIBRARY_DIRS}) + +INCLUDE_DIRECTORIES( + ${${CAPI_LIB}_INCLUDE_DIRS} + dali-toolkit-test-utils +) + +ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES}) +TARGET_LINK_LIBRARIES(${EXEC_NAME} + ${${CAPI_LIB}_LIBRARIES} +) + +INSTALL(PROGRAMS ${EXEC_NAME} + DESTINATION ${BIN_DIR}/${EXEC_NAME} +) diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.cpp new file mode 100644 index 0000000..64f576e --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.cpp @@ -0,0 +1,370 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +// INTERNAL INCLUDES +#include +#include + +#include "dali-test-suite-utils.h" + +using namespace Dali; + +int test_return_value = TET_UNDEF; + +void tet_result(int value) +{ + // First TET_PASS should set to zero + // first TET_FAIL should prevent any further TET_PASS from setting back to zero + // Any TET_FAIL should set to fail or leave as fail + if( test_return_value != 1 ) + test_return_value = value; +} + +#define END_TEST \ + return ((test_return_value>0)?1:0) + + +void tet_infoline(const char* str) +{ + fprintf(stderr, "%s\n", str); +} + +void tet_printf(const char *format, ...) +{ + va_list arg; + va_start(arg, format); + vfprintf(stderr, format, arg); + va_end(arg); +} + +/** + * DALI_TEST_CHECK is a wrapper for tet_result. + * If the condition evaluates to false, then the function & line number is printed. + * @param[in] The boolean expression to check + */ +#define DALI_TEST_CHECK(condition) \ +if ( (condition) ) \ +{ \ + tet_result(TET_PASS); \ +} \ +else \ +{ \ + fprintf(stderr, "%s Failed in %s at line %d\n", __PRETTY_FUNCTION__, __FILE__, __LINE__); \ + tet_result(TET_FAIL); \ +} + +bool operator==(TimePeriod a, TimePeriod b) +{ + return Equals(a.durationSeconds, b.durationSeconds) && Equals(a.delaySeconds, b.delaySeconds) ; +} + +std::ostream& operator<< (std::ostream& o, const TimePeriod value) +{ + return o << "( Duration:" << value.durationSeconds << " Delay:" << value.delaySeconds << ")"; +} + +void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, const char* location) +{ + const float* m1 = matrix1.AsFloat(); + const float* m2 = matrix2.AsFloat(); + bool equivalent = true; + + for (int i=0;i<9;++i) + { + equivalent &= (m1[i] != m2[i]); + } + + if (!equivalent) + { + fprintf(stderr, "%s, checking\n" + "(%f, %f, %f) (%f, %f, %f)\n" + "(%f, %f, %f) == (%f, %f, %f)\n" + "(%f, %f, %f) (%f, %f, %f)\n", + location, + m1[0], m1[1], m1[2], m2[0], m2[1], m2[2], + m1[3], m1[4], m1[5], m2[3], m2[4], m2[5], + m1[6], m1[7], m1[8], m2[6], m2[7], m2[8]); + + tet_result(TET_FAIL); + } + else + { + tet_result(TET_PASS); + } +} + +void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, float epsilon, const char* location) +{ + const float* m1 = matrix1.AsFloat(); + const float* m2 = matrix2.AsFloat(); + bool equivalent = true; + + for (int i=0;i<9;++i) + { + equivalent &= (fabsf(m1[i] - m2[i]) value2 + * @param[in] value1 The first value + * @param[in] value2 The second value + * @param[in] location The TEST_LOCATION macro should be used here + */ +void DALI_TEST_GREATER(unsigned int value1, unsigned int value2, const char* location) +{ + if (!(value1 > value2)) + { + fprintf(stderr, "%s, checking %d > %d\n", location, value1, value2); + tet_result(TET_FAIL); + } + else + { + tet_result(TET_PASS); + } +} + +/** + * Test whether one float value is greater than another. + * Test succeeds if value1 > value2 + * @param[in] value1 The first value + * @param[in] value2 The second value + * @param[in] location The TEST_LOCATION macro should be used here + */ +void DALI_TEST_GREATER( float value1, float value2, const char* location) +{ + if (!(value1 > value2)) + { + fprintf(stderr, "%s, checking %f > %f\n", location, value1, value2); + tet_result(TET_FAIL); + } + else + { + tet_result(TET_PASS); + } +} + +/** + * Test whether the assertion condition that failed and thus triggered the + * exception \b e contained a given substring at the start of its literal text. + * @param[in] e The exception that we expect was fired by a runtime assertion + * failure. + * @param[in] conditionSubString The text that we expect to be present in an + * assertion which triggered the exception. + * @param[in] location The TEST_LOCATION macro should be used here. + * + * @remark **Side-effects:** The result of the tet test is set to TET_PASS if + * the substring is at the start of the exception's condition and + * TET_FAIL if it isn't. Note, if the result of a test is set multiple + * times, a TET_FAIL will override any number of TET_PASSes. + */ +void DALI_TEST_ASSERT( DaliException& e, std::string conditionSubString, const char* location ) +{ + if( 0u != e.mCondition.find( conditionSubString )) + { + fprintf(stderr, "Assertion %s failed at %s\n", conditionSubString.c_str(), location); + tet_result(TET_FAIL); + } + else + { + tet_result(TET_PASS); + } +} + +/** Self-documenting wrapper for DALI_TEST_ASSERT. + * @copydoc DALI_TEST_ASSERT() + */ +void DALI_TEST_ASSERT_CONDITION_STARTS_WITH_SUBSTRING( DaliException& exceptionFromAssertion, std::string conditionSubString, const char* location ) +{ + DALI_TEST_ASSERT(exceptionFromAssertion, conditionSubString, location); +} + +// Functor to test whether an Applied signal is emitted +ConstraintAppliedCheck::ConstraintAppliedCheck( bool& signalReceived ) +: mSignalReceived( signalReceived ) +{ +} + +void ConstraintAppliedCheck::operator()( ActiveConstraint& constraint ) +{ + mSignalReceived = true; +} + +void ConstraintAppliedCheck::Reset() +{ + mSignalReceived = false; +} + +void ConstraintAppliedCheck::CheckSignalReceived() +{ + if ( !mSignalReceived ) + { + fprintf(stderr, "Expected Applied signal was not received\n" ); + tet_result( TET_FAIL ); + } + else + { + tet_result( TET_PASS ); + } +} + +void ConstraintAppliedCheck::CheckSignalNotReceived() +{ + if ( mSignalReceived ) + { + fprintf(stderr, "Unexpected Applied signal was received\n" ); + tet_result( TET_FAIL ); + } + else + { + tet_result( TET_PASS ); + } +} + + +BitmapImage CreateBitmapImage(int width, int height, const Vector4& color) +{ + BitmapImage image = BitmapImage::New(width, height, Pixel::RGBA8888); + + PixelBuffer* pixbuf = image.GetBuffer(); + + // Using a 4x4 image gives a better blend with the GL implementation + // than a 3x3 image + for(size_t i=0; i<16; i++) + { + pixbuf[i*4+0] = color.r*255; + pixbuf[i*4+1] = color.g*255; + pixbuf[i*4+2] = color.b*255; + pixbuf[i*4+3] = color.a*255; + } + + return image; +} + +BitmapImage CreateBitmapImage() +{ + return CreateBitmapImage(4, 4, Color::WHITE); +} diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h new file mode 100644 index 0000000..1657a4b --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h @@ -0,0 +1,407 @@ +#ifndef __DALI_TEST_SUITE_UTILS_H__ +#define __DALI_TEST_SUITE_UTILS_H__ + +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +// INTERNAL INCLUDES +#include +#include +#include + +void tet_infoline(const char*str); +void tet_printf(const char *format, ...); + +#include "test-application.h" + +using namespace Dali; + +#define STRINGIZE_I(text) #text +#define STRINGIZE(text) STRINGIZE_I(text) + +// the following is the other compilers way of token pasting, gcc seems to just concatenate strings automatically +//#define TOKENPASTE(x,y) x ## y +#define TOKENPASTE(x,y) x y +#define TOKENPASTE2(x,y) TOKENPASTE( x, y ) +#define TEST_LOCATION TOKENPASTE2( "Test failed in ", TOKENPASTE2( __FILE__, TOKENPASTE2( ", line ", STRINGIZE(__LINE__) ) ) ) + +#define TET_UNDEF 2 +#define TET_FAIL 1 +#define TET_PASS 0 + +extern int test_return_value; + +void tet_result(int value); + +#define END_TEST \ + return ((test_return_value>0)?1:0) + +void tet_infoline(const char* str); +void tet_printf(const char *format, ...); + +/** + * DALI_TEST_CHECK is a wrapper for tet_result. + * If the condition evaluates to false, then the function & line number is printed. + * @param[in] The boolean expression to check + */ +#define DALI_TEST_CHECK(condition) \ +if ( (condition) ) \ +{ \ + tet_result(TET_PASS); \ +} \ +else \ +{ \ + fprintf(stderr, "%s Failed in %s at line %d\n", __PRETTY_FUNCTION__, __FILE__, __LINE__); \ + tet_result(TET_FAIL); \ +} + +template +inline bool CompareType(Type value1, Type value2, float epsilon); + +/** + * A helper for fuzzy-comparing Vector2 objects + * @param[in] vector1 the first object + * @param[in] vector2 the second object + * @param[in] epsilon difference threshold + * @returns true if difference is smaller than epsilon threshold, false otherwise + */ +template <> +inline bool CompareType(float value1, float value2, float epsilon) +{ + return fabsf(value1 - value2) < epsilon; +} + +/** + * A helper for fuzzy-comparing Vector2 objects + * @param[in] vector1 the first object + * @param[in] vector2 the second object + * @param[in] epsilon difference threshold + * @returns true if difference is smaller than epsilon threshold, false otherwise + */ +template <> +inline bool CompareType(Vector2 vector1, Vector2 vector2, float epsilon) +{ + return fabsf(vector1.x - vector2.x) +inline bool CompareType(Vector3 vector1, Vector3 vector2, float epsilon) +{ + return fabsf(vector1.x - vector2.x) +inline bool CompareType(Vector4 vector1, Vector4 vector2, float epsilon) +{ + return fabsf(vector1.x - vector2.x) +inline bool CompareType(Quaternion q1, Quaternion q2, float epsilon) +{ + Quaternion q2N = -q2; // These quaternions represent the same rotation + return CompareType(q1.mVector, q2.mVector, epsilon) || CompareType(q1.mVector, q2N.mVector, epsilon); +} + +template <> +inline bool CompareType(Radian q1, Radian q2, float epsilon) +{ + return CompareType(float(q1), float(q2), epsilon); +} + +template <> +inline bool CompareType(Degree q1, Degree q2, float epsilon) +{ + return CompareType(float(q1), float(q2), epsilon); +} + +bool operator==(TimePeriod a, TimePeriod b); +std::ostream& operator<< (std::ostream& o, const TimePeriod value); + +/** + * Test whether two values are equal. + * @param[in] value1 The first value + * @param[in] value2 The second value + * @param[in] location The TEST_LOCATION macro should be used here + */ +template +inline void DALI_TEST_EQUALS(TypeA value1, TypeB value2, const char* location) +{ + if (!(value1 == value2)) + { + std::ostringstream o; + o << value1 << " == " << value2 << std::endl; + fprintf(stderr, "%s, checking %s", location, o.str().c_str()); + tet_result(TET_FAIL); + } + else + { + tet_result(TET_PASS); + } +} + +template +inline void DALI_TEST_EQUALS(Type value1, Type value2, float epsilon, const char* location) +{ + if( !CompareType(value1, value2, epsilon) ) + { + std::ostringstream o; + o << value1 << " == " << value2 << std::endl; + fprintf(stderr, "%s, checking %s", location, o.str().c_str()); + tet_result(TET_FAIL); + } + else + { + tet_result(TET_PASS); + } +} + +/** + * Test whether two TimePeriods are within a certain distance of each other. + * @param[in] value1 The first value + * @param[in] value2 The second value + * @param[in] epsilon The values must be within this distance of each other + * @param[in] location The TEST_LOCATION macro should be used here + */ +template<> +inline void DALI_TEST_EQUALS( TimePeriod value1, TimePeriod value2, float epsilon, const char* location) +{ + if ((fabs(value1.durationSeconds - value2.durationSeconds) > epsilon)) + { + fprintf(stderr, "%s, checking durations %f == %f, epsilon %f\n", location, value1.durationSeconds, value2.durationSeconds, epsilon); + tet_result(TET_FAIL); + } + else if ((fabs(value1.delaySeconds - value2.delaySeconds) > epsilon)) + { + fprintf(stderr, "%s, checking delays %f == %f, epsilon %f\n", location, value1.delaySeconds, value2.delaySeconds, epsilon); + tet_result(TET_FAIL); + } + else + { + tet_result(TET_PASS); + } +} + +/** + * Test whether two Matrix3 objects are equal. + * @param[in] matrix1 The first object + * @param[in] matrix2 The second object + * @param[in] location The TEST_LOCATION macro should be used here + */ +void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, const char* location); + +/** Test whether two Matrix3 objects are equal (fuzzy compare). + * @param[in] matrix1 The first object + * @param[in] matrix2 The second object + * @param[in] epsilon The epsilon to use for comparison + * @param[in] location The TEST_LOCATION macro should be used here + */ +void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, float epsilon, const char* location); + +/** + * Test whether two Matrix objects are equal. + * @param[in] matrix1 The first object + * @param[in] matrix2 The second object + * @param[in] location The TEST_LOCATION macro should be used here + */ +void DALI_TEST_EQUALS( const Matrix& matrix1, const Matrix& matrix2, const char* location); + +/** + * Test whether two Matrix objects are equal (fuzzy-compare). + * @param[in] matrix1 The first object + * @param[in] matrix2 The second object + * @param[in] location The TEST_LOCATION macro should be used here + */ +void DALI_TEST_EQUALS( const Matrix& matrix1, const Matrix& matrix2, float epsilon, const char* location); + +/** + * Test whether two strings are equal. + * @param[in] str1 The first string + * @param[in] str2 The second string + * @param[in] location The TEST_LOCATION macro should be used here + */ +template<> +inline void DALI_TEST_EQUALS( const char* str1, const char* str2, const char* location) +{ + if (strcmp(str1, str2)) + { + fprintf(stderr, "%s, checking '%s' == '%s'\n", location, str1, str2); + tet_result(TET_FAIL); + } + else + { + tet_result(TET_PASS); + } +} + +/** + * Test whether two strings are equal. + * @param[in] str1 The first string + * @param[in] str2 The second string + * @param[in] location The TEST_LOCATION macro should be used here + */ +template<> +inline void DALI_TEST_EQUALS( const std::string &str1, const std::string &str2, const char* location) +{ + DALI_TEST_EQUALS(str1.c_str(), str2.c_str(), location); +} + +/** + * Test whether two strings are equal. + * @param[in] str1 The first string + * @param[in] str2 The second string + * @param[in] location The TEST_LOCATION macro should be used here + */ +void DALI_TEST_EQUALS( const std::string &str1, const char* str2, const char* location); + +/** + * Test whether two strings are equal. + * @param[in] str1 The first string + * @param[in] str2 The second string + * @param[in] location The TEST_LOCATION macro should be used here + */ +void DALI_TEST_EQUALS( const char* str1, const std::string &str2, const char* location); + + +/** + * Test whether two UTF32 strings are equal. + * @param[in] str1 The first string + * @param[in] str2 The second string + * @param[in] location The TEST_LOCATION macro should be used here + */ +template<> +inline void DALI_TEST_EQUALS( const TextArray& str1, const TextArray& str2, const char* location) +{ + if (!std::equal(str1.begin(), str1.end(), str2.begin())) + { + fprintf(stderr, "%s, checking '", location); + + for( unsigned int i = 0; i < str1.size(); ++i) + { + fprintf(stderr, "%c", str1[i]); + } + + fprintf(stderr, "' == '"); + + for( unsigned int i = 0; i < str2.size(); ++i) + { + fprintf(stderr, "%c", str2[i]); + } + + fprintf(stderr, "'\n"); + + tet_result(TET_FAIL); + } + else + { + tet_result(TET_PASS); + } +} + +/** + * Test whether one unsigned integer value is greater than another. + * Test succeeds if value1 > value2 + * @param[in] value1 The first value + * @param[in] value2 The second value + * @param[in] location The TEST_LOCATION macro should be used here + */ +void DALI_TEST_GREATER(unsigned int value1, unsigned int value2, const char* location); + +/** + * Test whether one float value is greater than another. + * Test succeeds if value1 > value2 + * @param[in] value1 The first value + * @param[in] value2 The second value + * @param[in] location The TEST_LOCATION macro should be used here + */ +void DALI_TEST_GREATER( float value1, float value2, const char* location); + +/** + * Test whether the assertion condition that failed and thus triggered the + * exception \b e contained a given substring at the start of its literal text. + * @param[in] e The exception that we expect was fired by a runtime assertion + * failure. + * @param[in] conditionSubString The text that we expect to be present in an + * assertion which triggered the exception. + * @param[in] location The TEST_LOCATION macro should be used here. + * + * @remark **Side-effects:** The result of the tet test is set to TET_PASS if + * the substring is at the start of the exception's condition and + * TET_FAIL if it isn't. Note, if the result of a test is set multiple + * times, a TET_FAIL will override any number of TET_PASSes. + */ +void DALI_TEST_ASSERT( DaliException& e, std::string conditionSubString, const char* location ); + +/** Self-documenting wrapper for DALI_TEST_ASSERT. + * @copydoc DALI_TEST_ASSERT() + */ +void DALI_TEST_ASSERT_CONDITION_STARTS_WITH_SUBSTRING( DaliException& exceptionFromAssertion, std::string conditionSubString, const char* location ); + + +// Functor to test whether an Applied signal is emitted +struct ConstraintAppliedCheck +{ + ConstraintAppliedCheck( bool& signalReceived ); + void operator()( ActiveConstraint& constraint ); + void Reset(); + void CheckSignalReceived(); + void CheckSignalNotReceived(); + bool& mSignalReceived; // owned by individual tests +}; + +/** + * A Helper to test default functions + */ +template +struct DefaultFunctionCoverage +{ + DefaultFunctionCoverage() + { + T a; + T *b = new T(a); + DALI_TEST_CHECK(b); + a = *b; + delete b; + } +}; + + +// Helper to Create bitmap image +BitmapImage CreateBitmapImage(); +BitmapImage CreateBitmapImage(int width, int height, const Vector4& color); + + +#endif // __DALI_TEST_SUITE_UTILS_H__ diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-toolkit-test-suite-utils.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-toolkit-test-suite-utils.h new file mode 100644 index 0000000..350bedc --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-toolkit-test-suite-utils.h @@ -0,0 +1,35 @@ +#ifndef __DALI_TOOLKIT_TEST_SUITE_UTILS_H__ +#define __DALI_TOOLKIT_TEST_SUITE_UTILS_H__ + +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +// INTERNAL INCLUDES + +// dali-test-suite-utils.h needed first, but want to prevent certain headers +// from being read, as we want to override as much of their behaviour as possible. +#define __DALI_STYLE_MONITOR_H__ +#define __DALI_ACCESSIBILITY_MANAGER_H__ +#define __DALI_TIMER_H__ +#define __DALI_CLIPBOARD_H__ +#define IMFMANAGER_H + +#include + +#include "toolkit-test-application.h" +#include "toolkit-application.h" + +#endif // __DALI_TOOLKIT_TEST_SUITE_UTILS_H__ diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp new file mode 100644 index 0000000..df988c0 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp @@ -0,0 +1,161 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 "dummy-control.h" + +namespace Dali +{ + +namespace Toolkit +{ + +DummyControl::DummyControl() +: mCustomSlot1Called(false) +{ +} + +DummyControl::DummyControl(const DummyControl& control) +: Control( control ), + mCustomSlot1Called(false), + mCustomSlot1Value(Vector3::ZERO) +{ +} + +DummyControl::~DummyControl() +{ +} + +DummyControl DummyControl::DownCast( BaseHandle handle ) +{ + return Control::DownCast(handle); +} + +DummyControl& DummyControl::operator=(const DummyControl& control) +{ + Control::operator=( control ); + return *this; +} + +// Used to test signal connections +void DummyControl::CustomSlot1( Actor actor, const Vector3& value ) +{ + mCustomSlot1Called = true; + mCustomSlot1Value = value; +} + +DummyControl DummyControlImpl::New() +{ + IntrusivePtr< DummyControlImpl > impl = new DummyControlImpl; + DummyControl control( *impl ); + impl->Initialize(); + return control; +} + +DummyControlImpl::DummyControlImpl() +: ControlImpl(true) +{ +} + +DummyControlImpl::~DummyControlImpl() +{ +} + +DummyControl DummyControlImplOverride::New() +{ + IntrusivePtr< DummyControlImplOverride > impl = new DummyControlImplOverride; + DummyControl control( *impl ); + impl->Initialize(); + return control; +} + + +DummyControlImplOverride::DummyControlImplOverride() +: DummyControlImpl(), + initializeCalled(false), + styleChangeCalled(false), + pinchCalled(false), + panCalled(false), + tapCalled(false), + longPressCalled(false), + stageConnectionCalled(false), + stageDisconnectionCalled(false), + childAddCalled(false), + childRemoveCalled(false), + sizeSetCalled(false), + sizeAnimationCalled(false), + touchEventCalled(false), + mouseWheelEventCalled(false), + keyEventCalled(false), + keyInputFocusGained(false), + keyInputFocusLost(false) +{ +} + +DummyControlImplOverride::~DummyControlImplOverride() { } + + +void DummyControlImplOverride::OnInitialize() { initializeCalled = true; } +void DummyControlImplOverride::OnStyleChange(StyleChange change) { styleChangeCalled = true;} +void DummyControlImplOverride::OnPinch(PinchGesture pinch) { pinchCalled = true; } +void DummyControlImplOverride::OnPan(PanGesture pan) { panCalled = true; } +void DummyControlImplOverride::OnTap(TapGesture tap) { tapCalled = true; } +void DummyControlImplOverride::OnLongPress(LongPressGesture longPress) { longPressCalled = true; } +void DummyControlImplOverride::OnStageConnection() { stageConnectionCalled = true; } +void DummyControlImplOverride::OnStageDisconnection() { stageDisconnectionCalled = true; } +void DummyControlImplOverride::OnChildAdd(Actor& child) { childAddCalled = true; } +void DummyControlImplOverride::OnChildRemove(Actor& child) { childRemoveCalled = true; } +void DummyControlImplOverride::OnSizeSet(const Vector3& targetSize) { sizeSetCalled = true; } +void DummyControlImplOverride::OnSizeAnimation(Animation& animation, const Vector3& targetSize) { sizeAnimationCalled = true; } +bool DummyControlImplOverride::OnTouchEvent(const TouchEvent& event) { touchEventCalled = true; return false; } +bool DummyControlImplOverride::OnMouseWheelEvent(const MouseWheelEvent& event) { mouseWheelEventCalled = true; return false; } +bool DummyControlImplOverride::OnKeyEvent(const KeyEvent& event) { keyEventCalled = true; return false;} +void DummyControlImplOverride::OnKeyInputFocusGained() { keyInputFocusGained = true; } +void DummyControlImplOverride::OnKeyInputFocusLost() { keyInputFocusLost = true; } + +DummyControl DummyControl::New( bool override ) +{ + DummyControl control; + + if (override) + { + control = DummyControlImplOverride::New(); + } + else + { + control = DummyControlImpl::New(); + } + + return control; +} + +DummyControl::DummyControl( DummyControlImpl& implementation ) +: Control( implementation ), + mCustomSlot1Called(false), + mCustomSlot1Value(Vector3::ZERO) +{ +} + +DummyControl::DummyControl( Dali::Internal::CustomActor* internal ) +: Control( internal ), + mCustomSlot1Called(false), + mCustomSlot1Value(Vector3::ZERO) +{ + VerifyCustomActorPointer(internal); +} + +} // namespace Toolkit + +} // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h new file mode 100644 index 0000000..cf2d965 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h @@ -0,0 +1,152 @@ +#ifndef __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__ +#define __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__ + +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace Toolkit +{ + +class DummyControlImpl; + +/** + * Control does not have a New method so use this dummy class for the handle. + */ +class DummyControl : public Control +{ +public: + + DummyControl(); + DummyControl(const DummyControl& control); + virtual ~DummyControl(); + + static DummyControl New( bool override = false ); + + static DummyControl DownCast( BaseHandle handle ); + + + DummyControl& operator=(const DummyControl& control); + + // Used to test signal connections + void CustomSlot1( Actor actor, const Vector3& value ); + +public: + + bool mCustomSlot1Called; + Vector3 mCustomSlot1Value; + +public: // Not intended for application developers + + DummyControl( DummyControlImpl& implementation ); + DummyControl( Dali::Internal::CustomActor* internal ); +}; + +/** + * Cannot create an instance of ControlImpl, so use this dummy class for the implementation. + * This class does not override any of ControlImpl's behaviour. + */ +class DummyControlImpl : public ControlImpl +{ +public: + + static DummyControl New(); + +public: + inline void EnableGestureDetection(Gesture::Type type) { ControlImpl::EnableGestureDetection(type); } + inline void DisableGestureDetection(Gesture::Type type) { ControlImpl::DisableGestureDetection(type); } + inline PinchGestureDetector GetPinchGestureDetector() const { return ControlImpl::GetPinchGestureDetector(); } + inline PanGestureDetector GetPanGestureDetector() const { return ControlImpl::GetPanGestureDetector(); } + inline TapGestureDetector GetTapGestureDetector() const { return ControlImpl::GetTapGestureDetector(); } + inline LongPressGestureDetector GetLongPressGestureDetector() const { return ControlImpl::GetLongPressGestureDetector(); } + +protected: + + DummyControlImpl(); + + virtual ~DummyControlImpl(); +}; + +/** + * Cannot create an instance of ControlImpl, so use this dummy class for the implementation. + * This class DOES override ControlImpl's behaviour. + */ +class DummyControlImplOverride : public DummyControlImpl +{ +public: + + static DummyControl New(); + +private: + + DummyControlImplOverride(); + + virtual ~DummyControlImplOverride(); + +private: // From ControlImpl + + virtual void OnInitialize(); + virtual void OnStyleChange(StyleChange change); + virtual void OnPinch(PinchGesture pinch); + virtual void OnPan(PanGesture pan); + virtual void OnTap(TapGesture tap); + virtual void OnLongPress(LongPressGesture longPress); + +private: // From CustomActorImpl + + virtual void OnStageConnection(); + virtual void OnStageDisconnection(); + virtual void OnChildAdd(Actor& child); + virtual void OnChildRemove(Actor& child); + virtual void OnSizeSet(const Vector3& targetSize); + virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize); + virtual bool OnTouchEvent(const TouchEvent& event); + virtual bool OnMouseWheelEvent(const MouseWheelEvent& event); + virtual bool OnKeyEvent(const KeyEvent& event); + virtual void OnKeyInputFocusGained(); + virtual void OnKeyInputFocusLost(); + +public: + + bool initializeCalled; + bool styleChangeCalled; + bool pinchCalled; + bool panCalled; + bool tapCalled; + bool longPressCalled; + bool stageConnectionCalled; + bool stageDisconnectionCalled; + bool childAddCalled; + bool childRemoveCalled; + bool sizeSetCalled; + bool sizeAnimationCalled; + bool touchEventCalled; + bool mouseWheelEventCalled; + bool keyEventCalled; + bool keyInputFocusGained; + bool keyInputFocusLost; +}; + +} // namespace Toolkit + +} // namespace Dali + +#endif // __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__ diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp new file mode 100644 index 0000000..5aa928e --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp @@ -0,0 +1,195 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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-application.h" + +namespace Dali +{ + + +TestApplication::TestApplication( size_t surfaceWidth, + size_t surfaceHeight, + float horizontalDpi, + float verticalDpi) +: mCore( NULL ), + mSurfaceWidth( surfaceWidth ), + mSurfaceHeight( surfaceHeight ), + mFrame( 0u ), + mDpi( horizontalDpi, verticalDpi ) +{ + Initialize(); +} + +TestApplication::TestApplication( bool initialize, + size_t surfaceWidth, + size_t surfaceHeight, + float horizontalDpi, + float verticalDpi ) +: mCore( NULL ), + mSurfaceWidth( surfaceWidth ), + mSurfaceHeight( surfaceHeight ), + mFrame( 0u ), + mDpi( horizontalDpi, verticalDpi ) +{ + if ( initialize ) + { + Initialize(); + } +} + +void TestApplication::Initialize() +{ + mCore = Dali::Integration::Core::New( + mRenderController, + mPlatformAbstraction, + mGlAbstraction, + mGlSyncAbstraction, + mGestureManager ); + + mCore->ContextCreated(); + mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight ); + mCore->SetDpi( mDpi.x, mDpi.y ); + + Dali::Integration::Log::LogFunction logFunction(&TestApplication::LogMessage); + Dali::Integration::Log::InstallLogFunction(logFunction); +} + +TestApplication::~TestApplication() +{ + Dali::Integration::Log::UninstallLogFunction(); + delete mCore; +} + +void TestApplication::LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message) +{ + switch(level) + { + case Dali::Integration::Log::DebugInfo: + fprintf(stderr, "INFO: %s", message.c_str()); + break; + case Dali::Integration::Log::DebugWarning: + fprintf(stderr, "WARN: %s", message.c_str()); + break; + case Dali::Integration::Log::DebugError: + fprintf(stderr, "ERROR: %s", message.c_str()); + break; + default: + fprintf(stderr, "DEFAULT: %s", message.c_str()); + break; + } +} + +Dali::Integration::Core& TestApplication::GetCore() +{ + return *mCore; +} + +TestPlatformAbstraction& TestApplication::GetPlatform() +{ + return mPlatformAbstraction; +} + +TestRenderController& TestApplication::GetRenderController() +{ + return mRenderController; +} + +TestGlAbstraction& TestApplication::GetGlAbstraction() +{ + return mGlAbstraction; +} + +TestGlSyncAbstraction& TestApplication::GetGlSyncAbstraction() +{ + return mGlSyncAbstraction; +} + +TestGestureManager& TestApplication::GetGestureManager() +{ + return mGestureManager; +} + +void TestApplication::ProcessEvent(const Integration::Event& event) +{ + mCore->QueueEvent(event); + mCore->ProcessEvents(); +} + +void TestApplication::SendNotification() +{ + mCore->ProcessEvents(); +} + +void TestApplication::SetSurfaceWidth( unsigned int width, unsigned height ) +{ + mSurfaceWidth = width; + mSurfaceHeight = height; + + mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight ); +} + +bool TestApplication::Render( unsigned int intervalMilliseconds ) +{ + // Update Time values + mPlatformAbstraction.IncrementGetTimeResult( intervalMilliseconds ); + unsigned int seconds(0u), microseconds(0u); + mPlatformAbstraction.GetTimeMicroseconds( seconds, microseconds ); + + mCore->VSync( mFrame, seconds, microseconds ); + mCore->Update( mStatus ); + mCore->Render( mRenderStatus ); + + mFrame++; + + return mStatus.KeepUpdating() || mRenderStatus.NeedsUpdate(); +} + +unsigned int TestApplication::GetUpdateStatus() +{ + return mStatus.KeepUpdating(); +} + +bool TestApplication::UpdateOnly( unsigned int intervalMilliseconds ) +{ + // Update Time values + mPlatformAbstraction.IncrementGetTimeResult( intervalMilliseconds ); + unsigned int seconds(0u), microseconds(0u); + mPlatformAbstraction.GetTimeMicroseconds( seconds, microseconds ); + + mCore->VSync( mFrame, seconds, microseconds ); + mCore->Update( mStatus ); + + return mStatus.KeepUpdating(); +} + +bool TestApplication::RenderOnly( ) +{ + // Update Time values + mCore->Render( mRenderStatus ); + + mFrame++; + + return mRenderStatus.NeedsUpdate(); +} + +void TestApplication::ResetContext() +{ + mCore->ContextToBeDestroyed(); + mCore->ContextCreated(); +} + + +} // Namespace dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h new file mode 100644 index 0000000..a490c96 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h @@ -0,0 +1,99 @@ +#ifndef __DALI_TEST_APPLICATION_H__ +#define __DALI_TEST_APPLICATION_H__ + +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +// INTERNAL INCLUDES +#include +#include "test-gesture-manager.h" +#include "test-gl-sync-abstraction.h" +#include "test-gl-abstraction.h" +#include "test-render-controller.h" +#include + +namespace Dali +{ + +class DALI_IMPORT_API TestApplication : public ConnectionTracker +{ +public: + + // Default values derived from H2 device. + static const unsigned int DEFAULT_SURFACE_WIDTH = 480; + static const unsigned int DEFAULT_SURFACE_HEIGHT = 800; + +#ifdef _CPP11 + static constexpr float DEFAULT_HORIZONTAL_DPI = 220.0f; + static constexpr float DEFAULT_VERTICAL_DPI = 217.0f; +#else + static const float DEFAULT_HORIZONTAL_DPI = 220.0f; + static const float DEFAULT_VERTICAL_DPI = 217.0f; +#endif + + static const unsigned int DEFAULT_RENDER_INTERVAL = 1; + + TestApplication( size_t surfaceWidth = DEFAULT_SURFACE_WIDTH, + size_t surfaceHeight = DEFAULT_SURFACE_HEIGHT, + float horizontalDpi = DEFAULT_HORIZONTAL_DPI, + float verticalDpi = DEFAULT_VERTICAL_DPI ); + + TestApplication( bool initialize, + size_t surfaceWidth = DEFAULT_SURFACE_WIDTH, + size_t surfaceHeight = DEFAULT_SURFACE_HEIGHT, + float horizontalDpi = DEFAULT_HORIZONTAL_DPI, + float verticalDpi = DEFAULT_VERTICAL_DPI ); + + void Initialize(); + virtual ~TestApplication(); + static void LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message); + Dali::Integration::Core& GetCore(); + TestPlatformAbstraction& GetPlatform(); + TestRenderController& GetRenderController(); + TestGlAbstraction& GetGlAbstraction(); + TestGlSyncAbstraction& GetGlSyncAbstraction(); + TestGestureManager& GetGestureManager(); + void ProcessEvent(const Integration::Event& event); + void SendNotification(); + void SetSurfaceWidth( unsigned int width, unsigned height ); + bool Render( unsigned int intervalMilliseconds = DEFAULT_RENDER_INTERVAL ); + unsigned int GetUpdateStatus(); + bool UpdateOnly( unsigned int intervalMilliseconds = DEFAULT_RENDER_INTERVAL ); + bool RenderOnly( ); + void ResetContext(); + +protected: + TestPlatformAbstraction mPlatformAbstraction; + TestRenderController mRenderController; + TestGlAbstraction mGlAbstraction; + TestGlSyncAbstraction mGlSyncAbstraction; + TestGestureManager mGestureManager; + + Integration::UpdateStatus mStatus; + Integration::RenderStatus mRenderStatus; + + Integration::Core* mCore; + + unsigned int mSurfaceWidth; + unsigned int mSurfaceHeight; + unsigned int mFrame; + + Vector2 mDpi; +}; + +} // Dali + +#endif diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gesture-manager.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gesture-manager.cpp new file mode 100644 index 0000000..1c9feb0 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gesture-manager.cpp @@ -0,0 +1,102 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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-gesture-manager.h" + +namespace Dali +{ + +TestGestureManager::TestGestureManager() +{ + Initialize(); +} + +/** + * Destructor + */ +TestGestureManager::~TestGestureManager() +{ +} + +/** + * @copydoc Dali::Integration::GestureManager::Register(Gesture::Type) + */ +void TestGestureManager::Register(const Integration::GestureRequest& request) +{ + mFunctionsCalled.Register = true; +} + +/** + * @copydoc Dali::Integration::GestureManager::Unregister(Gesture::Type) + */ +void TestGestureManager::Unregister(const Integration::GestureRequest& request) +{ + mFunctionsCalled.Unregister = true; +} + +/** + * @copydoc Dali::Integration::GestureManager::Update(Gesture::Type) + */ +void TestGestureManager::Update(const Integration::GestureRequest& request) +{ + mFunctionsCalled.Update = true; +} + + +/** Call this every test */ +void TestGestureManager::Initialize() +{ + mFunctionsCalled.Reset(); +} + +bool TestGestureManager::WasCalled(TestFuncEnum func) +{ + switch(func) + { + case RegisterType: return mFunctionsCalled.Register; + case UnregisterType: return mFunctionsCalled.Unregister; + case UpdateType: return mFunctionsCalled.Update; + } + return false; +} + +void TestGestureManager::ResetCallStatistics(TestFuncEnum func) +{ + switch(func) + { + case RegisterType: mFunctionsCalled.Register = false; break; + case UnregisterType: mFunctionsCalled.Unregister = false; break; + case UpdateType: mFunctionsCalled.Update = false; break; + } +} + +TestGestureManager::TestFunctions::TestFunctions() +: Register(false), + Unregister(false), + Update(false) +{ +} + +void TestGestureManager::TestFunctions::Reset() +{ + Register = false; + Unregister = false; + Update = false; +} + + + +} // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gesture-manager.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gesture-manager.h new file mode 100644 index 0000000..5643deb --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gesture-manager.h @@ -0,0 +1,92 @@ +#ifndef __DALI_TEST_GESTURE_MANAGER_H__ +#define __DALI_TEST_GESTURE_MANAGER_H__ + +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +// INTERNAL INCLUDES +#include +#include + +namespace Dali +{ + +/** + * Concrete implementation of the gesture manager class. + */ +class DALI_IMPORT_API TestGestureManager : public Dali::Integration::GestureManager +{ + +public: + + /** + * Constructor + */ + TestGestureManager(); + + /** + * Destructor + */ + virtual ~TestGestureManager(); + + /** + * @copydoc Dali::Integration::GestureManager::Register(Gesture::Type) + */ + virtual void Register(const Integration::GestureRequest& request); + + /** + * @copydoc Dali::Integration::GestureManager::Unregister(Gesture::Type) + */ + virtual void Unregister(const Integration::GestureRequest& request); + + /** + * @copydoc Dali::Integration::GestureManager::Update(Gesture::Type) + */ + virtual void Update(const Integration::GestureRequest& request); + +public: // TEST FUNCTIONS + + // Enumeration of Gesture Manager methods + enum TestFuncEnum + { + RegisterType, + UnregisterType, + UpdateType, + }; + + /** Call this every test */ + void Initialize(); + bool WasCalled(TestFuncEnum func); + void ResetCallStatistics(TestFuncEnum func); + +private: + + struct TestFunctions + { + TestFunctions(); + void Reset(); + + bool Register; + bool Unregister; + bool Update; + }; + + TestFunctions mFunctionsCalled; +}; + +} // Dali + +#endif // __DALI_TEST_GESTURE_MANAGER_H__ diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp new file mode 100644 index 0000000..eaeef05 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp @@ -0,0 +1,90 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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-gl-abstraction.h" + +namespace Dali +{ + +TestGlAbstraction::TestGlAbstraction() +{ + Initialize(); +} + +TestGlAbstraction::~TestGlAbstraction() {} + +void TestGlAbstraction::Initialize() +{ + mCurrentProgram = 0; + mCompileStatus = GL_TRUE; + mLinkStatus = GL_TRUE; + + mGetAttribLocationResult = 0; + mGetErrorResult = 0; + mGetStringResult = NULL; + mIsBufferResult = 0; + mIsEnabledResult = 0; + mIsFramebufferResult = 0; + mIsProgramResult = 0; + mIsRenderbufferResult = 0; + mIsShaderResult = 0; + mIsTextureResult = 0; + mVertexAttribArrayChanged = false; + + mCheckFramebufferStatusResult = 0; + mNumBinaryFormats = 1; + mBinaryFormats = 1; + mProgramBinaryLength = 0; + + mLastAutoTextureIdUsed = 0; + + mLastShaderIdUsed = 0; + mLastProgramIdUsed = 0; + mLastUniformIdUsed = 0; + mLastShaderCompiled = 0; + + mLastBlendEquationRgb = 0; + mLastBlendEquationAlpha = 0; + mLastBlendFuncSrcRgb = 0; + mLastBlendFuncDstRgb = 0; + mLastBlendFuncSrcAlpha = 0; + mLastBlendFuncDstAlpha = 0; + + mUniforms.clear(); + mProgramUniforms1i.clear(); + mProgramUniforms1f.clear(); + mProgramUniforms2f.clear(); + mProgramUniforms3f.clear(); + mProgramUniforms4f.clear(); +} + +} // Namespace dali + +bool BlendEnabled(const Dali::TraceCallStack& callStack) +{ + std::stringstream out; + out << GL_BLEND; + bool blendEnabled = callStack.FindMethodAndParams("Enable", out.str()); + return blendEnabled; +} + +bool BlendDisabled(const Dali::TraceCallStack& callStack) +{ + std::stringstream out; + out << GL_BLEND; + bool blendEnabled = callStack.FindMethodAndParams("Disable", out.str()); + return blendEnabled; +} diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h new file mode 100644 index 0000000..c4c1304 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h @@ -0,0 +1,1833 @@ +#ifndef __TEST_GL_ABSTRACTION_H__ +#define __TEST_GL_ABSTRACTION_H__ + +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include + +// INTERNAL INCLUDES +#include +#include +#include +#include +#include "test-trace-call-stack.h" + +namespace Dali +{ + +static const unsigned int MAX_ATTRIBUTE_CACHE_SIZE = 64; +static const char *mStdAttribs[MAX_ATTRIBUTE_CACHE_SIZE] = +{ + "aPosition", // ATTRIB_POSITION + "aNormal", // ATTRIB_NORMAL + "aTexCoord", // ATTRIB_TEXCOORD + "aColor", // ATTRIB_COLOR + "aBoneWeights", // ATTRIB_BONE_WEIGHTS + "aBoneIndices" // ATTRIB_BONE_INDICES +}; + +class DALI_IMPORT_API TestGlAbstraction: public Dali::Integration::GlAbstraction +{ +public: + TestGlAbstraction(); + ~TestGlAbstraction(); + void Initialize(); + + /* OpenGL ES 2.0 */ + + inline void ActiveTexture( GLenum textureUnit ) + { + mActiveTextureUnit = textureUnit - GL_TEXTURE0; + } + + inline GLenum GetActiveTextureUnit() const + { + return mActiveTextureUnit + GL_TEXTURE0; + } + + inline void AttachShader( GLuint program, GLuint shader ) + { + std::stringstream out; + out << program << ", " << shader; + mShaderTrace.PushCall("AttachShader", out.str()); + } + + inline void BindAttribLocation( GLuint program, GLuint index, const char* name ) + { + } + + inline void BindBuffer( GLenum target, GLuint buffer ) + { + } + + inline void BindFramebuffer( GLenum target, GLuint framebuffer ) + { + } + + inline void BindRenderbuffer( GLenum target, GLuint renderbuffer ) + { + } + + /** + * This method can be used by test cases, to query the texture IDs that have been bound by BindTexture. + * @return A vector containing the IDs that were bound. + */ + inline const std::vector& GetBoundTextures() const + { + return mBoundTextures; + } + + /** + * Query the texture IDs that have been bound with BindTexture, with a specific active texture unit. + * @param[in] activeTextureUnit The specific active texture unit. + * @return A vector containing the IDs that were bound. + */ + inline const std::vector& GetBoundTextures( GLuint activeTextureUnit ) const + { + return mActiveTextures[ activeTextureUnit - GL_TEXTURE0 ].mBoundTextures; + } + + /** + * This method can be used by test cases, to clear the record of texture IDs that have been bound by BindTexture. + */ + inline void ClearBoundTextures() + { + mBoundTextures.clear(); + + for( unsigned int i=0; i::iterator iter=mDeletedTextureIds.begin(); iter != mDeletedTextureIds.end(); ++iter) + { + if(*iter == textureId) + { + found = true; + break; + } + } + return found; + } + + inline void ClearDeletedTextures() + { + mDeletedTextureIds.clear(); + } + + inline void DepthFunc(GLenum func) + { + } + + inline void DepthMask(GLboolean flag) + { + } + + inline void DepthRangef(GLclampf zNear, GLclampf zFar) + { + } + + inline void DetachShader(GLuint program, GLuint shader) + { + std::stringstream out; + out << program << ", " << shader; + mShaderTrace.PushCall("DetachShader", out.str()); + } + + inline void Disable(GLenum cap) + { + std::stringstream out; + out << cap; + mCullFaceTrace.PushCall("Disable", out.str()); + } + + inline void DisableVertexAttribArray(GLuint index) + { + SetVertexAttribArray( index, false ); + } + + inline void DrawArrays(GLenum mode, GLint first, GLsizei count) + { + std::stringstream out; + out << mode << ", " << first << ", " << count; + mDrawTrace.PushCall("DrawArrays", out.str()); + } + + 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()); + } + + inline void Enable(GLenum cap) + { + std::stringstream out; + out << cap; + mCullFaceTrace.PushCall("Enable", out.str()); + } + + inline void EnableVertexAttribArray(GLuint index) + { + SetVertexAttribArray( index, true); + } + + inline void Finish(void) + { + } + + inline void Flush(void) + { + } + + inline void FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) + { + } + + inline void FramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) + { + } + + inline void FrontFace(GLenum mode) + { + } + + inline void GenBuffers(GLsizei n, GLuint* buffers) + { + // avoids an assert in GpuBuffers + *buffers = 1u; + } + + inline void GenerateMipmap(GLenum target) + { + } + + inline void GenFramebuffers(GLsizei n, GLuint* framebuffers) + { + } + + inline void GenRenderbuffers(GLsizei n, GLuint* renderbuffers) + { + } + + /** + * This method can be used by test cases, to manipulate the texture IDs generated by GenTextures. + * @param[in] ids A vector containing the next IDs to be generated + */ + inline void SetNextTextureIds( const std::vector& ids ) + { + mNextTextureIds = ids; + } + + inline const std::vector& GetNextTextureIds() + { + return mNextTextureIds; + } + + inline void GenTextures(GLsizei n, GLuint* textures) + { + for( int i=0; isecond; + UniformIDMap::iterator it2 = uniformIDs.find( name ); + if( it2 == uniformIDs.end() ) + { + // Uniform not found, so add it... + uniformIDs[name] = ++mLastUniformIdUsed; + return mLastUniformIdUsed; + } + + return it2->second; + } + + inline void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) + { + } + + inline void GetVertexAttribiv(GLuint index, GLenum pname, GLint* params) + { + } + + inline void GetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer) + { + } + + inline void Hint(GLenum target, GLenum mode) + { + } + + inline GLboolean IsBuffer(GLuint buffer) + { + return mIsBufferResult; + } + + inline GLboolean IsEnabled(GLenum cap) + { + return mIsEnabledResult; + } + + inline GLboolean IsFramebuffer(GLuint framebuffer) + { + return mIsFramebufferResult; + } + + inline GLboolean IsProgram(GLuint program) + { + return mIsProgramResult; + } + + inline GLboolean IsRenderbuffer(GLuint renderbuffer) + { + return mIsRenderbufferResult; + } + + inline GLboolean IsShader(GLuint shader) + { + return mIsShaderResult; + } + + inline GLboolean IsTexture(GLuint texture) + { + return mIsTextureResult; + } + + inline void LineWidth(GLfloat width) + { + } + + inline void LinkProgram(GLuint program) + { + std::stringstream out; + out << program; + mShaderTrace.PushCall("LinkProgram", out.str()); + } + + inline void PixelStorei(GLenum pname, GLint param) + { + } + + inline void PolygonOffset(GLfloat factor, GLfloat units) + { + } + + inline void ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) + { + } + + inline void ReleaseShaderCompiler(void) + { + } + + inline void RenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) + { + } + + inline void SampleCoverage(GLclampf value, GLboolean invert) + { + } + + inline void Scissor(GLint x, GLint y, GLsizei width, GLsizei height) + { + } + + inline void ShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length) + { + } + + inline void ShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length) + { + std::string stringBuilder; + for(int i = 0; i < count; ++i) + { + stringBuilder += string[i]; + } + mShaderSources[shader] = stringBuilder; + mLastShaderCompiled = shader; + } + + inline void GetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source) + { + const std::string shaderSource = mShaderSources[shader]; + if( static_cast(shaderSource.length()) < bufsize ) + { + strcpy(source, shaderSource.c_str()); + *length = shaderSource.length(); + } + else + { + *length = bufsize -1; + strncpy(source, shaderSource.c_str(), *length); + source[*length] = 0x0; + } + } + + inline void StencilFunc(GLenum func, GLint ref, GLuint mask) + { + } + + inline void StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) + { + } + + inline void StencilMask(GLuint mask) + { + } + + inline void StencilMaskSeparate(GLenum face, GLuint mask) + { + } + + inline void StencilOp(GLenum fail, GLenum zfail, GLenum zpass) + { + } + + inline void StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) + { + } + + 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()); + } + + inline void TexParameterf(GLenum target, GLenum pname, GLfloat param) + { + } + + inline void TexParameterfv(GLenum target, GLenum pname, const GLfloat* params) + { + } + + inline void TexParameteri(GLenum target, GLenum pname, GLint param) + { + } + + inline void TexParameteriv(GLenum target, GLenum pname, const GLint* params) + { + } + + 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()); + } + + inline void Uniform1f(GLint location, GLfloat x) + { + if( ! mProgramUniforms1f.SetUniformValue( mCurrentProgram, location, x ) ) + { + mGetErrorResult = GL_INVALID_OPERATION; + } + } + + inline void Uniform1fv(GLint location, GLsizei count, const GLfloat* v) + { + for( int i = 0; i < count; ++i ) + { + if( ! mProgramUniforms1f.SetUniformValue( mCurrentProgram, location, v[i] ) ) + { + mGetErrorResult = GL_INVALID_OPERATION; + break; + } + } + } + + inline void Uniform1i(GLint location, GLint x) + { + if( ! mProgramUniforms1i.SetUniformValue( mCurrentProgram, location, x ) ) + { + mGetErrorResult = GL_INVALID_OPERATION; + } + } + + inline void Uniform1iv(GLint location, GLsizei count, const GLint* v) + { + for( int i = 0; i < count; ++i ) + { + if( ! mProgramUniforms1i.SetUniformValue( mCurrentProgram, + location, + v[i] ) ) + { + mGetErrorResult = GL_INVALID_OPERATION; + break; + } + } + } + + inline void Uniform2f(GLint location, GLfloat x, GLfloat y) + { + if( ! mProgramUniforms2f.SetUniformValue( mCurrentProgram, + location, + Vector2( x, y ) ) ) + { + mGetErrorResult = GL_INVALID_OPERATION; + } + } + + inline void Uniform2fv(GLint location, GLsizei count, const GLfloat* v) + { + for( int i = 0; i < count; ++i ) + { + if( ! mProgramUniforms2f.SetUniformValue( mCurrentProgram, + location, + Vector2( v[2*i], v[2*i+1] ) ) ) + { + mGetErrorResult = GL_INVALID_OPERATION; + break; + } + } + } + + inline void Uniform2i(GLint location, GLint x, GLint y) + { + } + + inline void Uniform2iv(GLint location, GLsizei count, const GLint* v) + { + } + + inline void Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) + { + if( ! mProgramUniforms3f.SetUniformValue( mCurrentProgram, + location, + Vector3( x, y, z ) ) ) + { + mGetErrorResult = GL_INVALID_OPERATION; + } + } + + inline void Uniform3fv(GLint location, GLsizei count, const GLfloat* v) + { + for( int i = 0; i < count; ++i ) + { + if( ! mProgramUniforms3f.SetUniformValue( + mCurrentProgram, + location, + Vector3( v[3*i], v[3*i+1], v[3*i+2] ) ) ) + { + mGetErrorResult = GL_INVALID_OPERATION; + break; + } + } + } + + inline void Uniform3i(GLint location, GLint x, GLint y, GLint z) + { + } + + inline void Uniform3iv(GLint location, GLsizei count, const GLint* v) + { + } + + inline void Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) + { + if( ! mProgramUniforms4f.SetUniformValue( mCurrentProgram, + location, + Vector4( x, y, z, w ) ) ) + { + mGetErrorResult = GL_INVALID_OPERATION; + } + } + + inline void Uniform4fv(GLint location, GLsizei count, const GLfloat* v) + { + for( int i = 0; i < count; ++i ) + { + if( ! mProgramUniforms4f.SetUniformValue( + mCurrentProgram, + location, + Vector4( v[4*i], v[4*i+1], v[4*i+2], v[4*i+3] ) ) ) + { + mGetErrorResult = GL_INVALID_OPERATION; + break; + } + } + } + + inline void Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) + { + } + + inline void Uniform4iv(GLint location, GLsizei count, const GLint* v) + { + } + + inline void UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) + { + } + + inline void UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) + { + for( int i = 0; i < count; ++i ) + { + if( ! mProgramUniformsMat3.SetUniformValue( + mCurrentProgram, + location, + Matrix3( value[0], value[1], value[2], value[3], value[4], value[5], value[6], value[7], value[8] ) ) ) + { + mGetErrorResult = GL_INVALID_OPERATION; + break; + } + } + } + + inline void UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) + { + for( int i = 0; i < count; ++i ) + { + if( ! mProgramUniformsMat4.SetUniformValue( + mCurrentProgram, + location, + Matrix( value ) ) ) + { + mGetErrorResult = GL_INVALID_OPERATION; + break; + } + } + } + + inline void UseProgram(GLuint program) + { + mCurrentProgram = program; + } + + inline void ValidateProgram(GLuint program) + { + } + + inline void VertexAttrib1f(GLuint indx, GLfloat x) + { + } + + inline void VertexAttrib1fv(GLuint indx, const GLfloat* values) + { + } + + inline void VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) + { + } + + inline void VertexAttrib2fv(GLuint indx, const GLfloat* values) + { + } + + inline void VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) + { + } + + inline void VertexAttrib3fv(GLuint indx, const GLfloat* values) + { + } + + inline void VertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) + { + } + + inline void VertexAttrib4fv(GLuint indx, const GLfloat* values) + { + } + + inline void VertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) + { + } + + inline void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) + { + } + + /* OpenGL ES 3.0 */ + + inline void ReadBuffer(GLenum mode) + { + } + + inline void DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices) + { + } + + inline void TexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels) + { + } + + inline void TexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels) + { + } + + inline void CopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) + { + } + + inline void CompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data) + { + } + + inline void CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data) + { + } + + inline void GenQueries(GLsizei n, GLuint* ids) + { + } + + inline void DeleteQueries(GLsizei n, const GLuint* ids) + { + } + + inline GLboolean IsQuery(GLuint id) + { + return false; + } + + inline void BeginQuery(GLenum target, GLuint id) + { + } + + inline void EndQuery(GLenum target) + { + } + + inline void GetQueryiv(GLenum target, GLenum pname, GLint* params) + { + } + + inline void GetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params) + { + } + + inline GLboolean UnmapBuffer(GLenum target) + { + return false; + } + + inline void GetBufferPointerv(GLenum target, GLenum pname, GLvoid** params) + { + } + + inline void DrawBuffers(GLsizei n, const GLenum* bufs) + { + } + + inline void UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) + { + } + + inline void UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) + { + } + + inline void UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) + { + } + + inline void UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) + { + } + + inline void UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) + { + } + + inline void UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) + { + } + + inline void BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) + { + } + + inline void RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) + { + } + + inline void FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) + { + } + + inline GLvoid* MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) + { + return NULL; + } + + inline void FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) + { + } + + inline void BindVertexArray(GLuint array) + { + } + + inline void DeleteVertexArrays(GLsizei n, const GLuint* arrays) + { + } + + inline void GenVertexArrays(GLsizei n, GLuint* arrays) + { + } + + inline GLboolean IsVertexArray(GLuint array) + { + return false; + } + + inline void GetIntegeri_v(GLenum target, GLuint index, GLint* data) + { + } + + inline void BeginTransformFeedback(GLenum primitiveMode) + { + } + + inline void EndTransformFeedback(void) + { + } + + inline void BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) + { + } + + inline void BindBufferBase(GLenum target, GLuint index, GLuint buffer) + { + } + + inline void TransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode) + { + } + + inline void GetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name) + { + } + + inline void VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) + { + } + + inline void GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params) + { + } + + inline void GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params) + { + } + + inline void VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w) + { + } + + inline void VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) + { + } + + inline void VertexAttribI4iv(GLuint index, const GLint* v) + { + } + + inline void VertexAttribI4uiv(GLuint index, const GLuint* v) + { + } + + inline void GetUniformuiv(GLuint program, GLint location, GLuint* params) + { + } + + inline GLint GetFragDataLocation(GLuint program, const GLchar *name) + { + return -1; + } + + inline void Uniform1ui(GLint location, GLuint v0) + { + } + + inline void Uniform2ui(GLint location, GLuint v0, GLuint v1) + { + } + + inline void Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) + { + } + + inline void Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) + { + } + + inline void Uniform1uiv(GLint location, GLsizei count, const GLuint* value) + { + } + + inline void Uniform2uiv(GLint location, GLsizei count, const GLuint* value) + { + } + + inline void Uniform3uiv(GLint location, GLsizei count, const GLuint* value) + { + } + + inline void Uniform4uiv(GLint location, GLsizei count, const GLuint* value) + { + } + + inline void ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value) + { + } + + inline void ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value) + { + } + + inline void ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value) + { + } + + inline void ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) + { + } + + inline const GLubyte* GetStringi(GLenum name, GLuint index) + { + return NULL; + } + + inline void CopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) + { + } + + inline void GetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices) + { + } + + inline void GetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params) + { + } + + inline GLuint GetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName) + { + return GL_INVALID_INDEX; + } + + inline void GetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params) + { + } + + inline void GetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName) + { + } + + inline void UniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) + { + } + + inline void DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount) + { + } + + inline void DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount) + { + } + + inline GLsync FenceSync(GLenum condition, GLbitfield flags) + { + return NULL; + } + + inline GLboolean IsSync(GLsync sync) + { + return false; + } + + inline void DeleteSync(GLsync sync) + { + } + + inline GLenum ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) + { + return 0; + } + + inline void WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) + { + } + + inline void GetInteger64v(GLenum pname, GLint64* params) + { + } + + inline void GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values) + { + } + + inline void GetInteger64i_v(GLenum target, GLuint index, GLint64* data) + { + } + + inline void GetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params) + { + } + + inline void GenSamplers(GLsizei count, GLuint* samplers) + { + } + + inline void DeleteSamplers(GLsizei count, const GLuint* samplers) + { + } + + inline GLboolean IsSampler(GLuint sampler) + { + return false; + } + + inline void BindSampler(GLuint unit, GLuint sampler) + { + } + + inline void SamplerParameteri(GLuint sampler, GLenum pname, GLint param) + { + } + + inline void SamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param) + { + } + + inline void SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param) + { + } + + inline void SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param) + { + } + + inline void GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params) + { + } + + inline void GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params) + { + } + + inline void VertexAttribDivisor(GLuint index, GLuint divisor) + { + } + + inline void BindTransformFeedback(GLenum target, GLuint id) + { + } + + inline void DeleteTransformFeedbacks(GLsizei n, const GLuint* ids) + { + } + + inline void GenTransformFeedbacks(GLsizei n, GLuint* ids) + { + } + + inline GLboolean IsTransformFeedback(GLuint id) + { + return false; + } + + inline void PauseTransformFeedback(void) + { + } + + inline void ResumeTransformFeedback(void) + { + } + + inline void GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary) + { + } + + inline void ProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length) + { + } + + inline void ProgramParameteri(GLuint program, GLenum pname, GLint value) + { + } + + inline void InvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments) + { + } + + inline void InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height) + { + } + + inline void TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) + { + } + + inline void TexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) + { + } + + inline void GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params) + { + } + +public: // TEST FUNCTIONS + inline void SetCompileStatus( GLuint value ) { mCompileStatus = value; } + inline void SetLinkStatus( GLuint value ) { mLinkStatus = value; } + inline void SetGetAttribLocationResult( int result) { mGetAttribLocationResult = result; } + inline void SetGetErrorResult( GLenum result) { mGetErrorResult = result; } + inline void SetGetStringResult( GLubyte* result) { mGetStringResult = result; } + inline void SetIsBufferResult( GLboolean result) { mIsBufferResult = result; } + inline void SetIsEnabledResult( GLboolean result) { mIsEnabledResult = result; } + inline void SetIsFramebufferResult( GLboolean result) { mIsFramebufferResult = result; } + inline void SetIsProgramResult( GLboolean result) { mIsProgramResult = result; } + inline void SetIsRenderbufferResult( GLboolean result) { mIsRenderbufferResult = result; } + inline void SetIsShaderResult( GLboolean result) { mIsShaderResult = result; } + inline void SetIsTextureResult( GLboolean result) { mIsTextureResult = result; } + inline void SetCheckFramebufferStatusResult( GLenum result) { mCheckFramebufferStatusResult = result; } + inline void SetNumBinaryFormats( GLint numFormats ) { mNumBinaryFormats = numFormats; } + inline void SetBinaryFormats( GLint binaryFormats ) { mBinaryFormats = binaryFormats; } + inline void SetProgramBinaryLength( GLint length ) { mProgramBinaryLength = length; } + + inline bool GetVertexAttribArrayState(GLuint index) + { + if( index >= MAX_ATTRIBUTE_CACHE_SIZE ) + { + // out of range + return false; + } + return mVertexAttribArrayState[ index ]; + } + inline void ClearVertexAttribArrayChanged() { mVertexAttribArrayChanged = false; } + inline bool GetVertexAttribArrayChanged() { return mVertexAttribArrayChanged; } + + //Methods for CullFace verification + inline void EnableCullFaceCallTrace(bool enable) { mCullFaceTrace.Enable(enable); } + inline void ResetCullFaceCallStack() { mCullFaceTrace.Reset(); } + inline TraceCallStack& GetCullFaceTrace() { return mCullFaceTrace; } + + //Methods for Shader verification + inline void EnableShaderCallTrace(bool enable) { mShaderTrace.Enable(enable); } + inline void ResetShaderCallStack() { mShaderTrace.Reset(); } + inline TraceCallStack& GetShaderTrace() { return mShaderTrace; } + + //Methods for Texture verification + inline void EnableTextureCallTrace(bool enable) { mTextureTrace.Enable(enable); } + inline void ResetTextureCallStack() { mTextureTrace.Reset(); } + inline TraceCallStack& GetTextureTrace() { return mTextureTrace; } + + //Methods for Draw verification + inline void EnableDrawCallTrace(bool enable) { mDrawTrace.Enable(enable); } + inline void ResetDrawCallStack() { mDrawTrace.Reset(); } + inline TraceCallStack& GetDrawTrace() { return mDrawTrace; } + + template + inline bool CheckUniformValue( const char* name, const T& value ) const + { + for( ProgramUniformMap::const_iterator program_it = mUniforms.begin(); + program_it != mUniforms.end(); + ++program_it ) + { + const UniformIDMap &uniformIDs = program_it->second; + + UniformIDMap::const_iterator uniform_it = uniformIDs.find( name ); + if( uniform_it != uniformIDs.end() ) + { + // found one matching uniform name, lets check the value... + GLuint programId = program_it->first; + GLint uniformId = uniform_it->second; + + const ProgramUniformValue &mProgramUniforms = GetProgramUniformsForType( value ); + if( mProgramUniforms.CheckUniformValue( programId, uniformId, value ) ) + { + // the value matches + return true; + } + } + } + + fprintf(stderr, "Not found, printing possible values:" ); + for( ProgramUniformMap::const_iterator program_it = mUniforms.begin(); + program_it != mUniforms.end(); + ++program_it ) + { + const UniformIDMap &uniformIDs = program_it->second; + + UniformIDMap::const_iterator uniform_it = uniformIDs.find( name ); + if( uniform_it != uniformIDs.end() ) + { + // found one matching uniform name, lets check the value... + GLuint programId = program_it->first; + GLint uniformId = uniform_it->second; + + const ProgramUniformValue &mProgramUniforms = GetProgramUniformsForType( value ); + T origValue; + if ( mProgramUniforms.GetUniformValue(programId, uniformId, origValue) ) + { + std::stringstream out; + out << uniform_it->first << ": " << origValue; + fprintf(stderr, "%s", out.str().c_str() ); + } + } + } + return false; + } + + template + inline bool GetUniformValue( GLuint programId, GLuint uniformId, T& outValue) const + { + const ProgramUniformValue &mProgramUniforms = GetProgramUniformsForType( outValue ); + return mProgramUniforms.GetUniformValue( programId, uniformId, outValue ); + } + + inline bool GetUniformIds( const char* name, GLuint& programId, GLuint& uniformId ) const + { + for( ProgramUniformMap::const_iterator program_it = mUniforms.begin(); + program_it != mUniforms.end(); + ++program_it ) + { + const UniformIDMap &uniformIDs = program_it->second; + + UniformIDMap::const_iterator uniform_it = uniformIDs.find( name ); + if( uniform_it != uniformIDs.end() ) + { + programId = program_it->first; + uniformId = uniform_it->second; + return true; + } + } + return false; + } + + + + inline GLuint GetLastShaderCompiled() const + { + return mLastShaderCompiled; + } + + inline GLuint GetLastProgramCreated() const + { + return mLastProgramIdUsed; + } + + enum AttribType + { + ATTRIB_UNKNOWN = -1, + ATTRIB_POSITION, + ATTRIB_NORMAL, + ATTRIB_TEXCOORD, + ATTRIB_COLOR, + ATTRIB_BONE_WEIGHTS, + ATTRIB_BONE_INDICES, + ATTRIB_TYPE_LAST + }; + + +private: + GLuint mCurrentProgram; + GLuint mCompileStatus; + GLuint mLinkStatus; + GLint mGetAttribLocationResult; + GLenum mGetErrorResult; + GLubyte* mGetStringResult; + GLboolean mIsBufferResult; + GLboolean mIsEnabledResult; + GLboolean mIsFramebufferResult; + GLboolean mIsProgramResult; + GLboolean mIsRenderbufferResult; + GLboolean mIsShaderResult; + GLboolean mIsTextureResult; + GLenum mActiveTextureUnit; + GLenum mCheckFramebufferStatusResult; + GLint mNumBinaryFormats; + GLint mBinaryFormats; + GLint mProgramBinaryLength; + bool mVertexAttribArrayState[MAX_ATTRIBUTE_CACHE_SIZE]; + bool mVertexAttribArrayChanged; // whether the vertex attrib array has been changed + typedef std::map< GLuint, std::string> ShaderSourceMap; + ShaderSourceMap mShaderSources; + GLuint mLastShaderCompiled; + + Vector4 mLastBlendColor; + GLenum mLastBlendEquationRgb; + GLenum mLastBlendEquationAlpha; + GLenum mLastBlendFuncSrcRgb; + GLenum mLastBlendFuncDstRgb; + GLenum mLastBlendFuncSrcAlpha; + GLenum mLastBlendFuncDstAlpha; + + // Data for manipulating the IDs returned by GenTextures + GLuint mLastAutoTextureIdUsed; + std::vector mNextTextureIds; + std::vector mDeletedTextureIds; + std::vector mBoundTextures; + + struct ActiveTextureType + { + std::vector mBoundTextures; + }; + + ActiveTextureType mActiveTextures[ MIN_TEXTURE_UNIT_LIMIT ]; + + TraceCallStack mCullFaceTrace; + TraceCallStack mShaderTrace; + TraceCallStack mTextureTrace; + TraceCallStack mDrawTrace; + + // Shaders & Uniforms + GLuint mLastShaderIdUsed; + GLuint mLastProgramIdUsed; + GLuint mLastUniformIdUsed; + typedef std::map< std::string, GLint > UniformIDMap; + typedef std::map< GLuint, UniformIDMap > ProgramUniformMap; + ProgramUniformMap mUniforms; + + template + struct ProgramUniformValue : public std::map< GLuint, std::map< GLint, T > > + { + public: + typedef std::map< GLint, T > UniformValueMap; + typedef std::map< GLuint, UniformValueMap > Map; + + bool SetUniformValue( GLuint program, GLuint uniform, const T& value ) + { + if( program == 0 ) + { + return false; + } + + typename Map::iterator it = Map::find( program ); + if( it == Map::end() ) + { + // if its the first uniform for this program add it + std::pair< typename Map::iterator, bool > result = + Map::insert( typename Map::value_type( program, UniformValueMap() ) ); + it = result.first; + } + + UniformValueMap& uniforms = it->second; + uniforms[uniform] = value; + + return true; + } + + bool CheckUniformValue( GLuint program, GLuint uniform, const T& value ) const + { + T uniformValue; + if ( GetUniformValue( program, uniform, uniformValue ) ) + { + return value == uniformValue; + } + + return false; + } + + bool GetUniformValue( GLuint program, GLuint uniform, T& value ) const + { + if( program == 0 ) + { + return false; + } + + typename Map::const_iterator it = Map::find( program ); + if( it == Map::end() ) + { + // Uniform values always initialised as 0 + value = GetZero(); + return true; + } + + const UniformValueMap& uniforms = it->second; + typename UniformValueMap::const_iterator it2 = uniforms.find( uniform ); + if( it2 == uniforms.end() ) + { + // Uniform values always initialised as 0 + value = GetZero(); + return true; + } + value = it2->second; + + return true; + } + + T GetZero() const; + }; + ProgramUniformValue mProgramUniforms1i; + ProgramUniformValue mProgramUniforms1f; + ProgramUniformValue mProgramUniforms2f; + ProgramUniformValue mProgramUniforms3f; + ProgramUniformValue mProgramUniforms4f; + ProgramUniformValue mProgramUniformsMat4; + ProgramUniformValue mProgramUniformsMat3; + + inline const ProgramUniformValue& GetProgramUniformsForType( const int ) const + { + return mProgramUniforms1i; + } + inline const ProgramUniformValue& GetProgramUniformsForType( const float ) const + { + return mProgramUniforms1f; + } + inline const ProgramUniformValue& GetProgramUniformsForType( const Vector2& ) const + { + return mProgramUniforms2f; + } + inline const ProgramUniformValue& GetProgramUniformsForType( const Vector3& ) const + { + return mProgramUniforms3f; + } + inline const ProgramUniformValue& GetProgramUniformsForType( const Vector4& ) const + { + return mProgramUniforms4f; + } + inline const ProgramUniformValue& GetProgramUniformsForType( const Matrix& ) const + { + return mProgramUniformsMat4; + } + inline const ProgramUniformValue& GetProgramUniformsForType( const Matrix3& ) const + { + return mProgramUniformsMat3; + } + inline void SetVertexAttribArray(GLuint index, bool state) + { + if( index >= MAX_ATTRIBUTE_CACHE_SIZE ) + { + // out of range + return; + } + mVertexAttribArrayState[ index ] = state; + mVertexAttribArrayChanged = true; + } +}; + +template <> +inline int TestGlAbstraction::ProgramUniformValue::GetZero() const +{ + return 0; +} + +template <> +inline float TestGlAbstraction::ProgramUniformValue::GetZero() const +{ + return 0.0f; +} + +template <> +inline Vector2 TestGlAbstraction::ProgramUniformValue::GetZero() const +{ + return Vector2::ZERO; +} + +template <> +inline Vector3 TestGlAbstraction::ProgramUniformValue::GetZero() const +{ + return Vector3::ZERO; +} + +template <> +inline Vector4 TestGlAbstraction::ProgramUniformValue::GetZero() const +{ + return Vector4::ZERO; +} + +template <> +inline Matrix TestGlAbstraction::ProgramUniformValue::GetZero() const +{ + return Matrix(); +} + +template <> +inline Matrix3 TestGlAbstraction::ProgramUniformValue::GetZero() const +{ + return Matrix3( Matrix() ); +} + +} // namespace Dali + +bool BlendEnabled(const Dali::TraceCallStack& callStack); +bool BlendDisabled(const Dali::TraceCallStack& callStack); + + + + +#endif // __TEST_GL_ES_H__ diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp new file mode 100644 index 0000000..8ea52be --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp @@ -0,0 +1,135 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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-gl-sync-abstraction.h" + +namespace Dali +{ + +TestSyncObject::TestSyncObject(TraceCallStack& trace) +: synced(false), + mTrace(trace) +{ +} + +TestSyncObject::~TestSyncObject() +{ +} + +bool TestSyncObject::IsSynced() +{ + mTrace.PushCall("SyncObject::IsSynced", ""); // Trace the method + return synced; +} + + + +TestGlSyncAbstraction::TestGlSyncAbstraction() +{ + Initialize(); +} + +/** + * Destructor + */ +TestGlSyncAbstraction::~TestGlSyncAbstraction() +{ + for( SyncIter iter=mSyncObjects.begin(), end=mSyncObjects.end(); iter != end; ++iter ) + { + delete *iter; + } +} + +/** + * Initialize the sync objects - clear down the map + */ +void TestGlSyncAbstraction::Initialize() +{ + mSyncObjects.clear(); +} + +/** + * Create a sync object + * @return the sync object + */ +Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::CreateSyncObject( ) +{ + mTrace.PushCall("CreateSyncObject", ""); // Trace the method + + TestSyncObject* syncObject = new TestSyncObject(mTrace); + mSyncObjects.push_back( syncObject ); + return syncObject; +} + +/** + * Destroy a sync object + * @param[in] syncObject The object to destroy + */ +void TestGlSyncAbstraction::DestroySyncObject( Integration::GlSyncAbstraction::SyncObject* syncObject ) +{ + std::stringstream out; + out << syncObject; + mTrace.PushCall("DestroySyncObject", out.str()); // Trace the method + + for( SyncIter iter=mSyncObjects.begin(), end=mSyncObjects.end(); iter != end; ++iter ) + { + if( *iter == syncObject ) + { + delete *iter; + mSyncObjects.erase(iter); + break; + } + } +} + + +Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::GetLastSyncObject( ) +{ + if( !mSyncObjects.empty() ) + { + return mSyncObjects.back(); + } + return NULL; +} + +/** + * Test method to trigger the object sync behaviour. + * @param[in] + * @param[in] sync The sync value to set + */ +void TestGlSyncAbstraction::SetObjectSynced( Integration::GlSyncAbstraction::SyncObject* syncObject, bool sync ) +{ + TestSyncObject* testSyncObject = static_cast(syncObject); + testSyncObject->synced = sync; +} + +/** + * Turn trace on + */ +void TestGlSyncAbstraction::EnableTrace(bool enable) { mTrace.Enable(enable); } + +/** + * Reset the trace callstack + */ +void TestGlSyncAbstraction::ResetTrace() { mTrace.Reset(); } + +/** + * Get the trace object (allows test case to find methods on it) + */ +TraceCallStack& TestGlSyncAbstraction::GetTrace() { return mTrace; } + + +} // Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.h new file mode 100644 index 0000000..15f6450 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.h @@ -0,0 +1,111 @@ +#ifndef __TEST_GL_SYNC_ABSTRACTION_H__ +#define __TEST_GL_SYNC_ABSTRACTION_H__ + +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include + +// INTERNAL INCLUDES +#include +#include +#include "test-trace-call-stack.h" + +namespace Dali +{ + +class DALI_IMPORT_API TestSyncObject : public Integration::GlSyncAbstraction::SyncObject +{ +public: + TestSyncObject(TraceCallStack& trace); + ~TestSyncObject(); + bool IsSynced(); + bool synced; + TraceCallStack& mTrace; +}; + +/** + * Class to emulate the GL sync functions with tracing + */ +class DALI_IMPORT_API TestGlSyncAbstraction: public Integration::GlSyncAbstraction +{ +public: + /** + * Constructor + */ + TestGlSyncAbstraction(); + + /** + * Destructor + */ + ~TestGlSyncAbstraction(); + + /** + * Initialize the sync objects - clear down the map + */ + void Initialize(); + + /** + * Create a sync object + * @return the sync object + */ + virtual Integration::GlSyncAbstraction::SyncObject* CreateSyncObject( ); + + /** + * Destroy a sync object + * @param[in] syncObject The object to destroy + */ + virtual void DestroySyncObject( Integration::GlSyncAbstraction::SyncObject* syncObject ); + + +public: // TEST FUNCTIONS + Integration::GlSyncAbstraction::SyncObject* GetLastSyncObject( ); + + /** + * Test method to trigger the object sync behaviour. + * @param[in] + * @param[in] sync The sync value to set + */ + void SetObjectSynced( Integration::GlSyncAbstraction::SyncObject* syncObject, bool sync ); + + /** + * Turn trace on + */ + void EnableTrace(bool enable); + + /** + * Reset the trace callstack + */ + void ResetTrace(); + + /** + * Get the trace object (allows test case to find methods on it) + */ + TraceCallStack& GetTrace(); + +private: + typedef std::vector SyncContainer; + typedef SyncContainer::iterator SyncIter; + SyncContainer mSyncObjects; ///< The sync objects + TraceCallStack mTrace; ///< the trace call stack for testing +}; + +} // Dali + +#endif // __TEST_GL_SYNC_ABSTRACTION_H__ diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-native-image.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-native-image.cpp new file mode 100644 index 0000000..0604649 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-native-image.cpp @@ -0,0 +1,39 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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-application.h" +#include "test-native-image.h" + + +namespace Dali +{ + +TestNativeImagePointer TestNativeImage::New(int width, int height) +{ + return new TestNativeImage(width, height); +} + +TestNativeImage::TestNativeImage(int width, int height) +: mWidth(width), mHeight(height) +{ +} + +TestNativeImage::~TestNativeImage() +{ +} + +} // namespace dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-native-image.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-native-image.h new file mode 100644 index 0000000..2ba56a7 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-native-image.h @@ -0,0 +1,51 @@ +#ifndef __TEST_NATIVE_IMAGE_H__ +#define __TEST_NATIVE_IMAGE_H__ + +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +// INTERNAL INCLUDES +#include + +namespace Dali +{ +class TestNativeImage; +typedef IntrusivePtr TestNativeImagePointer; + +class DALI_IMPORT_API TestNativeImage : public Dali::NativeImage +{ +public: + static TestNativeImagePointer New(int width, int height); + + inline virtual bool GlExtensionCreate() {return true;}; + inline virtual void GlExtensionDestroy() {}; + inline virtual GLenum TargetTexture() {return 1;}; + inline virtual void PrepareTexture() {}; + inline virtual unsigned int GetWidth() const {return mWidth;}; + inline virtual unsigned int GetHeight() const {return mHeight;}; + inline virtual Pixel::Format GetPixelFormat() const {return Pixel::RGBA8888;}; + +private: + TestNativeImage(int width, int height); + virtual ~TestNativeImage(); + + int mWidth; + int mHeight; +}; + +} // Dali + +#endif diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp new file mode 100644 index 0000000..27e806e --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp @@ -0,0 +1,637 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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-platform-abstraction.h" +#include "dali-test-suite-utils.h" +#include + +namespace Dali +{ + +/** + * Constructor + */ +TestPlatformAbstraction::TestPlatformAbstraction() +: mRequest(0) +{ + Initialize(); +} + +/** + * Destructor + */ +TestPlatformAbstraction::~TestPlatformAbstraction() +{ +} + +/** + * @copydoc PlatformAbstraction::GetTimeMicroseconds() + */ +void TestPlatformAbstraction::GetTimeMicroseconds(unsigned int &seconds, unsigned int µSeconds) +{ + seconds = mSeconds; + microSeconds = mMicroSeconds; + mTrace.PushCall("GetTimeMicroseconds", ""); +} + +/** + * @copydoc PlatformAbstraction::Suspend() + */ +void TestPlatformAbstraction::Suspend() +{ + mTrace.PushCall("Suspend", ""); +} + +/** + * @copydoc PlatformAbstraction::Resume() + */ +void TestPlatformAbstraction::Resume() +{ + mTrace.PushCall("Resume", ""); +} + +void TestPlatformAbstraction::GetClosestImageSize( const std::string& filename, + const ImageAttributes& attributes, + Vector2& closestSize) +{ + closestSize = mClosestSize; + mTrace.PushCall("GetClosestImageSize", ""); +} + +void TestPlatformAbstraction::GetClosestImageSize( Integration::ResourcePointer resourceBuffer, + const ImageAttributes& attributes, + Vector2& closestSize) +{ + closestSize = mClosestSize; + mTrace.PushCall("GetClosestImageSize", ""); +} + + +/** + * @copydoc PlatformAbstraction::LoadResource() + */ +void TestPlatformAbstraction::LoadResource(const Integration::ResourceRequest& request) +{ + mTrace.PushCall("LoadResource", ""); + if(mRequest != NULL) + { + delete mRequest; + tet_infoline ("Warning: multiple resource requests not handled by Test Suite. You may see unexpected errors"); + } + mRequest = new Integration::ResourceRequest(request); +} + +Integration::ResourcePointer TestPlatformAbstraction::LoadResourceSynchronously( const Integration::ResourceType& resourceType, const std::string& resourcePath ) +{ + mTrace.PushCall("LoadResourceSynchronously", ""); + return mResources.loadedResource; +} + +/** + * @copydoc PlatformAbstraction::SaveResource() + */ +void TestPlatformAbstraction::SaveResource(const Integration::ResourceRequest& request) +{ + mTrace.PushCall("SaveResource", ""); + if(mRequest != NULL) + { + delete mRequest; + tet_infoline ("Warning: multiple resource requests not handled by Test Suite. You may see unexpected errors"); + } + mRequest = new Integration::ResourceRequest(request); +} + +/** + * @copydoc PlatformAbstraction::CancelLoad() + */ +void TestPlatformAbstraction::CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId) +{ + mTrace.PushCall("CancelLoad", ""); +} + +/** + * @copydoc PlatformAbstraction::GetResources() + */ +void TestPlatformAbstraction::GetResources(Integration::ResourceCache& cache) +{ + mTrace.PushCall("GetResources", ""); + + if(mResources.loaded) + { + cache.LoadResponse( mResources.loadedId, mResources.loadedType, mResources.loadedResource, Integration::RESOURCE_COMPLETELY_LOADED ); + } + if(mResources.loadFailed) + { + cache.LoadFailed( mResources.loadFailedId, mResources.loadFailure ); + } + if(mResources.saved) + { + cache.SaveComplete( mResources.savedId, mResources.savedType ); + } + if(mResources.saveFailed) + { + cache.SaveFailed( mResources.saveFailedId, mResources.saveFailure ); + } +} + +/** + * @copydoc PlatformAbstraction::IsLoading() + */ +bool TestPlatformAbstraction::IsLoading() +{ + mTrace.PushCall("IsLoading", ""); + return mIsLoadingResult; +} + +/** + * @copydoc PlatformAbstraction::GetDefaultFontFamily() + */ +std::string TestPlatformAbstraction::GetDefaultFontFamily() const +{ + mTrace.PushCall("GetDefaultFontFamily", ""); + return mGetDefaultFontFamilyResult; +} + +/** + * @copydoc PlatformAbstraction::GetDefaultFontSize() + */ +const float TestPlatformAbstraction::GetDefaultFontSize() const +{ + mTrace.PushCall("GetDefaultFontSize", ""); + return mGetDefaultFontSizeResult; +} + +const PixelSize TestPlatformAbstraction::GetFontLineHeightFromCapsHeight(const std::string& fontFamily, const std::string& fontStyle, const CapsHeight& capsHeight) const +{ + mTrace.PushCall("GetFontLineHeightFromCapsHeight", ""); + // LineHeight will be bigger than CapsHeight, so return capsHeight + 1 + return PixelSize(capsHeight + 1); +} + +/** + * @copydoc PlatformAbstraction::GetGlyphData() + */ + +Integration::GlyphSet* TestPlatformAbstraction::GetGlyphData ( const Integration::TextResourceType& textRequest, + const std::string& fontFamily, + bool getBitmap) const +{ + if( getBitmap ) + { + mTrace.PushCall("GetGlyphData", "getBitmap:true"); + } + else + { + mTrace.PushCall("GetGlyphData", "getBitmap:false"); + } + + // It creates fake metrics for the received characters. + + Integration::GlyphSet* set = new Dali::Integration::GlyphSet(); + Integration::BitmapPtr bitmapData; + + std::set characters; + + for( Integration::TextResourceType::CharacterList::const_iterator it = textRequest.mCharacterList.begin(), endIt = textRequest.mCharacterList.end(); it != endIt; ++it ) + { + if( characters.find( it->character ) == characters.end() ) + { + characters.insert( it->character ); + Integration::GlyphMetrics character = {it->character, Integration::GlyphMetrics::LOW_QUALITY, 10.0f, 10.0f, 9.0f, 1.0f, 10.0f, it->xPosition, it->yPosition }; + + if( getBitmap ) + { + bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true); + bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, 64, 64); + PixelBuffer* pixelBuffer = bitmapData->GetBuffer(); + memset( pixelBuffer, it->character, 64*64 ); + } + + set->AddCharacter(bitmapData, character); + } + } + + set->mLineHeight = 10.0f; + set->mAscender = 9.0f; + set->mUnitsPerEM = 2048.0f/64.0f; + set->SetAtlasResourceId( textRequest.mTextureAtlasId ); + set->mFontHash = textRequest.mFontHash; + + return set; +} + +/** + * @copydoc PlatformAbstraction::GetCachedGlyphData() + */ + +Integration::GlyphSet* TestPlatformAbstraction::GetCachedGlyphData( const Integration::TextResourceType& textRequest, + const std::string& fontFamily ) const +{ + mTrace.PushCall("GetCachedGlyphData", ""); + + // It creates fake metrics and bitmap for received numeric characters '0' through '9'. + Integration::GlyphSet* set = new Dali::Integration::GlyphSet(); + Integration::BitmapPtr bitmapData; + + std::set characters; + + for( Integration::TextResourceType::CharacterList::const_iterator it = textRequest.mCharacterList.begin(), endIt = textRequest.mCharacterList.end(); it != endIt; ++it ) + { + if( it->character >= '0' && it->character <= '9' && characters.find( it->character ) == characters.end() ) + { + characters.insert( it->character ); + Integration::GlyphMetrics character = {it->character, Integration::GlyphMetrics::HIGH_QUALITY, 10.0f, 10.0f, 9.0f, 1.0f, 10.0f, it->xPosition, it->yPosition }; + + bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true); + bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, 64, 64); + PixelBuffer* pixelBuffer = bitmapData->GetBuffer(); + memset( pixelBuffer, it->character, 64*64 ); + set->AddCharacter(bitmapData, character); + } + } + + set->mLineHeight = 10.0f; + set->mAscender = 9.0f; + set->mUnitsPerEM = 2048.0f/64.0f; + set->SetAtlasResourceId( textRequest.mTextureAtlasId ); + set->mFontHash = textRequest.mFontHash; + + return set; +} + + +/** + * @copydoc PlatformAbstraction::GetGlobalMetrics() + */ +void TestPlatformAbstraction::GetGlobalMetrics( const std::string& fontFamily, + const std::string& fontStyle, + Integration::GlobalMetrics& globalMetrics ) const +{ + globalMetrics.lineHeight = 10.0f; + globalMetrics.ascender = 9.0f; + globalMetrics.unitsPerEM = 2048.0f/64.0f; + globalMetrics.underlineThickness = 2.f; + globalMetrics.underlinePosition = 1.f; +} + +/** + * @copydoc PlatformAbstraction::GetFontPath() + */ +std::string TestPlatformAbstraction::GetFontPath(const std::string& family, bool bold, bool italic) const +{ + mTrace.PushCall("GetFontPath", ""); + return mGetFontPathResult; + + // Do nothing with arguments +} + +/** + * @copydoc PlatformAbstraction::SetDpi() + */ +void TestPlatformAbstraction::SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical) +{ + mTrace.PushCall("SetDpi", ""); +} + +/** + * @copydoc PlatformAbstraction::GetFontFamilyForChars() + */ +std::string TestPlatformAbstraction::GetFontFamilyForChars(const TextArray& charsRequested) const +{ + mTrace.PushCall("GetFontFamilyForChars", ""); + return mGetDefaultFontFamilyResult; +} + +/** + * @copydoc PlatformAbstraction::AllGlyphsSupported() + */ +bool TestPlatformAbstraction::AllGlyphsSupported(const std::string& name, const std::string& fontStyle, const TextArray& text) const +{ + mTrace.PushCall("AllGlyphsSupported", ""); + return true; +} + +/** + * @copydoc PlatformAbstraction::ValidateFontFamilyName() + */ +bool TestPlatformAbstraction::ValidateFontFamilyName(const std::string& fontFamily, const std::string& fontStyle, bool& isDefaultSystemFont, std::string& closestMatch, std::string& closestStyleMatch) const +{ + mTrace.PushCall("ValidateFontFamilyName", ""); + return true; +} + +/** + * @copydoc PlatformAbstraction::GetFontList() + */ +std::vector TestPlatformAbstraction::GetFontList( PlatformAbstraction::FontListMode mode ) const +{ + mFontListMode = mode; + mTrace.PushCall("ValidateGetFontList", ""); + std::vector fontList; + return fontList; +} + +/** + * @copydoc PlatformAbstraction::LoadFile() + */ +bool TestPlatformAbstraction::LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const +{ + mTrace.PushCall("LoadFile", ""); + if( mLoadFileResult.loadResult ) + { + buffer = mLoadFileResult.buffer; + } + + return mLoadFileResult.loadResult; +} + +/** + * @copydoc PlatformAbstraction::SaveFile() + */ +bool TestPlatformAbstraction::SaveFile(const std::string& filename, std::vector< unsigned char >& buffer) const +{ + mTrace.PushCall("SaveFile", ""); + return false; +} + +void TestPlatformAbstraction::JoinLoaderThreads() +{ + mTrace.PushCall("JoinLoaderThreads", ""); +} + +void TestPlatformAbstraction::UpdateDefaultsFromDevice() +{ + mTrace.PushCall("UpdateDefaultsFromDevice", ""); + mGetDefaultFontFamilyResult+=1.0f; +} + +Integration::DynamicsFactory* TestPlatformAbstraction::GetDynamicsFactory() +{ + mTrace.PushCall("GetDynamicsFactory", ""); + return NULL; +} + +bool TestPlatformAbstraction::ReadGlobalMetricsFromCache( const std::string& fontFamily, + const std::string& fontStyle, + Integration::GlobalMetrics& globalMetrics ) +{ + mTrace.PushCall("ReadGlobalMetricsFromCacheFile", ""); + globalMetrics = mReadGlobalMetrics; // Want to copy contents... + return mReadGlobalMetricsResult; // Default false (will be set to true on subsequent write) +} + +void TestPlatformAbstraction::WriteGlobalMetricsToCache( const std::string& fontFamily, + const std::string& fontStyle, + const Integration::GlobalMetrics& globalMetrics ) +{ + // Copy so next read uses written values. TODO: Could add method + // to turn this behaviour off for more extensive testing. + mReadGlobalMetrics = globalMetrics; + mReadGlobalMetricsResult = true; + + mTrace.PushCall("WriteGlobalMetricsToCacheFile", ""); +} + +bool TestPlatformAbstraction::ReadMetricsFromCache( const std::string& fontFamily, + const std::string& fontStyle, + std::vector& glyphMetricsContainer ) +{ + mTrace.PushCall("ReadMetricsFromCacheFile", ""); + glyphMetricsContainer = mReadMetrics; + return mReadMetricsResult; // Default false (will be set to true on subsequent write) +} + +void TestPlatformAbstraction::WriteMetricsToCache( const std::string& fontFamily, + const std::string& fontStyle, + const Integration::GlyphSet& glyphSet ) +{ + // Copy so next read uses written values. TODO: Could add method + // to turn this behaviour off for more extensive testing. + const Integration::GlyphSet::CharacterList& charList = glyphSet.GetCharacterList(); + mReadMetrics.clear(); + for(std::size_t i=0, end=charList.size(); i& fileNames ) +{ + fileNames.push_back( std::string( "u1f004.png" ) ); + fileNames.push_back( std::string( "u1f0cf.png" ) ); + fileNames.push_back( std::string( "u1f170.png" ) ); + fileNames.push_back( std::string( "u1f601.png" ) ); +} + + +Integration::BitmapPtr TestPlatformAbstraction::GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const +{ + Integration::BitmapPtr image = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true ); + image->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 1, 1 ); + + mTrace.PushCall("GetGlyphImage", ""); + + return image; +} + + +/** Call this every test */ +void TestPlatformAbstraction::Initialize() +{ + mTrace.Reset(); + mTrace.Enable(true); + memset(&mResources, 0, sizeof(Resources)); + memset(&mReadGlobalMetrics, 0, sizeof(Integration::GlobalMetrics)); + mSeconds=0; + mMicroSeconds=0; + mIsLoadingResult=false; + mGetDefaultFontFamilyResult = "HelveticaNeue"; + mGetDefaultFontSizeResult=12.0f; + mGetFontPathResult="helvetica-12"; + mReadMetricsResult=false; + mReadGlobalMetricsResult=false; + + if(mRequest) + { + delete mRequest; + mRequest = 0; + } +} + + +bool TestPlatformAbstraction::WasCalled(TestFuncEnum func) +{ + switch(func) + { + case GetTimeMicrosecondsFunc: return mTrace.FindMethod("GetTimeMicroseconds"); + case SuspendFunc: return mTrace.FindMethod("Suspend"); + case ResumeFunc: return mTrace.FindMethod("Resume"); + case LoadResourceFunc: return mTrace.FindMethod("LoadResource"); + case SaveResourceFunc: return mTrace.FindMethod("SaveResource"); + case LoadFileFunc: return mTrace.FindMethod("LoadFile"); + case SaveFileFunc: return mTrace.FindMethod("SaveFile"); + case CancelLoadFunc: return mTrace.FindMethod("CancelLoad"); + case GetResourcesFunc: return mTrace.FindMethod("GetResources"); + case IsLoadingFunc: return mTrace.FindMethod("IsLoading"); + case GetDefaultFontFamilyFunc: return mTrace.FindMethod("GetDefaultFontFamily"); + case GetDefaultFontSizeFunc: return mTrace.FindMethod("GetDefaultFontSize"); + case GetFontLineHeightFromCapsHeightFunc: return mTrace.FindMethod("GetFontLineHeightFromCapsHeight"); + case GetGlyphDataFunc: return mTrace.FindMethod("GetGlyphData"); + case GetCachedGlyphDataFunc: return mTrace.FindMethod("GetCachedGlyphData"); + case GetFontPathFunc: return mTrace.FindMethod("GetFontPath"); + case SetDpiFunc: return mTrace.FindMethod("SetDpi"); + case JoinLoaderThreadsFunc: return mTrace.FindMethod("JoinLoaderThreads"); + case GetFontFamilyForCharsFunc: return mTrace.FindMethod("GetFontFamilyForChars"); + case AllGlyphsSupportedFunc: return mTrace.FindMethod("AllGlyphsSupported"); + case ValidateFontFamilyNameFunc: return mTrace.FindMethod("ValidateFontFamilyName"); + case UpdateDefaultsFromDeviceFunc: return mTrace.FindMethod("UpdateDefaultsFromDevice"); + case GetDynamicsFactoryFunc: return mTrace.FindMethod("GetDynamicsFactory"); + case ValidateGetFontListFunc: return mTrace.FindMethod("ValidateGetFontList"); + case ReadGlobalMetricsFromCacheFileFunc: return mTrace.FindMethod("ReadGlobalMetricsFromCacheFile"); + case WriteGlobalMetricsToCacheFileFunc: return mTrace.FindMethod("WriteGlobalMetricsToCacheFile"); + case ReadMetricsFromCacheFileFunc: return mTrace.FindMethod("ReadMetricsFromCacheFile"); + case WriteMetricsToCacheFileFunc: return mTrace.FindMethod("WriteMetricsToCacheFile"); + } + return false; +} + +void TestPlatformAbstraction::SetGetTimeMicrosecondsResult(size_t sec, size_t usec) +{ + mSeconds = sec; + mMicroSeconds = usec; +} + +void TestPlatformAbstraction::IncrementGetTimeResult(size_t milliseconds) +{ + mMicroSeconds += milliseconds * 1000u; + unsigned int additionalSeconds = mMicroSeconds / 1000000u; + + mSeconds += additionalSeconds; + mMicroSeconds -= additionalSeconds * 1000000u; +} + +void TestPlatformAbstraction::SetIsLoadingResult(bool result) +{ + mIsLoadingResult = result; +} + +void TestPlatformAbstraction::SetGetDefaultFontFamilyResult(std::string result) +{ + mGetDefaultFontFamilyResult = result; +} + +void TestPlatformAbstraction::SetGetDefaultFontSizeResult(float result) +{ + mGetDefaultFontSizeResult = result; +} + +void TestPlatformAbstraction::SetGetFontPathResult(std::string& result) +{ + mGetFontPathResult = result; +} + +void TestPlatformAbstraction::ClearReadyResources() +{ + memset(&mResources, 0, sizeof(Resources)); +} + +void TestPlatformAbstraction::SetResourceLoaded(Integration::ResourceId loadedId, + Integration::ResourceTypeId loadedType, + Integration::ResourcePointer loadedResource) +{ + mResources.loaded = true; + mResources.loadedId = loadedId; + mResources.loadedType = loadedType; + mResources.loadedResource = loadedResource; +} + +void TestPlatformAbstraction::SetResourceLoadFailed(Integration::ResourceId id, + Integration::ResourceFailure failure) +{ + mResources.loadFailed = true; + mResources.loadFailedId = id; + mResources.loadFailure = failure; +} + +void TestPlatformAbstraction::SetResourceSaved(Integration::ResourceId savedId, + Integration::ResourceTypeId savedType) +{ + mResources.saved = true; + mResources.savedId = savedId; + mResources.savedType = savedType; +} + +void TestPlatformAbstraction::SetResourceSaveFailed(Integration::ResourceId id, + Integration::ResourceFailure failure) +{ + mResources.saveFailed = true; + mResources.saveFailedId = id; + mResources.saveFailure = failure; +} + +Integration::ResourceRequest* TestPlatformAbstraction::GetRequest() +{ + return mRequest; +} + +void TestPlatformAbstraction::DiscardRequest() +{ + delete mRequest; + mRequest = NULL; +} + +void TestPlatformAbstraction::SetClosestImageSize(const Vector2& size) +{ + mClosestSize = size; +} + +void TestPlatformAbstraction::SetLoadFileResult( bool result, std::vector< unsigned char >& buffer ) +{ + mLoadFileResult.loadResult = result; + if( result ) + { + mLoadFileResult.buffer = buffer; + } +} + +void TestPlatformAbstraction::SetSaveFileResult( bool result ) +{ + mSaveFileResult = result; +} + +Integration::PlatformAbstraction::FontListMode TestPlatformAbstraction::GetLastFontListMode( ) +{ + return mFontListMode; +} + +void TestPlatformAbstraction::SetReadGlobalMetricsResult( bool success, Integration::GlobalMetrics& globalMetrics ) +{ + mReadGlobalMetricsResult = success; + mReadGlobalMetrics = globalMetrics; +} + +void TestPlatformAbstraction::SetReadMetricsResult( bool success, std::vector& glyphMetricsContainer ) +{ + mReadMetricsResult = success; + mReadMetrics = glyphMetricsContainer; // copy +} + +} // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.h new file mode 100644 index 0000000..5051fce --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.h @@ -0,0 +1,350 @@ +#ifndef __DALI_TEST_PLATFORM_ABSTRACTION_H__ +#define __DALI_TEST_PLATFORM_ABSTRACTION_H__ + +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include + +// INTERNAL INCLUDES +#include + +#include +#include "test-trace-call-stack.h" + + +namespace Dali +{ + +/** + * Concrete implementation of the platform abstraction class. + */ +class DALI_IMPORT_API TestPlatformAbstraction : public Dali::Integration::PlatformAbstraction +{ + +public: + + struct Resources + { + bool loaded; + Integration::ResourceId loadedId; + Integration::ResourceTypeId loadedType; + Integration::ResourcePointer loadedResource; + + bool loadFailed; + Integration::ResourceId loadFailedId; + Integration::ResourceFailure loadFailure; + + bool saved; + Integration::ResourceId savedId; + Integration::ResourceTypeId savedType; + + bool saveFailed; + Integration::ResourceId saveFailedId; + Integration::ResourceFailure saveFailure; + }; + + struct LoadFileResult + { + inline LoadFileResult() + : loadResult(false) + { + + } + + bool loadResult; + std::vector< unsigned char> buffer; + }; + + /** + * Constructor + */ + TestPlatformAbstraction(); + + /** + * Destructor + */ + virtual ~TestPlatformAbstraction(); + + /** + * @copydoc PlatformAbstraction::GetTimeMicroseconds() + */ + virtual void GetTimeMicroseconds(unsigned int &seconds, unsigned int µSeconds); + + /** + * @copydoc PlatformAbstraction::Suspend() + */ + virtual void Suspend(); + + /** + * @copydoc PlatformAbstraction::Resume() + */ + virtual void Resume(); + + virtual void GetClosestImageSize( const std::string& filename, + const ImageAttributes& attributes, + Vector2& closestSize); + + virtual void GetClosestImageSize( Integration::ResourcePointer resourceBuffer, + const ImageAttributes& attributes, + Vector2& closestSize); + + /** + * @copydoc PlatformAbstraction::LoadResource() + */ + virtual void LoadResource(const Integration::ResourceRequest& request); + + /** + * @copydoc PlatformAbstraction::LoadResourceSynchronously() + */ + virtual Integration::ResourcePointer LoadResourceSynchronously( const Integration::ResourceType& resourceType, const std::string& resourcePath ); + + /** + * @copydoc PlatformAbstraction::SaveResource() + */ + virtual void SaveResource(const Integration::ResourceRequest& request); + + /** + * @copydoc PlatformAbstraction::CancelLoad() + */ + virtual void CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId); + + /** + * @copydoc PlatformAbstraction::GetResources() + */ + virtual void GetResources(Integration::ResourceCache& cache); + + /** + * @copydoc PlatformAbstraction::IsLoading() + */ + virtual bool IsLoading(); + + /** + * @copydoc PlatformAbstraction::GetDefaultFontFamily() + */ + virtual std::string GetDefaultFontFamily() const; + + /** + * @copydoc PlatformAbstraction::GetDefaultFontSize() + */ + virtual const float GetDefaultFontSize() const; + + virtual const Dali::PixelSize GetFontLineHeightFromCapsHeight(const std::string& fontFamily, const std::string& fontStyle, const CapsHeight& capsHeight) const; + + /** + * @copydoc PlatformAbstraction::GetGlyphData() + */ + virtual Integration::GlyphSet* GetGlyphData ( const Integration::TextResourceType& textRequest, + const std::string& fontFamily, + bool getBitmap) const; + + /** + * @copydoc PlatformAbstraction::GetCachedGlyphData() + */ + virtual Integration::GlyphSet* GetCachedGlyphData( const Integration::TextResourceType& textRequest, + const std::string& fontFamily ) const; + + + /** + * @copydoc PlatformAbstraction::GetGlobalMetrics() + */ + virtual void GetGlobalMetrics( const std::string& fontFamily, + const std::string& fontStyle, + Integration::GlobalMetrics& globalMetrics ) const; + + /** + * @copydoc PlatformAbstraction::GetFontPath() + */ + virtual std::string GetFontPath(const std::string& family, bool bold, bool italic) const; + + /** + * @copydoc PlatformAbstraction::SetDpi() + */ + virtual void SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical); + + /** + * @copydoc PlatformAbstraction::GetFontFamilyForChars() + */ + virtual std::string GetFontFamilyForChars(const TextArray& charsRequested) const; + + /** + * @copydoc PlatformAbstraction::AllGlyphsSupported() + */ + virtual bool AllGlyphsSupported(const std::string& name, const std::string& fontStyle, const TextArray& text) const; + + /** + * @copydoc PlatformAbstraction::ValidateFontFamilyName() + */ + virtual bool ValidateFontFamilyName(const std::string& fontFamily, const std::string& fontStyle, bool& isDefaultSystemFont, std::string& closestMatch, std::string& closestStyleMatch) const; + + /** + * @copydoc PlatformAbstraction::GetFontList() + */ + virtual std::vector GetFontList( PlatformAbstraction::FontListMode mode ) const; + + /** + * @copydoc PlatformAbstraction::LoadFile() + */ + virtual bool LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const; + + /** + * @copydoc PlatformAbstraction::SaveFile() + */ + virtual bool SaveFile(const std::string& filename, std::vector< unsigned char >& buffer) const; + + virtual void JoinLoaderThreads(); + + virtual void UpdateDefaultsFromDevice(); + + virtual Integration::DynamicsFactory* GetDynamicsFactory(); + + virtual bool ReadGlobalMetricsFromCache( const std::string& fontFamily, + const std::string& fontStyle, + Integration::GlobalMetrics& globalMetrics ); + + virtual void WriteGlobalMetricsToCache( const std::string& fontFamily, + const std::string& fontStyle, + const Integration::GlobalMetrics& globalMetrics ); + + virtual bool ReadMetricsFromCache( const std::string& fontFamily, + const std::string& fontStyle, + std::vector& glyphMetricsContainer ); + virtual void WriteMetricsToCache( const std::string& fontFamily, + const std::string& fontStyle, + const Integration::GlyphSet& glyphSet ); + + + virtual void GetFileNamesFromDirectory( const std::string& directoryName, + std::vector& fileNames ); + + virtual Integration::BitmapPtr GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const; + +public: // TEST FUNCTIONS + + // Enumeration of Platform Abstraction methods + typedef enum + { + GetTimeMicrosecondsFunc, + SuspendFunc, + ResumeFunc, + LoadResourceFunc, + SaveResourceFunc, + SaveFileFunc, + LoadFileFunc, + CancelLoadFunc, + GetResourcesFunc, + IsLoadingFunc, + GetDefaultFontFamilyFunc, + GetDefaultFontSizeFunc, + GetFontLineHeightFromCapsHeightFunc, + GetGlyphDataFunc, + GetCachedGlyphDataFunc, + SetDpiFunc, + GetFontPathFunc, + JoinLoaderThreadsFunc, + GetFontFamilyForCharsFunc, + AllGlyphsSupportedFunc, + ValidateFontFamilyNameFunc, + UpdateDefaultsFromDeviceFunc, + GetDynamicsFactoryFunc, + ValidateGetFontListFunc, + ReadGlobalMetricsFromCacheFileFunc, + WriteGlobalMetricsToCacheFileFunc, + ReadMetricsFromCacheFileFunc, + WriteMetricsToCacheFileFunc, + } TestFuncEnum; + + /** Call this every test */ + void Initialize(); + + inline void EnableTrace(bool enable) { mTrace.Enable(enable); } + inline void ResetTrace() { mTrace.Reset(); } + inline TraceCallStack& GetTrace() { return mTrace; } + + bool WasCalled(TestFuncEnum func); + + void SetGetTimeMicrosecondsResult(size_t sec, size_t usec); + + void IncrementGetTimeResult(size_t milliseconds); + + void SetIsLoadingResult(bool result); + + void SetGetDefaultFontFamilyResult(std::string result); + + void SetGetDefaultFontSizeResult(float result); + + void SetGetFontPathResult(std::string& result); + + void ClearReadyResources(); + + void SetResourceLoaded(Integration::ResourceId loadedId, + Integration::ResourceTypeId loadedType, + Integration::ResourcePointer loadedResource); + + void SetResourceLoadFailed(Integration::ResourceId id, + Integration::ResourceFailure failure); + + void SetResourceSaved(Integration::ResourceId savedId, + Integration::ResourceTypeId savedType); + + void SetResourceSaveFailed(Integration::ResourceId id, + Integration::ResourceFailure failure); + + Integration::ResourceRequest* GetRequest(); + + void DiscardRequest(); + + void SetClosestImageSize(const Vector2& size); + + void SetLoadFileResult( bool result, std::vector< unsigned char >& buffer ); + + void SetSaveFileResult( bool result ); + + PlatformAbstraction::FontListMode GetLastFontListMode( ); + + void SetReadGlobalMetricsResult( bool success, Integration::GlobalMetrics& globalMetrics ); + + void SetReadMetricsResult( bool success, std::vector& glyphMetricsContainer ); + + +private: + mutable TraceCallStack mTrace; + size_t mSeconds; + size_t mMicroSeconds; + bool mIsLoadingResult; + std::string mGetDefaultFontFamilyResult; + float mGetDefaultFontSizeResult; + std::string mGetFontPathResult; + Resources mResources; + Integration::ResourceRequest* mRequest; + Vector2 mSize; + Vector2 mClosestSize; + bool mReadGlobalMetricsResult; + bool mReadMetricsResult; + Integration::GlobalMetrics mReadGlobalMetrics; + std::vector mReadMetrics; + + LoadFileResult mLoadFileResult; + bool mSaveFileResult; + mutable FontListMode mFontListMode; +}; + +} // Dali + +#endif /* __DALI_TET_PLATFORM_ABSTRACTION_H__ */ diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp new file mode 100644 index 0000000..76b20de --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp @@ -0,0 +1,59 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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-render-controller.h" + +namespace Dali +{ + +TestRenderController::TestRenderController() +{ + Initialize(); +} + +TestRenderController::~TestRenderController() +{ +} + +void TestRenderController::RequestUpdate() +{ + mRequestUpdateCalled = true; +} + +void TestRenderController::RequestProcessEventsOnIdle() +{ + mRequestProcessEventsOnIdleCalled = true; +} + +bool TestRenderController::WasCalled(TestRenderControllerFuncEnum func) +{ + switch(func) + { + case RequestUpdateFunc: return mRequestUpdateCalled; + case RequestProcessEventsOnIdleFunc: return mRequestProcessEventsOnIdleCalled; + } + + return false; +} + +void TestRenderController::Initialize() +{ + mRequestUpdateCalled = false; + mRequestProcessEventsOnIdleCalled = false; +} + + +} // namespace dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-render-controller.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-render-controller.h new file mode 100644 index 0000000..83b64a6 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-render-controller.h @@ -0,0 +1,53 @@ +#ifndef __TEST_RENDER_CONTROLLER_H__ +#define __TEST_RENDER_CONTROLLER_H__ + +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +// INTERNAL INCLUDES +#include +#include + +namespace Dali +{ + +class DALI_IMPORT_API TestRenderController : public Dali::Integration::RenderController +{ +public: + TestRenderController(); + ~TestRenderController(); + + virtual void RequestUpdate(); + virtual void RequestProcessEventsOnIdle(); + + typedef enum + { + RequestUpdateFunc, + RequestProcessEventsOnIdleFunc, + } TestRenderControllerFuncEnum; + + bool WasCalled(TestRenderControllerFuncEnum func); + void Initialize(); + + +private: + bool mRequestUpdateCalled; + bool mRequestProcessEventsOnIdleCalled; +}; + +} // Dali + +#endif diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp new file mode 100644 index 0000000..4837b48 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp @@ -0,0 +1,111 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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-trace-call-stack.h" + +namespace Dali +{ +/** + * Constructor + */ +TraceCallStack::TraceCallStack() : mTraceActive(false) { } + +/** + * Destructor + */ +TraceCallStack::~TraceCallStack() { } + +/** + * Turn on / off tracing + */ +void TraceCallStack::Enable(bool enable) { mTraceActive = enable; } + +/** + * 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 + */ +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 ); + } +} + +/** + * Search for a method in the stack + * @param[in] method The name of the method + * @return true if the method was in the stack + */ +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) ) + { + found = true; + break; + } + } + return found; +} + +/** + * 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 true if the method was in the stack + */ +bool TraceCallStack::FindMethodAndParams(std::string method, std::string params) const +{ + bool found = false; + for( size_t i=0; i < mCallStack.size(); i++ ) + { + if( 0 == mCallStack[i][0].compare(method) && 0 == mCallStack[i][1].compare(params) ) + { + found = true; + break; + } + } + return found; +} + +/** + * 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 + * @param[in] params A comma separated list of parameter values to test + */ +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) ); +} + +/** + * Reset the call stack + */ +void TraceCallStack::Reset() +{ + mCallStack.clear(); +} + + +} // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.h new file mode 100644 index 0000000..76d6061 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.h @@ -0,0 +1,96 @@ +#ifndef __TEST_TRACE_CALL_STACK_H__ +#define __TEST_TRACE_CALL_STACK_H__ + +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include + +namespace Dali +{ + +/** + * Helper class to track method calls in the abstraction and search for them in test cases + */ +class TraceCallStack +{ +public: + /** + * Constructor + */ + TraceCallStack(); + + /** + * Destructor + */ + ~TraceCallStack(); + + /** + * Turn on / off tracing + */ + void Enable(bool enable); + + /** + * 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 + */ + void PushCall(std::string method, std::string params); + + + /** + * Search for a method in the stack + * @param[in] method The name of the method + * @return true if the method was in the stack + */ + bool FindMethod(std::string method) 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 true if the method was in the stack + */ + bool FindMethodAndParams(std::string method, std::string 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 + * @param[in] params A comma separated list of parameter values to test + */ + bool TestMethodAndParams(int index, std::string method, std::string params) const; + + /** + * Reset the call stack + */ + 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 +}; + +} // namespace dali + +#endif //__TEST_TRACE_CALL_STACK_H__ diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp new file mode 100644 index 0000000..1db7f0a --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp @@ -0,0 +1,363 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 "toolkit-accessibility-manager.h" + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + +/** + * Stub for the AccessibilityManager + */ +class AccessibilityManager : public BaseObject +{ +public: // Creation & Destruction + + static Dali::AccessibilityManager Get(); + + AccessibilityManager(); + ~AccessibilityManager(); + +public: + + bool IsEnabled() const; + void SetActionHandler(Dali::AccessibilityActionHandler& handler); + void SetGestureHandler(Dali::AccessibilityGestureHandler& handler); + +public: // Signals + + Dali::AccessibilityManager::AccessibilityActionSignalV2& StatusChangedSignal(); + Dali::AccessibilityManager::AccessibilityActionSignalV2& ActionNextSignal(); + Dali::AccessibilityManager::AccessibilityActionSignalV2& ActionPreviousSignal(); + Dali::AccessibilityManager::AccessibilityActionSignalV2& ActionActivateSignal(); + Dali::AccessibilityManager::AccessibilityActionSignalV2& ActionReadSignal(); + Dali::AccessibilityManager::AccessibilityActionSignalV2& ActionReadNextSignal(); + Dali::AccessibilityManager::AccessibilityActionSignalV2& ActionReadPreviousSignal(); + Dali::AccessibilityManager::AccessibilityActionSignalV2& ActionOverSignal(); + Dali::AccessibilityManager::AccessibilityActionSignalV2& ActionUpSignal(); + Dali::AccessibilityManager::AccessibilityActionSignalV2& ActionDownSignal(); + Dali::AccessibilityManager::AccessibilityActionSignalV2& ActionClearFocusSignal(); + Dali::AccessibilityManager::AccessibilityActionSignalV2& ActionBackSignal(); + Dali::AccessibilityManager::AccessibilityActionSignalV2& ActionControlPanelOpenSignal(); + +private: + + Dali::AccessibilityManager::AccessibilityActionSignalV2 mStatusChangedSignal; + Dali::AccessibilityManager::AccessibilityActionSignalV2 mActionNextSignal; + Dali::AccessibilityManager::AccessibilityActionSignalV2 mActionPreviousSignal; + Dali::AccessibilityManager::AccessibilityActionSignalV2 mActionActivateSignal; + Dali::AccessibilityManager::AccessibilityActionSignalV2 mActionReadSignal; + Dali::AccessibilityManager::AccessibilityActionSignalV2 mActionReadNextSignal; + Dali::AccessibilityManager::AccessibilityActionSignalV2 mActionReadPreviousSignal; + Dali::AccessibilityManager::AccessibilityActionSignalV2 mActionOverSignal; + Dali::AccessibilityManager::AccessibilityActionSignalV2 mActionUpSignal; + Dali::AccessibilityManager::AccessibilityActionSignalV2 mActionDownSignal; + Dali::AccessibilityManager::AccessibilityActionSignalV2 mActionClearFocusSignal; + Dali::AccessibilityManager::AccessibilityActionSignalV2 mActionBackSignal; + Dali::AccessibilityManager::AccessibilityActionSignalV2 mActionControlPanelOpenSignal; + + bool mIsEnabled; + Dali::AccessibilityActionHandler* mActionHandler; + Dali::AccessibilityGestureHandler* mGestureHandler; + + static Dali::AccessibilityManager mToolkitAccessibilityManager; +}; + +Dali::AccessibilityManager AccessibilityManager::mToolkitAccessibilityManager; + + +Dali::AccessibilityManager AccessibilityManager::Get() +{ + if( ! mToolkitAccessibilityManager ) + { + mToolkitAccessibilityManager = Dali::AccessibilityManager( new Dali::Internal::Adaptor::AccessibilityManager() ); + } + return mToolkitAccessibilityManager; +} + +AccessibilityManager::AccessibilityManager() +: mIsEnabled(false) +{ +} + +AccessibilityManager::~AccessibilityManager() +{ +} + +bool AccessibilityManager::IsEnabled() const +{ + return mIsEnabled; +} + +void AccessibilityManager::SetActionHandler(Dali::AccessibilityActionHandler& handler) +{ + mActionHandler = &handler; +} + +void AccessibilityManager::SetGestureHandler(Dali::AccessibilityGestureHandler& handler) +{ + mGestureHandler = &handler; +} + +Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::StatusChangedSignal() +{ + return mStatusChangedSignal; +} + +Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionNextSignal() +{ + return mActionNextSignal; +} + +Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionPreviousSignal() +{ + return mActionPreviousSignal; +} + +Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionActivateSignal() +{ + return mActionActivateSignal; +} + +Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionReadSignal() +{ + return mActionReadSignal; +} + +Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionReadNextSignal() +{ + return mActionReadNextSignal; +} + +Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionReadPreviousSignal() +{ + return mActionReadPreviousSignal; +} + +Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionOverSignal() +{ + return mActionOverSignal; +} + +Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionUpSignal() +{ + return mActionUpSignal; +} + +Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionDownSignal() +{ + return mActionDownSignal; +} + +Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionClearFocusSignal() +{ + return mActionClearFocusSignal; +} + +Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionBackSignal() +{ + return mActionBackSignal; +} + +Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionControlPanelOpenSignal() +{ + return mActionControlPanelOpenSignal; +} + +static Internal::Adaptor::AccessibilityManager& GetImplementation(Dali::AccessibilityManager& manager) +{ + BaseObject& handle = manager.GetBaseObject(); + return static_cast(handle); +} + + +} // namespace Adaptor +} // namespace Internal + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +AccessibilityManager::AccessibilityManager() +{ +} + +AccessibilityManager AccessibilityManager::Get() +{ + return Internal::Adaptor::AccessibilityManager::Get(); +} + +AccessibilityManager::~AccessibilityManager() +{ +} + +Vector2 AccessibilityManager::GetReadPosition() const +{ + //return Internal::Adaptor::GetImplementation(*this).GetReadPosition(); + return Vector2::ZERO; +} + +bool AccessibilityManager::IsEnabled() const +{ + //return Internal::Adaptor::GetImplementation(*this).IsEnabled(); + return false; +} + +void AccessibilityManager::SetActionHandler(AccessibilityActionHandler& handler) +{ + Internal::Adaptor::GetImplementation(*this).SetActionHandler(handler); +} + +void AccessibilityManager::SetGestureHandler(AccessibilityGestureHandler& handler) +{ + Internal::Adaptor::GetImplementation(*this).SetGestureHandler(handler); +} + +bool AccessibilityManager::HandleActionNextEvent() +{ + return true; //Internal::Adaptor::GetImplementation(*this).HandleActionNextEvent(); +} + +bool AccessibilityManager::HandleActionPreviousEvent() +{ + return true; //Internal::Adaptor::GetImplementation(*this).HandleActionPreviousEvent(); +} + +bool AccessibilityManager::HandleActionActivateEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionActivateEvent(); +} + +bool AccessibilityManager::HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain) +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadEvent(x, y, allowReadAgain); +} + +bool AccessibilityManager::HandleActionReadNextEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadNextEvent(); +} + +bool AccessibilityManager::HandleActionReadPreviousEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadPreviousEvent(); +} + +bool AccessibilityManager::HandleActionUpEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionUpEvent(); +} + +bool AccessibilityManager::HandleActionDownEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionDownEvent(); +} + +bool AccessibilityManager::HandleActionClearFocusEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionClearFocusEvent(); +} + +bool AccessibilityManager::HandleActionScrollEvent(TouchPoint& point, unsigned long timeStamp) +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionScrollEvent(point, timeStamp); +} + +bool AccessibilityManager::HandleActionBackEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionBackEvent(); +} + +void AccessibilityManager::HandleActionEnableEvent() +{ + //Internal::Adaptor::GetImplementation(*this).HandleActionEnableEvent(); +} + +void AccessibilityManager::HandleActionDisableEvent() +{ + //Internal::Adaptor::GetImplementation(*this).HandleActionDisableEvent(); +} + +AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::StatusChangedSignal() +{ + return Internal::Adaptor::GetImplementation(*this).StatusChangedSignal(); +} + +AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionNextSignal() +{ + return Internal::Adaptor::GetImplementation(*this).ActionNextSignal(); +} + +AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionPreviousSignal() +{ + return Internal::Adaptor::GetImplementation(*this).ActionPreviousSignal(); +} + +AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionActivateSignal() +{ + return Internal::Adaptor::GetImplementation(*this).ActionActivateSignal(); +} + +AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionOverSignal() +{ + return Internal::Adaptor::GetImplementation(*this).ActionOverSignal(); +} + +AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionReadSignal() +{ + return Internal::Adaptor::GetImplementation(*this).ActionReadSignal(); +} + +AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionReadNextSignal() +{ + return Internal::Adaptor::GetImplementation(*this).ActionReadNextSignal(); +} + +AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionReadPreviousSignal() +{ + return Internal::Adaptor::GetImplementation(*this).ActionReadPreviousSignal(); +} + +AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionUpSignal() +{ + return Internal::Adaptor::GetImplementation(*this).ActionUpSignal(); +} + +AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionDownSignal() +{ + return Internal::Adaptor::GetImplementation(*this).ActionDownSignal(); +} + +AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionClearFocusSignal() +{ + return Internal::Adaptor::GetImplementation(*this).ActionClearFocusSignal(); +} + +AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionBackSignal() +{ + return Internal::Adaptor::GetImplementation(*this).ActionBackSignal(); +} + +AccessibilityManager::AccessibilityManager( Internal::Adaptor::AccessibilityManager* manager ) +: BaseHandle( manager ) +{ +} + +} // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.h new file mode 100644 index 0000000..5365e77 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.h @@ -0,0 +1,92 @@ +// Prevent normal accessibility manager declaration from loading +#define __DALI_ACCESSIBILITY_MANAGER_H__ + +#ifndef __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__ +#define __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__ + +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 + +#include + +namespace Dali +{ +namespace Internal +{ +namespace Adaptor +{ +class AccessibilityManager; +} +} +class AccessibilityActionHandler; +class AccessibilityGestureHandler; +class TouchPoint; + +/** + * This creates a stubbed AccessibilityManager so that internal Toolkit Adaptor calls work. + */ +class AccessibilityManager : public BaseHandle +{ +public: // Typedefs + typedef SignalV2< bool ( AccessibilityManager& ) > AccessibilityActionSignalV2; + +public: // Construction & Destruction + AccessibilityManager(); + virtual ~AccessibilityManager(); + +public: // Getters + static AccessibilityManager Get(); + Vector2 GetReadPosition() const; + bool IsEnabled() const; + void SetActionHandler(AccessibilityActionHandler& handler); + void SetGestureHandler(AccessibilityGestureHandler& handler); + bool HandleActionNextEvent(); + bool HandleActionPreviousEvent(); + bool HandleActionActivateEvent(); + bool HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain); + bool HandleActionReadNextEvent(); + bool HandleActionReadPreviousEvent(); + bool HandleActionUpEvent(); + bool HandleActionDownEvent(); + bool HandleActionClearFocusEvent(); + bool HandleActionScrollEvent(TouchPoint& point, unsigned long timeStamp); + bool HandleActionBackEvent(); + void HandleActionEnableEvent(); + void HandleActionDisableEvent(); + +public: // Signals + AccessibilityActionSignalV2& StatusChangedSignal(); + AccessibilityActionSignalV2& ActionNextSignal(); + AccessibilityActionSignalV2& ActionPreviousSignal(); + AccessibilityActionSignalV2& ActionActivateSignal(); + AccessibilityActionSignalV2& ActionReadSignal(); + AccessibilityActionSignalV2& ActionOverSignal(); + AccessibilityActionSignalV2& ActionReadNextSignal(); + AccessibilityActionSignalV2& ActionReadPreviousSignal(); + AccessibilityActionSignalV2& ActionUpSignal(); + AccessibilityActionSignalV2& ActionDownSignal(); + AccessibilityActionSignalV2& ActionClearFocusSignal(); + AccessibilityActionSignalV2& ActionBackSignal(); + + AccessibilityManager( Internal::Adaptor::AccessibilityManager* manager ); +}; + +} // namespace Dali + +#endif // __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__ diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp new file mode 100644 index 0000000..c27157d --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp @@ -0,0 +1,263 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +#define __DALI_ADAPTOR_H__ +#define __DALI_ACCESSIBILITY_MANAGER_H__ +#define __DALI_TIMER_H__ +#define __DALI_CLIPBOARD_H__ +#define IMFMANAGER_H + +#include "toolkit-adaptor.h" +#include +#include +#include + +namespace Dali +{ + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +class TestRenderSurface : public RenderSurface +{ +public: + TestRenderSurface(){} + virtual ~TestRenderSurface(){} + virtual SurfaceType GetType() { return RenderSurface::WINDOW; } + virtual Dali::Any GetSurface() { return Dali::Any(); } + virtual Dali::Any GetDisplay() { return Dali::Any(); } + virtual PositionSize GetPositionSize() const { return PositionSize(0, 0, 640, 480);} + virtual void SetRenderMode(RenderMode mode){} + virtual RenderMode GetRenderMode() const { return RenderSurface::RENDER_60FPS; } +}; + +typedef Dali::Rect PositionSize; + +/** + * Stub for the Adaptor + */ +class Adaptor +{ +public: + + typedef SignalV2< void ( Adaptor& ) > AdaptorSignalV2; + + typedef std::pair SingletonPair; + typedef std::map SingletonContainer; + typedef SingletonContainer::const_iterator SingletonConstIter; + +public: + + Adaptor(ToolkitAdaptor& toolkitAdaptor); + ~Adaptor(); + +public: + + void Start(); + void Pause(); + void Resume(); + void Stop(); + bool AddIdle(boost::function callBack); + void FeedEvent(TouchPoint& point, int timeStamp); + bool MoveResize(const PositionSize& positionSize); + void SurfaceResized(const PositionSize& positionSize); + void ReplaceSurface(RenderSurface& surface); + void RenderSync(); + RenderSurface& GetSurface(); + + void RegisterSingleton(const std::type_info& info, Dali::BaseHandle singleton); + Dali::BaseHandle GetSingleton(const std::type_info& info) const; + +public: // static methods + static Adaptor& Get(); + static bool IsAvailable(); + +public: // Signals + + AdaptorSignalV2& SignalResize(); + + void EmitSignalResize() + { + mResizeSignal.Emit( *this ); + } + +private: + + // Undefined + Adaptor(const Adaptor&); + Adaptor& operator=(Adaptor&); + + AdaptorSignalV2 mResizeSignal; + TestRenderSurface mRenderSurface; + ToolkitAdaptor& mToolkitAdaptor; + + SingletonContainer mSingletonContainer; +}; + +namespace +{ +Adaptor* gAdaptor = NULL; + +} + +Adaptor::Adaptor(ToolkitAdaptor& toolkitAdaptor) +: mToolkitAdaptor(toolkitAdaptor) +{ +} + +Adaptor::~Adaptor() +{ + +} + +void Adaptor::Start() +{ + mToolkitAdaptor.mFunctionsCalled.Start = true; +} + +void Adaptor::Pause() +{ + mToolkitAdaptor.mFunctionsCalled.Pause = true; +} + +void Adaptor::Resume() +{ + mToolkitAdaptor.mFunctionsCalled.Resume = true; +} + +void Adaptor::Stop() +{ + mToolkitAdaptor.mFunctionsCalled.Stop = true; +} + +bool Adaptor::AddIdle(boost::function callBack) +{ + mToolkitAdaptor.mFunctionsCalled.AddIdle = true; + mToolkitAdaptor.mLastIdleAdded = callBack; + return true; +} + +void Adaptor::FeedEvent(TouchPoint& point, int timeStamp) +{ + mToolkitAdaptor.mFunctionsCalled.FeedEvent = true; + mToolkitAdaptor.mLastTouchPointFed = point; + mToolkitAdaptor.mLastTimeStampFed = timeStamp; +} + +bool Adaptor::MoveResize(const PositionSize& positionSize) +{ + mToolkitAdaptor.mFunctionsCalled.MoveResize = true; + mToolkitAdaptor.mLastSizeSet = positionSize; + return true; +} + +void Adaptor::SurfaceResized(const PositionSize& positionSize) +{ + mToolkitAdaptor.mFunctionsCalled.SurfaceResized = true; + mToolkitAdaptor.mLastSizeSet = positionSize; +} + +void Adaptor::ReplaceSurface(RenderSurface& surface) +{ + mToolkitAdaptor.mFunctionsCalled.ReplaceSurface = true; +} + +void Adaptor::RenderSync() +{ + mToolkitAdaptor.mFunctionsCalled.RenderSync = true; +} + +RenderSurface& Adaptor::GetSurface() +{ + mToolkitAdaptor.mFunctionsCalled.GetSurface = true; + return mRenderSurface; +} + +Adaptor& Adaptor::Get() +{ + DALI_ASSERT_ALWAYS(gAdaptor); + gAdaptor->mToolkitAdaptor.mFunctionsCalled.Get = true; + return *gAdaptor; +} + +bool Adaptor::IsAvailable() +{ + bool available(false); + + if (gAdaptor) + { + gAdaptor->mToolkitAdaptor.mFunctionsCalled.IsAvailable = true; + available = true; + } + + return available; +} + +void Adaptor::RegisterSingleton(const std::type_info& info, Dali::BaseHandle singleton) +{ + mToolkitAdaptor.mFunctionsCalled.RegisterSingleton = true; + + if(singleton) + { + mSingletonContainer.insert(SingletonPair(info.name(), singleton)); + } +} + +Dali::BaseHandle Adaptor::GetSingleton(const std::type_info& info) const +{ + mToolkitAdaptor.mFunctionsCalled.GetSingleton = true; + + Dali::BaseHandle object = Dali::BaseHandle(); + + SingletonConstIter iter = mSingletonContainer.find(info.name()); + if(iter != mSingletonContainer.end()) + { + object = (*iter).second; + } + + return object; +} + +Adaptor::AdaptorSignalV2& Adaptor::SignalResize() +{ + mToolkitAdaptor.mFunctionsCalled.SignalResize = true; + return mResizeSignal; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +ToolkitAdaptor::ToolkitAdaptor() +: mLastTouchPointFed(0, TouchPoint::Down, 0.0f, 0.0f), + mLastTimeStampFed(0), + mStyleMonitor(StyleMonitor::Get()), + mAccessibilityManager(AccessibilityManager::Get()), + mImfManager(ImfManager::Get()), + mAdaptorStub(new Adaptor(*this)) +{ + gAdaptor = mAdaptorStub; +} + +ToolkitAdaptor::~ToolkitAdaptor() +{ + delete mAdaptorStub; + gAdaptor = NULL; +} + +void ToolkitAdaptor::EmitSignalResize() +{ + mAdaptorStub->EmitSignalResize(); +} + +} // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.h new file mode 100644 index 0000000..20d4697 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.h @@ -0,0 +1,255 @@ +#ifndef __DALI_TOOLKIT_TOOLKIT_ADAPTOR_H__ +#define __DALI_TOOLKIT_TOOLKIT_ADAPTOR_H__ + +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 + +// INTERNAL INCLUDES +#include "toolkit-style-monitor.h" +#include "toolkit-accessibility-manager.h" +#include "toolkit-timer.h" +#include "toolkit-imf-manager.h" +#include "toolkit-clipboard-event-notifier.h" + +#include +#include + +namespace Dali +{ + +class Adaptor; + +typedef Dali::Rect PositionSize; + +/** + * This creates a stubbed Adaptor so that internal Toolkit Adaptor calls work. + * Furthermore, it provides an interface to see if certain methods were invoked. + */ +class ToolkitAdaptor +{ +public: // Construction & Destruction + + ToolkitAdaptor(); + ~ToolkitAdaptor(); + +public: // Getters + + boost::function GetLastIdleAdded() const + { + return mLastIdleAdded; + } + + TouchPoint GetLastTouchPointFed() const + { + return mLastTouchPointFed; + } + + int GetLastTimeStampFed() const + { + return mLastTimeStampFed; + } + + PositionSize GetLastSizeSet() const + { + return mLastSizeSet; + } + + StyleMonitor& GetToolkitStyleMonitor() + { + return mStyleMonitor; + } + + AccessibilityManager& GetAccessibilityManager() + { + return mAccessibilityManager; + } + + ToolkitClipboardEventNotifier& GetClipboardEventNotifier() + { + return mClipboardEventNotifier; + } + +public: // Signal Emissions + + void EmitSignalResize(); + +public: // TEST FUNCTIONS + + // Enumeration of Adaptor methods + enum TestFuncEnum + { + StartType, + PauseType, + ResumeType, + StopType, + AddIdleType, + FeedEventType, + MoveResizeType, + SurfaceResizedType, + ReplaceSurfaceType, + RenderSyncType, + GetSurfaceType, + GetType, + IsAvailableType, + RegisterSingletonType, + GetSingletonType, + SignalResizeType, + }; + + void Reset() + { + mFunctionsCalled.Reset(); + } + + bool WasCalled(TestFuncEnum func) + { + switch(func) + { + case StartType: return mFunctionsCalled.Start; + case PauseType: return mFunctionsCalled.Pause; + case ResumeType: return mFunctionsCalled.Resume; + case StopType: return mFunctionsCalled.Stop; + case AddIdleType: return mFunctionsCalled.AddIdle; + case FeedEventType: return mFunctionsCalled.FeedEvent; + case MoveResizeType: return mFunctionsCalled.MoveResize; + case SurfaceResizedType: return mFunctionsCalled.SurfaceResized; + case ReplaceSurfaceType: return mFunctionsCalled.ReplaceSurface; + case RenderSyncType: return mFunctionsCalled.RenderSync; + case GetSurfaceType: return mFunctionsCalled.GetSurface; + case GetType: return mFunctionsCalled.Get; + case IsAvailableType: return mFunctionsCalled.IsAvailable; + case RegisterSingletonType: return mFunctionsCalled.RegisterSingleton; + case GetSingletonType: return mFunctionsCalled.GetSingleton; + case SignalResizeType: return mFunctionsCalled.SignalResize; + } + return false; + } + + void ResetCallStatistics(TestFuncEnum func) + { + switch(func) + { + case StartType: mFunctionsCalled.Start = false; break; + case PauseType: mFunctionsCalled.Pause = false; break; + case ResumeType: mFunctionsCalled.Resume = false; break; + case StopType: mFunctionsCalled.Stop = false; break; + case AddIdleType: mFunctionsCalled.AddIdle = false; break; + case FeedEventType: mFunctionsCalled.FeedEvent = false; break; + case MoveResizeType: mFunctionsCalled.MoveResize = false; break; + case SurfaceResizedType: mFunctionsCalled.SurfaceResized = false; break; + case ReplaceSurfaceType: mFunctionsCalled.ReplaceSurface = false; break; + case RenderSyncType: mFunctionsCalled.RenderSync = false; break; + case GetSurfaceType: mFunctionsCalled.GetSurface = false; break; + case GetType: mFunctionsCalled.Get = false; break; + case IsAvailableType: mFunctionsCalled.IsAvailable = false; break; + case RegisterSingletonType: mFunctionsCalled.RegisterSingleton = false; break; + case GetSingletonType: mFunctionsCalled.GetSingleton = false; break; + case SignalResizeType: mFunctionsCalled.SignalResize = false; break; + } + } + +private: + + struct TestFunctions + { + TestFunctions() + : Start(false), + Pause(false), + Resume(false), + Stop(false), + AddIdle(false), + FeedEvent(false), + MoveResize(false), + SurfaceResized(false), + ReplaceSurface(false), + RenderSync(false), + GetSurface(false), + Get(false), + IsAvailable(false), + RegisterSingleton(false), + GetSingleton(false), + SignalResize(false) + { + } + + void Reset() + { + Start = false; + Pause = false; + Resume = false; + Stop = false; + AddIdle = false; + FeedEvent = false; + MoveResize = false; + SurfaceResized = false; + ReplaceSurface = false; + RenderSync = false; + GetSurface = false; + Get = false; + IsAvailable = false; + RegisterSingleton = false; + GetSingleton = false; + SignalResize = false; + } + + bool Start; + bool Pause; + bool Resume; + bool Stop; + bool AddIdle; + bool FeedEvent; + bool MoveResize; + bool SurfaceResized; + bool ReplaceSurface; + bool RenderSync; + bool GetSurface; + bool Get; + bool IsAvailable; + bool RegisterSingleton; + bool GetSingleton; + bool SignalResize; + }; + + TestFunctions mFunctionsCalled; + + // Last set information + boost::function mLastIdleAdded; + TouchPoint mLastTouchPointFed; + int mLastTimeStampFed; + PositionSize mLastSizeSet; + + // Contains Test functions for the Style Monitor + StyleMonitor mStyleMonitor; + + // Stub for AccessibilityManager + AccessibilityManager mAccessibilityManager; + + // Stub for ClipboardEventNotifier + ToolkitClipboardEventNotifier mClipboardEventNotifier; + + ImfManager mImfManager; + + // The Adaptor Stub + Adaptor* mAdaptorStub; + friend class Adaptor; +}; + +} // namespace Dali + +#endif // __DALI_TOOLKIT_TOOLKIT_ADAPTOR_H__ diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp new file mode 100644 index 0000000..1b4fcc0 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp @@ -0,0 +1,103 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 "toolkit-application.h" + +#include + +#include +#include +#include + +namespace Dali +{ + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +/** + * Stub for the Application + */ +class Application +{ +public: + +public: + + Application(ToolkitApplication& toolkitApplication); + ~Application(); + +public: + + //Orientation& GetOrientation(); + +public: // static methods + +public: // Signals + +private: + + // Undefined + Application(const Application&); + Application& operator=(Application&); + + ToolkitApplication& mToolkitApplication; + + //Dali::Orientation* mOrientation; +}; + +namespace +{ +Application* gApplication = NULL; +} + +Application::Application(ToolkitApplication& toolkitApplication) +: mToolkitApplication(toolkitApplication) +// ,mOrientation( new Dali::Orientation() ) +{ +} + +Application::~Application() +{ + //delete mOrientation; +} + +//Orientation& Application::GetOrientation() +//{ +// return *mOrientation; +//} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +ToolkitApplication::ToolkitApplication() +: mApplicationStub(new Application(*this)) +{ + gApplication = mApplicationStub; +} + +ToolkitApplication::~ToolkitApplication() +{ + delete mApplicationStub; + gApplication = NULL; +} + +Application& ToolkitApplication::GetApplication() +{ + DALI_ASSERT_ALWAYS(gApplication); + return *gApplication; +} + +} // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-application.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-application.h new file mode 100644 index 0000000..8b376a0 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-application.h @@ -0,0 +1,91 @@ +#ifndef __DALI_TOOLKIT_TOOLKIT_APPLICATION_H__ +#define __DALI_TOOLKIT_TOOLKIT_APPLICATION_H__ + +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +namespace Dali +{ + +class Application; + +/** + * This creates a stubbed Application so that Application calls work. + * Furthermore, it provides an interface to see if certain methods were invoked. + */ +class ToolkitApplication +{ +public: // Construction & Destruction + + ToolkitApplication(); + ~ToolkitApplication(); + +public: // Getters + + Application& GetApplication(); + +public: // Signal Emissions + +public: // TEST FUNCTIONS + + // Enumeration of Application methods + enum TestFuncEnum + { + }; + + void Reset() + { + mFunctionsCalled.Reset(); + } + + bool WasCalled(TestFuncEnum func) + { + switch(func) + { + } + return false; + } + + void ResetCallStatistics(TestFuncEnum func) + { + switch(func) + { + } + } + +private: + + struct TestFunctions + { + TestFunctions() + { + } + + void Reset() + { + } + }; + + TestFunctions mFunctionsCalled; + + // The Application Stub + Application* mApplicationStub; + friend class Application; +}; + +} // namespace Dali + +#endif // __DALI_TOOLKIT_TOOLKIT_APPLICATION_H__ diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp new file mode 100644 index 0000000..168625e --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp @@ -0,0 +1,106 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 "toolkit-clipboard-event-notifier.h" + +#include +#include +#include + +namespace Dali +{ + +namespace +{ +ToolkitClipboardEventNotifier* gToolkitClipboardEventNotifier(NULL); +} // unnamed namespace + +namespace Internal +{ + +namespace Adaptor +{ + +/** + * Stub for the ClipboardEventNotifier + */ +class ClipboardEventNotifier : public BaseObject +{ +public: // Creation & Destruction + + static Dali::ClipboardEventNotifier Get(); + + ClipboardEventNotifier(); + ClipboardEventNotifier(ToolkitClipboardEventNotifier *clipboardEventNotifier); + ~ClipboardEventNotifier(); + +public: // Signals + + Dali::ClipboardEventNotifier::ClipboardEventSignalV2& SignalContentSelected() + { + return mClipboardSignal; + } + +private: + + ToolkitClipboardEventNotifier* mToolkitClipboardEventNotifier; + Dali::ClipboardEventNotifier::ClipboardEventSignalV2 mClipboardSignal; + +}; + +Dali::ClipboardEventNotifier ClipboardEventNotifier::Get() +{ + return gToolkitClipboardEventNotifier->GetClipboardEventNotifier(); +} + +ClipboardEventNotifier::ClipboardEventNotifier() +: mToolkitClipboardEventNotifier(NULL) +{ +} + +ClipboardEventNotifier::ClipboardEventNotifier(ToolkitClipboardEventNotifier *clipboardEventNotifier) +: mToolkitClipboardEventNotifier(clipboardEventNotifier) +{ +} + +ClipboardEventNotifier::~ClipboardEventNotifier() +{ +} + +} // namespace Adaptor + +} // namespace Internal + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +ToolkitClipboardEventNotifier::ToolkitClipboardEventNotifier() +: mClipboardEventNotifierStub(new Internal::Adaptor::ClipboardEventNotifier(this)), + mClipboardEventNotifier( mClipboardEventNotifierStub ) +{ + gToolkitClipboardEventNotifier = this; +} + +ToolkitClipboardEventNotifier::~ToolkitClipboardEventNotifier() +{ + gToolkitClipboardEventNotifier = NULL; +} + +ClipboardEventNotifier ToolkitClipboardEventNotifier::GetClipboardEventNotifier() +{ + return mClipboardEventNotifier; +} + +} // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.h new file mode 100644 index 0000000..4cb9a98 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.h @@ -0,0 +1,68 @@ +#ifndef __DALI_TOOLKIT_CLIPBOARD_EVENT_NOTIFIER_H__ +#define __DALI_TOOLKIT_CLIPBOARD_EVENT_NOTIFIER_H__ + +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 + +// PUBLIC INCLUDES +#include + +namespace Dali +{ + +namespace Internal +{ +namespace Adaptor +{ +class ClipboardEventNotifier; +} +} + +/** + * This creates a stubbed ClipboardEventNotifier so that internal Toolkit Adaptor calls work. + */ +class ToolkitClipboardEventNotifier +{ +public: // Constants + +public: // Construction & Destruction + + ToolkitClipboardEventNotifier(); + ~ToolkitClipboardEventNotifier(); + +public: // Getters + + ClipboardEventNotifier GetClipboardEventNotifier(); + +public: // Signal Emissions + + ClipboardEventNotifier::ClipboardEventSignalV2& SignalContentSelected(); + +public: // TEST FUNCTIONS + +private: + + Internal::Adaptor::ClipboardEventNotifier* mClipboardEventNotifierStub; + friend class Internal::Adaptor::ClipboardEventNotifier; + ClipboardEventNotifier mClipboardEventNotifier; // Hold a handle ourselves. +}; + +} // namespace Dali + +#endif // __DALI_TOOLKIT_TOOLKIT_CLIPBOARD_EVENT_NOTIFIER_H__ diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard.cpp new file mode 100644 index 0000000..bf347d5 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard.cpp @@ -0,0 +1,192 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 "toolkit-clipboard.h" + +// EXTERNAL INCLUDES +#include + + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + +/** + * Implementation of the Clip Board + */ + +class Clipboard : public Dali::BaseObject +{ +public: + + /** + * @copydoc Dali::ClipboardEventNotifier::Get() + */ + static Dali::Clipboard Get(); + + /** + * Constructor + * @param[in] ecoreXwin, The window is created by application. + */ + Clipboard(/*Ecore_X_Window ecoreXwin*/); + virtual ~Clipboard(); + + /** + * @copydoc Dali::Clipboard::SetItem() + */ + bool SetItem(const std::string &itemData); + + /** + * @copydoc Dali::Clipboard::GetItem() + */ + std::string GetItem( unsigned int index ); + + /** + * @copydoc Dali::Clipboard::NumberOfClipboardItems() + */ + unsigned int NumberOfItems(); + + /** + * @copydoc Dali::Clipboard::ShowClipboard() + */ + void ShowClipboard(); + + /** + * @copydoc Dali::Clipboard::HideClipboard() + */ + void HideClipboard(); + + +private: + Clipboard( const Clipboard& ); + Clipboard& operator=( Clipboard& ); + + static Dali::Clipboard mToolkitClipboard; +}; // class clipboard + + +Dali::Clipboard Dali::Internal::Adaptor::Clipboard::mToolkitClipboard; + + +Clipboard::Clipboard( /*Ecore_X_Window ecoreXwin*/) +{ +} + +Clipboard::~Clipboard() +{ +} + +Dali::Clipboard Clipboard::Get() +{ + if( ! mToolkitClipboard ) + { + mToolkitClipboard = Dali::Clipboard( new Dali::Internal::Adaptor::Clipboard() ); + } + return mToolkitClipboard; +} + +bool Clipboard::SetItem(const std::string &itemData ) +{ + return true; +} + +std::string Clipboard::GetItem( unsigned int index ) +{ + return ""; +} + +unsigned int Clipboard::NumberOfItems() +{ + return 0; +} + +void Clipboard::ShowClipboard() +{ +} + +void Clipboard::HideClipboard() +{ +} + + +} // namespace Adaptor + +} // namespace Internal + + +inline static Internal::Adaptor::Clipboard& GetImplementation(Dali::Clipboard& clipboard) +{ + // Bypass any passed in clipboard handle - it probably won't be initialized + Dali::Clipboard theClipboard = Dali::Clipboard::Get(); + BaseObject& object = theClipboard.GetBaseObject(); + return static_cast(object); +} + +inline static const Internal::Adaptor::Clipboard& GetImplementation(const Dali::Clipboard& clipboard) +{ + // Bypass any passed in clipboard handle - it probably won't be initialized + Dali::Clipboard theClipboard = Dali::Clipboard::Get(); + const BaseObject& object = theClipboard.GetBaseObject(); + return static_cast(object); +} + + +Clipboard::Clipboard() +{ +} +Clipboard::~Clipboard() +{ +} +Clipboard::Clipboard(Internal::Adaptor::Clipboard *impl) + : BaseHandle(impl) +{ +} + +Clipboard Clipboard::Get() +{ + return Internal::Adaptor::Clipboard::Get(); +} +bool Clipboard::SetItem( const std::string &itemData) +{ + return GetImplementation(*this).SetItem( itemData ); +} + +std::string Clipboard::GetItem( unsigned int index ) +{ + return GetImplementation(*this).GetItem( index ); +} + +unsigned int Clipboard::NumberOfItems() +{ + return GetImplementation(*this).NumberOfItems(); +} + +void Clipboard::ShowClipboard() +{ + GetImplementation(*this).ShowClipboard(); +} + +void Clipboard::HideClipboard() +{ + GetImplementation(*this).HideClipboard(); +} + +} // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard.h new file mode 100644 index 0000000..cbaf46c --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard.h @@ -0,0 +1,101 @@ +#ifndef __TOOLKIT_CLIPBOARD_H__ +#define __TOOLKIT_CLIPBOARD_H__ + +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +#define __DALI_CLIPBOARD_H__ + +// EXTERNAL INCLUDES +#include +#include + +namespace Dali DALI_IMPORT_API +{ + +namespace Internal DALI_INTERNAL +{ + +namespace Adaptor +{ +class Clipboard; +} +} + +/** + * The Clipboard can operate using various funtion. + * Clipboard can manage it's item and set show / hide status. + */ +class Clipboard : public BaseHandle +{ +public: + /** + * Create an uninitialized Clipboard; + * this can be initialized with one of the derived Clipboard' New() methods + */ + Clipboard(); + + /** + * Virtual destructor. + */ + virtual ~Clipboard(); + + /** + * This constructor is used by Adaptor::GetClipboard(). + * @param[in] clipboard A pointer to the clipboard. + */ + Clipboard( Internal::Adaptor::Clipboard* clipboard ); + + /** + * Retrieve a handle to the ClipboardEventNotifier instance + * @return A handle to the Clipboard + */ + static Clipboard Get(); + + /** + * Send the given string to the clipboard + * @param[in] itemData string to send to clip board + * @return bool true if the internal clip board sending was successful. + */ + bool SetItem( const std::string& itemData ); + + /** + * Retreive the string at the given index in the clip board. + * @param[in] index item in clipboard list to retrieve + * @return string the text item at the current index. + */ + std::string GetItem( unsigned int index ); + + /** + * Returns the number of item currently in the clipboard + * @return unsigned int number of clipboard items + */ + unsigned int NumberOfItems(); + + /** + * Show the clipboard window + */ + void ShowClipboard(); + + /** + * Hide the clipboard window + */ + void HideClipboard(); + +}; +} // namespace Dali + +#endif // __TOOLKIT_CLIPBOARD_H__ diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.cpp new file mode 100644 index 0000000..ca25896 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.cpp @@ -0,0 +1,562 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 "toolkit-imf-manager.h" + +// EXTERNAL INCLUDES +#include +#include +#include + +#include +#include +#include + +namespace Dali +{ +namespace Internal +{ +namespace Adaptor +{ +class RenderSurface; + + +class ImfManager : public Dali::BaseObject +{ +public: + typedef Dali::ImfManager::ImfManagerSignalV2 ImfManagerSignalV2; + typedef Dali::ImfManager::ImfEventSignalV2 ImfEventSignalV2; + +public: + static Dali::ImfManager Get(); + + ImfManager( /* Ecore_X_Window ecoreXwin */ ); + void ConnectCallbacks(); + void DisconnectCallbacks(); + void Activate(); + void Deactivate(); + void Reset(); + + Ecore_IMF_Context* GetContext(); + bool RestoreAfterFocusLost() const; + void SetRestoreAferFocusLost( bool toggle ); + void PreEditChanged( void *data, Ecore_IMF_Context *imfContext, void *event_info ); + void CommitReceived( void *data, Ecore_IMF_Context *imfContext, void *event_info ); + Eina_Bool RetrieveSurrounding( void *data, Ecore_IMF_Context *imfContext, char** text, int* cursorPosition ); + void DeleteSurrounding( void *data, Ecore_IMF_Context *imfContext, void *event_info ); + void NotifyCursorPosition(); + int GetCursorPosition(); + void SetCursorPosition( unsigned int cursorPosition ); + void SetSurroundingText( std::string text ); + std::string GetSurroundingText(); + +public: // Signals + ImfManagerSignalV2& ActivatedSignal() { return mActivatedSignalV2; } + ImfEventSignalV2& EventReceivedSignal() { return mEventSignalV2; } + +protected: + virtual ~ImfManager(); + +private: + void CreateContext( /*Ecore_X_Window ecoreXwin*/ ); + void DeleteContext(); + +private: + // Undefined + ImfManager( const ImfManager& ); + ImfManager& operator=( ImfManager& ); + +private: + Ecore_IMF_Context* mIMFContext; + int mIMFCursorPosition; + std::string mSurroundingText; + bool mRestoreAfterFocusLost:1; ///< Whether the keyboard needs to be restored (activated ) after focus regained. + bool mIdleCallbackConnected:1; ///< Whether the idle callback is already connected. + + std::vector mKeyEvents; ///< Stores key events to be sent from idle call-back. + ImfManagerSignalV2 mActivatedSignalV2; + ImfEventSignalV2 mEventSignalV2; + + + static Dali::ImfManager mToolkitImfManager; + +public: + +inline static Internal::Adaptor::ImfManager& GetImplementation(Dali::ImfManager& imfManager) +{ + Dali::ImfManager actualImfManager = ImfManager::Get(); + + BaseObject& handle = actualImfManager.GetBaseObject(); + return static_cast(handle); +} + +inline static const Internal::Adaptor::ImfManager& GetImplementation(const Dali::ImfManager& imfManager) +{ + Dali::ImfManager actualImfManager = ImfManager::Get(); + + const BaseObject& handle = imfManager.GetBaseObject(); + return static_cast(handle); +} + +}; + + +namespace +{ + +// Currently this code is internal to dali/dali/internal/event/text/utf8.h but should be made Public and used from there instead. +size_t Utf8SequenceLength(const unsigned char leadByte) +{ + size_t length = 0; + + if ((leadByte & 0x80) == 0 ) //ASCII character (lead bit zero) + { + length = 1; + } + else if (( leadByte & 0xe0 ) == 0xc0 ) //110x xxxx + { + length = 2; + } + else if (( leadByte & 0xf0 ) == 0xe0 ) //1110 xxxx + { + length = 3; + } + else if (( leadByte & 0xf8 ) == 0xf0 ) //1111 0xxx + { + length = 4; + } + + return length; +} + +// Static function calls used by ecore 'c' style callback registration +void Commit( void *data, Ecore_IMF_Context *imfContext, void *event_info ) +{ + if ( data ) + { + ImfManager* imfManager = reinterpret_cast< ImfManager* > ( data ); + imfManager->CommitReceived( data, imfContext, event_info ); + } +} + +void PreEdit( void *data, Ecore_IMF_Context *imfContext, void *event_info ) +{ + if ( data ) + { + ImfManager* imfManager = reinterpret_cast< ImfManager* > ( data ); + imfManager->PreEditChanged( data, imfContext, event_info ); + } +} + +Eina_Bool ImfRetrieveSurrounding(void *data, Ecore_IMF_Context *imfContext, char** text, int* cursorPosition ) +{ + if ( data ) + { + ImfManager* imfManager = reinterpret_cast< ImfManager* > ( data ); + return imfManager->RetrieveSurrounding( data, imfContext, text, cursorPosition ); + } + else + { + return false; + } +} + +/** + * Called when an IMF delete surrounding event is received. + * Here we tell the application that it should delete a certain range. + */ +void ImfDeleteSurrounding( void *data, Ecore_IMF_Context *imfContext, void *event_info ) +{ + if ( data ) + { + ImfManager* imfManager = reinterpret_cast< ImfManager* > ( data ); + imfManager->DeleteSurrounding( data, imfContext, event_info ); + } +} + +} // unnamed namespace + +Dali::ImfManager Dali::Internal::Adaptor::ImfManager::mToolkitImfManager; + + +Dali::ImfManager ImfManager::Get() +{ + Dali::ImfManager manager; + + if( ! mToolkitImfManager ) + { + mToolkitImfManager = Dali::ImfManager( new Dali::Internal::Adaptor::ImfManager() ); + } + return mToolkitImfManager; +} + +ImfManager::ImfManager( /*Ecore_X_Window ecoreXwin*/ ) +: mIMFContext(), + mIMFCursorPosition( 0 ), + mSurroundingText(""), + mRestoreAfterFocusLost( false ), + mIdleCallbackConnected( false ), + mKeyEvents() +{ + //ecore_imf_init(); + CreateContext( /*ecoreXwin*/ ); + ConnectCallbacks(); + //VirtualKeyboard::ConnectCallbacks( mIMFContext ); +} + +ImfManager::~ImfManager() +{ + //VirtualKeyboard::DisconnectCallbacks( mIMFContext ); + DisconnectCallbacks(); + DeleteContext(); + //ecore_imf_shutdown(); +} + +void ImfManager::CreateContext( /*Ecore_X_Window ecoreXwin*/ ) +{ +} + +void ImfManager::DeleteContext() +{ +} + +// Callbacks for predicitive text support. +void ImfManager::ConnectCallbacks() +{ + //if ( mIMFContext ) { + //ecore_imf_context_event_callback_add( mIMFContext, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, PreEdit, this ); + //ecore_imf_context_event_callback_add( mIMFContext, ECORE_IMF_CALLBACK_COMMIT, Commit, this ); + //ecore_imf_context_event_callback_add( mIMFContext, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, ImfDeleteSurrounding, this ); + //} +} + +void ImfManager::DisconnectCallbacks() +{ + // if ( mIMFContext ) + // { + // ecore_imf_context_event_callback_del( mIMFContext, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, PreEdit ); + // ecore_imf_context_event_callback_del( mIMFContext, ECORE_IMF_CALLBACK_COMMIT, Commit ); + // ecore_imf_context_event_callback_del( mIMFContext, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, ImfDeleteSurrounding ); + // } +} + +void ImfManager::Activate() +{ + // // Reset mIdleCallbackConnected + // mIdleCallbackConnected = false; + + // if ( mIMFContext ) + // { + // ecore_imf_context_focus_in( mIMFContext ); + // // emit keyboard activated signal + // Dali::ImfManager handle( this ); + // mActivatedSignalV2.Emit( handle ); + // } +} + +void ImfManager::Deactivate() +{ + // if( mIMFContext ) + // { + // Reset(); + // ecore_imf_context_focus_out( mIMFContext ); + // } + // // Reset mIdleCallbackConnected + // mIdleCallbackConnected = false; +} + +void ImfManager::Reset() +{ + // if ( mIMFContext ) + // { + // ecore_imf_context_reset( mIMFContext ); + // } +} + +Ecore_IMF_Context* ImfManager::GetContext() +{ + //return mIMFContext; + return NULL; +} + +bool ImfManager::RestoreAfterFocusLost() const +{ + return mRestoreAfterFocusLost; +} + +void ImfManager::SetRestoreAferFocusLost( bool toggle ) +{ + mRestoreAfterFocusLost = toggle; +} + +void ImfManager::PreEditChanged( void *, Ecore_IMF_Context *imfContext, void *event_info ) +{ + // char *preEditString( NULL ); + // int cursorPosition( 0 ); + // Eina_List *attrs = NULL; + // Eina_List *l = NULL; + + // Ecore_IMF_Preedit_Attr *attr; + + // // Retrieves attributes as well as the string the cursor position offset from start of pre-edit string. + // // the attributes (attrs) is used in languages that use the soft arrows keys to insert characters into a current pre-edit string. + // ecore_imf_context_preedit_string_with_attributes_get( imfContext, &preEditString, &attrs, &cursorPosition ); + // if ( attrs ) + // { + // // iterate through the list of attributes getting the type, start and end position. + // for ( l = attrs, (attr = (Ecore_IMF_Preedit_Attr*)eina_list_data_get(l) ); l; l = eina_list_next(l), ( attr = (Ecore_IMF_Preedit_Attr*)eina_list_data_get(l) )) + // { + // if ( attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB4 ) // (Ecore_IMF) + // { + // // check first byte so know how many bytes a character is represented by as keyboard returns cursor position in bytes. Which is different for some languages. + // size_t visualCharacterIndex = 0; + // size_t byteIndex = 0; + // // iterate through null terminated string checking each character's position against the given byte position ( attr->end_index ). + // while ( preEditString[byteIndex] != '\0' ) + // { + // // attr->end_index is provided as a byte position not character and we need to know the character position. + // size_t currentSequenceLength = Utf8SequenceLength(preEditString[byteIndex]); // returns number of bytes used to represent character. + // if ( byteIndex == attr->end_index ) + // { + // cursorPosition = visualCharacterIndex; + // break; + // // end loop as found cursor position that matches byte position + // } + // else + // { + // byteIndex += currentSequenceLength; // jump to next character + // visualCharacterIndex++; // increment character count so we know our position for when we get a match + // } + // DALI_ASSERT_DEBUG( visualCharacterIndex < strlen( preEditString )); + // } + // } + // } + // } + // if ( Dali::Adaptor::IsAvailable() ) + // { + // std::string keyString ( preEditString ); + // int numberOfChars( 0 ); + // Dali::ImfManager handle( this ); + // Dali::ImfManager::ImfEventData imfEventData ( Dali::ImfManager::PREEDIT, keyString, cursorPosition, numberOfChars ); + // Dali::ImfManager::ImfCallbackData callbackData = mEventSignalV2.Emit( handle, imfEventData ); + // if ( callbackData.update ) + // { + // SetCursorPosition( callbackData.cursorPosition ); + // SetSurroundingText( callbackData.currentText ); + // NotifyCursorPosition(); + // } + // if ( callbackData.preeditResetRequired ) + // { + // Reset(); + // } + // } + // free( preEditString ); +} + +void ImfManager::CommitReceived( void *, Ecore_IMF_Context *imfContext, void *event_info ) +{ + // if ( Dali::Adaptor::IsAvailable() ) + // { + // const std::string keyString( (char *)event_info ); + // const int cursorOffset( 0 ); + // const int numberOfChars( 0 ); + + // Dali::ImfManager handle( this ); + // Dali::ImfManager::ImfEventData imfEventData ( Dali::ImfManager::COMMIT, keyString, cursorOffset, numberOfChars ); + // Dali::ImfManager::ImfCallbackData callbackData = mEventSignalV2.Emit( handle, imfEventData ); + + // if ( callbackData.update ) + // { + // SetCursorPosition( callbackData.cursorPosition ); + // SetSurroundingText( callbackData.currentText ); + + // NotifyCursorPosition(); + // } + // } +} + +/** + * Called when an IMF retrieve surround event is received. + * Here the IMF module wishes to know the string we are working with and where within the string the cursor is + * We need to signal the application to tell us this information. + */ +Eina_Bool ImfManager::RetrieveSurrounding( void *data, Ecore_IMF_Context *imfContext, char** text, int* cursorPosition ) +{ + // std::string keyString ( "" ); + // int cursorOffset( 0 ); + // int numberOfChars( 0 ); + // Dali::ImfManager::ImfEventData imfData ( Dali::ImfManager::GETSURROUNDING , keyString, cursorOffset, numberOfChars ); + // Dali::ImfManager handle( this ); + // mEventSignalV2.Emit( handle, imfData ); + // if ( text ) + // { + // std::string surroundingText( GetSurroundingText() ); + // if ( !surroundingText.empty() ) + // { + // *text = strdup( surroundingText.c_str() ); + // } + // else + // { + // *text = strdup( "" ); + // } + // } + // if ( cursorPosition ) + // { + // *cursorPosition = GetCursorPosition(); + // } + return EINA_TRUE; +} + +/** + * Called when an IMF delete surrounding event is received. + * Here we tell the application that it should delete a certain range. + */ +void ImfManager::DeleteSurrounding( void *data, Ecore_IMF_Context *imfContext, void *event_info ) +{ + // if ( Dali::Adaptor::IsAvailable() ) + // { + // Ecore_IMF_Event_Delete_Surrounding* deleteSurroundingEvent = (Ecore_IMF_Event_Delete_Surrounding*) event_info; + // const std::string keyString( "" ); + // const int cursorOffset( deleteSurroundingEvent->offset ); + // const int numberOfChars( deleteSurroundingEvent->n_chars ); + // Dali::ImfManager::ImfEventData imfData ( Dali::ImfManager::DELETESURROUNDING , keyString, cursorOffset, numberOfChars ); + // Dali::ImfManager handle( this ); + // mEventSignalV2.Emit( handle, imfData ); + // } +} + +void ImfManager::NotifyCursorPosition() +{ + // if ( mIMFContext ) + // { + // ecore_imf_context_cursor_position_set( mIMFContext, mIMFCursorPosition ); + // } +} + +int ImfManager::GetCursorPosition() +{ + return mIMFCursorPosition; +} + +void ImfManager::SetCursorPosition( unsigned int cursorPosition ) +{ + mIMFCursorPosition = ( int )cursorPosition; +} + +void ImfManager::SetSurroundingText( std::string text ) +{ + mSurroundingText = text; +} + +std::string ImfManager::GetSurroundingText() +{ + return mSurroundingText; +} + +} // Adaptor + +} // Internal + + +/********************************************************************************/ +/********************************* PUBLIC CLASS *******************************/ +/********************************************************************************/ + +ImfManager::ImfManager() +{ +} + +ImfManager::~ImfManager() +{ +} + +ImfManager ImfManager::Get() +{ + return Internal::Adaptor::ImfManager::Get(); +} + +ImfContext ImfManager::GetContext() +{ + return reinterpret_cast( Internal::Adaptor::ImfManager::GetImplementation(*this).GetContext() ); +} + +void ImfManager::Activate() +{ + Internal::Adaptor::ImfManager::GetImplementation(*this).Activate(); +} + +void ImfManager::Deactivate() +{ + Internal::Adaptor::ImfManager::GetImplementation(*this).Deactivate(); +} + +bool ImfManager::RestoreAfterFocusLost() const +{ + return Internal::Adaptor::ImfManager::GetImplementation(*this).RestoreAfterFocusLost(); +} + +void ImfManager::SetRestoreAferFocusLost( bool toggle ) +{ + Internal::Adaptor::ImfManager::GetImplementation(*this).SetRestoreAferFocusLost( toggle ); +} + +void ImfManager::Reset() +{ + Internal::Adaptor::ImfManager::GetImplementation(*this).Reset(); +} + +void ImfManager::NotifyCursorPosition() +{ + Internal::Adaptor::ImfManager::GetImplementation(*this).NotifyCursorPosition(); +} + +void ImfManager::SetCursorPosition( unsigned int SetCursorPosition ) +{ + Internal::Adaptor::ImfManager::GetImplementation(*this).SetCursorPosition( SetCursorPosition ); +} + +int ImfManager::GetCursorPosition() +{ + return Internal::Adaptor::ImfManager::GetImplementation(*this).GetCursorPosition(); +} + +void ImfManager::SetSurroundingText( std::string text ) +{ + Internal::Adaptor::ImfManager::GetImplementation(*this).SetSurroundingText( text ); +} + +std::string ImfManager::GetSurroundingText() +{ + return Internal::Adaptor::ImfManager::GetImplementation(*this).GetSurroundingText(); +} + +ImfManager::ImfManagerSignalV2& ImfManager::ActivatedSignal() +{ + return Internal::Adaptor::ImfManager::GetImplementation(*this).ActivatedSignal(); +} + +ImfManager::ImfEventSignalV2& ImfManager::EventReceivedSignal() +{ + return Internal::Adaptor::ImfManager::GetImplementation(*this).EventReceivedSignal(); +} + +ImfManager::ImfManager(Internal::Adaptor::ImfManager *impl) + : BaseHandle(impl) +{ +} + +} // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.h new file mode 100644 index 0000000..2da670a --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.h @@ -0,0 +1,226 @@ +#ifndef _DALI_ADAPTOR_IMF_MANAGER_H_ +#define _DALI_ADAPTOR_IMF_MANAGER_H_ + +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#define IMFMANAGER_H +#include +#include + +namespace Dali DALI_IMPORT_API +{ + +namespace Internal DALI_INTERNAL +{ +namespace Adaptor +{ +class ImfManager; +} +} + +typedef void* ImfContext; + +/** + * @brief The ImfManager class + * Specifically manages the ecore input method framework which enables the virtual or hardware keyboards. + */ +class ImfManager : public BaseHandle +{ +public: + + enum ImfEvent + { + VOID, + PREEDIT, + COMMIT, + DELETESURROUNDING, + GETSURROUNDING + }; + + /** + * This structure is used to pass on data from the IMF regarding predictive text. + */ + struct ImfEventData + { + /** + * Default Constructor. + */ + ImfEventData() + : eventName( VOID ), + predictiveString(""), + cursorOffset( 0 ), + numberOfChars ( 0 ) + { + }; + + /** + * Constructor + * @param[in] aEventName The name of the event from the IMF. + * @param[in] aPredictiveString The pre-edit or commit string. + * @param[in] aCursorOffset Start position from the current cursor position to start deleting characters. + * @param[in] aNumberOfChars The number of characters to delete from the cursorOffset. + */ + ImfEventData(ImfEvent aEventName, const std::string& aPredictiveString, int aCursorOffset,int aNumberOfChars ) + : eventName(aEventName), predictiveString(aPredictiveString), cursorOffset( aCursorOffset ), numberOfChars( aNumberOfChars ) + { + } + + // Data + ImfEvent eventName; // The name of the event from the IMF. + std::string predictiveString; // The pre-edit or commit string. + int cursorOffset; // Start position from the current cursor position to start deleting characters. + int numberOfChars; //number of characters to delete from the cursorOffset. + }; + + /** + * Data required my IMF from the callback + */ + struct ImfCallbackData + { + ImfCallbackData( ) + : update( false ), cursorPosition( 0 ), preeditResetRequired ( false ) + { + } + + ImfCallbackData(bool aUpdate, int aCursorPosition, std::string aCurrentText, bool aPreeditResetRequired ) + : update(aUpdate), cursorPosition(aCursorPosition), currentText( aCurrentText ), preeditResetRequired( aPreeditResetRequired ) + { + } + + bool update; // if cursor position needs to be updated + int cursorPosition; // new position of cursor + std::string currentText; // current text string + bool preeditResetRequired; // flag if preedit reset is required. + }; + + typedef SignalV2< void (ImfManager&) > ImfManagerSignalV2; + + typedef SignalV2< ImfCallbackData ( ImfManager&, const ImfEventData& ) > ImfEventSignalV2; + +public: + + /** + * Retrieve a handle to the instance of ImfManager. + * @return A handle to the ImfManager. + */ + static ImfManager Get(); + + /** + * Get the current imf context. + * @return current imf context. + */ + ImfContext GetContext(); + + /** + * Activate the IMF. + * It means that the text editing is started at somewhere. + * If the H/W keyboard isn't connected then it will show the virtual keyboard. + */ + void Activate(); + + /** + * Deactivate the IMF. + * It means that the text editing is finished at somewhere. + */ + void Deactivate(); + + /** + * Get the restoration status, which controls if the keyboard is restored after the focus lost then regained. + * If true then keyboard will be restored (activated) after focus is regained. + * @return restoration status. + */ + bool RestoreAfterFocusLost() const; + + /** + * 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 ); + + /** + * Send message reset the pred-edit state / imf module. Used to interupt pre-edit state maybe due to a touch input. + */ + void Reset(); + + /** + * Notifies IMF context that the cursor position has changed, required for features like auto-capitalisation + */ + void NotifyCursorPosition(); + + /** + * Sets cursor position stored in VirtualKeyboard, this is required by the IMF context + * @param[in] cursorPosition position of cursor + */ + void SetCursorPosition( unsigned int cursorPosition ); + + /** + * Gets cursor position stored in VirtualKeyboard, this is required by the IMF context + * @return current position of cursor + */ + int GetCursorPosition(); + + /** + * Method to store the string required by the IMF, this is used to provide predictive word suggestions. + * @param[in] text The text string surrounding the current cursor point. + */ + void SetSurroundingText( std::string text ); + + /** + * Gets current text string set within the IMF manager, this is used to offer predictive suggestions + * @return current position of cursor + */ + std::string GetSurroundingText(); + +public: + + // Signals + + /** + * This is emitted when the virtual keyboard is connected to or the hardware keyboard is activated. + * @return The IMF Activated signal. + */ + ImfManagerSignalV2& ActivatedSignal(); + + /** + * This is emitted when the IMF manager receives an event from the IMF + * @return The Event signal containing the event data. + */ + ImfEventSignalV2& EventReceivedSignal(); + + // Construction & Destruction + + /** + * Constructor + */ + ImfManager(); + + /** + * Virtual destructor. + */ + virtual ~ImfManager(); + + /** + * This constructor is used by ImfManager::Get(). + * @param[in] imfManager A pointer to the imf Manager. + */ + ImfManager( Internal::Adaptor::ImfManager* imfManager ); +}; + +} // namespace Dali + +#endif // _DALI_ADAPTOR_IMF_MANAGER_H_ diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-orientation.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-orientation.cpp new file mode 100644 index 0000000..62598d3 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-orientation.cpp @@ -0,0 +1,143 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 "toolkit-orientation.h" + +#include +#include +#include + +namespace Dali +{ + +namespace +{ +ToolkitOrientation* gToolkitOrientation(NULL); +} // unnamed namespace + +namespace Internal +{ + +namespace Adaptor +{ + +/** + * Stub for the Orientation + */ +class Orientation : public BaseObject +{ +public: // Creation & Destruction + + Orientation(); + Orientation(ToolkitOrientation *orientation); + ~Orientation(); + +public: // Setters & Getters + + void SetDegrees( int degrees ) + { + mOrientation = degrees; + } + + int GetDegrees() const; + float GetRadians() const; + +public: // Signals + + Dali::Orientation::OrientationSignalV2& ChangedSignal(); + + void EmitChangedSignal() + { + mChangedSignal.Emit(Dali::Orientation(this)); + } + +private: + + Dali::Orientation::OrientationSignalV2 mChangedSignal; + + ToolkitOrientation* mToolkitOrientation; + + int mOrientation; +}; + +Orientation::Orientation() +: mToolkitOrientation(NULL), + mOrientation(0) +{ +} + +Orientation::Orientation(ToolkitOrientation *orientation) +: mToolkitOrientation(orientation), + mOrientation(0) +{ +} + +Orientation::~Orientation() +{ +} + +int Orientation::GetDegrees() const +{ + mToolkitOrientation->mFunctionsCalled.GetDegrees = true; + return mOrientation; +} + +float Orientation::GetRadians() const +{ + mToolkitOrientation->mFunctionsCalled.GetRadians = true; + return Math::PI * (float)mOrientation / 180.0f; +} + +Dali::Orientation::OrientationSignalV2& Orientation::ChangedSignal() +{ + mToolkitOrientation->mFunctionsCalled.ChangedSignal = true; + return mChangedSignal; +} + +} // namespace Adaptor + +} // namespace Internal + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +ToolkitOrientation::ToolkitOrientation() +: mOrientationStub(new Internal::Adaptor::Orientation(this)), + mOrientation( mOrientationStub ) +{ + gToolkitOrientation = this; +} + +ToolkitOrientation::~ToolkitOrientation() +{ + gToolkitOrientation = NULL; +} + +Orientation ToolkitOrientation::GetHandle() +{ + return mOrientation; +} + +void ToolkitOrientation::SetDegrees( int degrees ) +{ + mOrientationStub->SetDegrees( degrees ); +} + +void ToolkitOrientation::EmitChangedSignal() +{ + mOrientationStub->EmitChangedSignal(); +} + +} // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-orientation.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-orientation.h new file mode 100644 index 0000000..31c31f1 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-orientation.h @@ -0,0 +1,129 @@ +#ifndef __DALI_TOOLKIT_TOOLKIT_ORIENTATION_H__ +#define __DALI_TOOLKIT_TOOLKIT_ORIENTATION_H__ + +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace Internal +{ +namespace Adaptor +{ +class Orientation; +} +} + +/** + * This creates a stubbed Orientation so that internal Toolkit Adaptor calls work. + * Furthermore, it provides an interface to see if certain methods were invoked. + */ +class ToolkitOrientation +{ +public: // Construction & Destruction + + ToolkitOrientation(); + ~ToolkitOrientation(); + +public: // Getters + + Orientation GetHandle(); + +public: // Setters + + void SetDegrees( int degrees ); + +public: // Signal Emissions + + void EmitChangedSignal(); + +public: // TEST FUNCTIONS + + // Enumeration of Adaptor methods + enum TestFuncEnum + { + GetDegrees, + GetRadians, + ChangedSignal, + }; + + void Reset() + { + mFunctionsCalled.Reset(); + } + + bool WasCalled(TestFuncEnum func) + { + switch(func) + { + case GetDegrees: return mFunctionsCalled.GetDegrees; + case GetRadians: return mFunctionsCalled.GetRadians; + case ChangedSignal: return mFunctionsCalled.ChangedSignal; + } + return false; + } + + void ResetCallStatistics(TestFuncEnum func) + { + switch(func) + { + case GetDegrees: mFunctionsCalled.GetDegrees = false; break; + case GetRadians: mFunctionsCalled.GetRadians = false; break; + case ChangedSignal: mFunctionsCalled.ChangedSignal = false; break; + } + } + +private: + + struct TestFunctions + { + TestFunctions() + : GetDegrees(false), + GetRadians(false), + ChangedSignal(false) + { + } + + void Reset() + { + GetDegrees = false; + GetRadians = false; + ChangedSignal = false; + } + + bool GetDegrees; + bool GetRadians; + bool ChangedSignal; + }; + + TestFunctions mFunctionsCalled; + + // The stub + Internal::Adaptor::Orientation* mOrientationStub; + friend class Internal::Adaptor::Orientation; + Orientation mOrientation; // Hold a handle ourselves. +}; + +} // namespace Dali + +#endif // __DALI_TOOLKIT_TOOLKIT_ORIENTATION_H__ diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp new file mode 100644 index 0000000..41b0078 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp @@ -0,0 +1,122 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 "toolkit-physical-keyboard.h" + +#include +#include +#include + +namespace Dali +{ + +/******************************************************************************** + * Stub for Dali::Internal::Adaptor::PhysicalKeyboard + ********************************************************************************/ +namespace Internal +{ +namespace Adaptor +{ +class PhysicalKeyboard : public BaseObject +{ +public: // Creation & Destruction + + PhysicalKeyboard(); + ~PhysicalKeyboard(); + static Dali::PhysicalKeyboard Get(); + +public: + bool IsAttached() const; + +public: // Signals + Dali::PhysicalKeyboard::Signal& StatusChangedSignal(); + +private: + Dali::PhysicalKeyboard::Signal mStatusChangedSignal; + bool mIsAttached; + static Dali::PhysicalKeyboard mPhysicalKeyboard; +}; + +Dali::PhysicalKeyboard PhysicalKeyboard::mPhysicalKeyboard; + +PhysicalKeyboard::PhysicalKeyboard() +: mIsAttached(true) +{ +} + +PhysicalKeyboard::~PhysicalKeyboard() +{ +} + +Dali::PhysicalKeyboard PhysicalKeyboard::Get() +{ + if( ! mPhysicalKeyboard ) + { + mPhysicalKeyboard = Dali::PhysicalKeyboard(new Internal::Adaptor::PhysicalKeyboard()); + } + return mPhysicalKeyboard; +} + +bool PhysicalKeyboard::IsAttached() const +{ + return mIsAttached; +} + +Dali::PhysicalKeyboard::Signal& PhysicalKeyboard::StatusChangedSignal() +{ + return mStatusChangedSignal; +} + +} // namespace Adaptor +} // namespace Internal + + +/******************************************************************************** + * Stub for Dali::PhysicalKeyboard + ********************************************************************************/ + +PhysicalKeyboard::PhysicalKeyboard(){} +PhysicalKeyboard::~PhysicalKeyboard(){} + +PhysicalKeyboard PhysicalKeyboard::Get() +{ + // Get the physical keyboard handle + PhysicalKeyboard handle = Internal::Adaptor::PhysicalKeyboard::Get(); + return handle; +} + +bool PhysicalKeyboard::IsAttached() const +{ + const BaseObject& object = GetBaseObject(); + const Internal::Adaptor::PhysicalKeyboard& pyke = static_cast< const Internal::Adaptor::PhysicalKeyboard& >( object ); + return pyke.IsAttached(); +} + +PhysicalKeyboard::Signal& PhysicalKeyboard::StatusChangedSignal() +{ + BaseObject& object = GetBaseObject(); + Internal::Adaptor::PhysicalKeyboard& pyke = static_cast< Internal::Adaptor::PhysicalKeyboard& >( object ); + return pyke.StatusChangedSignal(); +} + +PhysicalKeyboard::PhysicalKeyboard( Internal::Adaptor::PhysicalKeyboard *impl ) +: BaseHandle(impl) +{ +} + + + +} // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-physical-keyboard.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-physical-keyboard.h new file mode 100644 index 0000000..aae2d7d --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-physical-keyboard.h @@ -0,0 +1,50 @@ +#ifndef __DALI_TOOLKIT_PHYSICAL_KEYBOARD_H__ +#define __DALI_TOOLKIT_PHYSICAL_KEYBOARD_H__ + +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include + +namespace Dali +{ +namespace Internal +{ +namespace Adaptor +{ +class PhysicalKeyboard; +} +} + +class PhysicalKeyboard : public BaseHandle +{ +public: + typedef SignalV2< void (PhysicalKeyboard) > Signal; + PhysicalKeyboard(); + virtual ~PhysicalKeyboard(); + static PhysicalKeyboard Get(); + bool IsAttached() const; + Signal& StatusChangedSignal(); + PhysicalKeyboard( Internal::Adaptor::PhysicalKeyboard* impl ); +}; + + +} // namespace Dali + +#endif // __DALI_TOOLKIT_PHYSICAL_KEYBOARD_H__ diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.cpp new file mode 100644 index 0000000..6b20063 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.cpp @@ -0,0 +1,191 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 "toolkit-style-monitor.h" + +#include +#include +#include + +namespace Dali +{ + + +namespace Internal +{ +namespace Adaptor +{ +/** + * Stub for the StyleMonitor + */ +class StyleMonitor : public BaseObject +{ +public: // Creation & Destruction + static Dali::StyleMonitor Get(); + StyleMonitor(); + ~StyleMonitor(); + +public: // Style Information + std::string GetDefaultFontFamily() const; + float GetDefaultFontSize() const; + const std::string& GetTheme() const; + void SetTheme(std::string theme); + +public: // Signals + Dali::StyleMonitor::StyleChangeSignalV2& StyleChangeSignal(); + + void EmitStyleChangeSignal(StyleChange styleChange) + { + mStyleChangeSignal.Emit(Dali::StyleMonitor(this), styleChange); + } + +private: + Dali::StyleMonitor::StyleChangeSignalV2 mStyleChangeSignal; + static Dali::StyleMonitor mToolkitStyleMonitor; + std::string mTheme; +}; + +Dali::StyleMonitor StyleMonitor::mToolkitStyleMonitor; + +Dali::StyleMonitor StyleMonitor::Get() +{ + if( ! mToolkitStyleMonitor ) + { + mToolkitStyleMonitor = Dali::StyleMonitor( new Dali::Internal::Adaptor::StyleMonitor() ); + } + return mToolkitStyleMonitor; +} + +StyleMonitor::StyleMonitor() +: mTheme("default") +{ +} + +StyleMonitor::~StyleMonitor() +{ +} + +std::string StyleMonitor::GetDefaultFontFamily() const +{ + return Dali::StyleMonitor::DEFAULT_FONT_FAMILY; +} + +float StyleMonitor::GetDefaultFontSize() const +{ + return Dali::StyleMonitor::DEFAULT_FONT_SIZE; +} + +const std::string& StyleMonitor::GetTheme() const +{ + return mTheme; +} + +void StyleMonitor::SetTheme(std::string path) +{ + StyleChange styleChange; + styleChange.themeChange = true; + styleChange.themeFilePath = path; + mTheme = path; + EmitStyleChangeSignal(styleChange); +} + +Dali::StyleMonitor::StyleChangeSignalV2& StyleMonitor::StyleChangeSignal() +{ + return mStyleChangeSignal; +} + +} // namespace Adaptor +} // namespace Internal + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +Internal::Adaptor::StyleMonitor& GetImplementation(Dali::StyleMonitor& monitor) +{ + BaseObject& object = monitor.GetBaseObject(); + return static_cast(object); +} +const Internal::Adaptor::StyleMonitor& GetImplementation(const Dali::StyleMonitor& monitor) +{ + const BaseObject& object = monitor.GetBaseObject(); + return static_cast(object); +} + +const std::string Dali::StyleMonitor::DEFAULT_FONT_FAMILY("DefaultFont"); +const float Dali::StyleMonitor::DEFAULT_FONT_SIZE(1.0f); + +StyleMonitor::StyleMonitor() +{ +} + +StyleMonitor::StyleMonitor(const StyleMonitor& monitor) +: BaseHandle(monitor) +{ +} + +StyleMonitor StyleMonitor::StyleMonitor::Get() +{ + return Internal::Adaptor::StyleMonitor::Get(); +} + +StyleMonitor::~StyleMonitor() +{ +} + +std::string StyleMonitor::GetDefaultFontFamily() const +{ + return GetImplementation(*this).GetDefaultFontFamily(); +} + +float StyleMonitor::GetDefaultFontSize() const +{ + return GetImplementation(*this).GetDefaultFontSize(); +} + +const std::string& StyleMonitor::GetTheme() const +{ + return GetImplementation(*this).GetTheme(); +} + +void StyleMonitor::SetTheme(std::string themeFilePath) +{ + GetImplementation(*this).SetTheme(themeFilePath); +} + +StyleMonitor::StyleChangeSignalV2& StyleMonitor::StyleChangeSignal() +{ + return GetImplementation(*this).StyleChangeSignal(); +} + +void StyleMonitor::EmitStyleChangeSignal(StyleChange styleChange) +{ + GetImplementation(*this).EmitStyleChangeSignal(styleChange); +} + +StyleMonitor& StyleMonitor::operator=(const StyleMonitor& monitor) +{ + if( *this != monitor ) + { + BaseHandle::operator=(monitor); + } + return *this; +} + +StyleMonitor::StyleMonitor(Internal::Adaptor::StyleMonitor* internal) +: BaseHandle(internal) +{ +} + +} // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.h new file mode 100644 index 0000000..3eec7e1 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.h @@ -0,0 +1,75 @@ +#ifndef __DALI_TOOLKIT_TOOLKIT_STYLE_MONITOR_H__ +#define __DALI_TOOLKIT_TOOLKIT_STYLE_MONITOR_H__ + +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 + +// INTERNAL INCLUDES +#define __DALI_STYLE_MONITOR_H__ +#include +#include +#include + +namespace Dali +{ + +namespace Internal +{ +namespace Adaptor +{ +class StyleMonitor; +} +} + +class StyleMonitor : public BaseHandle +{ +public: // Typedefs + typedef SignalV2< void (StyleMonitor, StyleChange) > StyleChangeSignalV2; + static const std::string DEFAULT_FONT_FAMILY; + static const float DEFAULT_FONT_SIZE; + +public: // Creation & Destruction + StyleMonitor(); + StyleMonitor(const StyleMonitor& monitor); + static StyleMonitor Get(); + virtual ~StyleMonitor(); + static StyleMonitor DownCast( BaseHandle handle ); + using BaseHandle::operator=; + +public: // Style Information + std::string GetDefaultFontFamily() const; + float GetDefaultFontSize() const; + const std::string& GetTheme() const; + void SetTheme(std::string themeFilePath); + +public: // Signals + StyleChangeSignalV2& StyleChangeSignal(); + void EmitStyleChangeSignal(StyleChange handle); + +public: // Operators + StyleMonitor& operator=(const StyleMonitor& monitor); + +public: + StyleMonitor(Internal::Adaptor::StyleMonitor* styleMonitor); +}; + + +} // namespace Dali + +#endif // __DALI_TOOLKIT_TOOLKIT_STYLE_MONITOR_H__ diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-test-application.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-test-application.h new file mode 100644 index 0000000..a90881c --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-test-application.h @@ -0,0 +1,78 @@ +#ifndef __DALI_TOOLKIT_TEST_APPLICATION_H__ +#define __DALI_TOOLKIT_TEST_APPLICATION_H__ + +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +// INTERNAL INCLUDES +#include + +#include "toolkit-adaptor.h" +#include "toolkit-orientation.h" + +namespace Dali +{ + +/** + * Adds some functionality on top of TestApplication that is required by the Toolkit. + */ +class ToolkitTestApplication : public TestApplication +{ +public: + + ToolkitTestApplication( size_t surfaceWidth = DEFAULT_SURFACE_WIDTH, + size_t surfaceHeight = DEFAULT_SURFACE_HEIGHT, + float horizontalDpi = DEFAULT_HORIZONTAL_DPI, + float verticalDpi = DEFAULT_VERTICAL_DPI ) + : TestApplication( false, surfaceWidth, surfaceHeight, horizontalDpi, verticalDpi ) + { + Initialize(); + } + + ~ToolkitTestApplication() + { + // Need to delete core before we delete the adaptor. + delete mCore; + mCore = NULL; + } + + inline ToolkitAdaptor& GetAdaptor() + { + return mAdaptor; + } + + //ToolkitOrientation& GetOrientation() + //{ + //return mOrientation; + //} + +private: + ToolkitAdaptor mAdaptor; + //ToolkitOrientation mOrientation; +}; + +} // namespace Dali + +inline ImageActor CreateSolidColorImageActor(ToolkitTestApplication& application, const Vector4& color, int width, int height) +{ + ImageActor actor = ImageActor::New(CreateBitmapImage(width, height, color)); + application.SendNotification(); + application.Render(); + return actor; +} + + +#endif // __DALI_TOOLKIT_TEST_APPLICATION_H__ diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp new file mode 100644 index 0000000..f2a3d58 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp @@ -0,0 +1,55 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 "toolkit-timer.h" + +#include + +// INTERNAL INCLUDES +#include +#include +#include + + +namespace +{ +bool ecore_timer_running = false; +Ecore_Task_Cb timer_callback_func=NULL; +const void* timer_callback_data=NULL; +int timerId = 0; +}// anon namespace + +extern "C" +{ +Ecore_Timer* ecore_timer_add(double in, + Ecore_Task_Cb func, + const void *data) +{ + ecore_timer_running = true; + timer_callback_func = func; + timer_callback_data = data; + timerId += sizeof(Ecore_Timer*); + return (Ecore_Timer*)timerId; +} + +void* ecore_timer_del(Ecore_Timer *timer) +{ + ecore_timer_running = false; + timer_callback_func = NULL; + return NULL; +} + +} diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-timer.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-timer.h new file mode 100644 index 0000000..29abb84 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-timer.h @@ -0,0 +1,56 @@ +#ifndef __DALI_TOOLKIT_TOOLKIT_TIMER_H__ +#define __DALI_TOOLKIT_TOOLKIT_TIMER_H__ + +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 + +// PUBLIC INCLUDES +#define __DALI_TIMER_H__ +#include +#include + +namespace Dali +{ + +class Timer : public BaseHandle +{ +public: + typedef SignalV2< bool () > TimerSignalV2; + static Timer New( unsigned int milliSec ); + Timer(); + Timer( const Timer& timer ); + Timer& operator=( const Timer& timer ); + virtual ~Timer(); + static Timer DownCast( BaseHandle handle ); + using BaseHandle::operator=; + void Start(); + void Stop(); + void SetInterval( unsigned int milliSec ); + unsigned int GetInterval() const; + bool IsRunning() const; + TimerSignalV2& TickSignal(); +private: + Dali::Timer::TimerSignalV2 mTickSignal; + unsigned int mInterval; + bool mIsRunning; +}; + +} // namespace Dali + +#endif // __DALI_TOOLKIT_TOOLKIT_TIMER_H__ diff --git a/automated-tests/src/dali-toolkit/tct-dali-toolkit-core.cpp b/automated-tests/src/dali-toolkit/tct-dali-toolkit-core.cpp new file mode 100644 index 0000000..d9c39e1 --- /dev/null +++ b/automated-tests/src/dali-toolkit/tct-dali-toolkit-core.cpp @@ -0,0 +1,31 @@ +#include +#include +#include "tct-dali-toolkit-core.h" + +int main(int argc, const char *argv[]) +{ + int result = -1; + int i; + + if (argc != 2) { + printf("Usage: %s \n", argv[0]); + return 2; + } + + for (i = 0; tc_array[i].name; i++) { + if (!strcmp(argv[1], tc_array[i].name)) { + if (tc_array[i].startup) + tc_array[i].startup(); + + result = tc_array[i].function(); + + if (tc_array[i].cleanup) + tc_array[i].cleanup(); + + return result; + } + } + + printf("Unknown testcase name: \"%s\"\n", argv[1]); + return 2; +} diff --git a/automated-tests/src/dali-toolkit/tct-dali-toolkit-core.h b/automated-tests/src/dali-toolkit/tct-dali-toolkit-core.h new file mode 100644 index 0000000..a225e88 --- /dev/null +++ b/automated-tests/src/dali-toolkit/tct-dali-toolkit-core.h @@ -0,0 +1,522 @@ +#ifndef __TCT_DALI_TOOLKIT_CORE_H__ +#define __TCT_DALI_TOOLKIT_CORE_H__ + +#include "testcase.h" + +extern void utc_dali_toolkit_alignment_startup(void); +extern void utc_dali_toolkit_alignment_cleanup(void); +extern void utc_dali_toolkit_bubble_emitter_startup(void); +extern void utc_dali_toolkit_bubble_emitter_cleanup(void); +extern void utc_dali_toolkit_button_startup(void); +extern void utc_dali_toolkit_button_cleanup(void); +extern void utc_dali_toolkit_control_startup(void); +extern void utc_dali_toolkit_control_cleanup(void); +extern void utc_dali_toolkit_control_impl_startup(void); +extern void utc_dali_toolkit_control_impl_cleanup(void); +extern void utc_dali_toolkit_default_controls_startup(void); +extern void utc_dali_toolkit_default_controls_cleanup(void); +extern void utc_dali_toolkit_dissolve_effect_startup(void); +extern void utc_dali_toolkit_dissolve_effect_cleanup(void); +extern void utc_dali_toolkit_focus_manager_startup(void); +extern void utc_dali_toolkit_focus_manager_cleanup(void); +extern void utc_dali_toolkit_grid_layout_startup(void); +extern void utc_dali_toolkit_grid_layout_cleanup(void); +extern void utc_dali_toolkit_iris_effect_startup(void); +extern void utc_dali_toolkit_iris_effect_cleanup(void); +extern void utc_dali_toolkit_item_view_startup(void); +extern void utc_dali_toolkit_item_view_cleanup(void); +extern void utc_dali_toolkit_keyboard_focus_manager_startup(void); +extern void utc_dali_toolkit_keyboard_focus_manager_cleanup(void); +extern void utc_dali_toolkit_markup_processor_startup(void); +extern void utc_dali_toolkit_markup_processor_cleanup(void); +extern void utc_dali_toolkit_mask_effect_startup(void); +extern void utc_dali_toolkit_mask_effect_cleanup(void); +extern void utc_dali_toolkit_nine_patch_startup(void); +extern void utc_dali_toolkit_nine_patch_cleanup(void); +extern void utc_dali_toolkit_popup_startup(void); +extern void utc_dali_toolkit_popup_cleanup(void); +extern void utc_dali_toolkit_pushbutton_startup(void); +extern void utc_dali_toolkit_pushbutton_cleanup(void); +extern void utc_dali_toolkit_ripple_2d_effect_startup(void); +extern void utc_dali_toolkit_ripple_2d_effect_cleanup(void); +extern void utc_dali_toolkit_ripple_effect_startup(void); +extern void utc_dali_toolkit_ripple_effect_cleanup(void); +extern void utc_dali_toolkit_scroll_view_effect_startup(void); +extern void utc_dali_toolkit_scroll_view_effect_cleanup(void); +extern void utc_dali_toolkit_super_blur_view_startup(void); +extern void utc_dali_toolkit_super_blur_view_cleanup(void); +extern void utc_dali_toolkit_swirl_effect_startup(void); +extern void utc_dali_toolkit_swirl_effect_cleanup(void); +extern void utc_dali_toolkit_text_input_startup(void); +extern void utc_dali_toolkit_text_input_cleanup(void); +extern void utc_dali_toolkit_text_view_startup(void); +extern void utc_dali_toolkit_text_view_cleanup(void); + +extern int UtcDaliAlignmentConstructorNegative(void); +extern int UtcDaliAlignmentConstructorPositive(void); +extern int UtcDaliAlignmentConstructorRegister(void); +extern int UtcDaliAlignmentSetAlignmentTypePositiveOffStage(void); +extern int UtcDaliAlignmentSetAlignmentTypePositiveOnStage(void); +extern int UtcDaliAlignmentSetAlignmentTypeNegative(void); +extern int UtcDaliAlignmentGetAlignmentType(void); +extern int UtcDaliAlignmentSetScaling(void); +extern int UtcDaliAlignmentGetScaling(void); +extern int UtcDaliAlignmentSetPaddingPositive(void); +extern int UtcDaliAlignmentSetPaddingNegative(void); +extern int UtcDaliAlignmentGetPadding(void); +extern int UtcDaliAlignmentChildAddAndRemove(void); +extern int UtcDaliAlignmentOnSizeSet(void); +extern int UtcDaliAlignmentOnTouchEvent(void); +extern int UtcDaliAlignmentOnKeyEvent(void); +extern int UtcDaliAlignmentOnSizeAnimation(void); +extern int UtcDaliAlignmentCopyAndAssignment(void); +extern int UtcDaliBubbleEmitterNew(void); +extern int UtcDaliBubbleEmitterGetRootActor(void); +extern int UtcDaliBubbleEmitterSetBackground(void); +extern int UtcDaliBubbleEmitterSetShapeImage(void); +extern int UtcDaliBubbleEmitterSetBubbleScale(void); +extern int UtcDaliBubbleEmitterSetBubbleDensity01(void); +extern int UtcDaliBubbleEmitterSetBubbleDensity02(void); +extern int UtcDaliBubbleEmitterSetBlendMode(void); +extern int UtcDaliBubbleEmitterEmitBubble(void); +extern int UtcDaliBubbleEmitterStartExplosion(void); +extern int UtcDaliBubbleEmitterRestore(void); +extern int UtcDaliButtonNew(void); +extern int UtcDaliButtonSetProperty(void); +extern int UtcDaliButtonSetGetDimmed(void); +extern int UtcDaliButtonSize(void); +extern int UtcDaliButtonClicked(void); +extern int UtcDaliButtonConnectSignal(void); +extern int UtcDaliButtonSetGetAnimationTime(void); +extern int UtcDaliControlConstructor(void); +extern int UtcDaliControlNew(void); +extern int UtcDaliControlRegister(void); +extern int UtcDaliControlCopyAndAssignment(void); +extern int UtcDaliControlDownCast(void); +extern int UtcDaliControlDownCastTemplate(void); +extern int UtcDaliControlKeyInputFocus(void); +extern int UtcDaliControlGetImplementation(void); +extern int UtcDaliControlSignalConnectDisconnect(void); +extern int UtcDaliControlSignalAutomaticDisconnect(void); +extern int UtcDaliControlTestParameters(void); +extern int UtcDaliControlImplNew(void); +extern int UtcDaliControlImplEnableGestureDetector(void); +extern int UtcDaliControlImplDisableGestureDetector(void); +extern int UtcDaliControlImplOnGestureMethods(void); +extern int UtcDaliControlImplChildAddAndRemove(void); +extern int UtcDaliControlImplStageConnection(void); +extern int UtcDaliControlImplSizeSet(void); +extern int UtcDaliControlImplSizeAnimation(void); +extern int UtcDaliControlImplTouchEvent(void); +extern int UtcDaliControlImplKeyEvent(void); +extern int UtcDaliControlImplStyleChange(void); +extern int UtcDaliControlImplKeyInputFocusGained(void); +extern int UtcDaliControlImplKeyInputFocusLost(void); +extern int UtcDaliDefaultControlsCreateSolidColorActor(void); +extern int UtcDaliDefaultControlsCreatePushButton(void); +extern int UtcDaliDissolveUninitializedEffect(void); +extern int UtcDaliDissolvePropertyNamesEffect(void); +extern int UtcDaliDissolveDefaultValuesEffect(void); +extern int UtcDaliDissolveCustomValuesEffect(void); +extern int UtcDaliSetEffectImageEffect(void); +extern int UtcDaliFocusManagerGet(void); +extern int UtcDaliFocusManagerSetAndGetAccessibilityAttribute(void); +extern int UtcDaliFocusManagerSetAndGetFocusOrder(void); +extern int UtcDaliFocusManagerGenerateNewFocusOrder(void); +extern int UtcDaliFocusManagerGetActorByFocusOrder(void); +extern int UtcDaliFocusManagerSetAndGetCurrentFocusActor(void); +extern int UtcDaliFocusManagerGetCurrentFocusGroup(void); +extern int UtcDaliFocusManagerGetCurrentFocusOrder(void); +extern int UtcDaliFocusManagerMoveFocusForward(void); +extern int UtcDaliFocusManagerMoveFocusBackward(void); +extern int UtcDaliFocusManagerClearFocus(void); +extern int UtcDaliFocusManagerReset(void); +extern int UtcDaliFocusManagerFocusGroup(void); +extern int UtcDaliFocusManagerSetAndGetFocusIndicator(void); +extern int UtcDaliFocusManagerSignalFocusChanged(void); +extern int UtcDaliFocusManagerSignalFocusOvershot(void); +extern int UtcDaliGridLayoutNew(void); +extern int UtcDaliGridLayoutSetAndGetNumberOfColumns(void); +extern int UtcDaliGridLayoutSetAndGetRowSpacing(void); +extern int UtcDaliGridLayoutSetAndGetColumnSpacing(void); +extern int UtcDaliGridLayoutSetAndGetTopMargin(void); +extern int UtcDaliGridLayoutSetAndGetBottomMargin(void); +extern int UtcDaliGridLayoutSetAndGetSideMargin(void); +extern int UtcDaliGridLayoutSetAndGetZGap(void); +extern int UtcDaliGridLayoutSetAndGetItemSizeFunction(void); +extern int UtcDaliGridLayoutSetAndGetScrollSpeedFactor(void); +extern int UtcDaliGridLayoutSetAndGetMaximumSwipeSpeed(void); +extern int UtcDaliGridLayoutSetAndGetItemFlickAnimationDuration(void); +extern int UtcDaliGridLayoutConstraintLeft(void); +extern int UtcDaliGridLayoutConstraintRight(void); +extern int UtcDaliGridLayoutConstraintUp(void); +extern int UtcDaliGridLayoutConstraintDown(void); +extern int UtcDaliGridLayoutScrollDirection(void); +extern int UtcDaliIrisEffectUninitialized(void); +extern int UtcDaliIrisEffectPropertyNames(void); +extern int UtcDaliIrisEffectDefaultValues(void); +extern int UtcDaliIrisEffectCustomValues(void); +extern int UtcDaliItemLayoutSetAndGetOrientation(void); +extern int UtcDaliItemLayoutGetScrollHints(void); +extern int UtcDaliItemViewNew(void); +extern int UtcDaliItemViewDownCast(void); +extern int UtcDaliItemViewAddAndGetLayout(void); +extern int UtcDaliItemViewAddAndRemoveLayout(void); +extern int UtcDaliItemViewActivateLayoutAndGetActiveLayout(void); +extern int UtcDaliItemViewDeactivateCurrentLayout(void); +extern int UtcDaliItemViewGetItemAndGetItemId(void); +extern int UtcDaliItemViewRemoveItem(void); +extern int UtcDaliItemViewGetCurrentLayoutPosition(void); +extern int UtcDaliItemViewSetAndGetMinimumSwipeSpeed(void); +extern int UtcDaliItemViewSetAndGetMinimumSwipeDistance(void); +extern int UtcDaliItemViewSetAndGetAnchoring(void); +extern int UtcDaliItemViewSetAndGetAnchoringDuration(void); +extern int UtcDaliItemViewSetAndGetRefreshInterval(void); +extern int UtcDaliItemViewScrollToItem(void); +extern int UtcDaliItemViewSetAndGetMouseWheelScrollDistanceStep(void); +extern int UtcDaliKeyboardFocusManagerGet(void); +extern int UtcDaliKeyboardFocusManagerSetAndGetCurrentFocusActor(void); +extern int UtcDaliKeyboardFocusManagerMoveFocus(void); +extern int UtcDaliKeyboardFocusManagerClearFocus(void); +extern int UtcDaliKeyboardFocusManagerSetAndGetFocusGroupLoop(void); +extern int UtcDaliKeyboardFocusManagerSetAsFocusGroup(void); +extern int UtcDaliKeyboardFocusManagerGetFocusGroup(void); +extern int UtcDaliKeyboardFocusManagerSetAndGetFocusIndicator(void); +extern int UtcDaliKeyboardFocusManagerSignalFocusedActorActivated(void); +extern int UtcDaliMarkupProcessor(void); +extern int UtcDaliMarkupProcessorSetTextStyle01(void); +extern int UtcDaliMarkupProcessorSetTextStyle02(void); +extern int UtcDaliMarkupProcessorTestColors(void); +extern int UtcDaliMaskEffectCreateEffect(void); +extern int UtcDaliMaskEffectDestructor(void); +extern int UtcDaliNinePatchMaskEffectApply(void); +extern int UtcDaliPopupNew(void); +extern int UtcDaliPopupDestructor(void); +extern int UtcDaliPopupDownCast(void); +extern int UtcDaliPopoupSetProperty(void); +extern int UtcDaliPopupSetBackgroundImage(void); +extern int UtcDaliPopupSetTitle(void); +extern int UtcDaliPopupSetTitleText(void); +extern int UtcDaliPopupAddButton(void); +extern int UtcDaliPopupSetState(void); +extern int UtcDaliPopupSetStateSlow(void); +extern int UtcDaliPopupShowHide(void); +extern int UtcDaliPopupShowHideTail(void); +extern int UtcDaliPopupOnTouchedOutside(void); +extern int UtcDaliPushButtonSetGetAutoRepeating(void); +extern int UtcDaliPushButtonSetGetToggleButton(void); +extern int UtcDaliPushButtonSetGetAutoRepeatingAndToggleButton(void); +extern int UtcDaliPushButtonSetGetToggled01(void); +extern int UtcDaliPushButtonSetGetToggled02(void); +extern int UtcDaliPushButtonSetGetAutorepeatingDelayValues01(void); +extern int UtcDaliPushButtonSetGetAutorepeatingDelayValues02(void); +extern int UtcDaliPushButtonSetImages(void); +extern int UtcDaliPushButtonSetLabelText(void); +extern int UtcDaliPushButtonPressed(void); +extern int UtcDaliPushButtonReleased(void); +extern int UtcDaliPushButtonToggled(void); +extern int UtcDaliRipple2DEffectUninitialized(void); +extern int UtcDaliRipple2DEffectPropertyNames(void); +extern int UtcDaliRipple2DEffectDefaultValues(void); +extern int UtcDaliRipple2DEffectCustomValues(void); +extern int UtcDaliRippleUninitializedEffect(void); +extern int UtcDaliRipplePropertyNamesEffect(void); +extern int UtcDaliRippleDefaultValuesEffect(void); +extern int UtcDaliRippleCustomValuesEffect(void); +extern int UtcDaliScrollViewCustomEffectSetup(void); +extern int UtcDaliScrollViewCubeEffectSetup(void); +extern int UtcDaliScrollViewSpiralEffectSetup(void); +extern int UtcDaliScrollViewSlideEffectSetup(void); +extern int UtcDaliScrollViewTwistEffectSetup(void); +extern int UtcDaliScrollViewCubeEffectTest(void); +extern int UtcDaliScrollViewSpiralEffectTest(void); +extern int UtcDaliScrollViewSlideEffectTest(void); +extern int UtcDaliScrollViewTwistEffectTest(void); +extern int UtcDaliScrollViewCustomEffectTest(void); +extern int UtcDaliSuperBlurViewNew(void); +extern int UtcDaliSuperBlurViewSetImage(void); +extern int UtcDaliSuperBlurViewSetGetBlurStrength(void); +extern int UtcDaliSuperBlurViewGetBlurStrengthPropertyIndex(void); +extern int UtcDaliSuperBlurViewGetBlurredImage(void); +extern int UtcDaliSwirlUninitializedEffect(void); +extern int UtcDaliSwirlPropertyNamesEffect(void); +extern int UtcDaliSwirlDefaultValuesEffect(void); +extern int UtcDaliSwirlCustomValuesEffect(void); +extern int UtcDaliTextInputConstruction(void); +extern int UtcDaliTextInputDownCast(void); +extern int UtcDaliTextInputGetText(void); +extern int UtcDaliTextInputGetMarkupText(void); +extern int UtcDaliTextInputSetMaxCharacterLength(void); +extern int UtcDaliTextInputSetAndGetNumberOfLines(void); +extern int UtcDaliTextInputGetNumberOfCharacters(void); +extern int UtcDaliTextInputSetAndGetPlaceholderText(void); +extern int UtcDaliTextInputSetInitialText(void); +extern int UtcDaliTextInputSetEditableAndIsEditable(void); +extern int UtcDaliTextInputSetEditOnTouch(void); +extern int UtcDaliTextInputSetTextSelectable(void); +extern int UtcDaliTextInputTextSelection(void); +extern int UtcDaliTextInputEnableGrabHandleAndIsGrabHandleEnabled(void); +extern int UtcDaliTextInputSetAndGetBoundingRectangle(void); +extern int UtcDaliTextInputSetAndGetTextAlignment(void); +extern int UtcDaliTextInputSetSortModifier(void); +extern int UtcDaliTextInputSetAndGetSnapshotModeEnabled(void); +extern int UtcDaliTextInputEndSignalEmit(void); +extern int UtcDaliTextInputStartSignalEmit(void); +extern int UtcDaliTextInputExceedMaxCharacters(void); +extern int UtcDaliTextInputSetAndGetFadeBoundary(void); +extern int UtcDaliTextInputSetAndGetWidthExceedPolicy(void); +extern int UtcDaliTextInputSetAndGetHeightExceedPolicy(void); +extern int UtcDaliTextInputScroll(void); +extern int UtcDaliTextViewNew(void); +extern int UtcDaliTextViewSetAndGetText(void); +extern int UtcDaliTextViewSetStyleToCurrentText(void); +extern int UtcDaliTextViewSetAndGetLineHeight(void); +extern int UtcDaliTextViewSetAndGetFadeBoundary(void); +extern int UtcDaliTextViewSetAndGetEllipsizeText(void); +extern int UtcDaliTextViewSetAndGetWidthExceedPolicy(void); +extern int UtcDaliTextViewSetAndGetHeightExceedPolicy(void); +extern int UtcDaliTextViewTestLayoutOptions01(void); +extern int UtcDaliTextViewTestLayoutOptions02(void); +extern int UtcDaliTextViewInsertRemoveText(void); +extern int UtcDaliTextViewSnapshotEnable(void); +extern int UtcDaliTextViewScroll(void); +extern int UtcDaliTextViewSetProperty(void); +extern int UtcDaliTextViewSetSortModifier(void); +extern int UtcDaliTextViewUnderlineText(void); + +testcase tc_array[] = { + {"UtcDaliAlignmentConstructorNegative", UtcDaliAlignmentConstructorNegative, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup}, + {"UtcDaliAlignmentConstructorPositive", UtcDaliAlignmentConstructorPositive, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup}, + {"UtcDaliAlignmentConstructorRegister", UtcDaliAlignmentConstructorRegister, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup}, + {"UtcDaliAlignmentSetAlignmentTypePositiveOffStage", UtcDaliAlignmentSetAlignmentTypePositiveOffStage, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup}, + {"UtcDaliAlignmentSetAlignmentTypePositiveOnStage", UtcDaliAlignmentSetAlignmentTypePositiveOnStage, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup}, + {"UtcDaliAlignmentSetAlignmentTypeNegative", UtcDaliAlignmentSetAlignmentTypeNegative, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup}, + {"UtcDaliAlignmentGetAlignmentType", UtcDaliAlignmentGetAlignmentType, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup}, + {"UtcDaliAlignmentSetScaling", UtcDaliAlignmentSetScaling, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup}, + {"UtcDaliAlignmentGetScaling", UtcDaliAlignmentGetScaling, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup}, + {"UtcDaliAlignmentSetPaddingPositive", UtcDaliAlignmentSetPaddingPositive, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup}, + {"UtcDaliAlignmentSetPaddingNegative", UtcDaliAlignmentSetPaddingNegative, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup}, + {"UtcDaliAlignmentGetPadding", UtcDaliAlignmentGetPadding, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup}, + {"UtcDaliAlignmentChildAddAndRemove", UtcDaliAlignmentChildAddAndRemove, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup}, + {"UtcDaliAlignmentOnSizeSet", UtcDaliAlignmentOnSizeSet, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup}, + {"UtcDaliAlignmentOnTouchEvent", UtcDaliAlignmentOnTouchEvent, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup}, + {"UtcDaliAlignmentOnKeyEvent", UtcDaliAlignmentOnKeyEvent, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup}, + {"UtcDaliAlignmentOnSizeAnimation", UtcDaliAlignmentOnSizeAnimation, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup}, + {"UtcDaliAlignmentCopyAndAssignment", UtcDaliAlignmentCopyAndAssignment, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup}, + {"UtcDaliBubbleEmitterNew", UtcDaliBubbleEmitterNew, utc_dali_toolkit_bubble_emitter_startup, utc_dali_toolkit_bubble_emitter_cleanup}, + {"UtcDaliBubbleEmitterGetRootActor", UtcDaliBubbleEmitterGetRootActor, utc_dali_toolkit_bubble_emitter_startup, utc_dali_toolkit_bubble_emitter_cleanup}, + {"UtcDaliBubbleEmitterSetBackground", UtcDaliBubbleEmitterSetBackground, utc_dali_toolkit_bubble_emitter_startup, utc_dali_toolkit_bubble_emitter_cleanup}, + {"UtcDaliBubbleEmitterSetShapeImage", UtcDaliBubbleEmitterSetShapeImage, utc_dali_toolkit_bubble_emitter_startup, utc_dali_toolkit_bubble_emitter_cleanup}, + {"UtcDaliBubbleEmitterSetBubbleScale", UtcDaliBubbleEmitterSetBubbleScale, utc_dali_toolkit_bubble_emitter_startup, utc_dali_toolkit_bubble_emitter_cleanup}, + {"UtcDaliBubbleEmitterSetBubbleDensity01", UtcDaliBubbleEmitterSetBubbleDensity01, utc_dali_toolkit_bubble_emitter_startup, utc_dali_toolkit_bubble_emitter_cleanup}, + {"UtcDaliBubbleEmitterSetBubbleDensity02", UtcDaliBubbleEmitterSetBubbleDensity02, utc_dali_toolkit_bubble_emitter_startup, utc_dali_toolkit_bubble_emitter_cleanup}, + {"UtcDaliBubbleEmitterSetBlendMode", UtcDaliBubbleEmitterSetBlendMode, utc_dali_toolkit_bubble_emitter_startup, utc_dali_toolkit_bubble_emitter_cleanup}, + {"UtcDaliBubbleEmitterEmitBubble", UtcDaliBubbleEmitterEmitBubble, utc_dali_toolkit_bubble_emitter_startup, utc_dali_toolkit_bubble_emitter_cleanup}, + {"UtcDaliBubbleEmitterStartExplosion", UtcDaliBubbleEmitterStartExplosion, utc_dali_toolkit_bubble_emitter_startup, utc_dali_toolkit_bubble_emitter_cleanup}, + {"UtcDaliBubbleEmitterRestore", UtcDaliBubbleEmitterRestore, utc_dali_toolkit_bubble_emitter_startup, utc_dali_toolkit_bubble_emitter_cleanup}, + {"UtcDaliButtonNew", UtcDaliButtonNew, utc_dali_toolkit_button_startup, utc_dali_toolkit_button_cleanup}, + {"UtcDaliButtonSetProperty", UtcDaliButtonSetProperty, utc_dali_toolkit_button_startup, utc_dali_toolkit_button_cleanup}, + {"UtcDaliButtonSetGetDimmed", UtcDaliButtonSetGetDimmed, utc_dali_toolkit_button_startup, utc_dali_toolkit_button_cleanup}, + {"UtcDaliButtonSize", UtcDaliButtonSize, utc_dali_toolkit_button_startup, utc_dali_toolkit_button_cleanup}, + {"UtcDaliButtonClicked", UtcDaliButtonClicked, utc_dali_toolkit_button_startup, utc_dali_toolkit_button_cleanup}, + {"UtcDaliButtonConnectSignal", UtcDaliButtonConnectSignal, utc_dali_toolkit_button_startup, utc_dali_toolkit_button_cleanup}, + {"UtcDaliButtonSetGetAnimationTime", UtcDaliButtonSetGetAnimationTime, utc_dali_toolkit_button_startup, utc_dali_toolkit_button_cleanup}, + {"UtcDaliControlConstructor", UtcDaliControlConstructor, utc_dali_toolkit_control_startup, utc_dali_toolkit_control_cleanup}, + {"UtcDaliControlNew", UtcDaliControlNew, utc_dali_toolkit_control_startup, utc_dali_toolkit_control_cleanup}, + {"UtcDaliControlRegister", UtcDaliControlRegister, utc_dali_toolkit_control_startup, utc_dali_toolkit_control_cleanup}, + {"UtcDaliControlCopyAndAssignment", UtcDaliControlCopyAndAssignment, utc_dali_toolkit_control_startup, utc_dali_toolkit_control_cleanup}, + {"UtcDaliControlDownCast", UtcDaliControlDownCast, utc_dali_toolkit_control_startup, utc_dali_toolkit_control_cleanup}, + {"UtcDaliControlDownCastTemplate", UtcDaliControlDownCastTemplate, utc_dali_toolkit_control_startup, utc_dali_toolkit_control_cleanup}, + {"UtcDaliControlKeyInputFocus", UtcDaliControlKeyInputFocus, utc_dali_toolkit_control_startup, utc_dali_toolkit_control_cleanup}, + {"UtcDaliControlGetImplementation", UtcDaliControlGetImplementation, utc_dali_toolkit_control_startup, utc_dali_toolkit_control_cleanup}, + {"UtcDaliControlSignalConnectDisconnect", UtcDaliControlSignalConnectDisconnect, utc_dali_toolkit_control_startup, utc_dali_toolkit_control_cleanup}, + {"UtcDaliControlSignalAutomaticDisconnect", UtcDaliControlSignalAutomaticDisconnect, utc_dali_toolkit_control_startup, utc_dali_toolkit_control_cleanup}, + {"UtcDaliControlTestParameters", UtcDaliControlTestParameters, utc_dali_toolkit_control_startup, utc_dali_toolkit_control_cleanup}, + {"UtcDaliControlImplNew", UtcDaliControlImplNew, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup}, + {"UtcDaliControlImplEnableGestureDetector", UtcDaliControlImplEnableGestureDetector, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup}, + {"UtcDaliControlImplDisableGestureDetector", UtcDaliControlImplDisableGestureDetector, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup}, + {"UtcDaliControlImplOnGestureMethods", UtcDaliControlImplOnGestureMethods, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup}, + {"UtcDaliControlImplChildAddAndRemove", UtcDaliControlImplChildAddAndRemove, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup}, + {"UtcDaliControlImplStageConnection", UtcDaliControlImplStageConnection, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup}, + {"UtcDaliControlImplSizeSet", UtcDaliControlImplSizeSet, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup}, + {"UtcDaliControlImplSizeAnimation", UtcDaliControlImplSizeAnimation, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup}, + {"UtcDaliControlImplTouchEvent", UtcDaliControlImplTouchEvent, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup}, + {"UtcDaliControlImplKeyEvent", UtcDaliControlImplKeyEvent, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup}, + {"UtcDaliControlImplStyleChange", UtcDaliControlImplStyleChange, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup}, + {"UtcDaliControlImplKeyInputFocusGained", UtcDaliControlImplKeyInputFocusGained, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup}, + {"UtcDaliControlImplKeyInputFocusLost", UtcDaliControlImplKeyInputFocusLost, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup}, + {"UtcDaliDefaultControlsCreateSolidColorActor", UtcDaliDefaultControlsCreateSolidColorActor, utc_dali_toolkit_default_controls_startup, utc_dali_toolkit_default_controls_cleanup}, + {"UtcDaliDefaultControlsCreatePushButton", UtcDaliDefaultControlsCreatePushButton, utc_dali_toolkit_default_controls_startup, utc_dali_toolkit_default_controls_cleanup}, + {"UtcDaliDissolveUninitializedEffect", UtcDaliDissolveUninitializedEffect, utc_dali_toolkit_dissolve_effect_startup, utc_dali_toolkit_dissolve_effect_cleanup}, + {"UtcDaliDissolvePropertyNamesEffect", UtcDaliDissolvePropertyNamesEffect, utc_dali_toolkit_dissolve_effect_startup, utc_dali_toolkit_dissolve_effect_cleanup}, + {"UtcDaliDissolveDefaultValuesEffect", UtcDaliDissolveDefaultValuesEffect, utc_dali_toolkit_dissolve_effect_startup, utc_dali_toolkit_dissolve_effect_cleanup}, + {"UtcDaliDissolveCustomValuesEffect", UtcDaliDissolveCustomValuesEffect, utc_dali_toolkit_dissolve_effect_startup, utc_dali_toolkit_dissolve_effect_cleanup}, + {"UtcDaliSetEffectImageEffect", UtcDaliSetEffectImageEffect, utc_dali_toolkit_dissolve_effect_startup, utc_dali_toolkit_dissolve_effect_cleanup}, + {"UtcDaliFocusManagerGet", UtcDaliFocusManagerGet, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup}, + {"UtcDaliFocusManagerSetAndGetAccessibilityAttribute", UtcDaliFocusManagerSetAndGetAccessibilityAttribute, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup}, + {"UtcDaliFocusManagerSetAndGetFocusOrder", UtcDaliFocusManagerSetAndGetFocusOrder, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup}, + {"UtcDaliFocusManagerGenerateNewFocusOrder", UtcDaliFocusManagerGenerateNewFocusOrder, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup}, + {"UtcDaliFocusManagerGetActorByFocusOrder", UtcDaliFocusManagerGetActorByFocusOrder, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup}, + {"UtcDaliFocusManagerSetAndGetCurrentFocusActor", UtcDaliFocusManagerSetAndGetCurrentFocusActor, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup}, + {"UtcDaliFocusManagerGetCurrentFocusGroup", UtcDaliFocusManagerGetCurrentFocusGroup, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup}, + {"UtcDaliFocusManagerGetCurrentFocusOrder", UtcDaliFocusManagerGetCurrentFocusOrder, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup}, + {"UtcDaliFocusManagerMoveFocusForward", UtcDaliFocusManagerMoveFocusForward, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup}, + {"UtcDaliFocusManagerMoveFocusBackward", UtcDaliFocusManagerMoveFocusBackward, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup}, + {"UtcDaliFocusManagerClearFocus", UtcDaliFocusManagerClearFocus, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup}, + {"UtcDaliFocusManagerReset", UtcDaliFocusManagerReset, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup}, + {"UtcDaliFocusManagerFocusGroup", UtcDaliFocusManagerFocusGroup, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup}, + {"UtcDaliFocusManagerSetAndGetFocusIndicator", UtcDaliFocusManagerSetAndGetFocusIndicator, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup}, + {"UtcDaliFocusManagerSignalFocusChanged", UtcDaliFocusManagerSignalFocusChanged, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup}, + {"UtcDaliFocusManagerSignalFocusOvershot", UtcDaliFocusManagerSignalFocusOvershot, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup}, + {"UtcDaliGridLayoutNew", UtcDaliGridLayoutNew, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup}, + {"UtcDaliGridLayoutSetAndGetNumberOfColumns", UtcDaliGridLayoutSetAndGetNumberOfColumns, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup}, + {"UtcDaliGridLayoutSetAndGetRowSpacing", UtcDaliGridLayoutSetAndGetRowSpacing, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup}, + {"UtcDaliGridLayoutSetAndGetColumnSpacing", UtcDaliGridLayoutSetAndGetColumnSpacing, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup}, + {"UtcDaliGridLayoutSetAndGetTopMargin", UtcDaliGridLayoutSetAndGetTopMargin, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup}, + {"UtcDaliGridLayoutSetAndGetBottomMargin", UtcDaliGridLayoutSetAndGetBottomMargin, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup}, + {"UtcDaliGridLayoutSetAndGetSideMargin", UtcDaliGridLayoutSetAndGetSideMargin, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup}, + {"UtcDaliGridLayoutSetAndGetZGap", UtcDaliGridLayoutSetAndGetZGap, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup}, + {"UtcDaliGridLayoutSetAndGetItemSizeFunction", UtcDaliGridLayoutSetAndGetItemSizeFunction, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup}, + {"UtcDaliGridLayoutSetAndGetScrollSpeedFactor", UtcDaliGridLayoutSetAndGetScrollSpeedFactor, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup}, + {"UtcDaliGridLayoutSetAndGetMaximumSwipeSpeed", UtcDaliGridLayoutSetAndGetMaximumSwipeSpeed, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup}, + {"UtcDaliGridLayoutSetAndGetItemFlickAnimationDuration", UtcDaliGridLayoutSetAndGetItemFlickAnimationDuration, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup}, + {"UtcDaliGridLayoutConstraintLeft", UtcDaliGridLayoutConstraintLeft, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup}, + {"UtcDaliGridLayoutConstraintRight", UtcDaliGridLayoutConstraintRight, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup}, + {"UtcDaliGridLayoutConstraintUp", UtcDaliGridLayoutConstraintUp, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup}, + {"UtcDaliGridLayoutConstraintDown", UtcDaliGridLayoutConstraintDown, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup}, + {"UtcDaliGridLayoutScrollDirection", UtcDaliGridLayoutScrollDirection, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup}, + {"UtcDaliIrisEffectUninitialized", UtcDaliIrisEffectUninitialized, utc_dali_toolkit_iris_effect_startup, utc_dali_toolkit_iris_effect_cleanup}, + {"UtcDaliIrisEffectPropertyNames", UtcDaliIrisEffectPropertyNames, utc_dali_toolkit_iris_effect_startup, utc_dali_toolkit_iris_effect_cleanup}, + {"UtcDaliIrisEffectDefaultValues", UtcDaliIrisEffectDefaultValues, utc_dali_toolkit_iris_effect_startup, utc_dali_toolkit_iris_effect_cleanup}, + {"UtcDaliIrisEffectCustomValues", UtcDaliIrisEffectCustomValues, utc_dali_toolkit_iris_effect_startup, utc_dali_toolkit_iris_effect_cleanup}, + {"UtcDaliItemLayoutSetAndGetOrientation", UtcDaliItemLayoutSetAndGetOrientation, utc_dali_toolkit_iris_effect_startup, utc_dali_toolkit_iris_effect_cleanup}, + {"UtcDaliItemLayoutGetScrollHints", UtcDaliItemLayoutGetScrollHints, utc_dali_toolkit_iris_effect_startup, utc_dali_toolkit_iris_effect_cleanup}, + {"UtcDaliItemViewNew", UtcDaliItemViewNew, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup}, + {"UtcDaliItemViewDownCast", UtcDaliItemViewDownCast, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup}, + {"UtcDaliItemViewAddAndGetLayout", UtcDaliItemViewAddAndGetLayout, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup}, + {"UtcDaliItemViewAddAndRemoveLayout", UtcDaliItemViewAddAndRemoveLayout, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup}, + {"UtcDaliItemViewActivateLayoutAndGetActiveLayout", UtcDaliItemViewActivateLayoutAndGetActiveLayout, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup}, + {"UtcDaliItemViewDeactivateCurrentLayout", UtcDaliItemViewDeactivateCurrentLayout, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup}, + {"UtcDaliItemViewGetItemAndGetItemId", UtcDaliItemViewGetItemAndGetItemId, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup}, + {"UtcDaliItemViewRemoveItem", UtcDaliItemViewRemoveItem, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup}, + {"UtcDaliItemViewGetCurrentLayoutPosition", UtcDaliItemViewGetCurrentLayoutPosition, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup}, + {"UtcDaliItemViewSetAndGetMinimumSwipeSpeed", UtcDaliItemViewSetAndGetMinimumSwipeSpeed, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup}, + {"UtcDaliItemViewSetAndGetMinimumSwipeDistance", UtcDaliItemViewSetAndGetMinimumSwipeDistance, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup}, + {"UtcDaliItemViewSetAndGetAnchoring", UtcDaliItemViewSetAndGetAnchoring, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup}, + {"UtcDaliItemViewSetAndGetAnchoringDuration", UtcDaliItemViewSetAndGetAnchoringDuration, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup}, + {"UtcDaliItemViewSetAndGetRefreshInterval", UtcDaliItemViewSetAndGetRefreshInterval, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup}, + {"UtcDaliItemViewScrollToItem", UtcDaliItemViewScrollToItem, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup}, + {"UtcDaliItemViewSetAndGetMouseWheelScrollDistanceStep", UtcDaliItemViewSetAndGetMouseWheelScrollDistanceStep, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup}, + {"UtcDaliKeyboardFocusManagerGet", UtcDaliKeyboardFocusManagerGet, utc_dali_toolkit_keyboard_focus_manager_startup, utc_dali_toolkit_keyboard_focus_manager_cleanup}, + {"UtcDaliKeyboardFocusManagerSetAndGetCurrentFocusActor", UtcDaliKeyboardFocusManagerSetAndGetCurrentFocusActor, utc_dali_toolkit_keyboard_focus_manager_startup, utc_dali_toolkit_keyboard_focus_manager_cleanup}, + {"UtcDaliKeyboardFocusManagerMoveFocus", UtcDaliKeyboardFocusManagerMoveFocus, utc_dali_toolkit_keyboard_focus_manager_startup, utc_dali_toolkit_keyboard_focus_manager_cleanup}, + {"UtcDaliKeyboardFocusManagerClearFocus", UtcDaliKeyboardFocusManagerClearFocus, utc_dali_toolkit_keyboard_focus_manager_startup, utc_dali_toolkit_keyboard_focus_manager_cleanup}, + {"UtcDaliKeyboardFocusManagerSetAndGetFocusGroupLoop", UtcDaliKeyboardFocusManagerSetAndGetFocusGroupLoop, utc_dali_toolkit_keyboard_focus_manager_startup, utc_dali_toolkit_keyboard_focus_manager_cleanup}, + {"UtcDaliKeyboardFocusManagerSetAsFocusGroup", UtcDaliKeyboardFocusManagerSetAsFocusGroup, utc_dali_toolkit_keyboard_focus_manager_startup, utc_dali_toolkit_keyboard_focus_manager_cleanup}, + {"UtcDaliKeyboardFocusManagerGetFocusGroup", UtcDaliKeyboardFocusManagerGetFocusGroup, utc_dali_toolkit_keyboard_focus_manager_startup, utc_dali_toolkit_keyboard_focus_manager_cleanup}, + {"UtcDaliKeyboardFocusManagerSetAndGetFocusIndicator", UtcDaliKeyboardFocusManagerSetAndGetFocusIndicator, utc_dali_toolkit_keyboard_focus_manager_startup, utc_dali_toolkit_keyboard_focus_manager_cleanup}, + {"UtcDaliKeyboardFocusManagerSignalFocusedActorActivated", UtcDaliKeyboardFocusManagerSignalFocusedActorActivated, utc_dali_toolkit_keyboard_focus_manager_startup, utc_dali_toolkit_keyboard_focus_manager_cleanup}, + {"UtcDaliMarkupProcessor", UtcDaliMarkupProcessor, utc_dali_toolkit_markup_processor_startup, utc_dali_toolkit_markup_processor_cleanup}, + {"UtcDaliMarkupProcessorSetTextStyle01", UtcDaliMarkupProcessorSetTextStyle01, utc_dali_toolkit_markup_processor_startup, utc_dali_toolkit_markup_processor_cleanup}, + {"UtcDaliMarkupProcessorSetTextStyle02", UtcDaliMarkupProcessorSetTextStyle02, utc_dali_toolkit_markup_processor_startup, utc_dali_toolkit_markup_processor_cleanup}, + {"UtcDaliMarkupProcessorTestColors", UtcDaliMarkupProcessorTestColors, utc_dali_toolkit_markup_processor_startup, utc_dali_toolkit_markup_processor_cleanup}, + {"UtcDaliMaskEffectCreateEffect", UtcDaliMaskEffectCreateEffect, utc_dali_toolkit_mask_effect_startup, utc_dali_toolkit_mask_effect_cleanup}, + {"UtcDaliMaskEffectDestructor", UtcDaliMaskEffectDestructor, utc_dali_toolkit_mask_effect_startup, utc_dali_toolkit_mask_effect_cleanup}, + {"UtcDaliNinePatchMaskEffectApply", UtcDaliNinePatchMaskEffectApply, utc_dali_toolkit_nine_patch_startup, utc_dali_toolkit_nine_patch_cleanup}, + {"UtcDaliPopupNew", UtcDaliPopupNew, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup}, + {"UtcDaliPopupDestructor", UtcDaliPopupDestructor, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup}, + {"UtcDaliPopupDownCast", UtcDaliPopupDownCast, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup}, + {"UtcDaliPopoupSetProperty", UtcDaliPopoupSetProperty, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup}, + {"UtcDaliPopupSetBackgroundImage", UtcDaliPopupSetBackgroundImage, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup}, + {"UtcDaliPopupSetTitle", UtcDaliPopupSetTitle, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup}, + {"UtcDaliPopupSetTitleText", UtcDaliPopupSetTitleText, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup}, + {"UtcDaliPopupAddButton", UtcDaliPopupAddButton, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup}, + {"UtcDaliPopupSetState", UtcDaliPopupSetState, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup}, + {"UtcDaliPopupSetStateSlow", UtcDaliPopupSetStateSlow, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup}, + {"UtcDaliPopupShowHide", UtcDaliPopupShowHide, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup}, + {"UtcDaliPopupShowHideTail", UtcDaliPopupShowHideTail, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup}, + {"UtcDaliPopupOnTouchedOutside", UtcDaliPopupOnTouchedOutside, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup}, + {"UtcDaliPushButtonSetGetAutoRepeating", UtcDaliPushButtonSetGetAutoRepeating, utc_dali_toolkit_pushbutton_startup, utc_dali_toolkit_pushbutton_cleanup}, + {"UtcDaliPushButtonSetGetToggleButton", UtcDaliPushButtonSetGetToggleButton, utc_dali_toolkit_pushbutton_startup, utc_dali_toolkit_pushbutton_cleanup}, + {"UtcDaliPushButtonSetGetAutoRepeatingAndToggleButton", UtcDaliPushButtonSetGetAutoRepeatingAndToggleButton, utc_dali_toolkit_pushbutton_startup, utc_dali_toolkit_pushbutton_cleanup}, + {"UtcDaliPushButtonSetGetToggled01", UtcDaliPushButtonSetGetToggled01, utc_dali_toolkit_pushbutton_startup, utc_dali_toolkit_pushbutton_cleanup}, + {"UtcDaliPushButtonSetGetToggled02", UtcDaliPushButtonSetGetToggled02, utc_dali_toolkit_pushbutton_startup, utc_dali_toolkit_pushbutton_cleanup}, + {"UtcDaliPushButtonSetGetAutorepeatingDelayValues01", UtcDaliPushButtonSetGetAutorepeatingDelayValues01, utc_dali_toolkit_pushbutton_startup, utc_dali_toolkit_pushbutton_cleanup}, + {"UtcDaliPushButtonSetGetAutorepeatingDelayValues02", UtcDaliPushButtonSetGetAutorepeatingDelayValues02, utc_dali_toolkit_pushbutton_startup, utc_dali_toolkit_pushbutton_cleanup}, + {"UtcDaliPushButtonSetImages", UtcDaliPushButtonSetImages, utc_dali_toolkit_pushbutton_startup, utc_dali_toolkit_pushbutton_cleanup}, + {"UtcDaliPushButtonSetLabelText", UtcDaliPushButtonSetLabelText, utc_dali_toolkit_pushbutton_startup, utc_dali_toolkit_pushbutton_cleanup}, + {"UtcDaliPushButtonPressed", UtcDaliPushButtonPressed, utc_dali_toolkit_pushbutton_startup, utc_dali_toolkit_pushbutton_cleanup}, + {"UtcDaliPushButtonReleased", UtcDaliPushButtonReleased, utc_dali_toolkit_pushbutton_startup, utc_dali_toolkit_pushbutton_cleanup}, + {"UtcDaliPushButtonToggled", UtcDaliPushButtonToggled, utc_dali_toolkit_pushbutton_startup, utc_dali_toolkit_pushbutton_cleanup}, + {"UtcDaliRipple2DEffectUninitialized", UtcDaliRipple2DEffectUninitialized, utc_dali_toolkit_ripple_2d_effect_startup, utc_dali_toolkit_ripple_2d_effect_cleanup}, + {"UtcDaliRipple2DEffectPropertyNames", UtcDaliRipple2DEffectPropertyNames, utc_dali_toolkit_ripple_2d_effect_startup, utc_dali_toolkit_ripple_2d_effect_cleanup}, + {"UtcDaliRipple2DEffectDefaultValues", UtcDaliRipple2DEffectDefaultValues, utc_dali_toolkit_ripple_2d_effect_startup, utc_dali_toolkit_ripple_2d_effect_cleanup}, + {"UtcDaliRipple2DEffectCustomValues", UtcDaliRipple2DEffectCustomValues, utc_dali_toolkit_ripple_2d_effect_startup, utc_dali_toolkit_ripple_2d_effect_cleanup}, + {"UtcDaliRippleUninitializedEffect", UtcDaliRippleUninitializedEffect, utc_dali_toolkit_ripple_effect_startup, utc_dali_toolkit_ripple_effect_cleanup}, + {"UtcDaliRipplePropertyNamesEffect", UtcDaliRipplePropertyNamesEffect, utc_dali_toolkit_ripple_effect_startup, utc_dali_toolkit_ripple_effect_cleanup}, + {"UtcDaliRippleDefaultValuesEffect", UtcDaliRippleDefaultValuesEffect, utc_dali_toolkit_ripple_effect_startup, utc_dali_toolkit_ripple_effect_cleanup}, + {"UtcDaliRippleCustomValuesEffect", UtcDaliRippleCustomValuesEffect, utc_dali_toolkit_ripple_effect_startup, utc_dali_toolkit_ripple_effect_cleanup}, + {"UtcDaliScrollViewCustomEffectSetup", UtcDaliScrollViewCustomEffectSetup, utc_dali_toolkit_scroll_view_effect_startup, utc_dali_toolkit_scroll_view_effect_cleanup}, + {"UtcDaliScrollViewCubeEffectSetup", UtcDaliScrollViewCubeEffectSetup, utc_dali_toolkit_scroll_view_effect_startup, utc_dali_toolkit_scroll_view_effect_cleanup}, + {"UtcDaliScrollViewSpiralEffectSetup", UtcDaliScrollViewSpiralEffectSetup, utc_dali_toolkit_scroll_view_effect_startup, utc_dali_toolkit_scroll_view_effect_cleanup}, + {"UtcDaliScrollViewSlideEffectSetup", UtcDaliScrollViewSlideEffectSetup, utc_dali_toolkit_scroll_view_effect_startup, utc_dali_toolkit_scroll_view_effect_cleanup}, + {"UtcDaliScrollViewTwistEffectSetup", UtcDaliScrollViewTwistEffectSetup, utc_dali_toolkit_scroll_view_effect_startup, utc_dali_toolkit_scroll_view_effect_cleanup}, + {"UtcDaliScrollViewCubeEffectTest", UtcDaliScrollViewCubeEffectTest, utc_dali_toolkit_scroll_view_effect_startup, utc_dali_toolkit_scroll_view_effect_cleanup}, + {"UtcDaliScrollViewSpiralEffectTest", UtcDaliScrollViewSpiralEffectTest, utc_dali_toolkit_scroll_view_effect_startup, utc_dali_toolkit_scroll_view_effect_cleanup}, + {"UtcDaliScrollViewSlideEffectTest", UtcDaliScrollViewSlideEffectTest, utc_dali_toolkit_scroll_view_effect_startup, utc_dali_toolkit_scroll_view_effect_cleanup}, + {"UtcDaliScrollViewTwistEffectTest", UtcDaliScrollViewTwistEffectTest, utc_dali_toolkit_scroll_view_effect_startup, utc_dali_toolkit_scroll_view_effect_cleanup}, + {"UtcDaliScrollViewCustomEffectTest", UtcDaliScrollViewCustomEffectTest, utc_dali_toolkit_scroll_view_effect_startup, utc_dali_toolkit_scroll_view_effect_cleanup}, + {"UtcDaliSuperBlurViewNew", UtcDaliSuperBlurViewNew, utc_dali_toolkit_super_blur_view_startup, utc_dali_toolkit_super_blur_view_cleanup}, + {"UtcDaliSuperBlurViewSetImage", UtcDaliSuperBlurViewSetImage, utc_dali_toolkit_super_blur_view_startup, utc_dali_toolkit_super_blur_view_cleanup}, + {"UtcDaliSuperBlurViewSetGetBlurStrength", UtcDaliSuperBlurViewSetGetBlurStrength, utc_dali_toolkit_super_blur_view_startup, utc_dali_toolkit_super_blur_view_cleanup}, + {"UtcDaliSuperBlurViewGetBlurStrengthPropertyIndex", UtcDaliSuperBlurViewGetBlurStrengthPropertyIndex, utc_dali_toolkit_super_blur_view_startup, utc_dali_toolkit_super_blur_view_cleanup}, + {"UtcDaliSuperBlurViewGetBlurredImage", UtcDaliSuperBlurViewGetBlurredImage, utc_dali_toolkit_super_blur_view_startup, utc_dali_toolkit_super_blur_view_cleanup}, + {"UtcDaliSwirlUninitializedEffect", UtcDaliSwirlUninitializedEffect, utc_dali_toolkit_swirl_effect_startup, utc_dali_toolkit_swirl_effect_cleanup}, + {"UtcDaliSwirlPropertyNamesEffect", UtcDaliSwirlPropertyNamesEffect, utc_dali_toolkit_swirl_effect_startup, utc_dali_toolkit_swirl_effect_cleanup}, + {"UtcDaliSwirlDefaultValuesEffect", UtcDaliSwirlDefaultValuesEffect, utc_dali_toolkit_swirl_effect_startup, utc_dali_toolkit_swirl_effect_cleanup}, + {"UtcDaliSwirlCustomValuesEffect", UtcDaliSwirlCustomValuesEffect, utc_dali_toolkit_swirl_effect_startup, utc_dali_toolkit_swirl_effect_cleanup}, + {"UtcDaliTextInputConstruction", UtcDaliTextInputConstruction, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextInputDownCast", UtcDaliTextInputDownCast, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextInputGetText", UtcDaliTextInputGetText, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextInputGetMarkupText", UtcDaliTextInputGetMarkupText, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextInputSetMaxCharacterLength", UtcDaliTextInputSetMaxCharacterLength, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextInputSetAndGetNumberOfLines", UtcDaliTextInputSetAndGetNumberOfLines, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextInputGetNumberOfCharacters", UtcDaliTextInputGetNumberOfCharacters, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextInputSetAndGetPlaceholderText", UtcDaliTextInputSetAndGetPlaceholderText, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextInputSetInitialText", UtcDaliTextInputSetInitialText, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextInputSetEditableAndIsEditable", UtcDaliTextInputSetEditableAndIsEditable, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextInputSetEditOnTouch", UtcDaliTextInputSetEditOnTouch, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextInputSetTextSelectable", UtcDaliTextInputSetTextSelectable, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextInputTextSelection", UtcDaliTextInputTextSelection, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextInputEnableGrabHandleAndIsGrabHandleEnabled", UtcDaliTextInputEnableGrabHandleAndIsGrabHandleEnabled, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextInputSetAndGetBoundingRectangle", UtcDaliTextInputSetAndGetBoundingRectangle, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextInputSetAndGetTextAlignment", UtcDaliTextInputSetAndGetTextAlignment, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextInputSetSortModifier", UtcDaliTextInputSetSortModifier, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextInputSetAndGetSnapshotModeEnabled", UtcDaliTextInputSetAndGetSnapshotModeEnabled, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextInputEndSignalEmit", UtcDaliTextInputEndSignalEmit, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextInputStartSignalEmit", UtcDaliTextInputStartSignalEmit, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextInputExceedMaxCharacters", UtcDaliTextInputExceedMaxCharacters, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextInputSetAndGetFadeBoundary", UtcDaliTextInputSetAndGetFadeBoundary, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextInputSetAndGetWidthExceedPolicy", UtcDaliTextInputSetAndGetWidthExceedPolicy, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextInputSetAndGetHeightExceedPolicy", UtcDaliTextInputSetAndGetHeightExceedPolicy, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextInputScroll", UtcDaliTextInputScroll, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup}, + {"UtcDaliTextViewNew", UtcDaliTextViewNew, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup}, + {"UtcDaliTextViewSetAndGetText", UtcDaliTextViewSetAndGetText, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup}, + {"UtcDaliTextViewSetStyleToCurrentText", UtcDaliTextViewSetStyleToCurrentText, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup}, + {"UtcDaliTextViewSetAndGetLineHeight", UtcDaliTextViewSetAndGetLineHeight, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup}, + {"UtcDaliTextViewSetAndGetFadeBoundary", UtcDaliTextViewSetAndGetFadeBoundary, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup}, + {"UtcDaliTextViewSetAndGetEllipsizeText", UtcDaliTextViewSetAndGetEllipsizeText, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup}, + {"UtcDaliTextViewSetAndGetWidthExceedPolicy", UtcDaliTextViewSetAndGetWidthExceedPolicy, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup}, + {"UtcDaliTextViewSetAndGetHeightExceedPolicy", UtcDaliTextViewSetAndGetHeightExceedPolicy, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup}, + {"UtcDaliTextViewTestLayoutOptions01", UtcDaliTextViewTestLayoutOptions01, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup}, + {"UtcDaliTextViewTestLayoutOptions02", UtcDaliTextViewTestLayoutOptions02, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup}, + {"UtcDaliTextViewInsertRemoveText", UtcDaliTextViewInsertRemoveText, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup}, + {"UtcDaliTextViewSnapshotEnable", UtcDaliTextViewSnapshotEnable, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup}, + {"UtcDaliTextViewScroll", UtcDaliTextViewScroll, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup}, + {"UtcDaliTextViewSetProperty", UtcDaliTextViewSetProperty, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup}, + {"UtcDaliTextViewSetSortModifier", UtcDaliTextViewSetSortModifier, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup}, + {"UtcDaliTextViewUnderlineText", UtcDaliTextViewUnderlineText, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup}, + {NULL, NULL} +}; + +#endif // __TCT_DALI_TOOLKIT_CORE_H__ diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Alignment.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Alignment.cpp new file mode 100644 index 0000000..7b5ff87 --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-Alignment.cpp @@ -0,0 +1,1108 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include + + +// Need to override adaptor classes for toolkit test harness, so include +// test harness headers before dali headers. +#include +#include +#include +#include + +using namespace Dali; +using namespace Dali::Toolkit; + +void utc_dali_toolkit_alignment_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_toolkit_alignment_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +namespace +{ +static bool gObjectCreatedCallBackCalled; + +static void TestCallback(BaseHandle handle) +{ + gObjectCreatedCallBackCalled = true; +} +} // namespace + + +int UtcDaliAlignmentConstructorNegative(void) +{ + ToolkitTestApplication application; + + Alignment alignment; + + try + { + Alignment::Padding padding; + alignment.SetPadding(padding); + tet_result(TET_FAIL); + } + catch (DaliException& exception) + { + if (exception.mCondition == "alignment") + { + tet_result(TET_PASS); + } + } + END_TEST; +} + +int UtcDaliAlignmentConstructorPositive(void) +{ + ToolkitTestApplication application; + + Alignment alignment = Alignment::New(); + + try + { + Alignment::Padding padding; + alignment.SetPadding(padding); + tet_result(TET_PASS); + } + catch (DaliException& exception) + { + tet_result(TET_FAIL); + } + + Actor actor = alignment; + alignment = Alignment::DownCast( actor ); + + DALI_TEST_CHECK( alignment ); + END_TEST; +} + +int UtcDaliAlignmentConstructorRegister(void) +{ + ToolkitTestApplication application; + + //Te ensure the object is registered after creation + ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + DALI_TEST_CHECK( registry ); + + gObjectCreatedCallBackCalled = false; + registry.ObjectCreatedSignal().Connect(&TestCallback); + { + Alignment alignment = Alignment::New(); + } + DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + END_TEST; +} + +int UtcDaliAlignmentSetAlignmentTypePositiveOffStage(void) +{ + ToolkitTestApplication application; + + // Default, HorizontalCenter, VerticalCenter - Ensure they do not change! + { + Alignment alignment = Alignment::New(); + + // Check default values + DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION); + + Alignment::Type type(Alignment::Type(Alignment::HorizontalCenter | Alignment::VerticalCenter)); + alignment.SetAlignmentType(type); + DALI_TEST_CHECK(alignment.GetAlignmentType() & type); + } + + // HorizontalLeft, VerticalCenter + { + Alignment alignment = Alignment::New(); + + // Check default values + DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION); + + Alignment::Type type(Alignment::HorizontalLeft); + alignment.SetAlignmentType(type); + DALI_TEST_CHECK(alignment.GetAlignmentType() & type); + } + + // HorizontalRight, VerticalCenter + { + Alignment alignment = Alignment::New(); + + // Check default values + DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION); + + Alignment::Type type(Alignment::HorizontalRight); + alignment.SetAlignmentType(type); + DALI_TEST_CHECK(alignment.GetAlignmentType() & type); + } + + // HorizontalLeft, VerticalTop + { + Alignment alignment = Alignment::New(); + + // Check default values + DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION); + + Alignment::Type type(Alignment::Type(Alignment::HorizontalLeft | Alignment::VerticalTop)); + alignment.SetAlignmentType(type); + DALI_TEST_CHECK(alignment.GetAlignmentType() & type); + } + + // HorizontalCenter, VerticalTop + { + Alignment alignment = Alignment::New(); + + // Check default values + DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION); + + Alignment::Type type(Alignment::VerticalTop); + alignment.SetAlignmentType(type); + DALI_TEST_CHECK(alignment.GetAlignmentType() & type); + } + + // HorizontalRight, VerticalTop + { + Alignment alignment = Alignment::New(); + + // Check default values + DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION); + + Alignment::Type type(Alignment::Type(Alignment::HorizontalRight | Alignment::VerticalTop)); + alignment.SetAlignmentType(type); + DALI_TEST_CHECK(alignment.GetAlignmentType() & type); + } + + // HorizontalLeft, VerticalBottom + { + Alignment alignment = Alignment::New(); + + // Check default values + DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION); + + Alignment::Type type(Alignment::Type(Alignment::HorizontalLeft | Alignment::VerticalBottom)); + alignment.SetAlignmentType(type); + DALI_TEST_CHECK(alignment.GetAlignmentType() & type); + } + + // HorizontalCenter, VerticalBottom + { + Alignment alignment = Alignment::New(); + + // Check default values + DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION); + + Alignment::Type type(Alignment::VerticalBottom); + alignment.SetAlignmentType(type); + DALI_TEST_CHECK(alignment.GetAlignmentType() & type); + } + + // HorizontalRight, VerticalBottom + { + Alignment alignment = Alignment::New(); + + // Check default values + DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION); + + Alignment::Type type(Alignment::Type(Alignment::HorizontalRight | Alignment::VerticalBottom)); + alignment.SetAlignmentType(type); + DALI_TEST_CHECK(alignment.GetAlignmentType() & type); + } + END_TEST; +} + +int UtcDaliAlignmentSetAlignmentTypePositiveOnStage(void) +{ + ToolkitTestApplication application; + + // Default, HorizontalCenter, VerticalCenter - Ensure they do not change! + { + Alignment alignment = Alignment::New(); + alignment.Add(RenderableActor::New()); + Stage::GetCurrent().Add(alignment); + application.Render(); + application.SendNotification(); + + // Check default values + DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION); + + Alignment::Type type(Alignment::Type(Alignment::HorizontalCenter | Alignment::VerticalCenter)); + alignment.SetAlignmentType(type); + DALI_TEST_CHECK(alignment.GetAlignmentType() & type); + + Stage::GetCurrent().Remove(alignment); + application.Render(); + application.SendNotification(); + } + + // HorizontalLeft, VerticalCenter + { + Alignment alignment = Alignment::New(); + alignment.Add(RenderableActor::New()); + Stage::GetCurrent().Add(alignment); + application.Render(); + application.SendNotification(); + + // Check default values + DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION); + + Alignment::Type type(Alignment::HorizontalLeft); + alignment.SetAlignmentType(type); + DALI_TEST_CHECK(alignment.GetAlignmentType() & type); + + Stage::GetCurrent().Remove(alignment); + application.Render(); + application.SendNotification(); + } + + // HorizontalRight, VerticalCenter + { + Alignment alignment = Alignment::New(); + alignment.Add(RenderableActor::New()); + Stage::GetCurrent().Add(alignment); + application.Render(); + application.SendNotification(); + + // Check default values + DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION); + + Alignment::Type type(Alignment::HorizontalRight); + alignment.SetAlignmentType(type); + DALI_TEST_CHECK(alignment.GetAlignmentType() & type); + + Stage::GetCurrent().Remove(alignment); + application.Render(); + application.SendNotification(); + } + + // HorizontalLeft, VerticalTop + { + Alignment alignment = Alignment::New(); + alignment.Add(RenderableActor::New()); + Stage::GetCurrent().Add(alignment); + application.Render(); + application.SendNotification(); + + // Check default values + DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION); + + Alignment::Type type(Alignment::Type(Alignment::HorizontalLeft | Alignment::VerticalTop)); + alignment.SetAlignmentType(type); + DALI_TEST_CHECK(alignment.GetAlignmentType() & type); + + Stage::GetCurrent().Remove(alignment); + application.Render(); + application.SendNotification(); + } + + // HorizontalCenter, VerticalTop + { + Alignment alignment = Alignment::New(); + alignment.Add(RenderableActor::New()); + Stage::GetCurrent().Add(alignment); + application.Render(); + application.SendNotification(); + + // Check default values + DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION); + + Alignment::Type type(Alignment::VerticalTop); + alignment.SetAlignmentType(type); + DALI_TEST_CHECK(alignment.GetAlignmentType() & type); + + Stage::GetCurrent().Remove(alignment); + application.Render(); + application.SendNotification(); + } + + // HorizontalRight, VerticalTop + { + Alignment alignment = Alignment::New(); + alignment.Add(RenderableActor::New()); + Stage::GetCurrent().Add(alignment); + application.Render(); + application.SendNotification(); + + // Check default values + DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION); + + Alignment::Type type(Alignment::Type(Alignment::HorizontalRight | Alignment::VerticalTop)); + alignment.SetAlignmentType(type); + DALI_TEST_CHECK(alignment.GetAlignmentType() & type); + + Stage::GetCurrent().Remove(alignment); + application.Render(); + application.SendNotification(); + } + + // HorizontalLeft, VerticalBottom + { + Alignment alignment = Alignment::New(); + alignment.Add(RenderableActor::New()); + Stage::GetCurrent().Add(alignment); + application.Render(); + application.SendNotification(); + + // Check default values + DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION); + + Alignment::Type type(Alignment::Type(Alignment::HorizontalLeft | Alignment::VerticalBottom)); + alignment.SetAlignmentType(type); + DALI_TEST_CHECK(alignment.GetAlignmentType() & type); + + Stage::GetCurrent().Remove(alignment); + application.Render(); + application.SendNotification(); + } + + // HorizontalCenter, VerticalBottom + { + Alignment alignment = Alignment::New(); + alignment.Add(RenderableActor::New()); + Stage::GetCurrent().Add(alignment); + application.Render(); + application.SendNotification(); + + // Check default values + DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION); + + Alignment::Type type(Alignment::VerticalBottom); + alignment.SetAlignmentType(type); + DALI_TEST_CHECK(alignment.GetAlignmentType() & type); + + Stage::GetCurrent().Remove(alignment); + application.Render(); + application.SendNotification(); + } + + // HorizontalRight, VerticalBottom + { + Alignment alignment = Alignment::New(); + alignment.Add(RenderableActor::New()); + Stage::GetCurrent().Add(alignment); + application.Render(); + application.SendNotification(); + + // Check default values + DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION); + + Alignment::Type type(Alignment::Type(Alignment::HorizontalRight | Alignment::VerticalBottom)); + alignment.SetAlignmentType(type); + DALI_TEST_CHECK(alignment.GetAlignmentType() & type); + + Stage::GetCurrent().Remove(alignment); + application.Render(); + application.SendNotification(); + } + END_TEST; +} + +int UtcDaliAlignmentSetAlignmentTypeNegative(void) +{ + ToolkitTestApplication application; + + // Setting HorizontalLeft, HorizontalCenter + { + Alignment alignment = Alignment::New(); + Alignment::Type type(Alignment::Type(Alignment::HorizontalLeft | Alignment::HorizontalCenter)); + + try + { + alignment.SetAlignmentType(type); + tet_result(TET_FAIL); + } + catch (DaliException& exception) + { + if (exception.mCondition == "!horizontalSet") + { + tet_result(TET_PASS); + } + } + } + + // Setting HorizontalCenter, HorizontalRight + { + Alignment alignment = Alignment::New(); + Alignment::Type type(Alignment::Type(Alignment::HorizontalCenter | Alignment::HorizontalRight)); + + try + { + alignment.SetAlignmentType(type); + tet_result(TET_FAIL); + } + catch (DaliException& exception) + { + if (exception.mCondition == "!horizontalSet") + { + tet_result(TET_PASS); + } + } + } + + // Setting VerticalTop, VerticalCenter + { + Alignment alignment = Alignment::New(); + Alignment::Type type(Alignment::Type(Alignment::VerticalTop | Alignment::VerticalCenter)); + + try + { + alignment.SetAlignmentType(type); + tet_result(TET_FAIL); + } + catch (DaliException& exception) + { + if (exception.mCondition == "!verticalSet") + { + tet_result(TET_PASS); + } + } + } + + // Setting VerticalCenter, VerticalBottom + { + Alignment alignment = Alignment::New(); + Alignment::Type type(Alignment::Type(Alignment::VerticalTop | Alignment::VerticalBottom)); + + try + { + alignment.SetAlignmentType(type); + tet_result(TET_FAIL); + } + catch (DaliException& exception) + { + if (exception.mCondition == "!veritcalSet") + { + tet_result(TET_PASS); + } + } + } + END_TEST; +} + +int UtcDaliAlignmentGetAlignmentType(void) +{ + ToolkitTestApplication application; + + // Default, HorizonalCenter, VerticalCenter + { + Alignment alignment = Alignment::New(); + DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION); + alignment.Add(RenderableActor::New()); + Stage::GetCurrent().Add(alignment); + application.Render(); + application.SendNotification(); + Stage::GetCurrent().Remove(alignment); + application.Render(); + application.SendNotification(); + } + + // HorizontalLeft, VerticalCenter + { + Alignment alignment = Alignment::New(Alignment::HorizontalLeft); + DALI_TEST_EQUALS(Alignment::HorizontalLeft | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION); + alignment.Add(RenderableActor::New()); + Stage::GetCurrent().Add(alignment); + application.Render(); + application.SendNotification(); + Stage::GetCurrent().Remove(alignment); + application.Render(); + application.SendNotification(); + } + + // HorizontalRight, VerticalCenter + { + Alignment alignment = Alignment::New(Alignment::HorizontalRight); + DALI_TEST_EQUALS(Alignment::HorizontalRight | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION); + alignment.Add(RenderableActor::New()); + Stage::GetCurrent().Add(alignment); + application.Render(); + application.SendNotification(); + Stage::GetCurrent().Remove(alignment); + application.Render(); + application.SendNotification(); + } + + // HorizontalLeft, VerticalTop + { + Alignment alignment = Alignment::New(Alignment::HorizontalLeft, Alignment::VerticalTop); + DALI_TEST_EQUALS(Alignment::HorizontalLeft | Alignment::VerticalTop, alignment.GetAlignmentType(), TEST_LOCATION); + alignment.Add(RenderableActor::New()); + Stage::GetCurrent().Add(alignment); + application.Render(); + application.SendNotification(); + Stage::GetCurrent().Remove(alignment); + application.Render(); + application.SendNotification(); + } + + // HorizontalCenter, VerticalTop + { + Alignment alignment = Alignment::New(Alignment::HorizontalCenter, Alignment::VerticalTop); + DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalTop, alignment.GetAlignmentType(), TEST_LOCATION); + alignment.Add(RenderableActor::New()); + Stage::GetCurrent().Add(alignment); + application.Render(); + application.SendNotification(); + Stage::GetCurrent().Remove(alignment); + application.Render(); + application.SendNotification(); + } + + // HorizontalRight, VerticalTop + { + Alignment alignment = Alignment::New(Alignment::HorizontalRight, Alignment::VerticalTop); + DALI_TEST_EQUALS(Alignment::HorizontalRight | Alignment::VerticalTop, alignment.GetAlignmentType(), TEST_LOCATION); + alignment.Add(RenderableActor::New()); + Stage::GetCurrent().Add(alignment); + application.Render(); + application.SendNotification(); + Stage::GetCurrent().Remove(alignment); + application.Render(); + application.SendNotification(); + } + + // HorizontalLeft, VerticalBottom + { + Alignment alignment = Alignment::New(Alignment::HorizontalLeft, Alignment::VerticalBottom); + DALI_TEST_EQUALS(Alignment::HorizontalLeft | Alignment::VerticalBottom, alignment.GetAlignmentType(), TEST_LOCATION); + alignment.Add(RenderableActor::New()); + Stage::GetCurrent().Add(alignment); + application.Render(); + application.SendNotification(); + Stage::GetCurrent().Remove(alignment); + application.Render(); + application.SendNotification(); + } + + // HorizontalCenter, VerticalBottom + { + Alignment alignment = Alignment::New(Alignment::HorizontalCenter, Alignment::VerticalBottom); + DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalBottom, alignment.GetAlignmentType(), TEST_LOCATION); + alignment.Add(RenderableActor::New()); + Stage::GetCurrent().Add(alignment); + application.Render(); + application.SendNotification(); + Stage::GetCurrent().Remove(alignment); + application.Render(); + application.SendNotification(); + } + + // HorizontalRight, VerticalBottom + { + Alignment alignment = Alignment::New(Alignment::HorizontalRight, Alignment::VerticalBottom); + DALI_TEST_EQUALS(Alignment::HorizontalRight | Alignment::VerticalBottom, alignment.GetAlignmentType(), TEST_LOCATION); + alignment.Add(RenderableActor::New()); + Stage::GetCurrent().Add(alignment); + application.Render(); + application.SendNotification(); + Stage::GetCurrent().Remove(alignment); + application.Render(); + application.SendNotification(); + } + END_TEST; +} + +int UtcDaliAlignmentSetScaling(void) +{ + ToolkitTestApplication application; + + // ScaleToFill + { + Alignment alignment = Alignment::New(); + alignment.Add(RenderableActor::New()); + Stage::GetCurrent().Add(alignment); + application.Render(); + application.SendNotification(); + + DALI_TEST_EQUALS(Alignment::ScaleNone, alignment.GetScaling(), TEST_LOCATION); + alignment.SetScaling(Alignment::ScaleToFill); + DALI_TEST_EQUALS(Alignment::ScaleToFill, alignment.GetScaling(), TEST_LOCATION); + application.Render(); + application.SendNotification(); + + // For complete line coverage + alignment.SetAlignmentType(Alignment::HorizontalLeft); + application.Render(); + application.SendNotification(); + alignment.SetAlignmentType(Alignment::HorizontalRight); + application.Render(); + application.SendNotification(); + alignment.SetAlignmentType(Alignment::VerticalTop); + application.Render(); + application.SendNotification(); + alignment.SetAlignmentType(Alignment::VerticalBottom); + application.Render(); + application.SendNotification(); + + Stage::GetCurrent().Remove(alignment); + application.Render(); + application.SendNotification(); + } + + // ScaleToFitKeepAspect + { + Alignment alignment = Alignment::New(); + alignment.Add(RenderableActor::New()); + Stage::GetCurrent().Add(alignment); + application.Render(); + application.SendNotification(); + + DALI_TEST_EQUALS(Alignment::ScaleNone, alignment.GetScaling(), TEST_LOCATION); + alignment.SetScaling(Alignment::ScaleToFitKeepAspect); + DALI_TEST_EQUALS(Alignment::ScaleToFitKeepAspect, alignment.GetScaling(), TEST_LOCATION); + application.Render(); + application.SendNotification(); + + // For complete line coverage + alignment.SetAlignmentType(Alignment::HorizontalLeft); + application.Render(); + application.SendNotification(); + alignment.SetAlignmentType(Alignment::HorizontalRight); + application.Render(); + application.SendNotification(); + alignment.SetAlignmentType(Alignment::VerticalTop); + application.Render(); + application.SendNotification(); + alignment.SetAlignmentType(Alignment::VerticalBottom); + application.Render(); + application.SendNotification(); + + Stage::GetCurrent().Remove(alignment); + application.Render(); + application.SendNotification(); + } + + // ScaleToFillKeepAspect + { + Alignment alignment = Alignment::New(); + alignment.Add(RenderableActor::New()); + Stage::GetCurrent().Add(alignment); + application.Render(); + application.SendNotification(); + + DALI_TEST_EQUALS(Alignment::ScaleNone, alignment.GetScaling(), TEST_LOCATION); + alignment.SetScaling(Alignment::ScaleToFillKeepAspect); + DALI_TEST_EQUALS(Alignment::ScaleToFillKeepAspect, alignment.GetScaling(), TEST_LOCATION); + application.Render(); + application.SendNotification(); + + // For complete line coverage + alignment.SetAlignmentType(Alignment::HorizontalLeft); + application.Render(); + application.SendNotification(); + alignment.SetAlignmentType(Alignment::HorizontalRight); + application.Render(); + application.SendNotification(); + alignment.SetAlignmentType(Alignment::VerticalTop); + application.Render(); + application.SendNotification(); + alignment.SetAlignmentType(Alignment::VerticalBottom); + application.Render(); + application.SendNotification(); + + Stage::GetCurrent().Remove(alignment); + application.Render(); + application.SendNotification(); + } + + // ShrinkToFit + { + Alignment alignment = Alignment::New(); + alignment.Add(RenderableActor::New()); + Stage::GetCurrent().Add(alignment); + application.Render(); + application.SendNotification(); + + DALI_TEST_EQUALS(Alignment::ScaleNone, alignment.GetScaling(), TEST_LOCATION); + alignment.SetScaling(Alignment::ShrinkToFit); + DALI_TEST_EQUALS(Alignment::ShrinkToFit, alignment.GetScaling(), TEST_LOCATION); + application.Render(); + application.SendNotification(); + + // For complete line coverage + alignment.SetAlignmentType(Alignment::HorizontalLeft); + application.Render(); + application.SendNotification(); + alignment.SetAlignmentType(Alignment::HorizontalRight); + application.Render(); + application.SendNotification(); + alignment.SetAlignmentType(Alignment::VerticalTop); + application.Render(); + application.SendNotification(); + alignment.SetAlignmentType(Alignment::VerticalBottom); + application.Render(); + application.SendNotification(); + + Stage::GetCurrent().Remove(alignment); + application.Render(); + application.SendNotification(); + } + + // ShrinkToFitKeepAspect + { + Alignment alignment = Alignment::New(); + alignment.Add(RenderableActor::New()); + Stage::GetCurrent().Add(alignment); + application.Render(); + application.SendNotification(); + + DALI_TEST_EQUALS(Alignment::ScaleNone, alignment.GetScaling(), TEST_LOCATION); + alignment.SetScaling(Alignment::ShrinkToFitKeepAspect); + DALI_TEST_EQUALS(Alignment::ShrinkToFitKeepAspect, alignment.GetScaling(), TEST_LOCATION); + application.Render(); + application.SendNotification(); + + // For complete line coverage + alignment.SetAlignmentType(Alignment::HorizontalLeft); + application.Render(); + application.SendNotification(); + alignment.SetAlignmentType(Alignment::HorizontalRight); + application.Render(); + application.SendNotification(); + alignment.SetAlignmentType(Alignment::VerticalTop); + application.Render(); + application.SendNotification(); + alignment.SetAlignmentType(Alignment::VerticalBottom); + application.Render(); + application.SendNotification(); + + Stage::GetCurrent().Remove(alignment); + application.Render(); + application.SendNotification(); + } + END_TEST; +} + +int UtcDaliAlignmentGetScaling(void) +{ + ToolkitTestApplication application; + + // ScaleToFill + { + Alignment alignment = Alignment::New(); + DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ScaleNone); + + alignment.SetScaling(Alignment::ScaleToFill); + DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ScaleToFill); + } + + // ScaleToFitKeepAspect + { + Alignment alignment = Alignment::New(); + DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ScaleNone); + + alignment.SetScaling(Alignment::ScaleToFitKeepAspect); + DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ScaleToFitKeepAspect); + } + + // ScaleToFillKeepAspect + { + Alignment alignment = Alignment::New(); + DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ScaleNone); + + alignment.SetScaling(Alignment::ScaleToFillKeepAspect); + DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ScaleToFillKeepAspect); + } + + // ShrinkToFit + { + Alignment alignment = Alignment::New(); + DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ScaleNone); + + alignment.SetScaling(Alignment::ShrinkToFit); + DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ShrinkToFit); + } + + // ShrinkToFitKeepAspect + { + Alignment alignment = Alignment::New(); + DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ScaleNone); + + alignment.SetScaling(Alignment::ShrinkToFitKeepAspect); + DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ShrinkToFitKeepAspect); + } + + END_TEST; +} + +int UtcDaliAlignmentSetPaddingPositive(void) +{ + ToolkitTestApplication application; + + Alignment alignment = Alignment::New(); + + Alignment::Padding padding(1.0f, 1.5f, 2.f, 0.5f); + DALI_TEST_CHECK( fabs( padding.left - alignment.GetPadding().left ) > GetRangedEpsilon( padding.left, alignment.GetPadding().left ) ); + DALI_TEST_CHECK( fabs( padding.right - alignment.GetPadding().right ) > GetRangedEpsilon( padding.right, alignment.GetPadding().right ) ); + DALI_TEST_CHECK( fabs( padding.top - alignment.GetPadding().top ) > GetRangedEpsilon( padding.top, alignment.GetPadding().top ) ); + DALI_TEST_CHECK( fabs( padding.bottom - alignment.GetPadding().bottom ) > GetRangedEpsilon( padding.bottom, alignment.GetPadding().bottom ) ); + + alignment.SetPadding(padding); + DALI_TEST_CHECK( fabs( padding.left - alignment.GetPadding().left ) < GetRangedEpsilon( padding.left, alignment.GetPadding().left ) ); + DALI_TEST_CHECK( fabs( padding.right - alignment.GetPadding().right ) < GetRangedEpsilon( padding.right, alignment.GetPadding().right ) ); + DALI_TEST_CHECK( fabs( padding.top - alignment.GetPadding().top ) < GetRangedEpsilon( padding.top, alignment.GetPadding().top ) ); + DALI_TEST_CHECK( fabs( padding.bottom - alignment.GetPadding().bottom ) < GetRangedEpsilon( padding.bottom, alignment.GetPadding().bottom ) ); + END_TEST; +} + +int UtcDaliAlignmentSetPaddingNegative(void) +{ + ToolkitTestApplication application; + + Alignment alignment = Alignment::New(); + + try + { + Alignment::Padding padding(-1.0f, 1.5f, 2.f, 0.f); + alignment.SetPadding(padding); + tet_result(TET_FAIL); + } + catch (DaliException& exception) + { + if (exception.mCondition == "( padding.left >= 0.f ) && ( padding.top >= 0.f ) && ( padding.right >= 0.f ) && ( padding.bottom >= 0.f )") + { + tet_result(TET_PASS); + } + } + + try + { + Alignment::Padding padding(1.0f, 1.5f, -2.f, 0.f); + alignment.SetPadding(padding); + tet_result(TET_FAIL); + } + catch (DaliException& exception) + { + if (exception.mCondition == "( padding.left >= 0.f ) && ( padding.top >= 0.f ) && ( padding.right >= 0.f ) && ( padding.bottom >= 0.f )") + { + tet_result(TET_PASS); + } + } + + try + { + Alignment::Padding padding(1.0f, 1.5f, 2.f, -1.f); + alignment.SetPadding(padding); + tet_result(TET_FAIL); + } + catch (DaliException& exception) + { + if (exception.mCondition == "( padding.left >= 0.f ) && ( padding.top >= 0.f ) && ( padding.right >= 0.f ) && ( padding.bottom >= 0.f )") + { + tet_result(TET_PASS); + } + } + + try + { + Alignment::Padding padding(1.0f, -1.5f, 2.f, 0.f); + alignment.SetPadding(padding); + tet_result(TET_FAIL); + } + catch (DaliException& exception) + { + if (exception.mCondition == "( padding.left >= 0.f ) && ( padding.top >= 0.f ) && ( padding.right >= 0.f ) && ( padding.bottom >= 0.f )") + { + tet_result(TET_PASS); + } + } + END_TEST; +} + +int UtcDaliAlignmentGetPadding(void) +{ + ToolkitTestApplication application; + + Alignment alignment = Alignment::New(); + DALI_TEST_CHECK( fabs( alignment.GetPadding().left ) < GetRangedEpsilon( 0.f, alignment.GetPadding().left ) ); + DALI_TEST_CHECK( fabs( alignment.GetPadding().right ) < GetRangedEpsilon( 0.f, alignment.GetPadding().right ) ); + DALI_TEST_CHECK( fabs( alignment.GetPadding().top ) < GetRangedEpsilon( 0.f, alignment.GetPadding().top ) ); + DALI_TEST_CHECK( fabs( alignment.GetPadding().bottom ) < GetRangedEpsilon( 0.f, alignment.GetPadding().bottom ) ); + + Alignment::Padding padding(1.0f, 1.5f, 2.f, 0.f); + alignment.SetPadding(padding); + DALI_TEST_CHECK( fabs( padding.left - alignment.GetPadding().left ) < GetRangedEpsilon( padding.left, alignment.GetPadding().left ) ); + DALI_TEST_CHECK( fabs( padding.right - alignment.GetPadding().right ) < GetRangedEpsilon( padding.right, alignment.GetPadding().right ) ); + DALI_TEST_CHECK( fabs( padding.top - alignment.GetPadding().top ) < GetRangedEpsilon( padding.top, alignment.GetPadding().top ) ); + DALI_TEST_CHECK( fabs( padding.bottom - alignment.GetPadding().bottom ) < GetRangedEpsilon( padding.bottom, alignment.GetPadding().bottom ) ); + END_TEST; +} + +int UtcDaliAlignmentChildAddAndRemove(void) +{ + ToolkitTestApplication application; + + Alignment alignment = Alignment::New(); + Stage::GetCurrent().Add(alignment); + + application.Render(); + application.SendNotification(); + + Actor actor = RenderableActor::New(); + alignment.Add(actor); + + DALI_TEST_EQUALS(alignment.GetChildCount(), 1u, TEST_LOCATION); + + application.Render(); + application.SendNotification(); + + alignment.Remove(actor); + + DALI_TEST_EQUALS(alignment.GetChildCount(), 0u, TEST_LOCATION); + + application.Render(); + application.SendNotification(); + + Stage::GetCurrent().Remove(alignment); + END_TEST; +} + +int UtcDaliAlignmentOnSizeSet(void) +{ + ToolkitTestApplication application; + + Alignment alignment = Alignment::New(); + Stage::GetCurrent().Add(alignment); + + application.Render(); + application.SendNotification(); + + Vector3 size(100.0f, 200.0f, 0.0f); + alignment.SetSize(size); + + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + + DALI_TEST_EQUALS(size, alignment.GetImplementation().GetControlSize(), TEST_LOCATION); + + Stage::GetCurrent().Remove(alignment); + END_TEST; +} + +/////////////////////////////////////////////////////////////////////////////// +static bool TouchEventCallback(Actor actor, const TouchEvent& event) +{ + return false; +} + +/////////////////////////////////////////////////////////////////////////////// + +int UtcDaliAlignmentOnTouchEvent(void) +{ + ToolkitTestApplication application; + + Alignment alignment = Alignment::New(); + alignment.SetSize(100.0f, 100.0f); + alignment.SetAnchorPoint(AnchorPoint::TOP_LEFT); + Stage::GetCurrent().Add(alignment); + + alignment.TouchedSignal().Connect(&TouchEventCallback); + + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + + Integration::TouchEvent touchEvent(1); + TouchPoint point(1, TouchPoint::Down, 20.0f, 20.0f); + touchEvent.AddPoint(point); + application.ProcessEvent(touchEvent); + + tet_result(TET_PASS); // For line coverage, as long as there are no exceptions, we assume passed. + END_TEST; +} + +int UtcDaliAlignmentOnKeyEvent(void) +{ + ToolkitTestApplication application; + + Alignment alignment = Alignment::New(); + Stage::GetCurrent().Add(alignment); + + alignment.SetKeyInputFocus(); + + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + + Integration::KeyEvent keyEvent; + application.ProcessEvent(keyEvent); + + tet_result(TET_PASS); // For line coverage, as long as there are no exceptions, we assume passed. + END_TEST; +} + +int UtcDaliAlignmentOnSizeAnimation(void) +{ + ToolkitTestApplication application; + + Alignment alignment = Alignment::New(); + Stage::GetCurrent().Add(alignment); + + Animation animation = Animation::New(100.0f); + animation.Resize(alignment, Vector3(100.0f, 150.0f, 200.0f)); + animation.Play(); + + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + + tet_result(TET_PASS); // For line coverage, as long as there are no exceptions, we assume passed. + END_TEST; +} + +int UtcDaliAlignmentCopyAndAssignment(void) +{ + ToolkitTestApplication application; + + Alignment alignment = Alignment::New(); + Alignment emptyAlignment; + + Alignment::Padding padding(100.0f, 150.0f, 200.f, 0.f); + alignment.SetPadding(padding); + + Alignment alignmentCopy(alignment); + DALI_TEST_CHECK( fabs( padding.left - alignmentCopy.GetPadding().left ) < GetRangedEpsilon( padding.left, alignmentCopy.GetPadding().left ) ); + DALI_TEST_CHECK( fabs( padding.right - alignmentCopy.GetPadding().right ) < GetRangedEpsilon( padding.right, alignmentCopy.GetPadding().right ) ); + DALI_TEST_CHECK( fabs( padding.top - alignmentCopy.GetPadding().top ) < GetRangedEpsilon( padding.top, alignmentCopy.GetPadding().top ) ); + DALI_TEST_CHECK( fabs( padding.bottom - alignmentCopy.GetPadding().bottom ) < GetRangedEpsilon( padding.bottom, alignmentCopy.GetPadding().bottom ) ); + + Alignment alignmentEmptyCopy(emptyAlignment); + DALI_TEST_CHECK(emptyAlignment == alignmentEmptyCopy); + + Alignment alignmentEquals; + alignmentEquals = alignment; + DALI_TEST_CHECK( fabs( padding.left - alignmentEquals.GetPadding().left ) < GetRangedEpsilon( padding.left, alignmentEquals.GetPadding().left ) ); + DALI_TEST_CHECK( fabs( padding.right - alignmentEquals.GetPadding().right ) < GetRangedEpsilon( padding.right, alignmentEquals.GetPadding().right ) ); + DALI_TEST_CHECK( fabs( padding.top - alignmentEquals.GetPadding().top ) < GetRangedEpsilon( padding.top, alignmentEquals.GetPadding().top ) ); + DALI_TEST_CHECK( fabs( padding.bottom - alignmentEquals.GetPadding().bottom ) < GetRangedEpsilon( padding.bottom, alignmentEquals.GetPadding().bottom ) ); + + Alignment alignmentEmptyEquals; + alignmentEmptyEquals = emptyAlignment; + DALI_TEST_CHECK(emptyAlignment == alignmentEmptyEquals); + + // Self assignment + alignment = alignment; + DALI_TEST_CHECK(alignment == alignmentCopy); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-BubbleEmitter.cpp b/automated-tests/src/dali-toolkit/utc-Dali-BubbleEmitter.cpp new file mode 100644 index 0000000..412dd3f --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-BubbleEmitter.cpp @@ -0,0 +1,406 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include + +// Need to override adaptor classes for toolkit test harness, so include +// test harness headers before dali headers. +#include + +#include +#include + +using namespace Dali; +using namespace Dali::Toolkit; + +void utc_dali_toolkit_bubble_emitter_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_toolkit_bubble_emitter_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +namespace +{ + +const int RENDER_FRAME_INTERVAL = 16; + +static bool gObjectCreatedCallBackCalled; +static void TestCallback(BaseHandle handle) +{ + gObjectCreatedCallBackCalled = true; +} + +/* + * Simulate time passed by. + * + * @note this will always process at least 1 frame (1/60 sec) + * + * @param application Test application instance + * @param duration Time to pass in milliseconds. + * @return The actual time passed in milliseconds + */ +static int Wait(ToolkitTestApplication& application, int duration = 0) +{ + int time = 0; + + for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++) + { + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + time += RENDER_FRAME_INTERVAL; + } + + return time; +} + +static Image CreateSolidColorImage( ToolkitTestApplication& application, const Vector4& color, unsigned int width, unsigned int height ) +{ + BitmapImage imageData = BitmapImage::New( width, height, Pixel::RGBA8888 ); + + // Create the image + PixelBuffer* pixbuf = imageData.GetBuffer(); + unsigned int size = width * height; + + for( size_t i = 0; i < size; i++ ) + { + pixbuf[i*4+0] = 0xFF * color.r; + pixbuf[i*4+1] = 0xFF * color.g; + pixbuf[i*4+2] = 0xFF * color.b; + pixbuf[i*4+3] = 0xFF * color.a; + } + imageData.Update(); + + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE ); + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + application.Render(RENDER_FRAME_INTERVAL); + application.SendNotification(); + + return imageData; +} +}//namespace + + +int UtcDaliBubbleEmitterNew(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliBubbleEmitterNew "); + + // Test default constructor + BubbleEmitter emitter; + DALI_TEST_CHECK( !emitter ); + + // Test object creation + Image shapeImage = CreateSolidColorImage( application, Color::GREEN, 5, 5 ); + emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 200, Vector2( 5.f, 10.f )); + DALI_TEST_CHECK( emitter ); + + // Additional check to ensure object is created by checking if it's registered + ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + DALI_TEST_CHECK( registry ); + gObjectCreatedCallBackCalled = false; + registry.ObjectCreatedSignal().Connect( &TestCallback ); + { + BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 200, Vector2( 5.f, 10.f )); + } + DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + + // Test copy constructor + BubbleEmitter emitterCopy( emitter ); + DALI_TEST_CHECK( emitterCopy ); + + // Test down cast + Handle handleEmitter; + handleEmitter = emitter; + BubbleEmitter downCastEmitter = BubbleEmitter::DownCast( handleEmitter ); + DALI_TEST_CHECK( downCastEmitter ); + END_TEST; +} + +int UtcDaliBubbleEmitterGetRootActor(void) +{ + ToolkitTestApplication application; + tet_infoline( " UtcDaliBubbleEmitterGetRootActor " ); + + Image shapeImage = CreateSolidColorImage( application, Color::GREEN, 5, 5 ); + BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 200, Vector2( 5.f, 10.f )); + + Actor root = emitter.GetRootActor(); + DALI_TEST_CHECK( root ); + DALI_TEST_CHECK( root.GetChildCount() == 3 ); + END_TEST; +} + +int UtcDaliBubbleEmitterSetBackground(void) +{ + ToolkitTestApplication application; + tet_infoline( " UtcDaliBubbleEmitterSetBackground " ); + + Image shapeImage = CreateSolidColorImage( application, Color::GREEN, 5, 5 ); + BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 200, Vector2( 5.f, 10.f )); + + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + unsigned int taskCount = taskList.GetTaskCount(); + + Image bgImage = CreateSolidColorImage( application, Color::RED, 50, 50 ); + emitter.SetBackground( bgImage, Vector3(0.f, 0.f, 0.5f) ); + + DALI_TEST_CHECK( taskList.GetTaskCount() == taskCount+1 ); + + Wait(application, 500); + DALI_TEST_CHECK( taskList.GetTaskCount() == taskCount ); + END_TEST; +} + +int UtcDaliBubbleEmitterSetShapeImage(void) +{ + ToolkitTestApplication application; + tet_infoline( " UtcDaliBubbleEmitterSetShapeImage " ); + + Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 ); + BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f )); + + Actor root = emitter.GetRootActor(); + MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) ); + Material material = bubbleMesh.GetMaterial(); + + DALI_TEST_CHECK( material.GetDiffuseTexture() == shapeImage1 ); + + Image shapeImage2 = CreateSolidColorImage( application, Color::RED, 8, 8 ); + emitter.SetShapeImage( shapeImage2 ); + + DALI_TEST_CHECK( material.GetDiffuseTexture() == shapeImage2 ); + END_TEST; +} + +int UtcDaliBubbleEmitterSetBubbleScale(void) +{ + ToolkitTestApplication application; + tet_infoline( " UtcDaliBubbleEmitterSetBubbleScale " ); + + Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 ); + BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f )); + + Actor root = emitter.GetRootActor(); + MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) ); + ShaderEffect effect = bubbleMesh.GetShaderEffect(); + DALI_TEST_CHECK( effect ); + + Property::Index scalePropertyIndex = effect.GetPropertyIndex( "uDynamicScale" ); + float scaleValue; + (effect.GetProperty(scalePropertyIndex)).Get( scaleValue ); + DALI_TEST_EQUALS(scaleValue, 1.f, TEST_LOCATION ); + + emitter.SetBubbleScale( 2.f ); + application.SendNotification(); + application.Render(); + (effect.GetProperty(scalePropertyIndex)).Get( scaleValue ); + DALI_TEST_EQUALS(scaleValue, 2.f, TEST_LOCATION ); + + emitter.SetBubbleScale( 0.5f ); + application.SendNotification(); + application.Render(); + (effect.GetProperty(scalePropertyIndex)).Get( scaleValue ); + DALI_TEST_EQUALS(scaleValue, 0.5f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliBubbleEmitterSetBubbleDensity01(void) +{ + ToolkitTestApplication application; + tet_infoline( " UtcDaliBubbleEmitterSetBubbleDensity " ); + + Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 ); + BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f )); + + try + { + emitter.SetBubbleDensity( 3.f ); + DALI_TEST_CHECK(true); + } + catch(Dali::DaliException& e) + { + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_ASSERT(e, "density>0 && density<=9", TEST_LOCATION ); + } + END_TEST; +} + +int UtcDaliBubbleEmitterSetBubbleDensity02(void) +{ + ToolkitTestApplication application; + tet_infoline( " UtcDaliBubbleEmitterSetBubbleDensity " ); + + Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 ); + BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f )); + + try + { + emitter.SetBubbleDensity( 10.f ); + } + catch(Dali::DaliException& e) + { + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_ASSERT(e, "density>0 && density<=9", TEST_LOCATION ); + } + END_TEST; +} + +int UtcDaliBubbleEmitterSetBlendMode(void) +{ + ToolkitTestApplication application; + tet_infoline( " UtcDaliBubbleEmitterSetBlendMode " ); + + Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 ); + BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f )); + + Actor root = emitter.GetRootActor(); + MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) ); + + BlendingFactor::Type srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha; + + emitter.SetBlendMode( true ); + bubbleMesh.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha ); + DALI_TEST_CHECK( srcFactorRgb == BlendingFactor::SRC_ALPHA ); + DALI_TEST_CHECK( destFactorRgb == BlendingFactor::ONE ); + DALI_TEST_CHECK( srcFactorAlpha == BlendingFactor::ZERO ); + DALI_TEST_CHECK( destFactorAlpha == BlendingFactor::ONE ); + + emitter.SetBlendMode( false ); + bubbleMesh.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha ); + DALI_TEST_CHECK( srcFactorRgb == BlendingFactor::SRC_ALPHA ); + DALI_TEST_CHECK( destFactorRgb == BlendingFactor::ONE_MINUS_SRC_ALPHA ); + DALI_TEST_CHECK( srcFactorAlpha == BlendingFactor::ONE ); + DALI_TEST_CHECK( destFactorAlpha == BlendingFactor::ONE_MINUS_SRC_ALPHA ); + END_TEST; +} + +int UtcDaliBubbleEmitterEmitBubble(void) +{ + ToolkitTestApplication application; + tet_infoline( " UtcDaliBubbleEmitterEmitBubble " ); + + Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 ); + BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f )); + + Actor root = emitter.GetRootActor(); + MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) ); + ShaderEffect effect = bubbleMesh.GetShaderEffect(); + DALI_TEST_CHECK( effect ); + + Property::Index propertyIndex0 = effect.GetPropertyIndex( "uPercentage[0]" ); + Property::Index propertyIndex1 = effect.GetPropertyIndex( "uPercentage[1]" ); + float value0, value1; + + Animation animation = Animation::New( 0.5f ); + emitter.EmitBubble( animation, Vector2(40.f,40.f), Vector2(-5.f,-5.f), Vector2(30.f,30.f) ); + emitter.EmitBubble( animation, Vector2(10.f,10.f), Vector2(5.f,5.f), Vector2(30.f,30.f) ); + (effect.GetProperty(propertyIndex0)).Get( value0 ); + (effect.GetProperty(propertyIndex1)).Get( value1 ); + DALI_TEST_EQUALS(value0, 0.f, TEST_LOCATION ); + DALI_TEST_EQUALS(value1, 0.f, TEST_LOCATION ); + + animation.Play(); + + Wait(application, 300); + (effect.GetProperty(propertyIndex0)).Get( value0 ); + (effect.GetProperty(propertyIndex1)).Get( value1 ); + DALI_TEST_CHECK( value0 >= 0.6f ); + DALI_TEST_CHECK( value1 >= 0.6f ); + + Wait(application, 600); + (effect.GetProperty(propertyIndex0)).Get( value0 ); + (effect.GetProperty(propertyIndex1)).Get( value1 ); + DALI_TEST_EQUALS(value0, 1.f, TEST_LOCATION ); + DALI_TEST_EQUALS(value1, 1.f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliBubbleEmitterStartExplosion(void) +{ + ToolkitTestApplication application; + tet_infoline( " UtcDaliBubbleEmitterStartExplosion " ); + + Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 ); + BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f )); + Actor root = emitter.GetRootActor(); + MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) ); + ShaderEffect effect = bubbleMesh.GetShaderEffect(); + DALI_TEST_CHECK( effect ); + + Property::Index propertyIndex = effect.GetPropertyIndex( "uMagnification" ); + float value; + (effect.GetProperty(propertyIndex)).Get( value ); + DALI_TEST_EQUALS(value, 1.f, TEST_LOCATION ); + + emitter.StartExplosion( 0.4, 4.f ); + + Wait(application, 200); // 0.2s + (effect.GetProperty(propertyIndex)).Get( value ); + DALI_TEST_CHECK( value >= 2.f ); + + Wait(application, 100); // 0.3s + (effect.GetProperty(propertyIndex)).Get( value ); + DALI_TEST_CHECK( value >= 3.f ); + + Wait(application, 100); // 0.4s + (effect.GetProperty(propertyIndex)).Get( value ); + DALI_TEST_EQUALS(value, 1.f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliBubbleEmitterRestore(void) +{ + ToolkitTestApplication application; + tet_infoline( " UtcDaliBubbleEmitterRestore " ); + + Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 ); + BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f )); + Actor root = emitter.GetRootActor(); + MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) ); + ShaderEffect effect = bubbleMesh.GetShaderEffect(); + DALI_TEST_CHECK( effect ); + + Property::Index percentagePropertyIndex = effect.GetPropertyIndex( "uPercentage[0]" ); + float percentage; + + Animation animation = Animation::New( 0.5f ); + emitter.EmitBubble( animation, Vector2(40.f,40.f), Vector2(-5.f,-5.f), Vector2(30.f,30.f) ); + (effect.GetProperty(percentagePropertyIndex)).Get( percentage ); + DALI_TEST_EQUALS(percentage, 0.f, TEST_LOCATION ); + + animation.Play(); + Wait(application, 200); + animation.Clear(); + + (effect.GetProperty(percentagePropertyIndex)).Get( percentage ); + DALI_TEST_CHECK( percentage < 0.5f && percentage >= 0.4); + + emitter.Restore(); + application.SendNotification(); + application.Render(); + + (effect.GetProperty(percentagePropertyIndex)).Get( percentage ); + DALI_TEST_EQUALS(percentage, 1.f, TEST_LOCATION ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Button.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Button.cpp new file mode 100644 index 0000000..e7f9aa4 --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-Button.cpp @@ -0,0 +1,313 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include + +// Need to override adaptor classes for toolkit test harness, so include +// test harness headers before dali headers. +#include + +#include +#include +#include + +using namespace Dali; +using namespace Toolkit; + + +void utc_dali_toolkit_button_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_toolkit_button_cleanup(void) +{ + test_return_value = TET_PASS; +} + +namespace +{ +static bool gButtonClicked = false; + +static bool ButtonClicked( Button button ) +{ + gButtonClicked = true; + return false; +} + +const Dali::TouchPoint pointDownInside( 0, TouchPoint::Down, 240, 400 ); +const Dali::TouchPoint pointUpInside( 0, TouchPoint::Up, 240, 400 ); +const Dali::TouchPoint pointLeave( 0, TouchPoint::Leave, 240, 400 ); +const Dali::TouchPoint pointEnter( 0, TouchPoint::Motion, 240, 400 ); +const Dali::TouchPoint pointDownOutside( 0, TouchPoint::Down, 10, 10 ); +const Dali::TouchPoint pointUpOutside( 0, TouchPoint::Up, 10, 10 ); + +static float ANIMATION_TIME( 0.5f ); +} // namespace + + + +// Positive test case for a method +int UtcDaliButtonNew(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliButtonNew"); + + PushButton pushButton = PushButton::New(); + + DALI_TEST_CHECK( pushButton ); + + PushButton pushButton2( pushButton ); + + DALI_TEST_CHECK( pushButton2 ); + + pushButton2 = NULL; + + // Test down cast + Handle handleButton; + handleButton = pushButton; + Button downCastPushButton = Button::DownCast( handleButton ); + DALI_TEST_CHECK( downCastPushButton ); + PushButton downCastPushButton2 = PushButton::DownCast( handleButton ); + DALI_TEST_CHECK( downCastPushButton2 ); + + END_TEST; +} + +int UtcDaliButtonSetProperty(void) +{ + tet_infoline("UtcDaliButtonSetProperty: "); + ToolkitTestApplication application; + + PushButton pushButton = PushButton::New(); + + pushButton.SetProperty(pushButton.GetPropertyIndex("dimmed"), false); + DALI_TEST_CHECK( false == pushButton.IsDimmed() ); + pushButton.SetProperty(pushButton.GetPropertyIndex("dimmed"), true); + DALI_TEST_CHECK( true == pushButton.IsDimmed() ); + END_TEST; +} + +int UtcDaliButtonSetGetDimmed(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliButtonSetGetDimmed"); + + PushButton pushButton = PushButton::New(); + + pushButton.SetDimmed( true ); + + DALI_TEST_CHECK( pushButton.IsDimmed() ); + + pushButton.SetDimmed( false ); + + DALI_TEST_CHECK( !pushButton.IsDimmed() ); + + pushButton.SetDimmed( true ); + + DALI_TEST_CHECK( pushButton.IsDimmed() ); + + pushButton.SetDimmed( false ); + + DALI_TEST_CHECK( !pushButton.IsDimmed() ); + END_TEST; +} + +int UtcDaliButtonSize(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliButtonSize"); + + ImageActor image01 = ImageActor::New(CreateBitmapImage()); + image01.SetSize( 100, 50 ); + + PushButton pushButton; + + Vector3 size; + + // Test1 Size is set through Actor API + + // First an image is set, then SetSize is called. + pushButton = PushButton::New(); + + pushButton.SetBackgroundImage( image01 ); + pushButton.SetSize( 10.f, 10.f ); + + application.SendNotification(); + application.Render(); + + size = pushButton.GetCurrentSize(); + + DALI_TEST_EQUALS( size.width, 10.f, TEST_LOCATION ); + DALI_TEST_EQUALS( size.height, 10.f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliButtonClicked(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliButtonClicked"); + + PushButton pushButton = PushButton::New(); + pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); + pushButton.SetPosition( 240, 400 ); + pushButton.SetSize( 100, 100 ); + + Stage::GetCurrent().Add( pushButton ); + + application.SendNotification(); + application.Render(); + + // connect to its touch signal + pushButton.ClickedSignal().Connect( &ButtonClicked ); + + Dali::Integration::TouchEvent event; + + // Test1. Touch point down and up inside the button. + + gButtonClicked = false; + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointDownInside ); + application.ProcessEvent( event ); + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointUpInside ); + application.ProcessEvent( event ); + + DALI_TEST_CHECK( gButtonClicked ); + + // Test2. Touch point down and up outside the button. + + gButtonClicked = false; + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointDownOutside ); + application.ProcessEvent( event ); + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointUpOutside ); + application.ProcessEvent( event ); + + DALI_TEST_CHECK( !gButtonClicked ); + + // Test3. Touch point down inside and up outside the button. + + gButtonClicked = false; + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointDownInside ); + application.ProcessEvent( event ); + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointLeave ); + application.ProcessEvent( event ); + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointUpOutside ); + application.ProcessEvent( event ); + + DALI_TEST_CHECK( !gButtonClicked ); + + // Test4. Touch point down outside and up inside the button. + + gButtonClicked = false; + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointDownOutside ); + application.ProcessEvent( event ); + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointEnter ); + application.ProcessEvent( event ); + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointUpInside ); + application.ProcessEvent( event ); + + DALI_TEST_CHECK( !gButtonClicked ); + END_TEST; +} + +namespace +{ + +static bool gClickedCallBackCalled; + +static bool TestClickedCallback(Button button) +{ + gClickedCallBackCalled = true; + return true; +} + +} // namespace + +int UtcDaliButtonConnectSignal(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliButtonConnectSignal()"); + + gClickedCallBackCalled = false; + + PushButton pushButton = PushButton::New(); + pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); + pushButton.SetPosition( 240, 400 ); + pushButton.SetSize( 100, 100 ); + + Stage::GetCurrent().Add( pushButton ); + + application.SendNotification(); + application.Render(); + + // connect to its clicked signal + pushButton.ClickedSignal().Connect(TestClickedCallback); + + Dali::Integration::TouchEvent event; + + // Touch point down and up inside the button. + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointDownInside ); + application.ProcessEvent( event ); + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointUpInside ); + application.ProcessEvent( event ); + + DALI_TEST_CHECK( gClickedCallBackCalled == true ); + + gClickedCallBackCalled = false; + pushButton.ClickedSignal().Disconnect(TestClickedCallback); + + // simulate another touch event + application.ProcessEvent( event ); + + DALI_TEST_CHECK( gClickedCallBackCalled == false ); + END_TEST; +} + +int UtcDaliButtonSetGetAnimationTime(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliButtonSetGetAnimationTime"); + + PushButton pushButton = PushButton::New(); + + pushButton.SetAnimationTime( ANIMATION_TIME ); + + DALI_TEST_EQUALS( pushButton.GetAnimationTime(), ANIMATION_TIME, TEST_LOCATION ); + + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp new file mode 100644 index 0000000..800c65f --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp @@ -0,0 +1,354 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include + +// Need to override adaptor classes for toolkit test harness, so include +// test harness headers before dali headers. +#include + +#include +#include +#include "dummy-control.h" + +using namespace Dali; +using namespace Dali::Toolkit; + +void utc_dali_toolkit_control_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_toolkit_control_cleanup(void) +{ + test_return_value = TET_PASS; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace +{ + +static bool gObjectCreatedCallBackCalled; + +static void TestCallback(BaseHandle handle) +{ + gObjectCreatedCallBackCalled = true; +} + +} // namespace + +/////////////////////////////////////////////////////////////////////////////////////////////////// + + +int UtcDaliControlConstructor(void) +{ + ToolkitTestApplication application; // Exceptions require ToolkitTestApplication + + DummyControl dummy; + + DALI_TEST_CHECK( !Control::DownCast(dummy) ); + + dummy = DummyControl::New(); + + DALI_TEST_CHECK( Control::DownCast(dummy) ); + END_TEST; +} + +int UtcDaliControlNew(void) +{ + ToolkitTestApplication application; // Exceptions require ToolkitTestApplication + + Control control; + + DALI_TEST_CHECK( !Control::DownCast(control) ); + + control = Control::New(); + + DALI_TEST_CHECK( Control::DownCast(control) ); + END_TEST; +} + + +int UtcDaliControlRegister(void) +{ + ToolkitTestApplication application; + + // Ensure the object is registered after creation + ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + DALI_TEST_CHECK( registry ); + + gObjectCreatedCallBackCalled = false; + registry.ObjectCreatedSignal().Connect( &TestCallback ); + { + Alignment alignment = Alignment::New(); + } + DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + END_TEST; +} + +int UtcDaliControlCopyAndAssignment(void) +{ + ToolkitTestApplication application; + + DummyControl control = DummyControl::New(); + Control emptyControl; + + Control controlCopy( control ); + DALI_TEST_CHECK( control == controlCopy ); + + Control emptyControlCopy( emptyControl ); + DALI_TEST_CHECK( emptyControl == emptyControlCopy ); + + Control controlEquals; + controlEquals = control; + DALI_TEST_CHECK( control == controlEquals ); + + Control emptyControlEquals; + emptyControlEquals = emptyControl; + DALI_TEST_CHECK( emptyControl == emptyControlEquals ); + + // Self assignment + control = control; + DALI_TEST_CHECK( control == controlCopy ); + END_TEST; +} + +int UtcDaliControlDownCast(void) +{ + ToolkitTestApplication application; + + DummyControl control; + + DALI_TEST_CHECK( !Control::DownCast( control ) ); + + control = DummyControl::New(); + + DALI_TEST_CHECK( Control::DownCast( control ) ); + + Actor actor; + + DALI_TEST_CHECK( !Control::DownCast( actor ) ); + + actor = Actor::New(); + + DALI_TEST_CHECK( !Control::DownCast( actor ) ); + END_TEST; +} + +int UtcDaliControlDownCastTemplate(void) +{ + ToolkitTestApplication application; + + DummyControl control; + + DALI_TEST_CHECK( !DummyControl::DownCast( control )); + + control = DummyControl::New(); + + DALI_TEST_CHECK( DummyControl::DownCast( control ) ); + + Actor actor; + + DALI_TEST_CHECK( !DummyControl::DownCast( actor ) ); + + actor = Actor::New(); + + DALI_TEST_CHECK( !DummyControl::DownCast( actor ) ); + END_TEST; +} + +int UtcDaliControlKeyInputFocus(void) +{ + ToolkitTestApplication application; + Stage stage = Stage::GetCurrent(); + + DummyControl control; + + PushButton pushButton1 = PushButton::New(); + stage.Add( pushButton1 ); + + pushButton1.SetKeyInputFocus(); + DALI_TEST_CHECK( pushButton1.HasKeyInputFocus() ); + + pushButton1.ClearKeyInputFocus(); + DALI_TEST_CHECK( !pushButton1.HasKeyInputFocus() ); + END_TEST; +} + +int UtcDaliControlGetImplementation(void) +{ + ToolkitTestApplication application; + + DummyControl control; + + // Get Empty + { + try + { + ControlImpl& controlImpl = control.GetImplementation(); + (void)controlImpl; // Avoid unused warning + tet_result(TET_FAIL); + } + catch (DaliException &exception) + { + tet_result(TET_PASS); + } + } + + // Get Const Empty + { + try + { + const DummyControl constControl(control); + const ControlImpl& controlImpl = constControl.GetImplementation(); + (void)controlImpl; // Avoid unused warning + tet_result(TET_FAIL); + } + catch (DaliException &exception) + { + tet_result(TET_PASS); + } + } + + control = DummyControl::New(); + + // Get + { + try + { + ControlImpl& controlImpl = control.GetImplementation(); + (void)controlImpl; // Avoid unused warning + tet_result(TET_PASS); + } + catch (DaliException &exception) + { + tet_result(TET_FAIL); + } + } + + // Get Const + { + try + { + const DummyControl constControl(control); + const ControlImpl& controlImpl = constControl.GetImplementation(); + (void)controlImpl; // Avoid unused warning + tet_result(TET_PASS); + } + catch (DaliException &exception) + { + tet_result(TET_FAIL); + } + } + END_TEST; +} + +int UtcDaliControlSignalConnectDisconnect(void) +{ + ToolkitTestApplication application; + + { + DummyControl dummy = DummyControlImpl::New(); + + Actor actor = Actor::New(); + DALI_TEST_EQUALS( actor.SetSizeSignal().GetConnectionCount(), 0u, TEST_LOCATION ); + actor.SetSizeSignal().Connect( &dummy, &DummyControl::CustomSlot1 ); + DALI_TEST_EQUALS( actor.SetSizeSignal().GetConnectionCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS( dummy.mCustomSlot1Called, false, TEST_LOCATION ); + DALI_TEST_EQUALS( dummy.mCustomSlot1Value, Vector3::ZERO, TEST_LOCATION ); + + const Vector3 newSize( 10, 10, 0 ); + actor.SetSize( newSize ); + DALI_TEST_EQUALS( dummy.mCustomSlot1Called, true, TEST_LOCATION ); + DALI_TEST_EQUALS( dummy.mCustomSlot1Value, newSize, TEST_LOCATION ); + + dummy.mCustomSlot1Called = false; + actor.SetSizeSignal().Disconnect( &dummy, &DummyControl::CustomSlot1 ); + DALI_TEST_EQUALS( actor.SetSizeSignal().GetConnectionCount(), 0u, TEST_LOCATION ); + const Vector3 ignoredSize( 20, 20, 0 ); + actor.SetSize( ignoredSize ); + DALI_TEST_EQUALS( dummy.mCustomSlot1Called, false, TEST_LOCATION ); + DALI_TEST_EQUALS( dummy.mCustomSlot1Value, newSize/*not ignoredSize*/, TEST_LOCATION ); + } + END_TEST; +} + +int UtcDaliControlSignalAutomaticDisconnect(void) +{ + ToolkitTestApplication application; + + Actor actor = Actor::New(); + + { + DummyControl dummy = DummyControlImpl::New(); + + actor.SetSizeSignal().Connect( &dummy, &DummyControl::CustomSlot1 ); + DALI_TEST_EQUALS( actor.SetSizeSignal().GetConnectionCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS( dummy.mCustomSlot1Called, false, TEST_LOCATION ); + DALI_TEST_EQUALS( dummy.mCustomSlot1Value, Vector3::ZERO, TEST_LOCATION ); + + const Vector3 newSize( 10, 10, 0 ); + actor.SetSize( newSize ); + DALI_TEST_EQUALS( dummy.mCustomSlot1Called, true, TEST_LOCATION ); + DALI_TEST_EQUALS( dummy.mCustomSlot1Value, newSize, TEST_LOCATION ); + } + // dummyControl automatically disconnects + + DALI_TEST_EQUALS( actor.SetSizeSignal().GetConnectionCount(), 0u, TEST_LOCATION ); + + const Vector3 ignoredSize( 20, 20, 0 ); + actor.SetSize( ignoredSize ); + END_TEST; +} + +int UtcDaliControlTestParameters(void) +{ + ToolkitTestApplication application; + DummyControl test = DummyControl::New(); + + Vector3 maxSize = test.GetNaturalSize(); + Vector3 minSize = maxSize / 2.0f; + + Toolkit::Control::SizePolicy widthPolicy( Control::Fixed ); + Toolkit::Control::SizePolicy heightPolicy( Control::Fixed ); + test.SetSizePolicy( widthPolicy, heightPolicy ); + test.GetSizePolicy( widthPolicy, heightPolicy ); + + DALI_TEST_CHECK( widthPolicy == Control::Fixed && heightPolicy == Control::Fixed ); + + test.SetSize( 0.7f, 0.7f, 0.7f ); + float width = 640.0f; + float height = test.GetHeightForWidth( width ); + DALI_TEST_CHECK( test.GetWidthForHeight( height ) == width ); + + test.SetMinimumSize( minSize ); + DALI_TEST_CHECK( test.GetMinimumSize() == minSize ); + + test.SetMaximumSize( maxSize ); + DALI_TEST_CHECK( test.GetMaximumSize() == maxSize ); + + test.KeyEventSignal(); + DummyControl test2 = DummyControl::New(); + dynamic_cast< ConnectionTrackerInterface& >( test2 ).GetConnectionCount(); + + // Provide coverage for pointer destructor + Control* testControlPtr = new Control; + DALI_TEST_CHECK( testControlPtr ); + delete testControlPtr; + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp new file mode 100644 index 0000000..5152b05 --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp @@ -0,0 +1,734 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include + +// Need to override adaptor classes for toolkit test harness, so include +// test harness headers before dali headers. +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "dummy-control.h" + +using namespace Dali; +using namespace Dali::Toolkit; + +void utc_dali_toolkit_control_impl_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_toolkit_control_impl_cleanup(void) +{ + test_return_value = TET_PASS; +} + +int UtcDaliControlImplNew(void) +{ + ToolkitTestApplication application; // Exceptions require ToolkitTestApplication + + Control control; + + DALI_TEST_CHECK( !Control::DownCast(control) ); + + control = ControlImpl::New(); + + DALI_TEST_CHECK( Control::DownCast(control) ); + END_TEST; +} + + +int UtcDaliControlImplEnableGestureDetector(void) +{ + ToolkitTestApplication application; + + // Enable individually + { + DummyControl dummy = DummyControl::New(); + DummyControlImpl& dummyImpl = static_cast(dummy.GetImplementation()); + + DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() ); + dummyImpl.EnableGestureDetection(Gesture::Pinch); + DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() ); + + DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() ); + dummyImpl.EnableGestureDetection(Gesture::Pan); + DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() ); + + DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() ); + dummyImpl.EnableGestureDetection(Gesture::Tap); + DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() ); + + DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() ); + dummyImpl.EnableGestureDetection(Gesture::LongPress); + DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() ); + } + + // Enable All + { + DummyControl dummy = DummyControl::New(); + DummyControlImpl& dummyImpl = static_cast(dummy.GetImplementation()); + + DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() ); + DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() ); + DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() ); + DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() ); + + dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) ); + + DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() ); + DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() ); + DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() ); + DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() ); + + // Enable when already enabled + + dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) ); + + DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() ); + DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() ); + DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() ); + DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() ); + } + END_TEST; +} + +int UtcDaliControlImplDisableGestureDetector(void) +{ + ToolkitTestApplication application; + + // Disable individually + { + DummyControl dummy = DummyControl::New(); + DummyControlImpl& dummyImpl = static_cast(dummy.GetImplementation()); + + dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) ); + + DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() ); + dummyImpl.DisableGestureDetection(Gesture::Pinch); + DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() ); + + DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() ); + dummyImpl.DisableGestureDetection(Gesture::Pan); + DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() ); + + DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() ); + dummyImpl.DisableGestureDetection(Gesture::Tap); + DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() ); + + DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() ); + dummyImpl.DisableGestureDetection(Gesture::LongPress); + DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() ); + } + + // Disable All + { + DummyControl dummy = DummyControl::New(); + DummyControlImpl& dummyImpl = static_cast(dummy.GetImplementation()); + + dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) ); + + DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() ); + DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() ); + DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() ); + DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() ); + + dummyImpl.DisableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) ); + + DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() ); + DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() ); + DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() ); + DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() ); + } + + // Disable When not enabled + { + DummyControl dummy = DummyControl::New(); + DummyControlImpl& dummyImpl = static_cast(dummy.GetImplementation()); + + DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() ); + DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() ); + DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() ); + DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() ); + + dummyImpl.DisableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) ); + + DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() ); + DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() ); + DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() ); + DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() ); + } + + // Ensure control is detached if gesture detector is not deleted + { + DummyControl dummy = DummyControl::New(); + DummyControlImpl& dummyImpl = static_cast(dummy.GetImplementation()); + + dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) ); + + PinchGestureDetector pinch = dummyImpl.GetPinchGestureDetector(); + PanGestureDetector pan = dummyImpl.GetPanGestureDetector(); + TapGestureDetector tap = dummyImpl.GetTapGestureDetector(); + LongPressGestureDetector longPress = dummyImpl.GetLongPressGestureDetector(); + + DALI_TEST_EQUALS( pinch.GetAttachedActors().empty(), false, TEST_LOCATION ); + DALI_TEST_EQUALS( pan.GetAttachedActors().empty(), false, TEST_LOCATION ); + DALI_TEST_EQUALS( tap.GetAttachedActors().empty(), false, TEST_LOCATION ); + DALI_TEST_EQUALS( longPress.GetAttachedActors().empty(), false, TEST_LOCATION ); + + dummyImpl.DisableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) ); + + DALI_TEST_EQUALS( pinch.GetAttachedActors().empty(), true, TEST_LOCATION ); + DALI_TEST_EQUALS( pan.GetAttachedActors().empty(), true, TEST_LOCATION ); + DALI_TEST_EQUALS( tap.GetAttachedActors().empty(), true, TEST_LOCATION ); + DALI_TEST_EQUALS( longPress.GetAttachedActors().empty(), true, TEST_LOCATION ); + } + END_TEST; +} + +int UtcDaliControlImplOnGestureMethods(void) +{ + ToolkitTestApplication application; + + // Check gesture actually happens + { + DummyControl dummy = DummyControl::New(true); + dummy.SetSize( Vector3(100.0f, 100.0f, 100.0f) ); + + dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); + Stage::GetCurrent().Add(dummy); + + // Render and notify a couple of times + application.SendNotification(); + application.Render(); + application.SendNotification(); + application.Render(); + + DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation()); + dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) ); + + DALI_TEST_CHECK( dummyImpl.pinchCalled == false ); + Integration::PinchGestureEvent pinch(Gesture::Started); + pinch.scale = 10.0f; + pinch.speed = 50.0f; + pinch.centerPoint = Vector2(20.0f, 20.0f); + application.ProcessEvent(pinch); + DALI_TEST_CHECK( dummyImpl.pinchCalled == true ); + + DALI_TEST_CHECK( dummyImpl.panCalled == false ); + Integration::PanGestureEvent pan(Gesture::Possible); + pan.previousPosition = Vector2(10.0f, 20.0f); + pan.currentPosition = Vector2(20.0f, 20.0f); + pan.timeDelta = 10; + pan.numberOfTouches = 1u; + application.ProcessEvent(pan); + pan.state = Gesture::Started; + application.ProcessEvent(pan); + DALI_TEST_CHECK( dummyImpl.panCalled == true ); + + DALI_TEST_CHECK( dummyImpl.tapCalled == false ); + Integration::TapGestureEvent tap(Gesture::Possible); + tap.numberOfTaps = 1u; + tap.numberOfTouches = 1u; + tap.point = Vector2(50.0f, 50.0f); + application.ProcessEvent(tap); + tap.state = Gesture::Started; + application.ProcessEvent(tap); + DALI_TEST_CHECK( dummyImpl.tapCalled == true ); + + DALI_TEST_CHECK( dummyImpl.longPressCalled == false ); + Integration::LongPressGestureEvent longPress(Gesture::Possible); + longPress.numberOfTouches = 1u; + longPress.point = Vector2(50.0f, 50.0f); + application.ProcessEvent(longPress); + longPress.state = Gesture::Started; + application.ProcessEvent(longPress); + DALI_TEST_CHECK( dummyImpl.longPressCalled == true ); + longPress.state = Gesture::Finished; + application.ProcessEvent(longPress); + + Stage::GetCurrent().Remove(dummy); + } + + // Ensure full code coverage + { + DummyControl dummy = DummyControl::New(); + dummy.SetSize( Vector3(100.0f, 100.0f, 100.0f) ); + + dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); + Stage::GetCurrent().Add(dummy); + + // Render and notify a couple of times + application.SendNotification(); + application.Render(); + application.SendNotification(); + application.Render(); + + DummyControlImpl& dummyImpl = static_cast(dummy.GetImplementation()); + dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) ); + + DALI_TEST_CHECK( dummy.GetCurrentScale().x != 10.0f ); + Integration::PinchGestureEvent pinch(Gesture::Started); + pinch.scale = 10.0f; + pinch.speed = 50.0f; + pinch.centerPoint = Vector2(20.0f, 20.0f); + application.ProcessEvent(pinch); + + // Render and notify a couple of times + application.SendNotification(); + application.Render(); + application.SendNotification(); + application.Render(); + DALI_TEST_CHECK( dummy.GetCurrentScale().x == 10.0f ); + + Integration::PanGestureEvent pan(Gesture::Possible); + pan.previousPosition = Vector2(10.0f, 20.0f); + pan.currentPosition = Vector2(20.0f, 20.0f); + pan.timeDelta = 10; + pan.numberOfTouches = 1u; + application.ProcessEvent(pan); + pan.state = Gesture::Started; + application.ProcessEvent(pan); + + Integration::TapGestureEvent tap(Gesture::Possible); + tap.numberOfTaps = 1u; + tap.numberOfTouches = 1u; + tap.point = Vector2(50.0f, 50.0f); + application.ProcessEvent(tap); + tap.state = Gesture::Started; + application.ProcessEvent(tap); + + Integration::LongPressGestureEvent longPress(Gesture::Possible); + longPress.numberOfTouches = 1u; + longPress.point = Vector2(50.0f, 50.0f); + application.ProcessEvent(longPress); + longPress.state = Gesture::Started; + application.ProcessEvent(longPress); + longPress.state = Gesture::Finished; + application.ProcessEvent(longPress); + + Stage::GetCurrent().Remove(dummy); + } + END_TEST; +} + +int UtcDaliControlImplChildAddAndRemove(void) +{ + ToolkitTestApplication application; + + { + DummyControl dummy = DummyControl::New( true ); + Stage::GetCurrent().Add(dummy); + DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation()); + + application.Render(); + application.SendNotification(); + + DALI_TEST_EQUALS( dummyImpl.childAddCalled, false, TEST_LOCATION ); + DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION ); + Actor actor = RenderableActor::New(); + dummy.Add(actor); + DALI_TEST_EQUALS( dummyImpl.childAddCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS( dummy.GetChildCount(), 1u, TEST_LOCATION ); + + application.Render(); + application.SendNotification(); + + DALI_TEST_EQUALS( dummyImpl.childRemoveCalled, false, TEST_LOCATION ); + dummy.Remove( actor ); + DALI_TEST_EQUALS( dummyImpl.childRemoveCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION ); + + application.Render(); + application.SendNotification(); + + Stage::GetCurrent().Remove(dummy); + } + + // Ensure full code coverage + { + DummyControl dummy = DummyControl::New(); + Stage::GetCurrent().Add(dummy); + + application.Render(); + application.SendNotification(); + + DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION ); + Actor actor = RenderableActor::New(); + dummy.Add(actor); + DALI_TEST_EQUALS( dummy.GetChildCount(), 1u, TEST_LOCATION ); + + application.Render(); + application.SendNotification(); + + dummy.Remove( actor ); + DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION ); + + application.Render(); + application.SendNotification(); + + Stage::GetCurrent().Remove(dummy); + } + END_TEST; +} + +int UtcDaliControlImplStageConnection(void) +{ + ToolkitTestApplication application; + + { + DummyControl dummy = DummyControl::New( true ); + DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation()); + + DALI_TEST_EQUALS( dummyImpl.stageConnectionCalled, false, TEST_LOCATION ); + Stage::GetCurrent().Add(dummy); + application.Render(); + application.SendNotification(); + DALI_TEST_EQUALS( dummyImpl.stageConnectionCalled, true, TEST_LOCATION ); + + DALI_TEST_EQUALS( dummyImpl.stageDisconnectionCalled, false, TEST_LOCATION ); + Stage::GetCurrent().Remove(dummy); + application.Render(); + application.SendNotification(); + DALI_TEST_EQUALS( dummyImpl.stageDisconnectionCalled, true, TEST_LOCATION ); + } + + // Ensure full code coverage + { + unsigned int stageChildren = Stage::GetCurrent().GetLayer(0).GetChildCount(); + DummyControl dummy = DummyControl::New(); + + DALI_TEST_EQUALS( Stage::GetCurrent().GetLayer(0).GetChildCount(), stageChildren, TEST_LOCATION ); + Stage::GetCurrent().Add(dummy); + application.Render(); + application.SendNotification(); + DALI_TEST_EQUALS( Stage::GetCurrent().GetLayer(0).GetChildCount(), stageChildren + 1, TEST_LOCATION ); + + Stage::GetCurrent().Remove(dummy); + application.Render(); + application.SendNotification(); + DALI_TEST_EQUALS( Stage::GetCurrent().GetLayer(0).GetChildCount(), stageChildren, TEST_LOCATION ); + } + END_TEST; +} + +int UtcDaliControlImplSizeSet(void) +{ + ToolkitTestApplication application; + + { + DummyControl dummy = DummyControl::New( true ); + DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation()); + + Stage::GetCurrent().Add(dummy); + application.Render(); + application.SendNotification(); + + DALI_TEST_EQUALS( dummyImpl.sizeSetCalled, false, TEST_LOCATION ); + Vector3 size(100.0f, 200.0f, 0.0f); + dummy.SetSize(size); + + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + + DALI_TEST_EQUALS(size, dummy.GetCurrentSize(), TEST_LOCATION); + DALI_TEST_EQUALS( dummyImpl.sizeSetCalled, true, TEST_LOCATION ); + + Stage::GetCurrent().Remove(dummy); + } + + // Ensure full code coverage + { + DummyControl dummy = DummyControl::New(); + Stage::GetCurrent().Add(dummy); + + Vector3 size(100.0f, 200.0f, 0.0f); + DALI_TEST_CHECK( size != dummy.GetCurrentSize() ); + + application.Render(); + application.SendNotification(); + + dummy.SetSize(size); + + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + + DALI_TEST_EQUALS(size, dummy.GetCurrentSize(), TEST_LOCATION); + + Stage::GetCurrent().Remove(dummy); + } + END_TEST; +} + +int UtcDaliControlImplSizeAnimation(void) +{ + ToolkitTestApplication application; + + { + DummyControl dummy = DummyControl::New( true ); + DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation()); + + Stage::GetCurrent().Add(dummy); + + DALI_TEST_EQUALS( dummyImpl.sizeAnimationCalled, false, TEST_LOCATION ); + Animation animation = Animation::New(1.0f); + animation.Resize(dummy, Vector3(100.0f, 150.0f, 200.0f)); + animation.Play(); + + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + + DALI_TEST_EQUALS( dummyImpl.sizeAnimationCalled, true, TEST_LOCATION ); + + Stage::GetCurrent().Remove(dummy); + } + + // Ensure full code coverage + { + DummyControl dummy = DummyControl::New(); + + Stage::GetCurrent().Add(dummy); + + Animation animation = Animation::New(1.0f); + animation.Resize(dummy, Vector3(100.0f, 150.0f, 200.0f)); + animation.Play(); + + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + + Stage::GetCurrent().Remove(dummy); + } + END_TEST; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////// + +int UtcDaliControlImplTouchEvent(void) +{ + ToolkitTestApplication application; + + { + DummyControl dummy = DummyControl::New( true ); + DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation()); + + dummy.SetSize(100.0f, 100.0f); + dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); + Stage::GetCurrent().Add(dummy); + + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + + DALI_TEST_EQUALS( dummyImpl.touchEventCalled, false, TEST_LOCATION ); + Integration::TouchEvent touchEvent(1); + TouchPoint point(1, TouchPoint::Down, 20.0f, 20.0f); + touchEvent.AddPoint(point); + application.ProcessEvent(touchEvent); + DALI_TEST_EQUALS( dummyImpl.touchEventCalled, true, TEST_LOCATION ); + + Stage::GetCurrent().Remove(dummy); + } + + // Ensure full code coverage + { + DummyControl dummy = DummyControl::New(); + + dummy.SetSize(100.0f, 100.0f); + dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); + Stage::GetCurrent().Add(dummy); + + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + + Integration::TouchEvent touchEvent(1); + TouchPoint point(1, TouchPoint::Down, 20.0f, 20.0f); + touchEvent.AddPoint(point); + application.ProcessEvent(touchEvent); + + Stage::GetCurrent().Remove(dummy); + } + END_TEST; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////// + + +int UtcDaliControlImplKeyEvent(void) +{ + ToolkitTestApplication application; + + { + DummyControl dummy = DummyControl::New( true ); + DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation()); + + Stage::GetCurrent().Add(dummy); + dummy.SetKeyInputFocus(); + + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + + DALI_TEST_EQUALS( dummyImpl.keyEventCalled, false, TEST_LOCATION ); + Integration::KeyEvent keyEvent; + application.ProcessEvent(keyEvent); + DALI_TEST_EQUALS( dummyImpl.keyEventCalled, true, TEST_LOCATION ); + + Stage::GetCurrent().Remove(dummy); + } + + // Ensure full code coverage + { + DummyControl dummy = DummyControl::New(); + + Stage::GetCurrent().Add(dummy); + dummy.SetKeyInputFocus(); + + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + + Integration::KeyEvent keyEvent; + application.ProcessEvent(keyEvent); + + Stage::GetCurrent().Remove(dummy); + } + END_TEST; +} + +int UtcDaliControlImplStyleChange(void) +{ + ToolkitTestApplication application; + + DummyControl dummy = DummyControl::New( true ); + DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation()); + + Stage::GetCurrent().Add(dummy); + + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + + // Add a Control and normal Actor as children + DummyControl dummyChild = DummyControl::New(); + dummy.Add(dummyChild); + + Actor actor = Actor::New(); + dummy.Add(actor); + + DALI_TEST_EQUALS( dummyImpl.styleChangeCalled, false, TEST_LOCATION ); + StyleChange styleChange; + styleChange.defaultFontChange = true; + Dali::StyleMonitor styleMonitor = application.GetAdaptor().GetToolkitStyleMonitor(); + styleMonitor.EmitStyleChangeSignal(styleChange); + + DALI_TEST_EQUALS( dummyImpl.styleChangeCalled, true, TEST_LOCATION ); + + Stage::GetCurrent().Remove(dummy); + END_TEST; +} + +int UtcDaliControlImplKeyInputFocusGained(void) +{ + ToolkitTestApplication application; + + { + DummyControl dummy = DummyControl::New( true ); + DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation()); + + Stage::GetCurrent().Add(dummy); + + DALI_TEST_EQUALS( dummyImpl.keyInputFocusGained, false, TEST_LOCATION ); + + dummy.SetKeyInputFocus(); + + DALI_TEST_EQUALS( dummyImpl.keyInputFocusGained, true, TEST_LOCATION ); + + Stage::GetCurrent().Remove(dummy); + } + + // Ensure full code coverage + { + DummyControl dummy = DummyControl::New(); + + Stage::GetCurrent().Add(dummy); + dummy.SetKeyInputFocus(); + Stage::GetCurrent().Remove(dummy); + } + END_TEST; +} + +int UtcDaliControlImplKeyInputFocusLost(void) +{ + ToolkitTestApplication application; + + { + DummyControl dummy = DummyControl::New( true ); + DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation()); + + Stage::GetCurrent().Add(dummy); + + DALI_TEST_EQUALS( dummyImpl.keyInputFocusLost, false, TEST_LOCATION ); + + dummy.SetKeyInputFocus(); + dummy.ClearKeyInputFocus(); + + DALI_TEST_EQUALS( dummyImpl.keyInputFocusLost, true, TEST_LOCATION ); + + Stage::GetCurrent().Remove(dummy); + } + + // Ensure full code coverage + { + DummyControl dummy = DummyControl::New(); + + Stage::GetCurrent().Add(dummy); + dummy.SetKeyInputFocus(); + dummy.ClearKeyInputFocus(); + + DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation()); + + dummyImpl.OnAccessibilityValueChange( true ); + dummyImpl.IsKeyboardNavigationSupported(); + dummyImpl.IsKeyboardFocusGroup(); + + Stage::GetCurrent().Remove(dummy); + } + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-DefaultControls.cpp b/automated-tests/src/dali-toolkit/utc-Dali-DefaultControls.cpp new file mode 100644 index 0000000..a5c9a0b --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-DefaultControls.cpp @@ -0,0 +1,142 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include + +// Need to override adaptor classes for toolkit test harness, so include +// test harness headers before dali headers. +#include + +#include +#include + +using namespace Dali; +using namespace Toolkit; + +void utc_dali_toolkit_default_controls_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_toolkit_default_controls_cleanup(void) +{ + test_return_value = TET_PASS; +} + +int UtcDaliDefaultControlsCreateSolidColorActor(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliDefaultControlsCreateSolidColorActor"); + + ImageActor image1 = CreateSolidColorActor( Color::RED ); + ImageActor image2 = CreateSolidColorActor( Color::RED, true, Color::BLUE, 2 ); + ImageActor image3 = CreateSolidColorActor( Color::RED, true, Color::BLUE, 12 ); + + DALI_TEST_CHECK(image1); + DALI_TEST_CHECK(image2); + DALI_TEST_CHECK(!image3); + END_TEST; +} + +int UtcDaliDefaultControlsCreatePushButton(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliDefaultControlsCreatePushButton"); + + const std::string imagePath( "Facke image path" ); + const std::string voidImagePath( "" ); + + ImageActor image = CreateSolidColorActor( Color::RED ); + ImageActor voidImage; + + PushButton button0, button1, button2, button3, button4, button5, button6; + + try + { + button0 = CreatePushButton( voidImagePath, voidImagePath, voidImagePath, voidImagePath, voidImagePath ); + button1 = CreatePushButton( imagePath, voidImagePath, voidImagePath, voidImagePath, voidImagePath ); + button2 = CreatePushButton( voidImagePath, imagePath, voidImagePath, voidImagePath, voidImagePath ); + button3 = CreatePushButton( voidImagePath, voidImagePath, imagePath, voidImagePath, voidImagePath ); + button4 = CreatePushButton( voidImagePath, voidImagePath, voidImagePath, imagePath, voidImagePath ); + button5 = CreatePushButton( voidImagePath, voidImagePath, voidImagePath, voidImagePath, imagePath ); + button6 = CreatePushButton( imagePath, imagePath, imagePath, imagePath, imagePath ); + } + catch( ... ) + { + tet_result( TET_FAIL ); + } + + DALI_TEST_CHECK( button0 ); + DALI_TEST_CHECK( button1 ); + DALI_TEST_CHECK( button2 ); + DALI_TEST_CHECK( button3 ); + DALI_TEST_CHECK( button4 ); + DALI_TEST_CHECK( button5 ); + DALI_TEST_CHECK( button6 ); + + try + { + button0 = CreatePushButton( voidImage, voidImage, voidImage, voidImage, voidImage ); + button1 = CreatePushButton( image, voidImage, voidImage, voidImage, voidImage ); + button2 = CreatePushButton( voidImage, image, voidImage, voidImage, voidImage ); + button3 = CreatePushButton( voidImage, voidImage, image, voidImage, voidImage ); + button4 = CreatePushButton( voidImage, voidImage, voidImage, image, voidImage ); + button5 = CreatePushButton( voidImage, voidImage, voidImage, voidImage, image ); + button6 = CreatePushButton( image, image, image, image, image ); + } + catch( ... ) + { + tet_result( TET_FAIL ); + } + + DALI_TEST_CHECK( button0 ); + DALI_TEST_CHECK( button1 ); + DALI_TEST_CHECK( button2 ); + DALI_TEST_CHECK( button3 ); + DALI_TEST_CHECK( button4 ); + DALI_TEST_CHECK( button5 ); + DALI_TEST_CHECK( button6 ); + + try + { + button0 = CreatePushButton( voidImagePath ); + button1 = CreatePushButton( imagePath ); + } + catch( ... ) + { + tet_result( TET_FAIL ); + } + + DALI_TEST_CHECK( button0 ); + DALI_TEST_CHECK( button1 ); + + try + { + button0 = CreatePushButton( voidImage ); + button1 = CreatePushButton( image ); + } + catch( ... ) + { + tet_result( TET_FAIL ); + } + + DALI_TEST_CHECK( button0 ); + DALI_TEST_CHECK( button1 ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-DissolveEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-DissolveEffect.cpp new file mode 100644 index 0000000..799bad1 --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-DissolveEffect.cpp @@ -0,0 +1,153 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include + +// Need to override adaptor classes for toolkit test harness, so include +// test harness headers before dali headers. +#include + +#include +#include + + +using namespace Dali; + +void utc_dali_toolkit_dissolve_effect_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_toolkit_dissolve_effect_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +int UtcDaliDissolveUninitializedEffect(void) +{ + ToolkitTestApplication application; + + Toolkit::DissolveEffect effect; + + try + { + // New() must be called to create a DissolveEffect or it wont be valid. + effect.SetDistortion( 2.0f ); + DALI_TEST_CHECK( false ); + } + catch (Dali::DaliException& e) + { + // Tests that a negative test of an assertion succeeds + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_CHECK(!effect); + } + END_TEST; +} + +int UtcDaliDissolvePropertyNamesEffect(void) +{ + ToolkitTestApplication application; + + Toolkit::DissolveEffect effectHighPrecision = Toolkit::DissolveEffect::New(); + Toolkit::DissolveEffect effectMediumPrecision = Toolkit::DissolveEffect::New( false ); + + // Check the names, this names are used in the shaders code, + // if they change the shader code has to be updated + DALI_TEST_EQUALS( effectHighPrecision.GetDistortionPropertyName(), "uPercentage", TEST_LOCATION ); + DALI_TEST_EQUALS( effectMediumPrecision.GetDistortionPropertyName(), "uPercentage", TEST_LOCATION ); + END_TEST; +} + +int UtcDaliDissolveDefaultValuesEffect(void) +{ + ToolkitTestApplication application; + + Toolkit::DissolveEffect effect = Toolkit::DissolveEffect::New(); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + actor.SetShaderEffect( effect ); + effect.SetCentralLine( Vector2(0.0,0.5), Vector2(1.0, -0.1) ); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + Property::Index index = effect.GetPropertyIndex( effect.GetDistortionPropertyName()); + float value; + (effect.GetProperty(index)).Get( value ); + DALI_TEST_EQUALS(value, 0.f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliDissolveCustomValuesEffect(void) +{ + ToolkitTestApplication application; + + Toolkit::DissolveEffect effect = Toolkit::DissolveEffect::New(); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + + effect.SetDistortion( 0.5f ); + + actor.SetShaderEffect(effect); + Stage::GetCurrent().Add(actor); + + application.SendNotification(); + application.Render(); + + Property::Index index = effect.GetPropertyIndex( effect.GetDistortionPropertyName()); + float value; + (effect.GetProperty(index)).Get( value ); + DALI_TEST_EQUALS(value, 0.5f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliSetEffectImageEffect(void) +{ + ToolkitTestApplication application; + + Toolkit::DissolveEffect effect = Toolkit::DissolveEffect::New(); + DALI_TEST_CHECK( effect ); + + Image effectImage = CreateBitmapImage(); + effect.SetEffectImage(effectImage); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + Property::Index index = effect.GetPropertyIndex( effect.GetDistortionPropertyName()); + float value; + (effect.GetProperty(index)).Get( value ); + DALI_TEST_EQUALS(value, 0.f, TEST_LOCATION ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-FocusManager.cpp b/automated-tests/src/dali-toolkit/utc-Dali-FocusManager.cpp new file mode 100644 index 0000000..c9fc767 --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-FocusManager.cpp @@ -0,0 +1,1053 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include + +// Need to override adaptor classes for toolkit test harness, so include +// test harness headers before dali headers. +#include + +#include +#include + +using namespace Dali; +using namespace Toolkit; + + +void utc_dali_toolkit_focus_manager_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_toolkit_focus_manager_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +namespace +{ + +static bool gObjectCreatedCallBackCalled; + +static void TestCallback(BaseHandle handle) +{ + gObjectCreatedCallBackCalled = true; +} + +// Functors to test whether focus changed signal is emitted when the 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; +}; + +// Functors to test whether focus overshot signal is emitted when there is no way to move focus further. +class FocusOvershotCallback : public Dali::ConnectionTracker +{ +public: + FocusOvershotCallback(bool& signalReceived) + : mSignalVerified(signalReceived), + mCurrentFocusedActor(), + mFocusOvershotDirection(Toolkit::FocusManager::OVERSHOT_NEXT) + { + } + + void Callback(Actor currentFocusedActor, Toolkit::FocusManager::FocusOvershotDirection direction) + { + tet_infoline("Verifying FocusOvershotCallback()"); + + if(currentFocusedActor == mCurrentFocusedActor && direction == mFocusOvershotDirection) + { + mSignalVerified = true; + } + } + + void Reset() + { + mSignalVerified = false; + } + + bool& mSignalVerified; + Actor mCurrentFocusedActor; + Toolkit::FocusManager::FocusOvershotDirection mFocusOvershotDirection; +}; + +} // namespace + + +int UtcDaliFocusManagerGet(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliFocusManagerGet"); + + FocusManager manager; + + //Ensure object is created by checking if it's registered + ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + DALI_TEST_CHECK(registry); + + gObjectCreatedCallBackCalled = false; + registry.ObjectCreatedSignal().Connect( &TestCallback ); + { + manager = FocusManager::Get(); + DALI_TEST_CHECK(manager); + } + DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + + FocusManager newManager = FocusManager::Get(); + DALI_TEST_CHECK(newManager); + + // Check that focus manager is a singleton + DALI_TEST_CHECK(manager == newManager); + END_TEST; +} + +int UtcDaliFocusManagerSetAndGetAccessibilityAttribute(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliFocusManagerSetAndGetAccessibilityAttribute"); + + FocusManager manager = FocusManager::Get(); + DALI_TEST_CHECK(manager); + + Actor actor = Actor::New(); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, FocusManager::ACCESSIBILITY_LABEL) == ""); + + manager.SetAccessibilityAttribute(actor, FocusManager::ACCESSIBILITY_LABEL, "Description"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, FocusManager::ACCESSIBILITY_LABEL) == "Description"); + + manager.SetAccessibilityAttribute(actor, FocusManager::ACCESSIBILITY_LABEL, "New description"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, FocusManager::ACCESSIBILITY_LABEL) == "New description"); + END_TEST; +} + +int UtcDaliFocusManagerSetAndGetFocusOrder(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliFocusManagerSetAndGetFocusOrder"); + + FocusManager manager = FocusManager::Get(); + DALI_TEST_CHECK(manager); + + Actor first = Actor::New(); + Actor second = Actor::New(); + DALI_TEST_CHECK(manager.GetFocusOrder(first) == 0); + DALI_TEST_CHECK(manager.GetFocusOrder(second) == 0); + + // Set the focus order and description for the first actor + manager.SetFocusOrder(first, 1); + manager.SetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL, "first"); + DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL) == "first"); + + // Set the focus order and description for the second actor + manager.SetFocusOrder(second, 2); + manager.SetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL, "second"); + DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second"); + + // check that the focus order of the first actor is changed + manager.SetFocusOrder(first, 2); + DALI_TEST_CHECK(manager.GetFocusOrder(first) == 2); + // make sure the change of focus order doesn't affect the actor's description + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL) == "first"); + + // check that the focus order of the second actor is increased to 3 + DALI_TEST_CHECK(manager.GetFocusOrder(second) == 3); + // make sure the change of focus order doesn't affect the actor's description + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second"); + + // check that the focus order of the second actor is changed to 1 + manager.SetFocusOrder(second, 1); + DALI_TEST_CHECK(manager.GetFocusOrder(second) == 1); + // make sure the change of focus order doesn't affect the actor's description + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second"); + + // Set the focus order and description for the third actor + Actor third = Actor::New(); + manager.SetFocusOrder(third, 1); + manager.SetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL, "third"); + DALI_TEST_CHECK(manager.GetFocusOrder(third) == 1); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL) == "third"); + + // check that the focus order of the second actor is increased to 2. + DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2); + // make sure the change of focus order doesn't affect the actor's description + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second"); + + // check that the focus order of the first actor is increased to 3. + DALI_TEST_CHECK(manager.GetFocusOrder(first) == 3); + // make sure the change of focus order doesn't affect the actor's description + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL) == "first"); + END_TEST; +} + +int UtcDaliFocusManagerGenerateNewFocusOrder(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliFocusManagerGenerateNewFocusOrder"); + + FocusManager manager = FocusManager::Get(); + DALI_TEST_CHECK(manager); + + DALI_TEST_CHECK(1 == manager.GenerateNewFocusOrder()); + DALI_TEST_CHECK(1 == manager.GenerateNewFocusOrder()); + + Actor first = Actor::New(); + Actor second = Actor::New(); + + // Set the focus order for the first actor + manager.SetFocusOrder(first, 1); + manager.SetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL, "first"); + DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1); + + //Test for new focus order + DALI_TEST_CHECK(2 == manager.GenerateNewFocusOrder()); + + // Set the focus order for the first actor + manager.SetFocusOrder(second, 2); + manager.SetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL, "first"); + DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2); + END_TEST; +} + +int UtcDaliFocusManagerGetActorByFocusOrder(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliFocusManagerGetActorByFocusOrder"); + + FocusManager manager = FocusManager::Get(); + DALI_TEST_CHECK(manager); + + // Create the actors and set their focus orders + Actor first = Actor::New(); + manager.SetFocusOrder(first, 1); + + Actor second = Actor::New(); + manager.SetFocusOrder(second, 2); + + Actor third = Actor::New(); + manager.SetFocusOrder(third, 3); + + // Check that we get an empty handle as no actor is added to the stage yet. + DALI_TEST_CHECK(manager.GetActorByFocusOrder(1) == Actor()); + DALI_TEST_CHECK(manager.GetActorByFocusOrder(2) == Actor()); + DALI_TEST_CHECK(manager.GetActorByFocusOrder(3) == Actor()); + + // Add the actors to the stage + Stage::GetCurrent().Add(first); + Stage::GetCurrent().Add(second); + Stage::GetCurrent().Add(third); + + // Check that we get an empty handle because focus order 0 means undefined. + DALI_TEST_CHECK(manager.GetActorByFocusOrder(0) == Actor()); + + // Check that we get correct actors for the specified focus orders + DALI_TEST_CHECK(manager.GetActorByFocusOrder(1) == first); + DALI_TEST_CHECK(manager.GetActorByFocusOrder(2) == second); + DALI_TEST_CHECK(manager.GetActorByFocusOrder(3) == third); + + // Change the focus order of the third actor to 1 + manager.SetFocusOrder(third, 1); + + // Check that we still get correct actors after changing their focus orders + DALI_TEST_CHECK(manager.GetActorByFocusOrder(1) == third); + DALI_TEST_CHECK(manager.GetActorByFocusOrder(2) == first); + DALI_TEST_CHECK(manager.GetActorByFocusOrder(3) == second); + + // Check that we get an empty handle because no actor has a focus order of 4 + DALI_TEST_CHECK(manager.GetActorByFocusOrder(4) == Actor()); + END_TEST; +} + +int UtcDaliFocusManagerSetAndGetCurrentFocusActor(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliFocusManagerSetAndGetCurrentFocusActor"); + + FocusManager manager = FocusManager::Get(); + DALI_TEST_CHECK(manager); + + // Create the first actor and add it to the stage + Actor first = Actor::New(); + manager.SetFocusOrder(first, 1); + Stage::GetCurrent().Add(first); + + // Create the second actor and add it to the stage + Actor second = Actor::New(); + manager.SetFocusOrder(second, 2); + Stage::GetCurrent().Add(second); + + // Create the third actor but don't add it to the stage + Actor third = Actor::New(); + manager.SetFocusOrder(third, 3); + + // Check that no actor is being focused yet. + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor()); + + // Check that it will fail to set focus on an invalid actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(Actor()) == false); + + // Check that the focus is set on the first actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); + + // Check that the focus is set on the second actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second); + + // Check that it will fail to set focus on the third actor as it's not in the stage + DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false); + + // Add the third actor to the stage + Stage::GetCurrent().Add(third); + + // make the third actor invisible + third.SetVisible(false); + // flush the queue and render once + application.SendNotification(); + application.Render(); + + // Check that it will fail to set focus on the third actor as it's invisible + DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false); + + // Make the third actor visible + third.SetVisible(true); + // flush the queue and render once + application.SendNotification(); + application.Render(); + + // Make the third actor not focusable + Property::Index propertyActorFocusable = third.GetPropertyIndex("focusable"); + third.SetProperty(propertyActorFocusable, false); + // flush the queue and render once + application.SendNotification(); + application.Render(); + + // Check that it will fail to set focus on the third actor as it's not focusable + DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false); + + // Make the third actor focusable + third.SetProperty(propertyActorFocusable, true); + // flush the queue and render once + application.SendNotification(); + application.Render(); + + // Check that the focus is successfully moved to the third actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true); + + // Make the current focused actor to be not focusable by setting its focus order to be 0 + manager.SetFocusOrder(third, 0); + + // Check that the focus is automatically cleared + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor()); + + // Set the focus order of the third actor again + manager.SetFocusOrder(third, 3); + + // Check that the third actor can be focused successfully now + DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true); + END_TEST; +} + +int UtcDaliFocusManagerGetCurrentFocusGroup(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliFocusManagerGetCurrentFocusGroup"); + + FocusManager manager = FocusManager::Get(); + DALI_TEST_CHECK(manager); + + // Create an actor with two child actors and add it to the stage + Actor parent = Actor::New(); + Actor firstChild = Actor::New(); + Actor secondChild = Actor::New(); + parent.Add(firstChild); + parent.Add(secondChild); + Stage::GetCurrent().Add(parent); + + // Create three actors and add them as the children of the first child actor + Actor firstGrandChild = Actor::New(); + Actor secondGrandChild = Actor::New(); + Actor thirdGrandChild = Actor::New(); + firstChild.Add(firstGrandChild); + firstChild.Add(secondGrandChild); + firstChild.Add(thirdGrandChild); + + // Set focus order to the actors + manager.SetFocusOrder(parent, 1); + manager.SetFocusOrder(firstChild, 2); + manager.SetFocusOrder(firstGrandChild, 3); + manager.SetFocusOrder(secondGrandChild, 4); + manager.SetFocusOrder(thirdGrandChild, 5); + manager.SetFocusOrder(secondChild, 6); + + // Set the parent and the first child actor as focus groups + manager.SetFocusGroup(parent, true); + DALI_TEST_CHECK(manager.IsFocusGroup(parent) == true); + + // Set focus to the first grand child actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(firstGrandChild) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild); + + // The current focus group should be the parent, As it is the immediate parent which is also a focus group. + DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == parent); + + manager.SetFocusGroup(firstChild, true); + DALI_TEST_CHECK(manager.IsFocusGroup(firstChild) == true); + + // The current focus group should be the firstChild, As it is the immediate parent which is also a focus group. + DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == firstChild); + + manager.SetFocusGroup(firstGrandChild, true); + DALI_TEST_CHECK(manager.IsFocusGroup(firstGrandChild) == true); + + // The current focus group should be itself, As it is also a focus group. + DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == firstGrandChild); + + // Set focus to the second grand child actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(secondGrandChild) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondGrandChild); + + // The current focus group should be the firstChild, As it is the immediate parent which is also a + // focus group for the current focus actor. + DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == firstChild); + + END_TEST; +} + +int UtcDaliFocusManagerGetCurrentFocusOrder(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliFocusManagerGetCurrentFocusOrder"); + + FocusManager manager = FocusManager::Get(); + DALI_TEST_CHECK(manager); + + Actor first = Actor::New(); + Stage::GetCurrent().Add(first); + + Actor second = Actor::New(); + Stage::GetCurrent().Add(second); + + Actor third = Actor::New(); + Stage::GetCurrent().Add(third); + + // Set the focus order and description for the first actor + manager.SetFocusOrder(first, 1); + manager.SetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL, "first"); + DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL) == "first"); + + // Set the focus order and description for the second actor + manager.SetFocusOrder(second, 2); + manager.SetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL, "second"); + DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second"); + + // Set the focus order and description for the second actor + manager.SetFocusOrder(third, 3); + manager.SetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL, "third"); + DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL) == "third"); + + // Check that no actor is being focused yet. + DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 0); + + // Set the focus on the first actor and test + DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 1); + + // Move the focus forward to the second actor and test + manager.MoveFocusForward(); + DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 2); + + // Move the focus forward to the third actor and test + manager.MoveFocusForward(); + DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 3); + + // Clear focus and test + manager.ClearFocus(); + DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 0); + END_TEST; +} + +int UtcDaliFocusManagerMoveFocusForward(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliFocusManagerMoveFocusForward"); + + FocusManager manager = FocusManager::Get(); + DALI_TEST_CHECK(manager); + + Actor first = Actor::New(); + Stage::GetCurrent().Add(first); + + Actor second = Actor::New(); + Stage::GetCurrent().Add(second); + + Actor third = Actor::New(); + Stage::GetCurrent().Add(third); + + // Set the focus order and description for the first actor + manager.SetFocusOrder(first, 1); + manager.SetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL, "first"); + DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL) == "first"); + + // Set the focus order and description for the second actor + manager.SetFocusOrder(second, 2); + manager.SetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL, "second"); + DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second"); + + // Set the focus order and description for the second actor + manager.SetFocusOrder(third, 3); + manager.SetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL, "third"); + DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL) == "third"); + + // Check that no actor is being focused yet. + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor()); + + // Set the focus on the first actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first"); + + // Test the non-wrapped move first + manager.SetWrapMode(false); + DALI_TEST_CHECK(manager.GetWrapMode() == false); + + // Move the focus forward to the second actor + manager.MoveFocusForward(); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "second"); + + // Move the focus forward to the third actor + manager.MoveFocusForward(); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third"); + + // Check that it will fail to move the focus forward again as the third actor is the last + // focusable actor in the focus chain + manager.MoveFocusForward(); + // The focus should still be set on the third actor + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third"); + + // Now test the wrapped move + manager.SetWrapMode(true); + DALI_TEST_CHECK(manager.GetWrapMode() == true); + + // Move the focus forward recursively and this time the first actor should be focused + manager.MoveFocusForward(); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first"); + + // Make the second actor not focusable + Property::Index propertyActorFocusable = second.GetPropertyIndex("focusable"); + second.SetProperty(propertyActorFocusable, false); + // flush the queue and render once + application.SendNotification(); + application.Render(); + + // Move the focus forward and check that the second actor should be skipped and + // the third actor should be focused now. + manager.MoveFocusForward(); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third"); + + // Make the first actor invisible + first.SetVisible(false); + // flush the queue and render once + application.SendNotification(); + application.Render(); + + // Move the focus forward and check that the first actor should be skipped as it's + // invisible and the second actor should also be skipped as it's not focusable, + // so the focus will still be on the third actor + manager.MoveFocusForward(); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third"); + + // Make the third actor invisible so that no actor can be focused. + third.SetVisible(false); + // flush the queue and render once + application.SendNotification(); + application.Render(); + + // Check that the focus move is failed as all the three actors can not be focused + manager.MoveFocusForward(); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third"); + END_TEST; +} + +int UtcDaliFocusManagerMoveFocusBackward(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliFocusManagerMoveFocusBackward"); + + FocusManager manager = FocusManager::Get(); + DALI_TEST_CHECK(manager); + + Actor first = Actor::New(); + Stage::GetCurrent().Add(first); + + Actor second = Actor::New(); + Stage::GetCurrent().Add(second); + + Actor third = Actor::New(); + Stage::GetCurrent().Add(third); + + // Set the focus order and description for the first actor + manager.SetFocusOrder(first, 1); + manager.SetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL, "first"); + DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL) == "first"); + + // Set the focus order and description for the second actor + manager.SetFocusOrder(second, 2); + manager.SetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL, "second"); + DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second"); + + // Set the focus order and description for the second actor + manager.SetFocusOrder(third, 3); + manager.SetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL, "third"); + DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL) == "third"); + + // Check that no actor is being focused yet. + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor()); + + // Set the focus on the third actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third"); + + // Test the non-wrapped move first + manager.SetWrapMode(false); + DALI_TEST_CHECK(manager.GetWrapMode() == false); + + // Move the focus backward to the second actor + manager.MoveFocusBackward(); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "second"); + + // Move the focus backward to the first actor + manager.MoveFocusBackward(); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first"); + + // Check that it will fail to move the focus backward again as the first actor is the first + // focusable actor in the focus chain + manager.MoveFocusBackward(); + // The focus should still be set on the first actor + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first"); + + // Now test the wrapped move + manager.SetWrapMode(true); + DALI_TEST_CHECK(manager.GetWrapMode() == true); + + // Move the focus backward recursively and this time the third actor should be focused + manager.MoveFocusBackward(); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third"); + + // Make the second actor not focusable + Property::Index propertyActorFocusable = second.GetPropertyIndex("focusable"); + second.SetProperty(propertyActorFocusable, false); + // flush the queue and render once + application.SendNotification(); + application.Render(); + + // Move the focus backward and check that the second actor should be skipped and + // the first actor should be focused now. + manager.MoveFocusBackward(); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first"); + + // Make the third actor invisible + third.SetVisible(false); + // flush the queue and render once + application.SendNotification(); + application.Render(); + + // Move the focus backward and check that the third actor should be skipped as it's + // invisible and the second actor should also be skipped as it's not focusable, + // so the focus will still be on the first actor + manager.MoveFocusBackward(); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first"); + + // Make the first actor invisible so that no actor can be focused. + first.SetVisible(false); + // flush the queue and render once + application.SendNotification(); + application.Render(); + + // Check that the focus move is failed as all the three actors can not be focused + manager.MoveFocusBackward(); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first"); + END_TEST; +} + +int UtcDaliFocusManagerClearFocus(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliFocusManagerClearFocus"); + + FocusManager manager = FocusManager::Get(); + DALI_TEST_CHECK(manager); + + // Create the first actor and add it to the stage + Actor first = Actor::New(); + manager.SetFocusOrder(first, 1); + Stage::GetCurrent().Add(first); + + // Create the second actor and add it to the stage + Actor second = Actor::New(); + manager.SetFocusOrder(second, 2); + Stage::GetCurrent().Add(second); + + // Check that no actor is being focused yet. + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor()); + + // Check that the focus is set on the first actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); + + // Check that the focus is set on the second actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second); + + // Clear the focus + manager.ClearFocus(); + + // Check that no actor is being focused now. + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor()); + END_TEST; +} + +int UtcDaliFocusManagerReset(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliFocusManagerReset"); + + FocusManager manager = FocusManager::Get(); + DALI_TEST_CHECK(manager); + + // Create the first actor and add it to the stage + Actor first = Actor::New(); + manager.SetFocusOrder(first, 1); + Stage::GetCurrent().Add(first); + + // Create the second actor and add it to the stage + Actor second = Actor::New(); + manager.SetFocusOrder(second, 2); + Stage::GetCurrent().Add(second); + + // Check that no actor is being focused yet. + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor()); + + // Check that the focus is set on the first actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); + + // Check that the focus is set on the second actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second); + + // Clear the focus + manager.Reset(); + + // Check that no actor is being focused now and the focus order of actors have been cleared + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor()); + DALI_TEST_CHECK(manager.GetFocusOrder(first) == 0); + DALI_TEST_CHECK(manager.GetFocusOrder(first) == 0); + END_TEST; +} + +int UtcDaliFocusManagerFocusGroup(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliFocusManagerFocusGroup"); + + FocusManager manager = FocusManager::Get(); + DALI_TEST_CHECK(manager); + + // Create an actor with two child actors and add it to the stage + Actor parent = Actor::New(); + Actor firstChild = Actor::New(); + Actor secondChild = Actor::New(); + parent.Add(firstChild); + parent.Add(secondChild); + Stage::GetCurrent().Add(parent); + + // Create three actors and add them as the children of the first child actor + Actor firstGrandChild = Actor::New(); + Actor secondGrandChild = Actor::New(); + Actor thirdGrandChild = Actor::New(); + firstChild.Add(firstGrandChild); + firstChild.Add(secondGrandChild); + firstChild.Add(thirdGrandChild); + + // Set focus order to the actors + manager.SetFocusOrder(parent, 1); + manager.SetFocusOrder(firstChild, 2); + manager.SetFocusOrder(firstGrandChild, 3); + manager.SetFocusOrder(secondGrandChild, 4); + manager.SetFocusOrder(thirdGrandChild, 5); + manager.SetFocusOrder(secondChild, 6); + + // Set the parent and the first child actor as focus groups + manager.SetFocusGroup(parent, true); + DALI_TEST_CHECK(manager.IsFocusGroup(parent) == true); + + // The focus group of the parent should be itself, as it is set to be a focus group. + DALI_TEST_CHECK(manager.GetFocusGroup(parent) == parent); + + // The focus group of the firstChild should be its parent, as it is the immediate parent which is also a group. + DALI_TEST_CHECK(manager.GetFocusGroup(firstChild) == parent); + + manager.SetFocusGroup(firstChild, true); + DALI_TEST_CHECK(manager.IsFocusGroup(firstChild) == true); + + // The focus group of the firstChild should be itself, as it is set to be a focus group now. + DALI_TEST_CHECK(manager.GetFocusGroup(firstChild) == firstChild); + + // Enable wrap mode for focus movement. + manager.SetWrapMode(true); + DALI_TEST_CHECK(manager.GetWrapMode() == true); + + // Check that no actor is being focused yet. + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor()); + + // Check that the focus is set on the parent actor. + DALI_TEST_CHECK(manager.SetCurrentFocusActor(parent) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == parent); + + // Check that group mode is disabled. + DALI_TEST_CHECK(manager.GetGroupMode() == false); + + // Check that the focus movement is wrapped as normal. + DALI_TEST_CHECK(manager.MoveFocusForward() == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstChild); + DALI_TEST_CHECK(manager.MoveFocusForward() == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild); + DALI_TEST_CHECK(manager.MoveFocusForward() == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondGrandChild); + DALI_TEST_CHECK(manager.MoveFocusForward() == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == thirdGrandChild); + DALI_TEST_CHECK(manager.MoveFocusForward() == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondChild); + DALI_TEST_CHECK(manager.MoveFocusForward() == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == parent); + DALI_TEST_CHECK(manager.MoveFocusForward() == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstChild); + DALI_TEST_CHECK(manager.MoveFocusForward() == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild); + + // Enable the group mode. + manager.SetGroupMode(true); + DALI_TEST_CHECK(manager.GetGroupMode() == true); + + // Check that the focus movement is now limited to the current focus group. + DALI_TEST_CHECK(manager.MoveFocusForward() == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondGrandChild); + DALI_TEST_CHECK(manager.MoveFocusForward() == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == thirdGrandChild); + DALI_TEST_CHECK(manager.MoveFocusForward() == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstChild); + DALI_TEST_CHECK(manager.MoveFocusForward() == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild); + END_TEST; +} + +int UtcDaliFocusManagerSetAndGetFocusIndicator(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliFocusManagerSetAndGetFocusIndicator"); + + FocusManager manager = FocusManager::Get(); + DALI_TEST_CHECK(manager); + + Actor defaultFocusIndicatorActor = manager.GetFocusIndicatorActor(); + DALI_TEST_CHECK(defaultFocusIndicatorActor); + + Actor newFocusIndicatorActor = Actor::New(); + manager.SetFocusIndicatorActor(newFocusIndicatorActor); + DALI_TEST_CHECK(manager.GetFocusIndicatorActor() == newFocusIndicatorActor); + END_TEST; +} + +int UtcDaliFocusManagerSignalFocusChanged(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliFocusManagerSignalFocusChanged"); + + FocusManager manager = FocusManager::Get(); + DALI_TEST_CHECK(manager); + + bool signalVerified = false; + FocusChangedCallback callback(signalVerified); + manager.FocusChangedSignal().Connect( &callback, &FocusChangedCallback::Callback ); + + // Create the first actor and add it to the stage + Actor first = Actor::New(); + manager.SetFocusOrder(first, 1); + Stage::GetCurrent().Add(first); + + // Create the second actor and add it to the stage + Actor second = Actor::New(); + manager.SetFocusOrder(second, 2); + Stage::GetCurrent().Add(second); + + // Check that no actor is being focused yet. + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor()); + + // Check that the focus is set on the first actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); + DALI_TEST_CHECK(callback.mSignalVerified); + callback.Reset(); + + // Check that the focus is set on the second actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second); + DALI_TEST_CHECK(callback.mSignalVerified); + callback.Reset(); + + // Clear the focus + manager.ClearFocus(); + + // Check that no actor is being focused now. + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor()); + DALI_TEST_CHECK(callback.mSignalVerified); + END_TEST; +} + +int UtcDaliFocusManagerSignalFocusOvershot(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliFocusManagerSignalFocusOvershot"); + + FocusManager manager = FocusManager::Get(); + DALI_TEST_CHECK(manager); + + bool signalVerified = false; + FocusOvershotCallback callback(signalVerified); + manager.FocusOvershotSignal().Connect(&callback, &FocusOvershotCallback::Callback); + + // Create the first actor and add it to the stage + Actor first = Actor::New(); + manager.SetFocusOrder(first, 1); + Stage::GetCurrent().Add(first); + + // Create the second actor and add it to the stage + Actor second = Actor::New(); + manager.SetFocusOrder(second, 2); + Stage::GetCurrent().Add(second); + + // Check that the wrap mode is disabled + DALI_TEST_CHECK(manager.GetWrapMode() == false); + + // Check that the focus is set on the first actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); + + // Check that the focus is moved to the second actor successfully. + DALI_TEST_CHECK(manager.MoveFocusForward() == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second); + + // Check that the forward focus movement is overshot. + callback.mCurrentFocusedActor = second; + callback.mFocusOvershotDirection = Toolkit::FocusManager::OVERSHOT_NEXT; + DALI_TEST_CHECK(manager.MoveFocusForward() == false); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second); + DALI_TEST_CHECK(signalVerified); + callback.Reset(); + + // Enable the wrap mode + manager.SetWrapMode(true); + DALI_TEST_CHECK(manager.GetWrapMode() == true); + + // Check that the forward focus movement is wrapped and no overshot happens. + DALI_TEST_CHECK(manager.MoveFocusForward() == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); + DALI_TEST_CHECK(signalVerified == false); + + // Disable the wrap mode + manager.SetWrapMode(false); + DALI_TEST_CHECK(manager.GetWrapMode() == false); + + // Check that the backward focus movement is overshot. + callback.mCurrentFocusedActor = first; + callback.mFocusOvershotDirection = Toolkit::FocusManager::OVERSHOT_PREVIOUS; + DALI_TEST_CHECK(manager.MoveFocusBackward() == false); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); + DALI_TEST_CHECK(signalVerified); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-GridLayout.cpp b/automated-tests/src/dali-toolkit/utc-Dali-GridLayout.cpp new file mode 100644 index 0000000..0d9a1fd --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-GridLayout.cpp @@ -0,0 +1,547 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include // for FLT_MAX + +// Need to override adaptor classes for toolkit test harness, so include +// test harness headers before dali headers. +#include + +#include +#include + +using namespace Dali; +using namespace Toolkit; + +void utc_dali_toolkit_grid_layout_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_toolkit_grid_layout_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +namespace +{ + +const unsigned int TOTAL_ITEM_NUMBER = 200; + +Vector3 GridLayoutItemSizeFunction(unsigned int numberOfColumns, float layoutWidth, float sideMargin, float columnSpacing) +{ + float width = (layoutWidth - sideMargin * 2.0f - columnSpacing * static_cast(numberOfColumns - 1)) / static_cast(numberOfColumns); + + return Vector3(width, width, width); +} + + +// Implementation of ItemFactory for providing actors to ItemView +class TestItemFactory : public ItemFactory +{ +public: + + /** + * Constructor + * @param application class, stored as reference + */ + TestItemFactory() + { + } + +public: // From ItemFactory + + /** + * Query the number of items available from the factory. + * The maximum available item has an ID of GetNumberOfItems() - 1. + */ + virtual unsigned int GetNumberOfItems() + { + return TOTAL_ITEM_NUMBER; + } + + /** + * Create an Actor to represent a visible item. + * @param itemId + * @return the created actor. + */ + virtual Actor NewItem(unsigned int itemId) + { + // Create an test actor for this item + ImageActor actor = CreateSolidColorActor(Color::RED); + actor.SetSize(64.0f, 64.0f); + return actor; + } +}; + +} // namespace + + + +int UtcDaliGridLayoutNew(void) +{ + ToolkitTestApplication application; + + // Create a grid layout + GridLayoutPtr gridLayout = GridLayout::New(); + + DALI_TEST_CHECK(gridLayout); + END_TEST; +} + +int UtcDaliGridLayoutSetAndGetNumberOfColumns(void) +{ + ToolkitTestApplication application; + + // Create a grid layout + GridLayoutPtr gridLayout = GridLayout::New(); + + // Set the number of columns + gridLayout->SetNumberOfColumns(6); + + // Check whether we get the correct number of columns + DALI_TEST_CHECK(gridLayout->GetNumberOfColumns() == 6); + END_TEST; +} + +int UtcDaliGridLayoutSetAndGetRowSpacing(void) +{ + ToolkitTestApplication application; + + // Create a grid layout + GridLayoutPtr gridLayout = GridLayout::New(); + + // Set the row spacing + gridLayout->SetRowSpacing(10.0f); + + // Check whether we get the correct row spacing + DALI_TEST_EQUALS(gridLayout->GetRowSpacing(), 10.0f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliGridLayoutSetAndGetColumnSpacing(void) +{ + ToolkitTestApplication application; + + // Create a grid layout + GridLayoutPtr gridLayout = GridLayout::New(); + + // Set the column spacing + gridLayout->SetColumnSpacing(10.0f); + + // Check whether we get the correct column spacing + DALI_TEST_EQUALS(gridLayout->GetColumnSpacing(), 10.0f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliGridLayoutSetAndGetTopMargin(void) +{ + ToolkitTestApplication application; + + // Create a grid layout + GridLayoutPtr gridLayout = GridLayout::New(); + + // Set the top margin + gridLayout->SetTopMargin(30.0f); + + // Check whether we get the correct top margin + DALI_TEST_EQUALS(gridLayout->GetTopMargin(), 30.0f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliGridLayoutSetAndGetBottomMargin(void) +{ + ToolkitTestApplication application; + + // Create a grid layout + GridLayoutPtr gridLayout = GridLayout::New(); + + // Set the bottom margin + gridLayout->SetBottomMargin(30.0f); + + // Check whether we get the correct bottom margin + DALI_TEST_EQUALS(gridLayout->GetBottomMargin(), 30.0f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliGridLayoutSetAndGetSideMargin(void) +{ + ToolkitTestApplication application; + + // Create a grid layout + GridLayoutPtr gridLayout = GridLayout::New(); + + // Set the side margin + gridLayout->SetSideMargin(10.0f); + + // Check whether we get the correct side margin + DALI_TEST_EQUALS(gridLayout->GetSideMargin(), 10.0f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliGridLayoutSetAndGetZGap(void) +{ + ToolkitTestApplication application; + + // Create a grid layout + GridLayoutPtr gridLayout = GridLayout::New(); + + // Set the gap of items in the Z axis in different columns + gridLayout->SetZGap(5.0f); + + // Check whether we get the correct Z gap + DALI_TEST_EQUALS(gridLayout->GetZGap(), 5.0f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliGridLayoutSetAndGetItemSizeFunction(void) +{ + ToolkitTestApplication application; + + // Create a grid layout + GridLayoutPtr gridLayout = GridLayout::New(); + + // Set the item size function + gridLayout->SetItemSizeFunction(GridLayoutItemSizeFunction); + + // Check whether we get the correct item size function + DALI_TEST_CHECK(gridLayout->GetItemSizeFunction() == GridLayoutItemSizeFunction); + END_TEST; +} + +int UtcDaliGridLayoutSetAndGetScrollSpeedFactor(void) +{ + ToolkitTestApplication application; + + // Create a grid layout + GridLayoutPtr gridLayout = GridLayout::New(); + + // Set the scroll speed factor + gridLayout->SetScrollSpeedFactor(0.05f); + + // Check whether we get the correct scroll speed factor + DALI_TEST_EQUALS(gridLayout->GetScrollSpeedFactor(), 0.05f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliGridLayoutSetAndGetMaximumSwipeSpeed(void) +{ + ToolkitTestApplication application; + + // Create a grid layout + GridLayoutPtr gridLayout = GridLayout::New(); + + // Set the maximum swipe speed + gridLayout->SetMaximumSwipeSpeed(50.0f); + + // Check whether we get the correct maximum swipe speed + DALI_TEST_EQUALS(gridLayout->GetMaximumSwipeSpeed(), 50.0f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliGridLayoutSetAndGetItemFlickAnimationDuration(void) +{ + ToolkitTestApplication application; + + // Create a grid layout + GridLayoutPtr gridLayout = GridLayout::New(); + + // Set the flick animaiton duration + gridLayout->SetItemFlickAnimationDuration(0.35f); + + // Check whether we get the correct flick animaiton duration + DALI_TEST_EQUALS( gridLayout->GetItemFlickAnimationDuration(), 0.35f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliGridLayoutConstraintLeft(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + GridLayoutPtr gridLayout = GridLayout::New(); + gridLayout->SetNumberOfColumns(6); + + view.SetName("view actor"); + view.AddLayout(*gridLayout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + gridLayout->SetOrientation(ControlOrientation::Left); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + // Confirm: we have actors in the view and they are positioned some distance from the origin. + int nonZeroCount = 0; + int elementsFound = 0; + for(unsigned int i = 0; i < 10; i++) + { + Actor testActor = view.GetItem(i); + if (testActor) + { + elementsFound++; + Vector3 pos = testActor.GetCurrentPosition(); + + if (pos.LengthSquared() > 0.0f) + { + nonZeroCount++; + } + } + } + + DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound)); + Stage::GetCurrent().Remove(view); + END_TEST; +} + +int UtcDaliGridLayoutConstraintRight(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + GridLayoutPtr gridLayout = GridLayout::New(); + gridLayout->SetNumberOfColumns(6); + + view.SetName("view actor"); + view.AddLayout(*gridLayout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + gridLayout->SetOrientation(ControlOrientation::Right); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + // Confirm: we have actors in the view and they are positioned some distance from the origin. + int nonZeroCount = 0; + int elementsFound = 0; + for(unsigned int i = 0; i < 10; i++) + { + Actor testActor = view.GetItem(i); + if (testActor) + { + elementsFound++; + Vector3 pos = testActor.GetCurrentPosition(); + + if (pos.LengthSquared() > 0.0f) + { + nonZeroCount++; + } + } + } + + DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound)); + Stage::GetCurrent().Remove(view); + END_TEST; +} + +int UtcDaliGridLayoutConstraintUp(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + GridLayoutPtr gridLayout = GridLayout::New(); + gridLayout->SetNumberOfColumns(6); + + view.SetName("view actor"); + view.AddLayout(*gridLayout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + gridLayout->SetOrientation(ControlOrientation::Up); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + // Confirm: we have actors in the view and they are positioned some distance from the origin. + int nonZeroCount = 0; + int elementsFound = 0; + for(unsigned int i = 0; i < 10; i++) + { + Actor testActor = view.GetItem(i); + if (testActor) + { + elementsFound++; + Vector3 pos = testActor.GetCurrentPosition(); + + if (pos.LengthSquared() > 0.0f) + { + nonZeroCount++; + } + } + } + + DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound)); + + ItemLayoutPtr layout = gridLayout; + layout->GetClosestOnScreenLayoutPosition(0, 0.0f, vec); + int nextItem = layout->GetNextFocusItemID(0, 10, Dali::Toolkit::Control::Right, false); + DALI_TEST_CHECK(nextItem == 1); + + Stage::GetCurrent().Remove(view); + END_TEST; +} + +int UtcDaliGridLayoutConstraintDown(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + GridLayoutPtr gridLayout = GridLayout::New(); + gridLayout->SetNumberOfColumns(6); + + view.SetName("view actor"); + view.AddLayout(*gridLayout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + gridLayout->SetOrientation(ControlOrientation::Down); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + // Confirm: we have actors in the view and they are positioned some distance from the origin. + int nonZeroCount = 0; + int elementsFound = 0; + for(unsigned int i = 0; i < 10; i++) + { + Actor testActor = view.GetItem(i); + if (testActor) + { + elementsFound++; + Vector3 pos = testActor.GetCurrentPosition(); + + if (pos.LengthSquared() > 0.0f) + { + nonZeroCount++; + } + } + } + + DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound)); + Stage::GetCurrent().Remove(view); + END_TEST; +} + +int UtcDaliGridLayoutScrollDirection(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + GridLayoutPtr gridLayout = GridLayout::New(); + gridLayout->SetNumberOfColumns(6); + + view.SetName("view actor"); + view.AddLayout(*gridLayout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + gridLayout->SetOrientation(ControlOrientation::Left); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + ItemLayoutPtr layout = gridLayout; + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + gridLayout->SetOrientation(ControlOrientation::Up); + view.ActivateLayout(0, vec, 0.0f); + application.SendNotification(); + application.Render(); + + Degree deg = layout->GetScrollDirection(); + DALI_TEST_CHECK(deg == 0.0f); + + gridLayout->SetOrientation(ControlOrientation::Down); + view.ActivateLayout(0, vec, 0.0f); + application.SendNotification(); + application.Render(); + + deg = layout->GetScrollDirection(); + DALI_TEST_CHECK((deg == 180.0f)); + + layout->SetOrientation(ControlOrientation::Left); + view.ActivateLayout(0, vec, 0.0f); + application.SendNotification(); + application.Render(); + + deg = layout->GetScrollDirection(); + DALI_TEST_CHECK(deg == 90.f); + + gridLayout->SetOrientation(ControlOrientation::Right); + view.ActivateLayout(0, vec, 0.0f); + application.SendNotification(); + application.Render(); + + deg = layout->GetScrollDirection(); + DALI_TEST_CHECK(deg == 270.0f); + + Stage::GetCurrent().Remove(view); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-IrisEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-IrisEffect.cpp new file mode 100644 index 0000000..978283f --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-IrisEffect.cpp @@ -0,0 +1,135 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include + +// Need to override adaptor classes for toolkit test harness, so include +// test harness headers before dali headers. +#include + +#include +#include + +using namespace Dali; + +void utc_dali_toolkit_iris_effect_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_toolkit_iris_effect_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +int UtcDaliIrisEffectUninitialized(void) +{ + ToolkitTestApplication application; + + Toolkit::IrisEffect effect; + + try + { + // New() must be called to create a IrisEffect or it wont be valid. + effect.SetRadius( 2.0f ); + DALI_TEST_CHECK( false ); + } + catch (Dali::DaliException& e) + { + // Tests that a negative test of an assertion succeeds + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_CHECK(!effect); + } + END_TEST; +} + +int UtcDaliIrisEffectPropertyNames(void) +{ + ToolkitTestApplication application; + + Toolkit::IrisEffect effect = Toolkit::IrisEffect::New(); + + // Check the names, this names are used in the shaders code, + // if they change the shader code has to be updated + DALI_TEST_EQUALS( effect.GetRadiusPropertyName(), "uRadius", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetCenterPropertyName(), "uCenter", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetBlendFactorPropertyName(), "uBlendFactor", TEST_LOCATION ); + END_TEST; +} + +int UtcDaliIrisEffectDefaultValues(void) +{ + ToolkitTestApplication application; + + Toolkit::IrisEffect effect = Toolkit::IrisEffect::New(); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + + const float radiusValue(0.0f); + const Vector2 centerValue(0.5f, 0.5f); + const float blendFactorValue(100.0f); + + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + TestGlAbstraction& gl = application.GetGlAbstraction(); + DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetRadiusPropertyName().c_str(), radiusValue ) ); + DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetCenterPropertyName().c_str(), centerValue ) ); + DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetBlendFactorPropertyName().c_str(), blendFactorValue ) ); + END_TEST; +} + +int UtcDaliIrisEffectCustomValues(void) +{ + ToolkitTestApplication application; + + Toolkit::IrisEffect effect = Toolkit::IrisEffect::New(); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + + const float radiusValue(23.0f); + const Vector2 centerValue(0.2f, 0.7f); + const float blendFactorValue(10.0f); + + effect.SetRadius( radiusValue ); + effect.SetCenter( centerValue ); + effect.SetBlendFactor( blendFactorValue ); + + actor.SetShaderEffect(effect); + Stage::GetCurrent().Add(actor); + + application.SendNotification(); + application.Render(); + + TestGlAbstraction& gl = application.GetGlAbstraction(); + DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetRadiusPropertyName().c_str(), radiusValue ) ); + DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetCenterPropertyName().c_str(), centerValue ) ); + DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetBlendFactorPropertyName().c_str(), blendFactorValue ) ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ItemLayout.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ItemLayout.cpp new file mode 100644 index 0000000..d1ccae3 --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-ItemLayout.cpp @@ -0,0 +1,138 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include + +// Need to override adaptor classes for toolkit test harness, so include +// test harness headers before dali headers. +#include + +#include +#include + +using namespace Dali; +using namespace Toolkit; + +namespace +{ +const unsigned int TOTAL_ITEM_NUMBER = 200; +const char* TEST_IMAGE_FILE_NAME = "gallery_image_01.jpg"; + + +// Implementation of ItemFactory for providing actors to ItemView +class TestItemFactory : public ItemFactory +{ +public: + + /** + * Constructor + * @param application class, stored as reference + */ + TestItemFactory() + { + } + +public: // From ItemFactory + + /** + * Query the number of items available from the factory. + * The maximum available item has an ID of GetNumberOfItems() - 1. + */ + virtual unsigned int GetNumberOfItems() + { + return TOTAL_ITEM_NUMBER; + } + + /** + * Create an Actor to represent a visible item. + * @param itemId + * @return the created actor. + */ + virtual Actor NewItem(unsigned int itemId) + { + // Create an image actor for this item + Image image = Image::New( TEST_IMAGE_FILE_NAME ); + Actor actor = ImageActor::New(image); + + return actor; + } +}; +} // namespace + +int UtcDaliItemLayoutSetAndGetOrientation(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + + // Create a grid layout and add it to ItemView + GridLayoutPtr gridLayout = GridLayout::New(); + view.AddLayout(*gridLayout); + + // Set the orientation of the layout to be horizontal from left to right + ItemLayoutPtr layout = view.GetLayout(0); + layout->SetOrientation(ControlOrientation::Left); + + // Check the orientation of the layout is horizontal from left to right + DALI_TEST_CHECK(layout->GetOrientation() == ControlOrientation::Left); + END_TEST; +} + +int UtcDaliItemLayoutGetScrollHints(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + + // Create a grid layout and add it to ItemView + GridLayoutPtr gridLayout = GridLayout::New(); + view.AddLayout(*gridLayout); + + // Set the orientation of the layout to be horizontal from left to right + ItemLayoutPtr layout = view.GetLayout(0); + + Vector2 axisScrollHint; + + layout->SetOrientation(ControlOrientation::Up); + layout->GetXAxisScrollHint(axisScrollHint); + DALI_TEST_EQUALS(axisScrollHint, Vector2::ZERO, Math::MACHINE_EPSILON_1, TEST_LOCATION); + layout->GetYAxisScrollHint(axisScrollHint); + DALI_TEST_EQUALS(axisScrollHint, Vector2::YAXIS, Math::MACHINE_EPSILON_1, TEST_LOCATION); + + layout->SetOrientation(ControlOrientation::Down); + layout->GetXAxisScrollHint(axisScrollHint); + DALI_TEST_EQUALS(axisScrollHint, Vector2::ZERO, Math::MACHINE_EPSILON_1, TEST_LOCATION); + layout->GetYAxisScrollHint(axisScrollHint); + DALI_TEST_EQUALS(axisScrollHint, Vector2::YAXIS, Math::MACHINE_EPSILON_1, TEST_LOCATION); + + layout->SetOrientation(ControlOrientation::Left); + layout->GetXAxisScrollHint(axisScrollHint); + DALI_TEST_EQUALS(axisScrollHint, Vector2::XAXIS, Math::MACHINE_EPSILON_1, TEST_LOCATION); + layout->GetYAxisScrollHint(axisScrollHint); + DALI_TEST_EQUALS(axisScrollHint, Vector2::ZERO, Math::MACHINE_EPSILON_1, TEST_LOCATION); + + layout->SetOrientation(ControlOrientation::Right); + layout->GetXAxisScrollHint(axisScrollHint); + DALI_TEST_EQUALS(axisScrollHint, Vector2::XAXIS, Math::MACHINE_EPSILON_1, TEST_LOCATION); + layout->GetYAxisScrollHint(axisScrollHint); + DALI_TEST_EQUALS(axisScrollHint, Vector2::ZERO, Math::MACHINE_EPSILON_1, TEST_LOCATION); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp new file mode 100644 index 0000000..12a07c0 --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp @@ -0,0 +1,489 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include +#include // for FLT_MAX + +// Need to override adaptor classes for toolkit test harness, so include +// test harness headers before dali headers. +#include + +#include +#include + +using namespace Dali; +using namespace Toolkit; + +void utc_dali_toolkit_item_view_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_toolkit_item_view_cleanup(void) +{ + test_return_value = TET_PASS; +} + +namespace +{ +const unsigned int TOTAL_ITEM_NUMBER = 100; +const char* TEST_IMAGE_FILE_NAME = "gallery_image_01.jpg"; + +static bool gObjectCreatedCallBackCalled; + +static void TestCallback(BaseHandle handle) +{ + gObjectCreatedCallBackCalled = true; +} + + +// Implementation of ItemFactory for providing actors to ItemView +class TestItemFactory : public ItemFactory +{ +public: + + /** + * Constructor + * @param application class, stored as reference + */ + TestItemFactory() + { + } + +public: // From ItemFactory + + /** + * Query the number of items available from the factory. + * The maximum available item has an ID of GetNumberOfItems() - 1. + */ + virtual unsigned int GetNumberOfItems() + { + return TOTAL_ITEM_NUMBER; + } + + /** + * Create an Actor to represent a visible item. + * @param itemId + * @return the created actor. + */ + virtual Actor NewItem(unsigned int itemId) + { + // Create an image actor for this item + Image image = Image::New( TEST_IMAGE_FILE_NAME ); + Actor actor = ImageActor::New(image); + + return actor; + } +}; + +} // namespace + + +int UtcDaliItemViewNew(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + + DALI_TEST_CHECK(view); + + //Additional check to ensure object is created by checking if it's registered + ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + DALI_TEST_CHECK( registry ); + + gObjectCreatedCallBackCalled = false; + registry.ObjectCreatedSignal().Connect(&TestCallback); + { + TestItemFactory factory; + ItemView view = ItemView::New(factory); + } + DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + END_TEST; +} + +int UtcDaliItemViewDownCast(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + const ItemView itemViewConst = ItemView::New(factory); + ItemView itemView(itemViewConst); + + BaseHandle handle(itemView); + + ItemView newItemView = ItemView::DownCast( handle ); + DALI_TEST_CHECK( itemView ); + DALI_TEST_CHECK( newItemView == itemView ); + END_TEST; +} + +int UtcDaliItemViewAddAndGetLayout(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + + // Create a grid layout and add it to ItemView + GridLayoutPtr gridLayout = GridLayout::New(); + view.AddLayout(*gridLayout); + + // As we have added one layout, check the number of layout is now 1 + DALI_TEST_CHECK(view.GetLayoutCount() == 1); + + + // Check we are getting the correct layout from ItemView + DALI_TEST_CHECK(view.GetLayout(0) == gridLayout); + END_TEST; +} + +int UtcDaliItemViewAddAndRemoveLayout(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + + // Create a grid layout and add it to ItemView + GridLayoutPtr gridLayout = GridLayout::New(); + view.AddLayout(*gridLayout); + + // As we have added one layout, check the number of layout is now 1 + DALI_TEST_CHECK(view.GetLayoutCount() == 1); + + // Check we are getting the correct layout from ItemView + DALI_TEST_CHECK(view.GetLayout(0) == gridLayout); + + // Remove the grid layout + view.RemoveLayout(0); + + // As we have removed the grid layout, check the number of layout is now 0 + DALI_TEST_CHECK(view.GetLayoutCount() == 0); + + END_TEST; +} + +int UtcDaliItemViewActivateLayoutAndGetActiveLayout(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + + // Create a grid layout and add it to ItemView + GridLayoutPtr gridLayout = GridLayout::New(); + view.AddLayout(*gridLayout); + + DALI_TEST_CHECK(view.GetLayoutCount() == 1); + + // Check there is no active layout at the moment + DALI_TEST_CHECK(view.GetActiveLayout() == NULL); + + // Activate the grid layout + Vector3 stageSize(Dali::Stage::GetCurrent().GetSize()); + view.ActivateLayout(0, stageSize, 0.5f); + + // Check the current active layout is the grid layout + DALI_TEST_CHECK(view.GetActiveLayout() == gridLayout); + + END_TEST; +} + +int UtcDaliItemViewDeactivateCurrentLayout(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + + // Create a grid layout and add it to ItemView + GridLayoutPtr gridLayout = GridLayout::New(); + view.AddLayout(*gridLayout); + + // Check there is no active layout at the moment + DALI_TEST_CHECK(view.GetActiveLayout() == NULL); + + // Activate the grid layout + Vector3 stageSize(Dali::Stage::GetCurrent().GetSize()); + view.ActivateLayout(0, stageSize, 0.5f); + + // Check the current active layout is the grid layout + DALI_TEST_CHECK(view.GetActiveLayout() == gridLayout); + + // Deactivate the current layout + view.DeactivateCurrentLayout(); + + // Check there is no active layout at the moment + DALI_TEST_CHECK(view.GetActiveLayout() == NULL); + END_TEST; +} + +int UtcDaliItemViewGetItemAndGetItemId(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + + // Create a grid layout and add it to ItemView + GridLayoutPtr gridLayout = GridLayout::New(); + view.AddLayout(*gridLayout); + + // Activate the grid layout so that the items will be created and added to ItemView + Vector3 stageSize(Dali::Stage::GetCurrent().GetSize()); + view.ActivateLayout(0, stageSize, 0.5f); + + // Get the item given the item ID + Actor itemActor = view.GetItem(2); + + // Check we are getting the correct Item ID given the specified actor + DALI_TEST_CHECK(view.GetItemId(itemActor) == 2); + END_TEST; +} + +int UtcDaliItemViewRemoveItem(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + + // Create a grid layout and add it to ItemView + GridLayoutPtr gridLayout = GridLayout::New(); + view.AddLayout(*gridLayout); + + // Activate the grid layout so that the items will be created and added to ItemView + Vector3 stageSize(Dali::Stage::GetCurrent().GetSize()); + view.ActivateLayout(0, stageSize, 0.5f); + + // Get the item given the item ID 2 and 3 + Actor oldItemActorID2 = view.GetItem(2); + Actor oldItemActorID3 = view.GetItem(3); + + // Remove the item with ID 2 + view.RemoveItem(2, 0.0f); + + // Get the new item given the item ID 2 + Actor newItemActorID2 = view.GetItem(2); + + // Check the original item with item ID 2 was deleted and now item ID 2 represents the original item with ID 3 + DALI_TEST_CHECK(view.GetItemId(newItemActorID2) == 2); + DALI_TEST_CHECK(oldItemActorID2 != newItemActorID2); + DALI_TEST_CHECK(newItemActorID2 = oldItemActorID3); + END_TEST; +} + +int UtcDaliItemViewGetCurrentLayoutPosition(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + + // Create a grid layout and add it to ItemView + GridLayoutPtr gridLayout = GridLayout::New(); + view.AddLayout(*gridLayout); + + // Activate the grid layout so that the items will be created and added to ItemView + Vector3 stageSize(Dali::Stage::GetCurrent().GetSize()); + view.ActivateLayout(0, stageSize, 0.0f); + + // Check the current layout position for the 10th items is 9.0f + DALI_TEST_EQUALS(view.GetCurrentLayoutPosition(9), 9.0f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliItemViewSetAndGetMinimumSwipeSpeed(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + + // Set the minimum swipe speed to be 1.5f + view.SetMinimumSwipeSpeed(1.5f); + + // Check the minimum swipe speed is 1.5f + DALI_TEST_EQUALS(view.GetMinimumSwipeSpeed(), 1.5f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliItemViewSetAndGetMinimumSwipeDistance(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + + // Set the minimum swipe distance to be 2.5f + view.SetMinimumSwipeDistance(2.5f); + + // Check the minimum swipe distance is 2.5f + DALI_TEST_EQUALS(view.GetMinimumSwipeDistance(), 2.5f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliItemViewSetAndGetAnchoring(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + + // Disable the anchor animation + view.SetAnchoring(false); + + // Check the anchor animation is disabled + DALI_TEST_CHECK(view.GetAnchoring() == false); + END_TEST; +} + +int UtcDaliItemViewSetAndGetAnchoringDuration(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + + // Set the duration of anchor animation to be 1.5f + view.SetAnchoringDuration(1.5f); + + // Check the duration of anchor animation is 1.5f + DALI_TEST_EQUALS(view.GetAnchoringDuration(), 1.5f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliItemViewSetAndGetRefreshInterval(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + + // Set the interval between refreshes to be 20 + view.SetRefreshInterval(20); + + // Check the interval between refreshes is 20 + DALI_TEST_CHECK(view.GetRefreshInterval() == 20); + END_TEST; +} + +int UtcDaliItemViewScrollToItem(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + Vector3 vec(480.0f, 800.0f, 0.0f); + GridLayoutPtr layout = GridLayout::New(); + + view.SetName("view actor"); + view.AddLayout(*layout); + view.SetSize(vec); + + Stage::GetCurrent().Add(view); + layout->SetOrientation(ControlOrientation::Up); + view.ActivateLayout(0, vec, 0.0f); + + application.SendNotification(); + application.Render(0); + + // render 10 frames + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + // Confirm: we have actors in the view. + std::vector indices; + for(unsigned int i = 0; i < 10; i++) + { + Actor testActor = view.GetItem(i); + if (testActor) + { + indices.push_back(i); + } + } + + try + { + if (!indices.empty()) + { + const unsigned int firstTargetIndex = indices[indices.size()-1]; + // scroll to last item + view.ScrollToItem(firstTargetIndex, 0.00f); + for(int i = 0; i < 10; ++i) + { + application.Render(16); // 60hz frames + } + + std::size_t moveCount = 0; + for(std::size_t i = 0; i < indices.size(); i++) + { + float layoutPosBefore = view.GetCurrentLayoutPosition(i); + view.ScrollToItem(indices[i], 0.0f); + float layoutPosAfter = view.GetCurrentLayoutPosition(i); + + if (fabs(layoutPosBefore-layoutPosAfter) <= FLT_EPSILON) + { + ++moveCount; + } + } + + DALI_TEST_CHECK((moveCount == indices.size())); + } + } + catch(...) + { + tet_result(TET_FAIL); + } + + Stage::GetCurrent().Remove(view); + END_TEST; +} + +int UtcDaliItemViewSetAndGetMouseWheelScrollDistanceStep(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + + // Set the scroll distance step for the mouse wheel event to be 100.0f + view.SetMouseWheelScrollDistanceStep(100.0f); + + // Check the scroll distance step is 100.0f + DALI_TEST_EQUALS(view.GetMouseWheelScrollDistanceStep(), 100.0f, TEST_LOCATION ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-KeyboardFocusManager.cpp b/automated-tests/src/dali-toolkit/utc-Dali-KeyboardFocusManager.cpp new file mode 100644 index 0000000..8b03227 --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-KeyboardFocusManager.cpp @@ -0,0 +1,537 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include + +// Need to override adaptor classes for toolkit test harness, so include +// test harness headers before dali headers. +#include + +#include +#include +#include + +using namespace Dali; +using namespace Dali::Toolkit; + +void utc_dali_toolkit_keyboard_focus_manager_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_toolkit_keyboard_focus_manager_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +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) + : mSignalVerified(signalReceived), + mCurrentFocusedActor(), + mProposedActorToFocus(), + mDirection(Control::Left) + { + } + + Actor Callback(Actor currentFocusedActor, Actor proposedActorToFocus, Control::KeyboardFocusNavigationDirection direction) + { + tet_infoline("Verifying PreFocusChangeCallback()"); + + mSignalVerified = true; + + mCurrentFocusedActor = currentFocusedActor; + mProposedActorToFocus = proposedActorToFocus; + mDirection = direction; + + return mProposedActorToFocus; + } + + void Reset() + { + mSignalVerified = false; + mCurrentFocusedActor = Actor(); + mProposedActorToFocus = Actor(); + mDirection = Control::Left; + } + + bool& mSignalVerified; + Actor mCurrentFocusedActor; + Actor mProposedActorToFocus; + Control::KeyboardFocusNavigationDirection 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; +}; + +// Functors to test whether focus group changed signal is emitted when the keyboard focus group is changed +class FocusGroupChangedCallback : public Dali::ConnectionTracker +{ +public: + FocusGroupChangedCallback(bool& signalReceived) + : mSignalVerified(signalReceived), + mCurrentFocusedActor(), + mForward(true) + { + } + + void Callback(Actor currentFocusedActor, bool forward) + { + tet_infoline("Verifying FocusGroupChangedCallback()"); + + mSignalVerified = true; + + mCurrentFocusedActor = currentFocusedActor; + mForward = forward; + } + + void Reset() + { + mSignalVerified = false; + } + + bool& mSignalVerified; + Actor mCurrentFocusedActor; + bool mForward; +}; + +// Functors to test whether focused actor activated signal is emitted when the focused actor is activated +class FocusedActorActivatedCallback : public Dali::ConnectionTracker +{ +public: + FocusedActorActivatedCallback(bool& signalReceived) + : mSignalVerified(signalReceived), + mActivatedActor() + { + } + + void Callback(Actor activatedActor) + { + tet_infoline("Verifying FocusedActorActivatedCallback()"); + + mSignalVerified = true; + + mActivatedActor = activatedActor; + } + + void Reset() + { + mSignalVerified = false; + } + + bool& mSignalVerified; + Actor mActivatedActor; +}; + +} // namespace + + +int UtcDaliKeyboardFocusManagerGet(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliKeyboardKeyboardFocusManagerGet"); + + KeyboardFocusManager manager; + + manager = KeyboardFocusManager::Get(); + DALI_TEST_CHECK(manager); + + KeyboardFocusManager newManager = KeyboardFocusManager::Get(); + DALI_TEST_CHECK(newManager); + + // Check that focus manager is a singleton + DALI_TEST_CHECK(manager == newManager); + END_TEST; +} + +int UtcDaliKeyboardFocusManagerSetAndGetCurrentFocusActor(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliKeyboardFocusManagerSetAndGetCurrentFocusActor"); + + KeyboardFocusManager manager = KeyboardFocusManager::Get(); + DALI_TEST_CHECK(manager); + + // Create the first actor and add it to the stage + Actor first = Actor::New(); + first.SetKeyboardFocusable(true); + Stage::GetCurrent().Add(first); + + // Create the second actor and add it to the stage + Actor second = Actor::New(); + second.SetKeyboardFocusable(true); + Stage::GetCurrent().Add(second); + + // Create the third actor but don't add it to the stage + Actor third = Actor::New(); + + // Check that no actor is being focused yet. + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor()); + + // Check that it will fail to set focus on an invalid actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(Actor()) == false); + + // Check that the focus is set on the first actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); + + // Check that the focus is set on the second actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second); + + // Check that it will fail to set focus on the third actor as it's not in the stage + DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second); + + // Add the third actor to the stage + Stage::GetCurrent().Add(third); + + // Check that it will fail to set focus on the third actor as it's not focusable + DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second); + + // Make the third actor focusable + third.SetKeyboardFocusable(true); + + // Check that the focus is successfully moved to the third actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third); + END_TEST; +} + +int UtcDaliKeyboardFocusManagerMoveFocus(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliKeyboardFocusManagerMoveFocus"); + + KeyboardFocusManager manager = KeyboardFocusManager::Get(); + DALI_TEST_CHECK(manager); + + bool preFocusChangeSignalVerified = false; + PreFocusChangeCallback preFocusChangeCallback(preFocusChangeSignalVerified); + manager.PreFocusChangeSignal().Connect( &preFocusChangeCallback, &PreFocusChangeCallback::Callback ); + + bool focusChangedSignalVerified = false; + FocusChangedCallback focusChangedCallback(focusChangedSignalVerified); + manager.FocusChangedSignal().Connect( &focusChangedCallback, &FocusChangedCallback::Callback ); + + // Create the first actor and add it to the stage + Actor first = Actor::New(); + first.SetKeyboardFocusable(true); + Stage::GetCurrent().Add(first); + + // Create the second actor and add it to the stage + Actor second = Actor::New(); + second.SetKeyboardFocusable(true); + Stage::GetCurrent().Add(second); + + // Move the focus to the right + DALI_TEST_CHECK(manager.MoveFocus(Control::Right) == false); + + // Because no layout control in the stage and no actor is focused, it should emit the PreFocusChange signal + DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified); + DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == Actor()); + DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor()); + DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::Right); + preFocusChangeCallback.Reset(); + + // Check that the focus is set on the first actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); + DALI_TEST_CHECK(focusChangedCallback.mSignalVerified); + DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == Actor()); + DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first); + focusChangedCallback.Reset(); + + // Move the focus towards right + DALI_TEST_CHECK(manager.MoveFocus(Control::Right) == false); + + // Because no layout control in the stage and the first actor is focused, it should emit the PreFocusChange signal + DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified); + DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == first); + DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor()); + DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::Right); + preFocusChangeCallback.Reset(); + + // Check that the focus is set on the second actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second); + DALI_TEST_CHECK(focusChangedCallback.mSignalVerified); + DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first); + DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == second); + focusChangedCallback.Reset(); + + // Move the focus towards up + DALI_TEST_CHECK(manager.MoveFocus(Control::Up) == false); + + // Because no layout control in the stage and no actor is focused, it should emit the PreFocusChange signal + DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified); + DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == second); + DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor()); + DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::Up); + preFocusChangeCallback.Reset(); + DALI_TEST_CHECK(!focusChangedCallback.mSignalVerified); + + END_TEST; +} + +int UtcDaliKeyboardFocusManagerClearFocus(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliKeyboardFocusManagerClearFocus"); + + KeyboardFocusManager manager = KeyboardFocusManager::Get(); + DALI_TEST_CHECK(manager); + + // Create the first actor and add it to the stage + Actor first = Actor::New(); + first.SetKeyboardFocusable(true); + Stage::GetCurrent().Add(first); + + // Create the second actor and add it to the stage + Actor second = Actor::New(); + second.SetKeyboardFocusable(true); + Stage::GetCurrent().Add(second); + + // Check that the focus is set on the first actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); + + // Check that the focus is set on the second actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second); + + // Clear the focus + manager.ClearFocus(); + + // Check that no actor is being focused now. + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor()); + END_TEST; +} + +int UtcDaliKeyboardFocusManagerSetAndGetFocusGroupLoop(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliKeyboardFocusManagerSetAndGetFocusGroupLoop"); + + KeyboardFocusManager manager = KeyboardFocusManager::Get(); + DALI_TEST_CHECK(manager); + + // Check that the focus movement is not looped within the same focus group by default + DALI_TEST_CHECK(manager.GetFocusGroupLoop() == false); + + // Enable the loop + manager.SetFocusGroupLoop(true); + DALI_TEST_CHECK(manager.GetFocusGroupLoop() == true); + END_TEST; +} + +int UtcDaliKeyboardFocusManagerSetAsFocusGroup(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliKeyboardFocusManagerSetAsFocusGroup"); + + KeyboardFocusManager manager = KeyboardFocusManager::Get(); + DALI_TEST_CHECK(manager); + + // Create an actor and check that it is not a focus group by default + Actor actor = Actor::New(); + DALI_TEST_CHECK(manager.IsFocusGroup(actor) == false); + + // Set the actor as focus group + manager.SetAsFocusGroup(actor, true); + + // flush the queue and render once + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK(manager.IsFocusGroup(actor) == true); + + // Set the actor not as focus group + manager.SetAsFocusGroup(actor, false); + + // flush the queue and render once + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK(manager.IsFocusGroup(actor) == false); + END_TEST; +} + +int UtcDaliKeyboardFocusManagerGetFocusGroup(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliKeyboardFocusManagerGetFocusGroup"); + + KeyboardFocusManager manager = KeyboardFocusManager::Get(); + DALI_TEST_CHECK(manager); + + // Create an actor with two child actors and add it to the stage + Actor parent = Actor::New(); + Actor child = Actor::New(); + parent.Add(child); + Stage::GetCurrent().Add(parent); + + // Create three actors and add them as the children of the first child actor + Actor grandChild = Actor::New(); + child.Add(grandChild); + + // Set the parent and the first child actor as focus groups + manager.SetAsFocusGroup(parent, true); + + // flush the queue and render once + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK(manager.IsFocusGroup(parent) == true); + + // The current focus group should be the parent, As it is the immediate parent which is also a focus group. + DALI_TEST_CHECK(manager.GetFocusGroup(grandChild) == parent); + + manager.SetAsFocusGroup(child, true); + + // flush the queue and render once + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK(manager.IsFocusGroup(child) == true); + + // The focus group should be the child, As it is the immediate parent which is also a focus group. + DALI_TEST_CHECK(manager.GetFocusGroup(grandChild) == child); + + manager.SetAsFocusGroup(grandChild, true); + + // flush the queue and render once + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK(manager.IsFocusGroup(grandChild) == true); + + // The current focus group should be itself, As it is also a focus group. + DALI_TEST_CHECK(manager.GetFocusGroup(grandChild) == grandChild); + END_TEST; +} + +int UtcDaliKeyboardFocusManagerSetAndGetFocusIndicator(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliKeyboardFocusManagerSetAndGetFocusIndicator"); + + KeyboardFocusManager manager = KeyboardFocusManager::Get(); + DALI_TEST_CHECK(manager); + + Actor defaultFocusIndicatorActor = manager.GetFocusIndicatorActor(); + DALI_TEST_CHECK(defaultFocusIndicatorActor); + + Actor newFocusIndicatorActor = Actor::New(); + manager.SetFocusIndicatorActor(newFocusIndicatorActor); + DALI_TEST_CHECK(manager.GetFocusIndicatorActor() == newFocusIndicatorActor); + END_TEST; +} + + +int UtcDaliKeyboardFocusManagerSignalFocusedActorActivated(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliKeyboardFocusManagerSignalFocusedActorActivated"); + + KeyboardFocusManager manager = KeyboardFocusManager::Get(); + DALI_TEST_CHECK(manager); + + bool focusedActorActivatedSignalVerified = false; + FocusedActorActivatedCallback focusedActorActivatedCallback(focusedActorActivatedSignalVerified); + manager.FocusedActorActivatedSignal().Connect( &focusedActorActivatedCallback, &FocusedActorActivatedCallback::Callback ); + + Integration::KeyEvent returnEvent("Return", "", 0, 0, 0, Integration::KeyEvent::Up); + + // Create the first button and add it to the stage + PushButton firstPushButton = PushButton::New(); + firstPushButton.SetKeyboardFocusable(true); + Stage::GetCurrent().Add(firstPushButton); + + // Create the second button and add it to the stage + PushButton secondPushButton = PushButton::New(); + secondPushButton.SetKeyboardFocusable(true); + Stage::GetCurrent().Add(secondPushButton); + + // Check that the focus is set on the first button + DALI_TEST_CHECK(manager.SetCurrentFocusActor(firstPushButton) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstPushButton); + + // Send the return event to activate the first button + application.ProcessEvent(returnEvent); + DALI_TEST_CHECK(focusedActorActivatedCallback.mSignalVerified); + DALI_TEST_CHECK(focusedActorActivatedCallback.mActivatedActor == firstPushButton); + focusedActorActivatedCallback.Reset(); + + // Check that the focus is set on the second button + DALI_TEST_CHECK(manager.SetCurrentFocusActor(secondPushButton) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondPushButton); + + // Send the return event again to activate the second button + application.ProcessEvent(returnEvent); + DALI_TEST_CHECK(focusedActorActivatedCallback.mSignalVerified); + DALI_TEST_CHECK(focusedActorActivatedCallback.mActivatedActor == secondPushButton); + focusedActorActivatedCallback.Reset(); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-MarkupProcessor.cpp b/automated-tests/src/dali-toolkit/utc-Dali-MarkupProcessor.cpp new file mode 100644 index 0000000..0f2812d --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-MarkupProcessor.cpp @@ -0,0 +1,397 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include + +// Need to override adaptor classes for toolkit test harness, so include +// test harness headers before dali headers. +#include + +#include +#include + +using namespace Dali; + +void utc_dali_toolkit_markup_processor_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_toolkit_markup_processor_cleanup(void) +{ + test_return_value = TET_PASS; +} + +namespace +{ + +struct MarkupStringTest +{ + std::string input; + std::string expectedResult; +}; + +bool TestMarkupString( const std::string& input, const std::string& expectedResult, std::string& result ) +{ + Toolkit::MarkupProcessor::StyledTextArray styledTextArray; + + GetStyledTextArray( input, styledTextArray, true ); + GetMarkupString( styledTextArray, result ); + + return expectedResult == result; +} + +} // namespace + + +// Positive test case for a method +int UtcDaliMarkupProcessor(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliMarkupProcessor "); + + const std::string text1( "Text" ); + const std::string text2( "< font face ='FreeSerif' color= 'green' >t< / font >" ); + const std::string text3( "< font face = 'FreeSerif' size= '16' style = 'Bold' color='red'>< i>Styled< / u> Text< /i >< / font >< br / >" ); + const std::string text4( "Styled Text< br/>" ); + const std::string text5( "< shadow color = 'blue' paramx = '1' paramy = '0.75' >Shadow< / shadow>
" ); + const std::string text6( "< glow color = 'red' param = '0.1' >Glow< br />" ); + const std::string text7( "< outline color = 'red' paramx = '0.7' paramy = '0.7' >Outline< / outline >< /font >< br / >" ); + const std::string text8( "Smooth< br / >" ); + const std::string text9( "\\<" ); + const std::string text10( "\\>" ); + + char crlf[2]; + crlf[0] = 0x0D; + crlf[1] = 0x0A; + const std::string text11( crlf, 2 ); + + const std::string result1( text1 ); + const std::string result2( "t" ); + const std::string result3( "Styled Text
" ); + const std::string result4( "Styled Text
" ); + const std::string result5( "Shadow
" ); + const std::string result6( "Glow
" ); + const std::string result7( "Outline
" ); + const std::string result8( "Smooth
" ); + const std::string result9( text9 ); + const std::string result10( text10 ); + const std::string result11( "
" ); + + std::string markupString; + Toolkit::MarkupProcessor::StyledTextArray styledTextArray; + + GetStyledTextArray( text1, styledTextArray, true ); + GetMarkupString( styledTextArray, markupString ); + DALI_TEST_EQUALS( result1, markupString, TEST_LOCATION ); + + GetStyledTextArray( text2, styledTextArray, true ); + GetMarkupString( styledTextArray, markupString ); + DALI_TEST_EQUALS( result2, markupString, TEST_LOCATION ); + + GetStyledTextArray( text3, styledTextArray, true ); + GetMarkupString( styledTextArray, markupString ); + DALI_TEST_EQUALS( result3, markupString, TEST_LOCATION ); + + GetStyledTextArray( text4, styledTextArray, true ); + GetMarkupString( styledTextArray, markupString ); + DALI_TEST_EQUALS( result4, markupString, TEST_LOCATION ); + + GetStyledTextArray( text5, styledTextArray, true ); + GetMarkupString( styledTextArray, markupString ); + DALI_TEST_EQUALS( result5, markupString, TEST_LOCATION ); + + GetStyledTextArray( text6, styledTextArray, true ); + GetMarkupString( styledTextArray, markupString ); + DALI_TEST_EQUALS( result6, markupString, TEST_LOCATION ); + + GetStyledTextArray( text7, styledTextArray, true ); + GetMarkupString( styledTextArray, markupString ); + DALI_TEST_EQUALS( result7, markupString, TEST_LOCATION ); + + GetStyledTextArray( text8, styledTextArray, true ); + GetMarkupString( styledTextArray, markupString ); + DALI_TEST_EQUALS( result8, markupString, TEST_LOCATION ); + + GetStyledTextArray( text9, styledTextArray, true ); + GetMarkupString( styledTextArray, markupString ); + DALI_TEST_EQUALS( result9, markupString, TEST_LOCATION ); + + GetStyledTextArray( text10, styledTextArray, true ); + GetMarkupString( styledTextArray, markupString ); + + DALI_TEST_EQUALS( result10, markupString, TEST_LOCATION ); + + GetStyledTextArray( text11, styledTextArray, true ); + GetMarkupString( styledTextArray, markupString ); + + DALI_TEST_EQUALS( result11, markupString, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliMarkupProcessorSetTextStyle01(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliMarkupProcessorSetTextStyle01 "); + + const std::string text1( "Text with no defined style" ); + const std::string result1( "Text with no defined style" ); + const std::string result2( "Text with no defined style" ); + + std::string markupString; + Toolkit::MarkupProcessor::StyledTextArray styledTextArray; + + GetStyledTextArray( text1, styledTextArray, true ); + + TextStyle style; + style.SetItalics( true ); + style.SetTextColor( Color::GREEN ); + + SetTextStyle( styledTextArray, style ); + GetMarkupString( styledTextArray, markupString ); + + DALI_TEST_EQUALS( result1, markupString, TEST_LOCATION ); + + styledTextArray.clear(); + SetTextStyle( text1, styledTextArray, style ); + GetMarkupString( styledTextArray, markupString ); + + DALI_TEST_EQUALS( result1, markupString, TEST_LOCATION ); + + GetStyledTextArray( text1, styledTextArray, true ); + SetTextStyleToRange( styledTextArray, style, TextStyle::ALL, 0, text1.size() - 1 ); + GetMarkupString( styledTextArray, markupString ); + + DALI_TEST_EQUALS( result1, markupString, TEST_LOCATION ); + + GetStyledTextArray( text1, styledTextArray, true ); + SetTextStyleToRange( styledTextArray, style, TextStyle::ALL, 10, 19 ); + GetMarkupString( styledTextArray, markupString ); + + DALI_TEST_EQUALS( result2, markupString, TEST_LOCATION ); + + std::string plainString; + GetPlainString( styledTextArray, plainString ); + + DALI_TEST_EQUALS( text1, plainString, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliMarkupProcessorSetTextStyle02(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliMarkupProcessorSetTextStyle02 "); + + Toolkit::MarkupProcessor::StyledTextArray styledTextArray; + + // Test style applied to and empty string doesn't crash + + TextStyle style; + style.SetItalics( true ); + style.SetTextColor( Color::GREEN ); + + bool fails = false; + try + { + SetTextStyle( styledTextArray, style ); + } + catch( ... ) + { + fails = true; + } + + DALI_TEST_CHECK( !fails ); + END_TEST; +} + +int UtcDaliMarkupProcessorTestColors(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliMarkupProcessorTestColors "); + + struct MarkupStringTest colorTests[] = + { + { + std::string( "black" ), + std::string( "black" ) + }, + { + std::string( "white" ), + std::string( "white" ) + }, + { + std::string( "red" ), + std::string( "red" ) + }, + { + std::string( "green" ), + std::string( "green" ) + }, + { + std::string( "blue" ), + std::string( "blue" ) + }, + { + std::string( "yellow" ), + std::string( "yellow" ) + }, + { + std::string( "magenta" ), + std::string( "magenta" ) + }, + { + std::string( "cyan" ), + std::string( "cyan" ) + }, + { + std::string( "transparent" ), + std::string( "transparent" ) + }, + { + std::string( "black" ), + std::string( "black" ) + }, + { + std::string( "white" ), + std::string( "white" ) + }, + { + std::string( "red" ), + std::string( "red" ) + }, + { + std::string( "green" ), + std::string( "green" ) + }, + { + std::string( "blue" ), + std::string( "blue" ) + }, + { + std::string( "yellow" ), + std::string( "yellow" ) + }, + { + std::string( "magenta" ), + std::string( "magenta" ) + }, + { + std::string( "cyan" ), + std::string( "cyan" ) + }, + { + std::string( "black" ), + std::string( "black" ) + }, + { + std::string( "white" ), + std::string( "white" ) + }, + { + std::string( "red" ), + std::string( "red" ) + }, + { + std::string( "green" ), + std::string( "green" ) + }, + { + std::string( "blue" ), + std::string( "blue" ) + }, + { + std::string( "yellow" ), + std::string( "yellow" ) + }, + { + std::string( "magenta" ), + std::string( "magenta" ) + }, + { + std::string( "cyan" ), + std::string( "cyan" ) + }, + { + std::string( "black" ), + std::string( "black" ) + }, + { + std::string( "black" ), + std::string( "black" ) + }, + { + std::string( "white" ), + std::string( "white" ) + }, + { + std::string( "red" ), + std::string( "red" ) + }, + { + std::string( "green" ), + std::string( "green" ) + }, + { + std::string( "blue" ), + std::string( "blue" ) + }, + { + std::string( "yellow" ), + std::string( "yellow" ) + }, + { + std::string( "magenta" ), + std::string( "magenta" ) + }, + { + std::string( "cyan" ), + std::string( "cyan" ) + }, + { + std::string( "transparent" ), + std::string( "transparent" ) + }, + { + std::string( "outline" ), + std::string( "outline" ) + }, + }; + + const std::size_t numberOfTests( 36 ); + + bool fails = false; + for( std::size_t index = 0; index < numberOfTests; ++index ) + { + const MarkupStringTest& test = colorTests[index]; + + std::string result; + if( !TestMarkupString( test.input, test.expectedResult, result ) ) + { + TestMarkupString( test.input, test.expectedResult, result ); + tet_printf( "%s\n input : %s\nexpected result : %s\n result : %s\n", TEST_LOCATION, test.input.c_str(), test.expectedResult.c_str(), result.c_str() ); + + fails = true; + } + } + + DALI_TEST_CHECK( !fails ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-MaskEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-MaskEffect.cpp new file mode 100644 index 0000000..1e38b08 --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-MaskEffect.cpp @@ -0,0 +1,60 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include + +// Need to override adaptor classes for toolkit test harness, so include +// test harness headers before dali headers. +#include + +#include +#include + +using namespace Dali; + +void utc_dali_toolkit_mask_effect_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_toolkit_mask_effect_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +int UtcDaliMaskEffectCreateEffect(void) +{ + ToolkitTestApplication application; + + BitmapImage image = CreateBitmapImage(); + + ShaderEffect effect = Toolkit::MaskEffect::New( image ); + DALI_TEST_CHECK( effect ); + END_TEST; +} + +int UtcDaliMaskEffectDestructor(void) +{ + ToolkitTestApplication application; + + Toolkit::MaskEffect* effect = new Toolkit::MaskEffect(); + delete effect; + + DALI_TEST_CHECK( true ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-NinePatchMaskEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-NinePatchMaskEffect.cpp new file mode 100644 index 0000000..40ae747 --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-NinePatchMaskEffect.cpp @@ -0,0 +1,66 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include + +// Need to override adaptor classes for toolkit test harness, so include +// test harness headers before dali headers. +#include + +#include +#include + +using namespace Dali; + +void utc_dali_toolkit_nine_patch_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_toolkit_nine_patch_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +int UtcDaliNinePatchMaskEffectApply(void) +{ + ToolkitTestApplication application; + + BitmapImage image = CreateBitmapImage(); + ImageActor actor0 = ImageActor::New( image ); + Toolkit::NinePatchMaskEffect::Apply( actor0, "" ); + + Stage::GetCurrent().Add( actor0 ); + + application.SendNotification(); // Force usage of constraint + application.Render(); + + DALI_TEST_CHECK( actor0.GetStyle() == ImageActor::STYLE_NINE_PATCH ); + + ImageActor actor1 = ImageActor::New( image ); + Vector4 border( 0, 0, 0, 0 ); + Toolkit::NinePatchMaskEffect::Apply( actor1, "", border ); + + Stage::GetCurrent().Add( actor1 ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK( actor1.GetStyle() == ImageActor::STYLE_NINE_PATCH ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Popup.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Popup.cpp new file mode 100644 index 0000000..3abf2d0 --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-Popup.cpp @@ -0,0 +1,449 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include + +// Need to override adaptor classes for toolkit test harness, so include +// test harness headers before dali headers. +#include + +#include +#include +#include + +using namespace Dali; +using namespace Toolkit; + +void utc_dali_toolkit_popup_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_toolkit_popup_cleanup(void) +{ + test_return_value = TET_PASS; +} + +namespace +{ +static bool gObjectCreatedCallBackCalled; + +static void TestCallback(BaseHandle handle) +{ + gObjectCreatedCallBackCalled = true; +} + +const int RENDER_FRAME_INTERVAL = 10; ///< Duration of each frame in ms. +const int RENDER_ANIMATION_TEST_DURATION_MS = 1000; ///< 1000ms to test animation +const int RENDER_ANIMATION_TEST_DURATION_FRAMES = RENDER_ANIMATION_TEST_DURATION_MS / RENDER_FRAME_INTERVAL; ///< equivalent frames. +const Vector3 DEFAULT_BUTTON_SIZE(100.0f, 50.0f, 0.0f); +const Dali::TouchPoint pointDownOutside( 0, TouchPoint::Down, 10.0f, 10.0f ); +const Dali::TouchPoint pointUpOutside( 0, TouchPoint::Up, 10.0f, 10.0f ); + +/** + * Counts how many descendents root Actor has, including + * itself. + * + * @param[in] root The root actor to count from. + * @return The number of descendents including root actor itself. + */ +int DescendentCount(const Actor& root) +{ + unsigned int numChildren = root.GetChildCount(); + + int count = 1; + + for(unsigned int i=0; i withoutTailCount ); + + // Hide again + popup.HideTail(); + int withoutTailCount2 = DescendentCount(popup); + + DALI_TEST_CHECK( withTailCount > withoutTailCount2 ); + END_TEST; +} + +int UtcDaliPopupOnTouchedOutside(void) +{ + ToolkitTestApplication application; // Exceptions require ToolkitTestApplication + tet_infoline(" UtcDaliPopupOnTouchedOutside"); + + // Create the Popup actor + Popup popup = Popup::New(); + Stage::GetCurrent().Add( popup ); + popup.SetParentOrigin(ParentOrigin::CENTER); + popup.SetAnchorPoint(ParentOrigin::CENTER); + popup.SetState(Popup::POPUP_SHOW, 0.0f); + popup.OutsideTouchedSignal().Connect( &OnPopupTouchedOutside ); + + application.SendNotification(); + application.Render(); + + gTouchedOutside = false; + Dali::Integration::TouchEvent event; + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointDownOutside ); + application.ProcessEvent( event ); + + application.SendNotification(); + application.Render(); + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointUpOutside ); + application.ProcessEvent( event ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK(gTouchedOutside); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-PushButton.cpp b/automated-tests/src/dali-toolkit/utc-Dali-PushButton.cpp new file mode 100644 index 0000000..26abdea --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-PushButton.cpp @@ -0,0 +1,662 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include + +// Need to override adaptor classes for toolkit test harness, so include +// test harness headers before dali headers. +#include + +#include +#include +#include + +using namespace Dali; +using namespace Toolkit; + +void utc_dali_toolkit_pushbutton_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_toolkit_pushbutton_cleanup(void) +{ + test_return_value = TET_PASS; +} + +namespace +{ + +static bool gPushButtonToggleState = false; +bool PushButtonToggled( Button button, bool toggled ) +{ + gPushButtonToggleState = toggled && ( toggled == static_cast( button ).IsToggled() ); + return true; +} + +static bool gPushButtonPressed = false; + +static bool PushButtonPressed( Button button ) +{ + gPushButtonPressed = true; + return true; +} + +static bool gPushButtonReleased = false; + +static bool PushButtonReleased( Button button ) +{ + gPushButtonReleased = true; + return true; +} + +const Dali::TouchPoint pointDownInside( 0, TouchPoint::Down, 240, 400 ); +const Dali::TouchPoint pointUpInside( 0, TouchPoint::Up, 240, 400 ); +const Dali::TouchPoint pointLeave( 0, TouchPoint::Leave, 240, 400 ); +const Dali::TouchPoint pointEnter( 0, TouchPoint::Motion, 240, 400 ); +const Dali::TouchPoint pointMotionOut( 0, TouchPoint::Motion, 10, 10 ); +const Dali::TouchPoint pointDownOutside( 0, TouchPoint::Down, 10, 10 ); +const Dali::TouchPoint pointUpOutside( 0, TouchPoint::Up, 10, 10 ); + +static bool gOnTouchPointInterrupted = false; + + +Image CreateSolidColorImage( const Vector4& color, unsigned int width, unsigned int height ) +{ + BitmapImage imageData = BitmapImage::New( width, height, Pixel::RGBA8888 ); + + // Create the image + PixelBuffer* pixbuf = imageData.GetBuffer(); + unsigned int size = width * height; + + for( size_t i = 0; i < size; i++ ) + { + pixbuf[i*4+0] = 0xFF * color.r; + pixbuf[i*4+1] = 0xFF * color.g; + pixbuf[i*4+2] = 0xFF * color.b; + pixbuf[i*4+3] = 0xFF * color.a; + } + + imageData.Update(); + + return imageData; +} + +} //namespace + + +int UtcDaliPushButtonSetGetAutoRepeating(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliPushButtonSetGetAutoRepeating"); + + PushButton pushButton = PushButton::New(); + + pushButton.SetAutoRepeating( true ); + + DALI_TEST_CHECK( pushButton.IsAutoRepeating() ); + + pushButton.SetAutoRepeating( false ); + + DALI_TEST_CHECK( !pushButton.IsAutoRepeating() ); + + pushButton.SetAutoRepeating( true ); + + DALI_TEST_CHECK( pushButton.IsAutoRepeating() ); + END_TEST; +} + +int UtcDaliPushButtonSetGetToggleButton(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliPushButtonSetGetToggleButton"); + + PushButton pushButton = PushButton::New(); + + pushButton.SetToggleButton( true ); + + DALI_TEST_CHECK( pushButton.IsToggleButton() ); + + pushButton.SetToggleButton( false ); + + DALI_TEST_CHECK( !pushButton.IsToggleButton() ); + + pushButton.SetToggleButton( true ); + + DALI_TEST_CHECK( pushButton.IsToggleButton() ); + END_TEST; +} + +int UtcDaliPushButtonSetGetAutoRepeatingAndToggleButton(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliPushButtonSetGetAutoRepeatingAndToggleButton"); + + PushButton pushButton = PushButton::New(); + + pushButton.SetAutoRepeating( true ); + pushButton.SetToggleButton( true ); + + DALI_TEST_CHECK( pushButton.IsToggleButton() ); + DALI_TEST_CHECK( !pushButton.IsAutoRepeating() ); + + pushButton.SetToggleButton( true ); + pushButton.SetAutoRepeating( true ); + + DALI_TEST_CHECK( pushButton.IsAutoRepeating() ); + DALI_TEST_CHECK( !pushButton.IsToggleButton() ); + END_TEST; +} + +int UtcDaliPushButtonSetGetToggled01(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliPushButtonSetGetToggled01"); + + PushButton pushButton = PushButton::New(); + + pushButton.SetToggleButton( true ); + pushButton.ToggledSignal().Connect( &PushButtonToggled ); + + gPushButtonToggleState = false; + pushButton.SetToggled( true ); + + DALI_TEST_CHECK( pushButton.IsToggled() ); + DALI_TEST_CHECK( gPushButtonToggleState ); + + pushButton.SetToggled( false ); + + DALI_TEST_CHECK( !pushButton.IsToggled() ); + DALI_TEST_CHECK( !gPushButtonToggleState ); + + pushButton.SetToggled( true ); + + DALI_TEST_CHECK( pushButton.IsToggled() ); + DALI_TEST_CHECK( gPushButtonToggleState ); + END_TEST; +} + +int UtcDaliPushButtonSetGetToggled02(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliPushButtonSetGetToggled02"); + + PushButton pushButton = PushButton::New(); + + pushButton.SetToggleButton( false ); + pushButton.ToggledSignal().Connect( &PushButtonToggled ); + + gPushButtonToggleState = false; + pushButton.SetToggled( true ); + + DALI_TEST_CHECK( !pushButton.IsToggled() ); + DALI_TEST_CHECK( !gPushButtonToggleState ); + + pushButton.SetToggled( false ); + + DALI_TEST_CHECK( !pushButton.IsToggled() ); + DALI_TEST_CHECK( !gPushButtonToggleState ); + + pushButton.SetToggled( true ); + + DALI_TEST_CHECK( !pushButton.IsToggled() ); + DALI_TEST_CHECK( !gPushButtonToggleState ); + END_TEST; +} + +int UtcDaliPushButtonSetGetAutorepeatingDelayValues01(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliPushButtonSetGetAutorepeatingDelayValues01"); + + PushButton pushButton = PushButton::New(); + + pushButton.SetAutoRepeating( true ); + + pushButton.SetInitialAutoRepeatingDelay( 1.f ); + DALI_TEST_EQUALS( pushButton.GetInitialAutoRepeatingDelay(), 1.f, TEST_LOCATION ); + + pushButton.SetNextAutoRepeatingDelay( 1.f ); + DALI_TEST_EQUALS( pushButton.GetNextAutoRepeatingDelay(), 1.f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliPushButtonSetGetAutorepeatingDelayValues02(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliPushButtonSetGetAutorepeatingDelayValues02"); + + PushButton pushButton = PushButton::New(); + + bool assert1( false ); + bool assert2( false ); + + pushButton.SetAutoRepeating( true ); + + try + { + pushButton.SetInitialAutoRepeatingDelay( -1.f ); + } + catch( Dali::DaliException& e ) + { + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_EQUALS(e.mCondition, "initialAutoRepeatingDelay > 0.f", TEST_LOCATION); + assert1 = true; + } + + try + { + pushButton.SetNextAutoRepeatingDelay( -1.f ); + } + catch( Dali::DaliException& e ) + { + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_EQUALS(e.mCondition, "nextAutoRepeatingDelay > 0.f", TEST_LOCATION); + assert2 = true; + } + + DALI_TEST_CHECK( assert1 && assert2 ); + END_TEST; +} + +int UtcDaliPushButtonSetImages(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliPushButtonSetImages"); + + Actor imageActor; + + Image image01 = CreateSolidColorImage( Color::RED, 10, 10 ); + ImageActor imageActor01 = CreateSolidColorActor( Color::RED ); + imageActor01.SetSize( 20.f, 20.f ); + + Image image02 = CreateSolidColorImage( Color::RED, 30, 30 ); + ImageActor imageActor02 = CreateSolidColorActor( Color::RED ); + imageActor02.SetSize( 40.f, 40.f ); + + Image image03 = CreateSolidColorImage( Color::RED, 50, 50 ); + ImageActor imageActor03 = CreateSolidColorActor( Color::RED ); + imageActor03.SetSize( 60.f, 60.f ); + + Image image04 = CreateSolidColorImage( Color::RED, 70, 70 ); + ImageActor imageActor04 = CreateSolidColorActor( Color::RED ); + imageActor04.SetSize( 80.f, 80.f ); + + Image image05 = CreateSolidColorImage( Color::RED, 90, 90 ); + ImageActor imageActor05 = CreateSolidColorActor( Color::RED ); + imageActor05.SetSize( 100.f, 100.f ); + + Vector3 size; + PushButton pushButton = PushButton::New(); + + application.SendNotification(); + application.Render(); + + // Just check if check box button size changes when a bigger image is set. + + pushButton.SetButtonImage( image01 ); + + application.SendNotification(); + application.Render(); + + size = pushButton.GetButtonImage().GetCurrentSize(); + + DALI_TEST_EQUALS( size.width, 10.f, TEST_LOCATION ); + DALI_TEST_EQUALS( size.height, 10.f, TEST_LOCATION ); + + pushButton.SetButtonImage( imageActor01 ); + + application.SendNotification(); + application.Render(); + + size = pushButton.GetButtonImage().GetCurrentSize(); + + DALI_TEST_EQUALS( size.width, 20.f, TEST_LOCATION ); + DALI_TEST_EQUALS( size.height, 20.f, TEST_LOCATION ); + + pushButton.SetBackgroundImage( image02 ); + + application.SendNotification(); + application.Render(); + + size = pushButton.GetBackgroundImage().GetCurrentSize(); + + DALI_TEST_EQUALS( size.width, 30.f, TEST_LOCATION ); + DALI_TEST_EQUALS( size.height, 30.f, TEST_LOCATION ); + + pushButton.SetBackgroundImage( imageActor02 ); + + application.SendNotification(); + application.Render(); + + size = pushButton.GetBackgroundImage().GetCurrentSize(); + + DALI_TEST_EQUALS( size.width, 40.f, TEST_LOCATION ); + DALI_TEST_EQUALS( size.height, 40.f, TEST_LOCATION ); + + pushButton.SetPressedImage( image03 ); + + application.SendNotification(); + application.Render(); + + size = pushButton.GetPressedImage().GetCurrentSize(); + + DALI_TEST_EQUALS( size.width, 50.f, TEST_LOCATION ); + DALI_TEST_EQUALS( size.height, 50.f, TEST_LOCATION ); + + pushButton.SetPressedImage( imageActor03 ); + + application.SendNotification(); + application.Render(); + + size = pushButton.GetPressedImage().GetCurrentSize(); + + DALI_TEST_EQUALS( size.width, 60.f, TEST_LOCATION ); + DALI_TEST_EQUALS( size.height, 60.f, TEST_LOCATION ); + + pushButton.SetDimmedBackgroundImage( image04 ); + + application.SendNotification(); + application.Render(); + + size = pushButton.GetDimmedBackgroundImage().GetCurrentSize(); + + DALI_TEST_EQUALS( size.width, 70.f, TEST_LOCATION ); + DALI_TEST_EQUALS( size.height, 70.f, TEST_LOCATION ); + + pushButton.SetDimmedBackgroundImage( imageActor04 ); + + application.SendNotification(); + application.Render(); + + size = pushButton.GetDimmedBackgroundImage().GetCurrentSize(); + + DALI_TEST_EQUALS( size.width, 80.f, TEST_LOCATION ); + DALI_TEST_EQUALS( size.height, 80.f, TEST_LOCATION ); + + pushButton.SetDimmedImage( image05 ); + + application.SendNotification(); + application.Render(); + + size = pushButton.GetDimmedImage().GetCurrentSize(); + + DALI_TEST_EQUALS( size.width, 90.f, TEST_LOCATION ); + DALI_TEST_EQUALS( size.height, 90.f, TEST_LOCATION ); + + pushButton.SetDimmedImage( imageActor05 ); + + application.SendNotification(); + application.Render(); + + size = pushButton.GetDimmedImage().GetCurrentSize(); + + DALI_TEST_EQUALS( size.width, 100.f, TEST_LOCATION ); + DALI_TEST_EQUALS( size.height, 100.f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliPushButtonSetLabelText(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliPushButtonSetLabelText"); + + const std::string STR( "Hola!" ); + + PushButton pushButton = PushButton::New(); + + application.SendNotification(); + application.Render(); + + TextView textView; + + pushButton.SetLabelText( STR ); + + textView = TextView::DownCast( pushButton.GetLabelText() ); + DALI_TEST_CHECK( STR == textView.GetText() ); + + TextView text = TextView::New( STR ); + pushButton.SetLabelText( text ); + + textView = TextView::DownCast( pushButton.GetLabelText() ); + DALI_TEST_CHECK( STR == textView.GetText() ); + END_TEST; +} + +int UtcDaliPushButtonPressed(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliPushButtonPressed"); + + PushButton pushButton = PushButton::New(); + pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); + pushButton.SetPosition( 240, 400 ); + pushButton.SetSize( 100, 100 ); + + Stage::GetCurrent().Add( pushButton ); + + application.SendNotification(); + application.Render(); + + gPushButtonPressed = false; + + // connect to its touch signal + pushButton.PressedSignal().Connect( &PushButtonPressed ); + + Dali::Integration::TouchEvent eventDown; + eventDown.AddPoint( pointDownInside ); + + // flush the queue and render once + application.SendNotification(); + application.Render(); + application.ProcessEvent( eventDown ); + + DALI_TEST_CHECK( gPushButtonPressed ); + END_TEST; +} + +int UtcDaliPushButtonReleased(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliPushButtonReleased"); + + PushButton pushButton = PushButton::New(); + pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); + pushButton.SetPosition( 240, 400 ); + pushButton.SetSize( 100, 100 ); + + Stage::GetCurrent().Add( pushButton ); + + application.SendNotification(); + application.Render(); + + // connect to its touch signal + pushButton.ReleasedSignal().Connect( &PushButtonReleased ); + + Dali::Integration::TouchEvent event; + + // Test1. Touch point down and up inside the button. + + gPushButtonReleased = false; + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointDownInside ); + application.ProcessEvent( event ); + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointUpInside ); + application.ProcessEvent( event ); + + DALI_TEST_CHECK( gPushButtonReleased ); + + // Test2. Touch point down and up outside the button. + + gPushButtonReleased = false; + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointDownOutside ); + application.ProcessEvent( event ); + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointUpOutside ); + application.ProcessEvent( event ); + + DALI_TEST_CHECK( !gPushButtonReleased ); + + // Test3. Touch point down inside and up outside the button. + + gPushButtonReleased = false; + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointDownInside ); + application.ProcessEvent( event ); + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointLeave ); + application.ProcessEvent( event ); + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointUpOutside ); + application.ProcessEvent( event ); + + DALI_TEST_CHECK( gPushButtonReleased ); + + // Test4. Touch point down outside and up inside the button. + + gPushButtonReleased = false; + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointDownOutside ); + application.ProcessEvent( event ); + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointEnter ); + application.ProcessEvent( event ); + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointUpInside ); + application.ProcessEvent( event ); + + DALI_TEST_CHECK( !gPushButtonReleased ); + END_TEST; +} + +int UtcDaliPushButtonToggled(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliPushButtonToggled"); + + PushButton pushButton = PushButton::New(); + pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); + pushButton.SetPosition( 240, 400 ); + pushButton.SetSize( 100, 100 ); + + Stage::GetCurrent().Add( pushButton ); + + application.SendNotification(); + application.Render(); + + // connect to its touch signal + pushButton.ToggledSignal().Connect( &PushButtonToggled ); + + Dali::Integration::TouchEvent event; + + // Test1. No toggle button. + + gPushButtonToggleState = false; + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointDownInside ); + application.ProcessEvent( event ); + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointUpInside ); + application.ProcessEvent( event ); + + DALI_TEST_CHECK( !gPushButtonToggleState ); + + // Set toggle property. + pushButton.SetToggleButton( true ); + + // Test2. Touch point down and up inside the button twice. + gPushButtonToggleState = false; + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointDownInside ); + application.ProcessEvent( event ); + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointUpInside ); + application.ProcessEvent( event ); + + DALI_TEST_CHECK( gPushButtonToggleState ); + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointDownInside ); + application.ProcessEvent( event ); + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointUpInside ); + application.ProcessEvent( event ); + + DALI_TEST_CHECK( !gPushButtonToggleState ); + + // Test3. Touch point down and up outside the button. + + gPushButtonToggleState = false; + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointDownOutside ); + application.ProcessEvent( event ); + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointUpOutside ); + application.ProcessEvent( event ); + + DALI_TEST_CHECK( !gPushButtonToggleState ); + + // Test4. Touch point down inside and up outside the button. + + gPushButtonToggleState = false; + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointDownInside ); + application.ProcessEvent( event ); + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointLeave ); + application.ProcessEvent( event ); + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointUpOutside ); + application.ProcessEvent( event ); + + DALI_TEST_CHECK( !gPushButtonToggleState ); + + // Test5. Touch point down outside and up inside the button. + + gPushButtonToggleState = false; + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointDownOutside ); + application.ProcessEvent( event ); + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointEnter ); + application.ProcessEvent( event ); + + event = Dali::Integration::TouchEvent(); + event.AddPoint( pointUpInside ); + application.ProcessEvent( event ); + + DALI_TEST_CHECK( !gPushButtonToggleState ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Ripple2DEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Ripple2DEffect.cpp new file mode 100644 index 0000000..b8a08cc --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-Ripple2DEffect.cpp @@ -0,0 +1,132 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include + +// Need to override adaptor classes for toolkit test harness, so include +// test harness headers before dali headers. +#include + +#include +#include + +using namespace Dali; + + +void utc_dali_toolkit_ripple_2d_effect_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_toolkit_ripple_2d_effect_cleanup(void) +{ + test_return_value = TET_PASS; +} + +int UtcDaliRipple2DEffectUninitialized(void) +{ + ToolkitTestApplication application; + + Toolkit::Ripple2DEffect effect; + + try + { + // New() must be called to create a Ripple2DEffect or it wont be valid. + effect.SetAmplitude( 0.5f ); + DALI_TEST_CHECK( false ); + } + catch (Dali::DaliException& e) + { + // Tests that a negative test of an assertion succeeds + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_CHECK(!effect); + } + END_TEST; +} + +int UtcDaliRipple2DEffectPropertyNames(void) +{ + ToolkitTestApplication application; + + Toolkit::Ripple2DEffect effect = Toolkit::Ripple2DEffect::New(); + + // Check the names, this names are used in the shaders code, + // if they change the shader code has to be updated + DALI_TEST_EQUALS( effect.GetAmplitudePropertyName(), "uAmplitude", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetTimePropertyName(), "uTime", TEST_LOCATION ); + END_TEST; +} + +int UtcDaliRipple2DEffectDefaultValues(void) +{ + ToolkitTestApplication application; + + Toolkit::Ripple2DEffect effect = Toolkit::Ripple2DEffect::New(); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetAmplitudePropertyName().c_str(), + 0.0f ) ); + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetTimePropertyName().c_str(), + 0.0f ) ); + END_TEST; +} + +int UtcDaliRipple2DEffectCustomValues(void) +{ + ToolkitTestApplication application; + + Toolkit::Ripple2DEffect effect = Toolkit::Ripple2DEffect::New(); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + actor.SetShaderEffect( effect ); + + effect.SetAmplitude( 5.0f ); + effect.SetTime( 2.0f ); + + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetAmplitudePropertyName().c_str(), + 5.0f ) ); + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetTimePropertyName().c_str(), + 2.0f ) ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-RippleEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-RippleEffect.cpp new file mode 100644 index 0000000..bda200b --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-RippleEffect.cpp @@ -0,0 +1,143 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include + +// Need to override adaptor classes for toolkit test harness, so include +// test harness headers before dali headers. +#include + +#include +#include + +using namespace Dali; + +void utc_dali_toolkit_ripple_effect_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_toolkit_ripple_effect_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +int UtcDaliRippleUninitializedEffect(void) +{ + ToolkitTestApplication application; + + Toolkit::RippleEffect effect; + + try + { + // New() must be called to create a RippleEffect or it wont be valid. + effect.SetAmplitude( 0.5f ); + DALI_TEST_CHECK( false ); + } + catch (Dali::DaliException& e) + { + // Tests that a negative test of an assertion succeeds + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_CHECK(!effect); + } + END_TEST; +} + +int UtcDaliRipplePropertyNamesEffect(void) +{ + ToolkitTestApplication application; + + Toolkit::RippleEffect effect = Toolkit::RippleEffect::New(); + + // Check the names, this names are used in the shaders code, + // if they change the shader code has to be updated + DALI_TEST_EQUALS( effect.GetAmplitudePropertyName(), "uAmplitude", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetCenterPropertyName(), "uCenter", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetTimePropertyName(), "uTime", TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliRippleDefaultValuesEffect(void) +{ + ToolkitTestApplication application; + + Toolkit::RippleEffect effect = Toolkit::RippleEffect::New(); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetAmplitudePropertyName().c_str(), + 0.0f ) ); + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetCenterPropertyName().c_str(), + Vector2( 0.0f, 0.0f ) ) ); + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetTimePropertyName().c_str(), + 0.0f ) ); + END_TEST; +} + +int UtcDaliRippleCustomValuesEffect(void) +{ + ToolkitTestApplication application; + + Toolkit::RippleEffect effect = Toolkit::RippleEffect::New(); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + + effect.SetAmplitude( 0.5f ); + effect.SetCenter( Vector2( 10.0f, 10.0f ) ); + effect.SetTime( 2.0f ); + + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetAmplitudePropertyName().c_str(), + 0.5f ) ); + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetCenterPropertyName().c_str(), + Vector2( 10.0f, 10.0f ) ) ); + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetTimePropertyName().c_str(), + 2.0f ) ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp new file mode 100644 index 0000000..f0b6215 --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp @@ -0,0 +1,684 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include + +// Need to override adaptor classes for toolkit test harness, so include +// test harness headers before dali headers. +#include + +#include +#include +#include +#include + +using namespace Dali; +using namespace Toolkit; + +void utc_dali_toolkit_scroll_view_effect_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_toolkit_scroll_view_effect_cleanup(void) +{ + test_return_value = TET_PASS; +} + +namespace +{ +static bool gObjectCreatedCallBackCalled; + +static void TestCallback(BaseHandle handle) +{ + gObjectCreatedCallBackCalled = true; +} + +const int MILLISECONDS_PER_SECOND = 1000; +const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS) +const int RENDER_ANIMATION_TEST_DURATION_MS = 1000; ///< 1000ms to test animation +const int RENDER_DELAY_SCROLL = 1000; ///< duration to wait for any scroll to complete. + +/* + * Simulate time passed by. + * + * @note this will always process at least 1 frame (1/60 sec) + * + * @param application Test application instance + * @param duration Time to pass in milliseconds. + * @return The actual time passed in milliseconds + */ +int Wait(ToolkitTestApplication& application, int duration = 0) +{ + int time = 0; + + for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++) + { + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + time += RENDER_FRAME_INTERVAL; + } + + return time; +} + +/** + * Creates a Ruler that snaps to a specified grid size. + * If that grid size is 0.0 then this ruler does not + * snap. + * + * @param[in] gridSize (optional) The grid size for the ruler, + * (Default = 0.0 i.e. no snapping) + * @return The ruler is returned. + */ +RulerPtr CreateRuler(float gridSize = 0.0f) +{ + if(gridSize <= Math::MACHINE_EPSILON_0) + { + return new DefaultRuler(); + } + return new FixedRuler(gridSize); +} + +// Callback probes. + +static bool gOnScrollStartCalled; ///< Whether the OnScrollStart signal was invoked. +static bool gOnScrollUpdateCalled; ///< Whether the OnScrollUpdate signal was invoked. +static bool gOnScrollCompleteCalled; ///< Whether the OnScrollComplete signal was invoked. +static bool gOnScrollClampedCalled; ///< Whether the OnScrollClamped signal was invoked. +static bool gOnSnapStartCalled; ///< Whether the OnSnapStart signal was invoked. +static ClampState3 gLastClampPosition; ///< Clamping information from OnScrollClampedEvent. +static SnapType gLastSnapType; ///< Snaping information from SnapEvent. +static Vector3 gConstraintResult; ///< Result from constraint. + +static ActorContainer gPages; ///< Keeps track of all the pages for applying effects. + +static void ResetScrollCallbackResults() +{ + gOnScrollStartCalled = false; + gOnScrollUpdateCalled = false; + gOnScrollCompleteCalled = false; +} + +/** + * Invoked when scrolling starts. + * + * @param[in] position The current scroll position. + */ +static void OnScrollStart( const Vector3& position ) +{ + gOnScrollStartCalled = true; +} + +/** + * Invoked when scrolling updates (via dragging) + * + * @param[in] position The current scroll position. + */ +static void OnScrollUpdate( const Vector3& position ) +{ + gOnScrollUpdateCalled = true; +} + +/** + * Invoked when scrolling finishes + * + * @param[in] position The current scroll position. + */ +static void OnScrollComplete( const Vector3& position ) +{ + gOnScrollCompleteCalled = true; +} + +/** + * Invoked when scrolling clamped. + * + * @param[in] event The position/scale/rotation axes that were clamped. + */ +static void OnScrollClamped( const ScrollView::ClampEvent& event ) +{ + gOnScrollClampedCalled = true; + gLastClampPosition = event.position; +} + +/** + * Invoked when a snap or flick started. + * + * @param[in] event The type of snap and the target position/scale/rotation. + */ +static void OnSnapStart( const ScrollView::SnapEvent& event ) +{ + gOnSnapStartCalled = true; + gLastSnapType = event.type; +} + +ScrollView SetupTestScrollView(int rows, int columns, Vector2 size) +{ + ScrollView scrollView = ScrollView::New(); + scrollView.SetSize(size); + scrollView.SetAnchorPoint(AnchorPoint::CENTER); + scrollView.SetParentOrigin(ParentOrigin::CENTER); + scrollView.ApplyConstraint( Constraint::New( Dali::Actor::SIZE, Dali::ParentSource( Dali::Actor::SIZE ), Dali::EqualToConstraint() ) ); + // Disable Refresh signal (TET environment cannot use adaptor's Timer) + scrollView.SetWrapMode(false); + scrollView.SetRefreshInterval(0); + scrollView.ScrollStartedSignal().Connect( &OnScrollStart ); + scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate ); + scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete ); + Stage::GetCurrent().Add( scrollView ); + RulerPtr rulerX = CreateRuler(size.width); + RulerPtr rulerY = CreateRuler(size.height); + if(columns > 1) + { + rulerX->SetDomain(RulerDomain(0.0f, size.width * columns)); + } + else + { + rulerX->Disable(); + } + if(rows > 1) + { + rulerY->SetDomain(RulerDomain(0.0f, size.width * rows)); + } + else + { + rulerY->Disable(); + } + + scrollView.SetRulerX( rulerX ); + scrollView.SetRulerY( rulerY ); + Stage::GetCurrent().Add( scrollView ); + + Actor container = Actor::New(); + container.SetParentOrigin(ParentOrigin::CENTER); + container.SetAnchorPoint(AnchorPoint::CENTER); + container.SetSize( size ); + scrollView.Add( container ); + container.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + + gPages.clear(); + for(int row = 0;row( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + page.SetParentOrigin( ParentOrigin::CENTER ); + page.SetAnchorPoint( AnchorPoint::CENTER ); + page.SetPosition( column * size.x, row * size.y ); + container.Add(page); + + gPages.push_back(page); + } + } + + ResetScrollCallbackResults(); + return scrollView; +} + +void CleanupTest() +{ + gPages.clear(); + ResetScrollCallbackResults(); +} + +Actor AddActorToPage(Actor page, float x, float y, float cols, float rows) +{ + Stage stage = Stage::GetCurrent(); + Vector2 stageSize = stage.GetSize(); + + const float margin = 10.0f; + const Vector2 actorSize((stageSize.x / cols) - margin, (stageSize.y / rows) - margin); + + Actor actor = Actor::New(); + actor.SetParentOrigin( ParentOrigin::CENTER ); + actor.SetAnchorPoint( AnchorPoint::CENTER ); + + Vector3 position( margin * 0.5f + (actorSize.x + margin) * x - stageSize.width * 0.5f, + margin * 0.5f + (actorSize.y + margin) * y - stageSize.height * 0.5f, + 0.0f); + Vector3 positionEnd( margin * 0.5f + (actorSize.x + margin) * (x + cols) - stageSize.width * 0.5f - margin, + margin * 0.5f + (actorSize.y + margin) * (y + rows) - stageSize.height * 0.5f - margin, + 0.0f); + Vector3 size(positionEnd - position); + actor.SetPosition( position + size * 0.5f); + actor.SetSize( positionEnd - position ); + page.Add(actor); + return actor; +} + +} // unnamed namespace + + +int UtcDaliScrollViewCustomEffectSetup(void) +{ + tet_infoline(" UtcDaliScrollViewCustomEffectSetup"); + + ScrollViewCustomEffect effect; + + DALI_TEST_CHECK( !effect ); + + BaseHandle handle = ScrollViewCustomEffect::New(); + + DALI_TEST_CHECK( handle ); + + effect = ScrollViewCustomEffect::DownCast(handle); + + DALI_TEST_CHECK( effect ); + + END_TEST; +} + +int UtcDaliScrollViewCubeEffectSetup(void) +{ + tet_infoline(" UtcDaliScrollViewCubeEffectSetup"); + + ScrollViewCubeEffect effect; + + DALI_TEST_CHECK( !effect ); + + BaseHandle handle = ScrollViewCubeEffect::New(); + + DALI_TEST_CHECK( handle ); + + effect = ScrollViewCubeEffect::DownCast(handle); + + DALI_TEST_CHECK( effect ); + END_TEST; +} + +int UtcDaliScrollViewSpiralEffectSetup(void) +{ + tet_infoline(" UtcDaliScrollViewSpiralEffectSetup"); + + ScrollViewPageSpiralEffect effect; + + DALI_TEST_CHECK( !effect ); + + BaseHandle handle = ScrollViewPageSpiralEffect::New(); + + DALI_TEST_CHECK( handle ); + + effect = ScrollViewPageSpiralEffect::DownCast(handle); + + DALI_TEST_CHECK( effect ); + END_TEST; +} + + + + +int UtcDaliScrollViewSlideEffectSetup(void) +{ + tet_infoline(" UtcDaliScrollViewSlideEffectSetup"); + + ScrollViewSlideEffect effect; + + DALI_TEST_CHECK( !effect ); + + BaseHandle handle = ScrollViewSlideEffect::New(); + + DALI_TEST_CHECK( handle ); + + effect = ScrollViewSlideEffect::DownCast(handle); + + DALI_TEST_CHECK( effect ); + END_TEST; +} + +int UtcDaliScrollViewTwistEffectSetup(void) +{ + tet_infoline(" UtcDaliScrollViewTwistEffectSetup"); + + ScrollViewTwistEffect effect; + + DALI_TEST_CHECK( !effect ); + + BaseHandle handle = ScrollViewTwistEffect::New(); + + DALI_TEST_CHECK( handle ); + + effect = ScrollViewTwistEffect::DownCast(handle); + + DALI_TEST_CHECK( effect ); + END_TEST; +} + +int UtcDaliScrollViewCubeEffectTest(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewCubeEffectTest"); + + Vector2 size = Stage::GetCurrent().GetSize(); + + ScrollView scrollView = SetupTestScrollView(1, 3, size); + Actor page = gPages[1]; + Wait(application, 500); + + ScrollViewCubeEffect effect = ScrollViewCubeEffect::New(); + scrollView.ApplyEffect(effect); + + Actor actor = AddActorToPage(page, 0.5f, 0.5f, 3, 3); + Wait(application); + Vector3 actorPrePosition = actor.GetCurrentPosition(); + + effect.ApplyToActor(actor, page, Vector3(-105.0f, 30.0f, -240.0f), Vector2(Math::PI * 0.5f, Math::PI * 0.5f), Vector2(0.25f, 0.25f) * size); + + Actor actor2 = AddActorToPage(page, 0.5f, 0.5f, 3, 3); + effect.ApplyToActor(actor2, Vector3(-105.0f, 30.0f, -240.0f), Vector2(Math::PI * 0.5f, Math::PI * 0.5f), Vector2(0.25f, 0.25f) * size); + + scrollView.ScrollTo(1); + while(!gOnScrollCompleteCalled) + { + Wait(application); + } + // test that the first page has reached centre of screen + Vector3 actorPostPosition = actor.GetCurrentPosition(); + // just check the actor has moved + DALI_TEST_CHECK((actorPostPosition - actorPrePosition).Length() > Math::MACHINE_EPSILON_1); + CleanupTest(); + END_TEST; +} + + +int UtcDaliScrollViewSpiralEffectTest(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewSpiralEffectTest"); + + Vector2 size = Stage::GetCurrent().GetSize(); + + ScrollView scrollView = SetupTestScrollView(1, 3, size); + Actor testPage = gPages[1]; + Wait(application, 500); + + ScrollViewPageSpiralEffect effect = ScrollViewPageSpiralEffect::New(); + scrollView.ApplyEffect(effect); + + for(ActorIter pageIter = gPages.begin(); pageIter != gPages.end(); ++pageIter) + { + Actor page = *pageIter; + page.RemoveConstraints(); + page.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + effect.ApplyToPage(page, Vector2(Math::PI_2, 0.0f)); + } + Wait(application); + + scrollView.ScrollTo(1); + while(!gOnScrollCompleteCalled) + { + Wait(application); + } + // test that the first page has reached centre of screen + Vector3 pagePos = testPage.GetCurrentPosition(); + DALI_TEST_EQUALS(pagePos, Vector3::ZERO, Math::MACHINE_EPSILON_0, TEST_LOCATION); + CleanupTest(); + END_TEST; +} + + + +int UtcDaliScrollViewSlideEffectTest(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewSlideEffectTest"); + + Vector2 size = Stage::GetCurrent().GetSize(); + Vector3 pageSize(size.x, size.y, 0.0f); + + ScrollView scrollView = SetupTestScrollView(1, 3, size); + Actor testPage = gPages[1]; + Wait(application, 500); + + ScrollViewSlideEffect effect = ScrollViewSlideEffect::New(); + effect.SetDelayReferenceOffset(pageSize * 0.25); + DALI_TEST_EQUALS(effect.GetDelayReferenceOffset(), pageSize * 0.25, Math::MACHINE_EPSILON_0, TEST_LOCATION); + effect.SetMaxDelayDuration(0.5f); + DALI_TEST_EQUALS(effect.GetMaxDelayDuration(), 0.5f, Math::MACHINE_EPSILON_0, TEST_LOCATION); + effect.SetSlideDirection(false); + DALI_TEST_CHECK(!effect.GetSlideDirection()); + + scrollView.ApplyEffect(effect); + + Actor actor = AddActorToPage(testPage, 0.5f, 0.5f, 3, 3); + Wait(application); + Vector3 actorPrePosition = actor.GetCurrentPosition(); + + effect.ApplyToActor(actor, 0.0f, 0.5f); + + scrollView.ScrollTo(1); + while(!gOnScrollCompleteCalled) + { + Wait(application); + } + // test that the first page has reached centre of screen + Vector3 actorPostPosition = actor.GetCurrentPosition(); + // just check the actor has moved + DALI_TEST_CHECK((actorPostPosition - actorPrePosition).Length() > Math::MACHINE_EPSILON_1); + CleanupTest(); + END_TEST; +} + +int UtcDaliScrollViewTwistEffectTest(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewTwistEffectTest"); + + Vector2 size = Stage::GetCurrent().GetSize(); + + ScrollView scrollView = SetupTestScrollView(1, 3, size); + Actor testPage = gPages[1]; + Wait(application, 500); + + ScrollViewTwistEffect effect = ScrollViewTwistEffect::New(); + float shrinkDist = 0.2f; + effect.SetMinimumDistanceForShrink(shrinkDist); + DALI_TEST_CHECK((shrinkDist - effect.GetMinimumDistanceForShrink()) < Math::MACHINE_EPSILON_0); + effect.EnableEffect(true); + scrollView.ApplyEffect(effect); + + Actor actor = AddActorToPage(testPage, 0.5f, 0.5f, 3, 3); + Wait(application); + Vector3 actorPrePosition = actor.GetCurrentPosition(); + + effect.ApplyToActor( actor, + true, + Vector2(Math::PI_2, Math::PI_2), + 0.0f); + + scrollView.ScrollTo(1); + while(!gOnScrollCompleteCalled) + { + Wait(application); + } + // test that the first page has reached centre of screen + Vector3 actorPostPosition = actor.GetCurrentPosition(); + // just check the actor has moved + DALI_TEST_CHECK((actorPostPosition - actorPrePosition).Length() > Math::MACHINE_EPSILON_1); + CleanupTest(); + END_TEST; +} + +int UtcDaliScrollViewCustomEffectTest(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliScrollViewCustomEffectTest"); + + Vector2 size = Stage::GetCurrent().GetSize(); + Vector3 pageSize(size.x, size.y, 0.0f); + + ScrollView scrollView = SetupTestScrollView(1, 3, size); + Actor testPage = gPages[1]; + Wait(application, 500); + Vector3 pageStartPos, pagePos; + pageStartPos = pagePos = testPage.GetCurrentPosition(); + //scrollView.RemoveConstraintsFromChildren(); + + ScrollViewCustomEffect effect = ScrollViewCustomEffect::DownCast(scrollView.ApplyEffect(ScrollView::PageEffectCarousel)); + + for(ActorIter pageIter = gPages.begin(); pageIter != gPages.end(); ++pageIter) + { + Actor page = *pageIter; + page.RemoveConstraints(); + page.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + effect.ApplyToPage(page, pageSize); + } + Wait(application); + pagePos = testPage.GetCurrentPosition(); + DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION); + + scrollView.ScrollTo(1); + while(!gOnScrollCompleteCalled) + { + Wait(application); + } + ResetScrollCallbackResults(); + // test that the first page has reached centre of screen + pagePos = testPage.GetCurrentPosition(); + DALI_TEST_EQUALS(pagePos, Vector3::ZERO, Math::MACHINE_EPSILON_0, TEST_LOCATION); + + // scroll back to page 0 + scrollView.ScrollTo(0); + while(!gOnScrollCompleteCalled) + { + Wait(application); + } + ResetScrollCallbackResults(); + pagePos = testPage.GetCurrentPosition(); + DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION); + + scrollView.RemoveEffect(effect); + + effect = ScrollViewCustomEffect::New(); + effect.SetPageTranslation(Vector3(20.0f, 20.0f, 5.0f)); + effect.SetPageTranslation(Vector3(20.0f, 20.0f, 5.0f), Vector3(20.0f, 20.0f, -5.0f)); + effect.SetPageTranslationIn(Vector3(20.0f, 20.0f, 5.0f)); + effect.SetPageTranslationOut(Vector3(20.0f, 20.0f, -5.0f)); + effect.SetPageTranslation(Vector3(20.0f, 0.0f, 0.0f)); + effect.SetSwingAngle(Math::PI, Vector3::YAXIS); + effect.SetPageSpacing(Vector2(20.0f, 20.0f)); + scrollView.ApplyEffect(effect); + + for(ActorIter pageIter = gPages.begin(); pageIter != gPages.end(); ++pageIter) + { + Actor page = *pageIter; + page.RemoveConstraints(); + page.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + effect.ApplyToPage(page, pageSize); + } + Wait(application); + pagePos = testPage.GetCurrentPosition(); + DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION); + + scrollView.ScrollTo(1); + while(!gOnScrollCompleteCalled) + { + Wait(application); + } + ResetScrollCallbackResults(); + // test that the first page has reached centre of screen + pagePos = testPage.GetCurrentPosition(); + DALI_TEST_EQUALS(pagePos, Vector3::ZERO, Math::MACHINE_EPSILON_0, TEST_LOCATION); + + // scroll back to page 0 + scrollView.ScrollTo(0); + while(!gOnScrollCompleteCalled) + { + Wait(application); + } + ResetScrollCallbackResults(); + pagePos = testPage.GetCurrentPosition(); + DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION); + + scrollView.RemoveEffect(effect); + effect = ScrollViewCustomEffect::New(); + effect.SetSwingAngle(Math::PI, Vector3::YAXIS); + effect.SetSwingAnchor(AnchorPoint::CENTER_LEFT); + effect.SetPageTranslation(Vector3(size.x, size.y, 0)); + effect.SetOpacityThreshold(0.66f); + scrollView.ApplyEffect(effect); + + for(ActorIter pageIter = gPages.begin(); pageIter != gPages.end(); ++pageIter) + { + Actor page = *pageIter; + page.RemoveConstraints(); + page.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + effect.ApplyToPage(page, pageSize); + } + Wait(application); + + scrollView.ScrollTo(1); + while(!gOnScrollCompleteCalled) + { + Wait(application); + } + ResetScrollCallbackResults(); + // test that the first page has reached centre of screen + pagePos = testPage.GetCurrentPosition(); + DALI_TEST_EQUALS(pagePos, Vector3::ZERO, Math::MACHINE_EPSILON_0, TEST_LOCATION); + + // scroll back to page 0 + scrollView.ScrollTo(0); + while(!gOnScrollCompleteCalled) + { + Wait(application); + } + ResetScrollCallbackResults(); + pagePos = testPage.GetCurrentPosition(); + DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION); + scrollView.RemoveEffect(effect); + + + effect.SetPageTranslateAlphaFunction(AlphaFunctions::Linear); + effect.SetPageTranslateAlphaFunction(AlphaFunctions::Linear, AlphaFunctions::Linear); + effect.SetPageTranslateAlphaFunctionIn(AlphaFunctions::Linear); + effect.SetPageTranslateAlphaFunctionOut(AlphaFunctions::Linear); + effect.SetGlobalPageRotation(Math::PI, Vector3::YAXIS); + effect.SetAngledOriginPageRotation(Vector3(Math::PI, Math::PI, 0.0f)); + effect.SetGlobalPageRotation(Math::PI, Vector3::YAXIS, Math::PI, Vector3::YAXIS); + effect.SetGlobalPageRotationIn(Math::PI, Vector3::YAXIS); + effect.SetGlobalPageRotationOut(Math::PI, Vector3::YAXIS); + effect.SetGlobalPageRotationOrigin(Vector3::ZERO); + effect.SetGlobalPageRotationOrigin(Vector3::ZERO, Vector3::ZERO); + effect.SetGlobalPageRotationOriginIn(Vector3::ZERO); + effect.SetGlobalPageRotationOriginOut(Vector3::ZERO); + effect.SetSwingAngle(Math::PI, Vector3::YAXIS); + effect.SetSwingAngle(Math::PI, Vector3::YAXIS, Math::PI, Vector3::YAXIS); + effect.SetSwingAngleIn(Math::PI, Vector3::YAXIS); + effect.SetSwingAngleOut(Math::PI, Vector3::YAXIS); + effect.SetSwingAngleAlphaFunction(AlphaFunctions::Linear); + effect.SetSwingAngleAlphaFunction(AlphaFunctions::Linear, AlphaFunctions::Linear); + effect.SetSwingAngleAlphaFunctionIn(AlphaFunctions::Linear); + effect.SetSwingAngleAlphaFunctionOut(AlphaFunctions::Linear); + effect.SetSwingAnchor(AnchorPoint::CENTER, AnchorPoint::CENTER_LEFT); + effect.SetSwingAnchorIn(AnchorPoint::CENTER); + effect.SetSwingAnchorOut(AnchorPoint::CENTER); + effect.SetSwingAnchorAlphaFunction(AlphaFunctions::Linear); + effect.SetSwingAnchorAlphaFunction(AlphaFunctions::Linear, AlphaFunctions::Linear); + effect.SetSwingAnchorAlphaFunctionIn(AlphaFunctions::Linear); + effect.SetSwingAnchorAlphaFunctionOut(AlphaFunctions::Linear); + effect.SetOpacityThreshold(0.5f); + effect.SetOpacityThreshold(0.5f, 0.5f); + effect.SetOpacityThresholdIn(0.5f); + effect.SetOpacityThresholdOut(0.5f); + effect.SetOpacityAlphaFunction(AlphaFunctions::Linear); + effect.SetOpacityAlphaFunction(AlphaFunctions::Linear, AlphaFunctions::Linear); + effect.SetOpacityAlphaFunctionIn(AlphaFunctions::Linear); + effect.SetOpacityAlphaFunctionOut(AlphaFunctions::Linear); + CleanupTest(); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-SuperBlurView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-SuperBlurView.cpp new file mode 100644 index 0000000..705c6e7 --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-SuperBlurView.cpp @@ -0,0 +1,216 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include + +// Need to override adaptor classes for toolkit test harness, so include +// test harness headers before dali headers. +#include + +#include +#include + +using namespace Dali; +using namespace Dali::Toolkit; + +void utc_dali_toolkit_super_blur_view_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_toolkit_super_blur_view_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +namespace +{ +const int BLUR_LEVELS = 3; +const int RENDER_FRAME_INTERVAL = 16; + +static bool gObjectCreatedCallBackCalled; +static void TestCallback(BaseHandle handle) +{ + gObjectCreatedCallBackCalled = true; +} + +/* + * Simulate time passed by. + * + * @note this will always process at least 1 frame (1/60 sec) + * + * @param application Test application instance + * @param duration Time to pass in milliseconds. + * @return The actual time passed in milliseconds + */ +int Wait(ToolkitTestApplication& application, int duration = 0) +{ + int time = 0; + + for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++) + { + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + time += RENDER_FRAME_INTERVAL; + } + + return time; +} + +Image CreateSolidColorImage( ToolkitTestApplication& application, const Vector4& color, unsigned int width, unsigned int height ) +{ + BitmapImage imageData = BitmapImage::New( width, height, Pixel::RGBA8888 ); + + // Create the image + PixelBuffer* pixbuf = imageData.GetBuffer(); + unsigned int size = width * height; + + for( size_t i = 0; i < size; i++ ) + { + pixbuf[i*4+0] = 0xFF * color.r; + pixbuf[i*4+1] = 0xFF * color.g; + pixbuf[i*4+2] = 0xFF * color.b; + pixbuf[i*4+3] = 0xFF * color.a; + } + imageData.Update(); + + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE ); + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + application.Render(RENDER_FRAME_INTERVAL); + application.SendNotification(); + + return imageData; +} +}//namespace + + +int UtcDaliSuperBlurViewNew(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliSuperBlurViewNew "); + + // Test default constructor. + SuperBlurView blurView; + DALI_TEST_CHECK( !blurView ); + + // Test object creation + blurView = SuperBlurView::New( BLUR_LEVELS ); + DALI_TEST_CHECK( blurView ); + + //Additional check to ensure object is created by checking if it's registered + ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + DALI_TEST_CHECK( registry ); + + gObjectCreatedCallBackCalled = false; + registry.ObjectCreatedSignal().Connect( &TestCallback ); + { + SuperBlurView blurView = SuperBlurView::New( BLUR_LEVELS ); + } + DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + + // Test copy constructor + SuperBlurView blurViewCopy2( blurView ); + DALI_TEST_CHECK( blurViewCopy2 ); + + // Test down cast + Actor actorView; + actorView = blurView; + SuperBlurView downCastView = SuperBlurView::DownCast( actorView ); + DALI_TEST_CHECK( downCastView ); + END_TEST; +} + +int UtcDaliSuperBlurViewSetImage(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliSuperBlurViewSetImage "); + + SuperBlurView blurView = SuperBlurView::New( BLUR_LEVELS ); + // create image actors for the original image and each blurred image + DALI_TEST_CHECK( blurView.GetChildCount() == BLUR_LEVELS+1 ); + + Image inputImage = CreateSolidColorImage( application, Color::GREEN, 50, 50 ); + blurView.SetImage( inputImage ); + // start multiple guassian blur call, each guassian blur creates two render tasks + DALI_TEST_CHECK( Stage::GetCurrent().GetRenderTaskList().GetTaskCount() == BLUR_LEVELS*2 + 1); + END_TEST; +} + +int UtcDaliSuperBlurViewSetGetBlurStrength(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliSuperBlurViewSetGetBlurStrength "); + + SuperBlurView blurView = SuperBlurView::New( BLUR_LEVELS ); + DALI_TEST_EQUALS(blurView.GetCurrentBlurStrength(), 0.f, TEST_LOCATION ); + + blurView.SetBlurStrength( 0.65f ); + Wait(application); + DALI_TEST_EQUALS(blurView.GetCurrentBlurStrength(), 0.65f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliSuperBlurViewGetBlurStrengthPropertyIndex(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliSuperBlurViewGetBlurStrengthPropertyIndex "); + + SuperBlurView blurView = SuperBlurView::New( BLUR_LEVELS ); + Property::Index blurPropertyIdx = blurView.GetBlurStrengthPropertyIndex(); + + float blurStrength; + (blurView.GetProperty( blurPropertyIdx )).Get(blurStrength); + DALI_TEST_EQUALS(blurStrength, 0.f, TEST_LOCATION ); + + blurView.SetBlurStrength( 0.65f ); + Wait(application); + (blurView.GetProperty( blurPropertyIdx )).Get(blurStrength); + DALI_TEST_EQUALS(blurStrength, 0.65f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliSuperBlurViewGetBlurredImage(void) +{ + ToolkitTestApplication application; + + tet_infoline( "UtcDaliSuperBlurViewGetBlurredImage" ); + + SuperBlurView blurView = SuperBlurView::New( BLUR_LEVELS ); + blurView.SetSize( 100.f,100.f ); + Image inputImage = CreateSolidColorImage( application, Color::GREEN, 100, 100 ); + blurView.SetImage( inputImage ); + + Wait(application, 200); // Make sure all the gaussian blur finished + + Image image1 = blurView.GetBlurredImage( 1 ); + DALI_TEST_CHECK( image1 ); + + Image image2 = blurView.GetBlurredImage( 2 ); + DALI_TEST_CHECK( image2.GetWidth() == 25 ); + DALI_TEST_CHECK( image2.GetHeight() == 25 ); + + Image image3 = blurView.GetBlurredImage( 3 ); + DALI_TEST_CHECK( FrameBufferImage::DownCast( image2 ) ); + + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-SwirlEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-SwirlEffect.cpp new file mode 100644 index 0000000..cac6977 --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-SwirlEffect.cpp @@ -0,0 +1,148 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include + +// Need to override adaptor classes for toolkit test harness, so include +// test harness headers before dali headers. +#include + +#include +#include + +using namespace Dali; + + +void utc_dali_toolkit_swirl_effect_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_toolkit_swirl_effect_cleanup(void) +{ + test_return_value = TET_PASS; +} + +int UtcDaliSwirlUninitializedEffect(void) +{ + ToolkitTestApplication application; + + Toolkit::SwirlEffect effect; + + try + { + // New() must be called to create a SwirlEffect or it wont be valid. + effect.SetRadius( 0.5f ); + DALI_TEST_CHECK( false ); + } + catch (Dali::DaliException& e) + { + // Tests that a negative test of an assertion succeeds + tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_CHECK(!effect); + } + END_TEST; +} + +int UtcDaliSwirlPropertyNamesEffect(void) +{ + ToolkitTestApplication application; + + Toolkit::SwirlEffect effect = Toolkit::SwirlEffect::New(false); + + // Check the names, this names are used in the shaders code, + // if they change the shader code has to be updated + DALI_TEST_EQUALS( effect.GetAnglePropertyName(), "uAngle", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetCenterPropertyName(), "uCenter", TEST_LOCATION ); + DALI_TEST_EQUALS( effect.GetRadiusPropertyName(), "uRadius", TEST_LOCATION ); + END_TEST; +} + +int UtcDaliSwirlDefaultValuesEffect(void) +{ + ToolkitTestApplication application; + + Toolkit::SwirlEffect effect = Toolkit::SwirlEffect::New(true); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + // Gets converted to opengl viewport coordinates + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetAnglePropertyName().c_str(), + 0.0f ) ); + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetCenterPropertyName().c_str(), + Vector2(0.5f, 0.5f) ) ); + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetRadiusPropertyName().c_str(), + 1.0f ) ); + END_TEST; +} + +int UtcDaliSwirlCustomValuesEffect(void) +{ + ToolkitTestApplication application; + + Toolkit::SwirlEffect effect = Toolkit::SwirlEffect::New(false); + DALI_TEST_CHECK( effect ); + + BitmapImage image = CreateBitmapImage(); + + ImageActor actor = ImageActor::New( image ); + actor.SetSize( 100.0f, 100.0f ); + + effect.SetAngle( 1.0f ); + effect.SetCenter( Vector2(0.3f, 0.7f) ); + effect.SetRadius( 2.0f ); + + actor.SetShaderEffect( effect ); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + // Gets converted to opengl viewport coordinates + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetAnglePropertyName().c_str(), + 1.0f ) ); + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetCenterPropertyName().c_str(), + Vector2(0.3f, 0.7f) ) ); + + DALI_TEST_CHECK( + application.GetGlAbstraction().CheckUniformValue( + effect.GetRadiusPropertyName().c_str(), + 2.0f ) ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextInput.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextInput.cpp new file mode 100644 index 0000000..1cf8bea --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextInput.cpp @@ -0,0 +1,727 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 + +#include +#include +#include +#include +#include + +using namespace Dali; +using namespace Toolkit; + +void utc_dali_toolkit_text_input_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_toolkit_text_input_cleanup(void) +{ + test_return_value = TET_PASS; +} + +namespace +{ +static bool gObjectCreatedCallBackCalled; + +static void TestCallback(BaseHandle handle) +{ + Actor actor = Actor::DownCast(handle); + + if(actor) + { + TextInput handle = TextInput::DownCast(actor); + if (handle) + { + gObjectCreatedCallBackCalled = true; + } + } +} + +static bool gHasEndSignalBeenReceived; +static bool gHasStartSignalBeenReceived; + +// Callback test function +void OnStartInput(TextInput textInput) +{ + gHasStartSignalBeenReceived = true; +} + +// Callback test function +void OnEndInput(TextInput textInput) +{ + gHasEndSignalBeenReceived = true; +} + +} + +// Positive test case for a method +int UtcDaliTextInputConstruction(void) +{ + ToolkitTestApplication application; + + tet_infoline("Testing New constructor"); + + TextInput textInput = TextInput::New(); + DALI_TEST_CHECK(textInput); + + //Additional check to ensure object is created by checking if it's registered + ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + DALI_TEST_CHECK( registry ); + + gObjectCreatedCallBackCalled = false; + registry.ObjectCreatedSignal().Connect(&TestCallback); + { + TextInput textInput = TextInput::New(); + } + DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + END_TEST; +} + + +static bool downCastToTextInput(Dali::Actor actor) +{ + TextInput handle = TextInput::DownCast(actor); + if (handle) + { + tet_infoline("Downcasted to TextInput"); + return true; + } + else + { + tet_infoline("Did not downcast to TextInput"); + return false; + } +} + +// Positive test case for a method +int UtcDaliTextInputDownCast(void) +{ + ToolkitTestApplication application; + + TextInput textInput = TextInput::New(); + + tet_infoline("Testing Downcasting with a TextInput"); + DALI_TEST_EQUALS(true,downCastToTextInput(textInput), TEST_LOCATION); // downcast a TextInput + + Dali::TextActor badHandle = Dali::TextActor::New("test"); + + tet_infoline("Testing Downcasting with the wrong actor"); + DALI_TEST_EQUALS(false, downCastToTextInput(badHandle), TEST_LOCATION); // downcast a TextActor to TextInput + END_TEST; +} + +// Positive test case for a method +int UtcDaliTextInputGetText(void) +{ + ToolkitTestApplication application; + + tet_infoline("Testing GetText"); + + const std::string teststring = "test"; + + TextInput textInput = TextInput::New(); // create empty TextInput + + DALI_TEST_EQUALS("",textInput.GetText(), TEST_LOCATION); // Get text which should be empty + + textInput.SetInitialText(teststring); + + DALI_TEST_EQUALS(teststring,textInput.GetText(), TEST_LOCATION); // Get text which should be test string + + END_TEST; +} + +int UtcDaliTextInputGetMarkupText(void) +{ + ToolkitTestApplication application; + + tet_infoline("Testing retrieval of Markup text after style set"); + + const std::string markup = "Text with italic style" ; + const std::string teststring = "Text with italic style"; + + TextInput textInput = TextInput::New(); + + tet_infoline("Set initial text"); + + textInput.SetInitialText( teststring ); + + tet_infoline("Check initial text"); + DALI_TEST_EQUALS( teststring,textInput.GetText(), TEST_LOCATION); // Get text which should be empty + + TextStyle style; + style.SetItalics( true ); + + tet_infoline("Apply style to TextInput"); + textInput.ApplyStyleToAll( style ); + + tet_infoline("Retreive Markup Text"); + const std::string retreivedMarkupString = textInput.GetMarkupText(); + + tet_infoline("Test Retreived text and Markup text match"); + DALI_TEST_EQUALS( retreivedMarkupString , retreivedMarkupString, TEST_LOCATION); + END_TEST; +} + +int UtcDaliTextInputSetMaxCharacterLength(void) +{ + ToolkitTestApplication application; + + tet_infoline("Testing Setting of max characters"); + + const int maxChars = 4; + const char* testChar = "v"; + + TextInput textInput = TextInput::New(); // create empty TextInput + Stage::GetCurrent().Add(textInput); + application.SendNotification(); + application.Render(); + + textInput.SetMaxCharacterLength(maxChars); + + Integration::KeyEvent event(testChar, testChar, 0, 0, 0, Integration::KeyEvent::Down ); + + std::string testString = ""; + + tet_infoline("Starting editmode"); + textInput.SetEditable( true ); + + tet_infoline("Sending Key Events"); + // Send max number of characters + for (int i=0; i < maxChars; i++) + { + application.ProcessEvent(event); + testString.append(testChar); + } + + tet_printf( "Get text result : %s\n", textInput.GetText().c_str()); + + DALI_TEST_EQUALS(testString, textInput.GetText(), TEST_LOCATION); + + tet_infoline("Sending Key Event which exceeds max characters"); + + application.ProcessEvent(event); // try to append additional character + + DALI_TEST_EQUALS(testString,textInput.GetText(), TEST_LOCATION); + + tet_infoline("Increase max characters limit"); + + textInput.SetMaxCharacterLength(maxChars+1); // increment max characters by 1 + + tet_infoline("Send character again which should now fit"); + application.ProcessEvent(event); // append additional character + testString.append(testChar); + + DALI_TEST_EQUALS(testString,textInput.GetText(), TEST_LOCATION); + END_TEST; +} + + +int UtcDaliTextInputSetAndGetNumberOfLines(void) +{ + ToolkitTestApplication application; + + tet_infoline("Ensuring API for setting and getting max number of lines is correct"); + + TextInput textInput = TextInput::New(); // create empty TextInput + + unsigned int numberOfLines = 1; + + textInput.SetNumberOfLinesLimit( numberOfLines ); + + DALI_TEST_EQUALS(numberOfLines ,textInput.GetNumberOfLinesLimit(), TEST_LOCATION); + END_TEST; +} + +int UtcDaliTextInputGetNumberOfCharacters(void) +{ + ToolkitTestApplication application; + + tet_infoline("Testing Getting number of characters"); + + const std::string initialString = "initial text"; + const std::string newInitialString = "initial text new"; + + TextInput textInput = TextInput::New(); // create empty TextInput + + textInput.SetInitialText( initialString ); + + tet_infoline("Testing TextInput contains correct number of characters "); + + DALI_TEST_EQUALS( initialString.size() , textInput.GetNumberOfCharacters(), TEST_LOCATION); + + tet_infoline("Testing TextInput contains correct number of characters second phase "); + + textInput.SetInitialText( newInitialString ); + + DALI_TEST_EQUALS( newInitialString.size() , textInput.GetNumberOfCharacters(), TEST_LOCATION); + END_TEST; +} + +int UtcDaliTextInputSetAndGetPlaceholderText(void) +{ + ToolkitTestApplication application; + + tet_infoline("Testing Setting of PlaceholderText"); + + const std::string initialString = "initial text"; + const std::string placeholderString = "placeholder"; + + TextInput textInput = TextInput::New(); // create empty TextInput + + tet_infoline("Testing TextInput is empty at creation "); + + DALI_TEST_EQUALS("",textInput.GetText(), TEST_LOCATION); + + tet_infoline("Set placeholder text"); + + textInput.SetPlaceholderText( placeholderString ); + + tet_infoline("Testing TextInput contains placeholder text"); + + DALI_TEST_EQUALS( placeholderString , textInput.GetPlaceholderText(), TEST_LOCATION); + + tet_infoline("Set initial text which should replace placeholder text"); + + textInput.SetInitialText( initialString ); + + tet_infoline("Testing TextInput contains initial text when placeholder text set"); + + DALI_TEST_EQUALS( initialString,textInput.GetText(), TEST_LOCATION); + END_TEST; +} + +// Positive test case for a method +int UtcDaliTextInputSetInitialText(void) +{ + ToolkitTestApplication application; + + tet_infoline("Testing Setting of Initial Text"); + + const std::string teststring = "test"; + + TextInput textInput = TextInput::New(); // create empty TextInput + + tet_infoline("Testing TextInput is empty at creation "); + + DALI_TEST_EQUALS("",textInput.GetText(), TEST_LOCATION); + + tet_infoline("Set text to TextInput"); + + textInput.SetInitialText(teststring); + + tet_infoline("Test TextInput contains set text"); + + DALI_TEST_EQUALS(teststring,textInput.GetText(), TEST_LOCATION); + END_TEST; +} + +int UtcDaliTextInputSetEditableAndIsEditable(void) +{ + ToolkitTestApplication application; + + tet_infoline("Testing SetEditable And IsEditable"); + + const std::string initialString = "initial text"; + + TextInput textInput = TextInput::New(); // create empty TextInput + textInput.SetInitialText( initialString ); + + Stage::GetCurrent().Add(textInput); + application.SendNotification(); + application.Render(); + + bool editableStateFalse ( false ); + bool editableStateTrue ( true ); + + textInput.SetEditable ( editableStateFalse ); + application.SendNotification(); + application.Render(); + DALI_TEST_EQUALS( editableStateFalse, textInput.IsEditable() , TEST_LOCATION); + + textInput.SetEditable ( editableStateTrue ); + application.SendNotification(); + application.Render(); + DALI_TEST_EQUALS( editableStateTrue, textInput.IsEditable() , TEST_LOCATION); + END_TEST; +} + +int UtcDaliTextInputSetEditOnTouch(void) +{ + ToolkitTestApplication application; + + tet_infoline("Testing SetEditOnTouch And IsEditOnTouch"); + + TextInput textInput = TextInput::New(); + + bool editableOnTouchOn ( true ); + bool editableOnTouchOff( false ); + + tet_infoline("Testing SetEditOnTouch disabled"); + textInput.SetEditOnTouch ( editableOnTouchOff ); + DALI_TEST_EQUALS( editableOnTouchOff, textInput.IsEditOnTouch() , TEST_LOCATION); + + tet_infoline("Testing SetEditOnTouch enabled"); + textInput.SetEditOnTouch ( editableOnTouchOn ); + DALI_TEST_EQUALS( editableOnTouchOn, textInput.IsEditOnTouch() , TEST_LOCATION); + END_TEST; +} + +int UtcDaliTextInputSetTextSelectable(void) +{ + ToolkitTestApplication application; + + tet_infoline("Testing SetTextSelectable and IsTextSelectable"); + + const std::string initialString = "initial text"; + + TextInput textInput = TextInput::New(); + textInput.SetInitialText( initialString ); + + tet_infoline("Testing SetTextSelectable"); + textInput.SetTextSelectable(); + DALI_TEST_EQUALS( true, textInput.IsTextSelectable() , TEST_LOCATION); + textInput.SetTextSelectable( false ); + DALI_TEST_EQUALS( false, textInput.IsTextSelectable() , TEST_LOCATION); + END_TEST; +} + +int UtcDaliTextInputTextSelection(void) +{ + ToolkitTestApplication application; + + tet_infoline("Testing Text Selection"); + + const std::string initialString = "initial text"; + + TextInput textInput = TextInput::New(); + textInput.SetInitialText( initialString ); + + Stage::GetCurrent().Add(textInput); + application.SendNotification(); + application.Render(); + + textInput.SetEditable( true ); + + tet_infoline("Testing IsTextSelected negative"); + DALI_TEST_EQUALS( false, textInput.IsTextSelected(), TEST_LOCATION); + + textInput.SelectText(1,7); + DALI_TEST_EQUALS( true, textInput.IsTextSelected(), TEST_LOCATION); + + textInput.DeSelectText(); + DALI_TEST_EQUALS( false, textInput.IsTextSelected(), TEST_LOCATION); + END_TEST; +} + +int UtcDaliTextInputEnableGrabHandleAndIsGrabHandleEnabled(void) +{ + ToolkitTestApplication application; + + TextInput textInput = TextInput::New(); + + bool grabHandleState = false; + + textInput.EnableGrabHandle( grabHandleState ); + + DALI_TEST_EQUALS( grabHandleState, textInput.IsGrabHandleEnabled(), TEST_LOCATION); + + grabHandleState = true; + textInput.EnableGrabHandle( grabHandleState ); + + DALI_TEST_EQUALS( grabHandleState, textInput.IsGrabHandleEnabled(), TEST_LOCATION); + + END_TEST; +} + +int UtcDaliTextInputSetAndGetBoundingRectangle(void) +{ + ToolkitTestApplication application; + + TextInput textInput = TextInput::New(); + + Stage::GetCurrent().Add(textInput); + Vector2 stageSize = Stage::GetCurrent().GetSize(); + + const Rect boundingRectangle( 100.0f, 100.0f, stageSize.width, stageSize.height ); + + textInput.SetBoundingRectangle( boundingRectangle ); + + const Rect retreievedBoundingRectangle = textInput.GetBoundingRectangle(); + + DALI_TEST_EQUALS( boundingRectangle.x, retreievedBoundingRectangle.x, TEST_LOCATION); + DALI_TEST_EQUALS( boundingRectangle.y, retreievedBoundingRectangle.y, TEST_LOCATION); + DALI_TEST_EQUALS( boundingRectangle.width, retreievedBoundingRectangle.width, TEST_LOCATION); + DALI_TEST_EQUALS( boundingRectangle.height, retreievedBoundingRectangle.height, TEST_LOCATION); + END_TEST; +} + + +int UtcDaliTextInputSetAndGetTextAlignment(void) +{ + ToolkitTestApplication application; + + TextInput textInput = TextInput::New(); + Stage::GetCurrent().Add(textInput); + application.SendNotification(); + application.Render(); + + textInput.SetTextAlignment(static_cast( Alignment::HorizontalCenter) ); + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK( static_cast( Alignment::HorizontalCenter) & textInput.GetTextAlignment()) ; + END_TEST; +} + + +int UtcDaliTextInputSetSortModifier(void) +{ + tet_infoline("Testing SetSortModifier does not cause TextInput failure"); + + ToolkitTestApplication application; + + TextInput textInput = TextInput::New(); + + const float offsetToUse = 1.5f; + + textInput.SetSortModifier( offsetToUse ); + + DALI_TEST_CHECK( textInput ); + END_TEST; +} + +int UtcDaliTextInputSetAndGetSnapshotModeEnabled(void) +{ + ToolkitTestApplication application; + + tet_infoline("Testing SetSnapshotModeEnabled and IsSnapshotModeEnabled"); + + TextInput textInput = TextInput::New(); // create empty TextInput + bool snapshotMode( true ); + textInput.SetSnapshotModeEnabled( snapshotMode ); + + DALI_TEST_EQUALS( snapshotMode, textInput.IsSnapshotModeEnabled(), TEST_LOCATION); + + snapshotMode = false; + textInput.SetSnapshotModeEnabled( snapshotMode ); + + DALI_TEST_EQUALS( snapshotMode, textInput.IsSnapshotModeEnabled(), TEST_LOCATION); + END_TEST; +} + + +int UtcDaliTextInputEndSignalEmit(void) +{ + ToolkitTestApplication application; + + tet_infoline("Testing Set editable false emits end signal"); + + TextInput textInput = TextInput::New(); // create empty TextInput + + Stage::GetCurrent().Add(textInput); + + textInput.InputFinishedSignal().Connect( &OnEndInput ); + + textInput.SetEditable(true) ; + + gHasEndSignalBeenReceived = false; + + textInput.SetEditable(false) ; + + DALI_TEST_EQUALS(true, gHasEndSignalBeenReceived, TEST_LOCATION); + END_TEST; +} + + + +int UtcDaliTextInputStartSignalEmit(void) +{ + ToolkitTestApplication application; + + tet_infoline("Testing SetEditable emits start signal"); + + TextInput textInput = TextInput::New(); // create empty TextInput + + Stage::GetCurrent().Add(textInput); + + textInput.InputStartedSignal().Connect( &OnStartInput ); + + gHasStartSignalBeenReceived = false; + + textInput.SetEditable(true); // Set editable first time + + DALI_TEST_EQUALS(true, gHasStartSignalBeenReceived, TEST_LOCATION); + + gHasStartSignalBeenReceived = false; + + textInput.SetEditable(true); // Set editable second time, signal should not be sent again. + + DALI_TEST_EQUALS(false, gHasStartSignalBeenReceived, TEST_LOCATION); + + textInput.SetEditable(false); + + gHasStartSignalBeenReceived = false; + + textInput.SetEditable(true); // Set editable again + + DALI_TEST_EQUALS(true, gHasStartSignalBeenReceived, TEST_LOCATION); + END_TEST; +} + +int UtcDaliTextInputExceedMaxCharacters(void) +{ + ToolkitTestApplication application; + + tet_infoline("Testing Max characters is obeyed when inputting key events "); + + TextInput textInput = TextInput::New(); // create empty TextInput + + Stage::GetCurrent().Add(textInput); + textInput.SetMaxCharacterLength(4); + textInput.SetInitialText(""); + textInput.SetEditable(true); + + application.SendNotification(); + application.Render(); + + Integration::KeyEvent eventA("a", "a", 0, 0, 0, Integration::KeyEvent::Down ); + Integration::KeyEvent eventB("b", "b", 0, 0, 0, Integration::KeyEvent::Down ); + + application.ProcessEvent(eventA); + application.ProcessEvent(eventB); + application.ProcessEvent(eventA); + application.ProcessEvent(eventB); + + application.ProcessEvent(eventA); + application.ProcessEvent(eventB); + + tet_printf( "Get text result : %s\n", textInput.GetText().c_str()); + + DALI_TEST_EQUALS("abab",textInput.GetText(), TEST_LOCATION); // Get text which should be only 4 characters + END_TEST; +} + + + +int UtcDaliTextInputSetAndGetFadeBoundary(void) +{ + tet_infoline("UtcDaliTextViewSetAndGetFadeBoundary: "); + + ToolkitTestApplication application; + + TextView::FadeBoundary fadeBoundary( PixelSize( 0 ), PixelSize( 20 ), PixelSize( 0 ), PixelSize( 10 ) ); + + TextInput textInput = TextInput::New(); + textInput.SetInitialText( "Hello world!" ); + + Stage::GetCurrent().Add(textInput); + application.SendNotification(); + application.Render(); + + textInput.SetFadeBoundary( fadeBoundary ); + + TextView::FadeBoundary fadeBoundary2 = textInput.GetFadeBoundary(); + + DALI_TEST_EQUALS( fadeBoundary.mLeft, fadeBoundary2.mLeft, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeBoundary.mRight, fadeBoundary2.mRight, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeBoundary.mTop, fadeBoundary2.mTop, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeBoundary.mBottom, fadeBoundary2.mBottom, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliTextInputSetAndGetWidthExceedPolicy(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextInputSetAndGetWidthExceedPolicy: "); + + const TextView::ExceedPolicy EXCEED_POLICIES[] = { TextView::Original, TextView::Fade, TextView::Split, TextView::ShrinkToFit }; + const unsigned int NUM_EXCEED_POLICIES = sizeof( EXCEED_POLICIES ) / sizeof( unsigned int ); + + TextInput textInput = TextInput::New(); + textInput.SetInitialText( "Hello world!" ); + + for( unsigned int epIndex = 0; epIndex < NUM_EXCEED_POLICIES; ++epIndex ) + { + textInput.SetWidthExceedPolicy( EXCEED_POLICIES[epIndex] ); + + DALI_TEST_EQUALS( textInput.GetWidthExceedPolicy(), EXCEED_POLICIES[epIndex], TEST_LOCATION ); + } + END_TEST; +} + +int UtcDaliTextInputSetAndGetHeightExceedPolicy(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTextInputSetAndGetHeightExceedPolicy: "); + + const TextView::ExceedPolicy EXCEED_POLICIES[] = { TextView::Original, TextView::Fade, TextView::ShrinkToFit }; + const unsigned int NUM_EXCEED_POLICIES = sizeof( EXCEED_POLICIES ) / sizeof( unsigned int ); + + TextInput textInput = TextInput::New(); + textInput.SetInitialText( "Hello world!" ); + + for( unsigned int epIndex = 0; epIndex < NUM_EXCEED_POLICIES; ++epIndex ) + { + textInput.SetHeightExceedPolicy( EXCEED_POLICIES[epIndex] ); + + DALI_TEST_EQUALS( textInput.GetHeightExceedPolicy(), EXCEED_POLICIES[epIndex], TEST_LOCATION ); + } + END_TEST; +} + +int UtcDaliTextInputScroll(void) +{ + tet_infoline("UtcDaliTextInputScroll: "); + ToolkitTestApplication application; + + // Avoids the frame buffer texture to throw an exception. + application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + + TextInput view = TextInput::New(); + view.SetMultilinePolicy( TextView::SplitByNewLineChar ); + view.SetWidthExceedPolicy( TextView::Original ); + view.SetHeightExceedPolicy( TextView::Original ); + view.SetTextAlignment( static_cast( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ) ); + view.SetInitialText( "Hello world! This is a scroll test." ); + view.SetSize( 100.f, 100.f ); + view.SetSnapshotModeEnabled( false ); + + Stage::GetCurrent().Add( view ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK( !view.IsScrollEnabled() ); // Scroll should be disabled by default. + + view.SetScrollEnabled( true ); + + DALI_TEST_CHECK( view.IsScrollEnabled() ); + DALI_TEST_CHECK( view.IsSnapshotModeEnabled() ); // Scroll should enable snapshot mode. + + view.SetScrollPosition( Vector2( 400.f, 400.f ) ); + + application.SendNotification(); + application.Render(); + + const Vector2& scrollPosition = view.GetScrollPosition(); + DALI_TEST_EQUALS( scrollPosition, Vector2( 149.153656f, 0.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextView.cpp new file mode 100644 index 0000000..eb1647f --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextView.cpp @@ -0,0 +1,826 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 +#include + +// Need to override adaptor classes for toolkit test harness, so include +// test harness headers before dali headers. +#include + +#include +#include + +using namespace Dali; +using namespace Toolkit; + +void utc_dali_toolkit_text_view_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_toolkit_text_view_cleanup(void) +{ + test_return_value = TET_PASS; +} + + +namespace +{ + +const char* const PROPERTY_TEXT = "text"; +const char* const PROPERTY_MULTILINE_POLICY = "multiline-policy"; +const char* const PROPERTY_WIDTH_EXCEED_POLICY = "width-exceed-policy"; +const char* const PROPERTY_HEIGHT_EXCEED_POLICY = "height-exceed-policy"; +const char* const PROPERTY_LINE_JUSTIFICATION = "line-justification"; +const char* const PROPERTY_FADE_BOUNDARY_LEFT = "fade-boundary-left"; +const char* const PROPERTY_FADE_BOUNDARY_RIGHT = "fade-boundary-right"; +const char* const PROPERTY_FADE_BOUNDARY_TOP = "fade-boundary-top"; +const char* const PROPERTY_FADE_BOUNDARY_BOTTOM = "fade-boundary-bottom"; +const char* const PROPERTY_LINE_HEIGHT_OFFSET = "line-height-offset"; +const char* const PROPERTY_HORIZONTAL_ALIGNMENT = "horizontal-alignment"; +const char* const PROPERTY_VERTICAL_ALIGNMENT = "vertical-alignment"; + +bool TestEqual( float x, float y ) +{ + return !( fabsf( x - y ) > Math::MACHINE_EPSILON_1000 ); +} + +static bool gObjectCreatedCallBackCalled; +static unsigned int gNumberObjectCreated; + +static void TestCallback(BaseHandle handle) +{ + gObjectCreatedCallBackCalled = true; + ++gNumberObjectCreated; +} + +static bool gTextScrolled; +static Vector2 gScrollDelta; +static void TestTextScrolled( TextView textView, Vector2 scrollDelta ) +{ + gTextScrolled = true; + gScrollDelta = scrollDelta; +} + +} // namespace + + +int UtcDaliTextViewNew(void) +{ + tet_infoline("UtcDaliTextViewNew: "); + ToolkitTestApplication application; + + // Test default constructor. + TextView view; + + DALI_TEST_CHECK( !view ); + + // Test default initialization. + view = TextView::New(); + + DALI_TEST_CHECK( view ); + + // Test copy constructor and asignment operator. + TextView viewCopy1; + + viewCopy1 = view; + + DALI_TEST_CHECK( viewCopy1 ); + + TextView viewCopy2( view ); + + DALI_TEST_CHECK( viewCopy2 ); + + // Test down cast. + Actor actorView; + + actorView = view; + + TextView downCastView = TextView::DownCast( actorView ); + + DALI_TEST_CHECK( downCastView ); + + // Test constructor with a given text. + + const std::string text( "Hello world!" ); + + const float DESCENDER = 8.0f; + + TextView view1 = TextView::New( text ); + + DALI_TEST_EQUALS( view1.GetText(), text, TEST_LOCATION ); + + MarkupProcessor::StyledTextArray styledText; + MarkupProcessor::GetStyledTextArray( text, styledText, true ); + + TextView view2 = TextView::New( styledText ); + + DALI_TEST_EQUALS( view2.GetText(), text, TEST_LOCATION ); + + // Check the default Toolkit::TextView::CharacterLayoutInfo::CharacterLayoutInfo() to increase coverage. + TextView::CharacterLayoutInfo characterLayoutInfo; + + DALI_TEST_EQUALS( characterLayoutInfo.mSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo.mPosition, Vector3::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo.mIsNewLineChar, false, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo.mIsRightToLeftCharacter, false, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo.mIsVisible, true, TEST_LOCATION ); + + TextView::CharacterLayoutInfo characterLayoutInfo2( Size( 2.f, 2.f ), + Vector3( 3.f, 4.f, 5.f ), + true, + true, + false, + DESCENDER ); + + characterLayoutInfo = characterLayoutInfo2; + + DALI_TEST_EQUALS( characterLayoutInfo.mSize, Size( 2.f, 2.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo.mPosition, Vector3( 3.f, 4.f, 5.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo.mIsNewLineChar, true, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo.mIsRightToLeftCharacter, true, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo.mIsVisible, false, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo.mDescender, DESCENDER , TEST_LOCATION ); + + + TextView::CharacterLayoutInfo characterLayoutInfo3( characterLayoutInfo ); + + DALI_TEST_EQUALS( characterLayoutInfo3.mSize, Size( 2.f, 2.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo3.mPosition, Vector3( 3.f, 4.f, 5.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo3.mIsNewLineChar, true, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo3.mIsRightToLeftCharacter, true, TEST_LOCATION ); + DALI_TEST_EQUALS( characterLayoutInfo3.mIsVisible, false, TEST_LOCATION ); + + // Check the default Toolkit::TextView::TextLayoutInfo::TextLayoutInfo() to increase coverage. + + TextView::TextLayoutInfo textLayoutInfo; + DALI_TEST_EQUALS( textLayoutInfo.mCharacterLayoutInfoTable.size(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo.mCharacterLogicalToVisualMap.size(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo.mCharacterVisualToLogicalMap.size(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo.mTextSize, Size::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo.mScrollOffset, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + + textLayoutInfo.mCharacterLayoutInfoTable.push_back( characterLayoutInfo ); + textLayoutInfo.mCharacterLogicalToVisualMap.push_back( 1 ); + textLayoutInfo.mCharacterVisualToLogicalMap.push_back( 1 ); + textLayoutInfo.mTextSize = Size( 10.f, 10.f ); + textLayoutInfo.mScrollOffset = Vector2( 5.f, 5.f ); + + TextView::TextLayoutInfo textLayoutInfo2( textLayoutInfo ); + + DALI_TEST_EQUALS( textLayoutInfo2.mCharacterLayoutInfoTable.size(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo2.mCharacterLogicalToVisualMap.size(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo2.mCharacterVisualToLogicalMap.size(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo2.mTextSize, Size( 10.f, 10.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo2.mScrollOffset, Vector2( 5.f, 5.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + + TextView::TextLayoutInfo textLayoutInfo3; + + textLayoutInfo3 = textLayoutInfo2; + + DALI_TEST_EQUALS( textLayoutInfo3.mCharacterLayoutInfoTable.size(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo3.mCharacterLogicalToVisualMap.size(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo3.mCharacterVisualToLogicalMap.size(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo3.mTextSize, Size( 10.f, 10.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( textLayoutInfo3.mScrollOffset, Vector2( 5.f, 5.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + + //Additional check to ensure object is created by checking if it's registered + ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + DALI_TEST_CHECK( registry ); + + gObjectCreatedCallBackCalled = false; + registry.ObjectCreatedSignal().Connect(&TestCallback); + { + TextView view = TextView::New(); + } + DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + END_TEST; +} + +int UtcDaliTextViewSetAndGetText(void) +{ + tet_infoline("UtcDaliTextViewSetAndGetText: "); + ToolkitTestApplication application; + + TextView view = TextView::New(); + view.SetSnapshotModeEnabled( false ); // Disables offscreen rendering. + + std::string str( "Text with differing aCeNdEr and dEcEnDeR" ); + + view.SetText( str ); + DALI_TEST_EQUALS( view.GetText(), str, TEST_LOCATION ); + + MarkupProcessor::StyledTextArray styledText; + MarkupProcessor::GetStyledTextArray( str, styledText, true ); + + view.SetText( styledText ); + DALI_TEST_EQUALS( view.GetText(), str, TEST_LOCATION ); + + // Test the number of text actor created. + + ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + DALI_TEST_CHECK( registry ); + + gNumberObjectCreated = 0; + registry.ObjectCreatedSignal().Connect(&TestCallback); + + // Following string should create three text-actors ([Hel], [lo wo] and [rld]). + std::string text( "Hello world!\n" + "\n" ); + + Stage::GetCurrent().Add( view ); + view.SetText( text ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( 3u, gNumberObjectCreated, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliTextViewSetStyleToCurrentText(void) +{ + tet_infoline("UtcDaliTextViewSetStyleToCurrentText: "); + ToolkitTestApplication application; + + TextStyle style; + style.SetItalics( true ); + + const std::string text( "앞서 농식품부 주이석 검역검사본부\n" + "동물방역부장을 단장으로 하는\n" + "민관합동조사단은 지난달 30일부터\n" + "12일간의 현지 조사활동을 마치고\n" + "11일 새벽 귀국했습니다." ); + TextView view = TextView::New( text ); + + bool fail = false; + try + { + view.SetStyleToCurrentText( style ); + } + catch( ... ) + { + tet_printf( "Tet case fails\n" ); + fail = true; + tet_result(TET_FAIL); + } + + DALI_TEST_CHECK( !fail ); + END_TEST; +} + +int UtcDaliTextViewSetAndGetLineHeight(void) +{ + tet_infoline("UtcDaliTextViewSetAndGetLineHeight: "); + + ToolkitTestApplication application; + + const float lineHeightOffset( 9.f ); + + TextView textView = TextView::New(); + + textView.SetLineHeightOffset( PointSize( lineHeightOffset ) ); + + DALI_TEST_EQUALS( float(textView.GetLineHeightOffset()), lineHeightOffset, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliTextViewSetAndGetFadeBoundary(void) +{ + tet_infoline("UtcDaliTextViewSetAndGetFadeBoundary: "); + + ToolkitTestApplication application; + + TextView::FadeBoundary fadeBoundary( PixelSize( 0 ), PixelSize( 20 ), PixelSize( 0 ), PixelSize( 10 ) ); + + TextView textView = TextView::New( "Hello world!" ); + + textView.SetFadeBoundary( fadeBoundary ); + + TextView::FadeBoundary fadeBoundary2 = textView.GetFadeBoundary(); + + DALI_TEST_EQUALS( fadeBoundary.mLeft, fadeBoundary2.mLeft, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeBoundary.mRight, fadeBoundary2.mRight, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeBoundary.mTop, fadeBoundary2.mTop, TEST_LOCATION ); + DALI_TEST_EQUALS( fadeBoundary.mBottom, fadeBoundary2.mBottom, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliTextViewSetAndGetEllipsizeText(void) +{ + tet_infoline("UtcDaliTextViewSetAndGetEllipsizeText: "); + + ToolkitTestApplication application; + + TextView textView = TextView::New( "Hello world!" ); + + textView.SetEllipsizeText( std::string( "..." ) ); + + DALI_TEST_EQUALS( std::string( "..." ), textView.GetEllipsizeText(), TEST_LOCATION ); + + Toolkit::MarkupProcessor::StyledTextArray styledTextArray; + + GetStyledTextArray( std::string( "..." ), styledTextArray, true ); + + textView.SetEllipsizeText( styledTextArray ); + + DALI_TEST_EQUALS( std::string( "..." ), textView.GetEllipsizeText(), TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliTextViewSetAndGetWidthExceedPolicy(void) +{ + tet_infoline("UtcDaliTextViewSetAndGetWidthExceedPolicy: "); + + ToolkitTestApplication application; + + const TextView::ExceedPolicy EXCEED_POLICIES[] = { TextView::Original, TextView::Fade, TextView::Split, TextView::ShrinkToFit }; + const unsigned int NUM_EXCEED_POLICIES = sizeof( EXCEED_POLICIES ) / sizeof( unsigned int ); + + TextView textView = TextView::New( "Hello world!" ); + + for( unsigned int epIndex = 0; epIndex < NUM_EXCEED_POLICIES; ++epIndex ) + { + textView.SetWidthExceedPolicy( EXCEED_POLICIES[epIndex] ); + + DALI_TEST_EQUALS( textView.GetWidthExceedPolicy(), EXCEED_POLICIES[epIndex], TEST_LOCATION ); + } + END_TEST; +} + +int UtcDaliTextViewSetAndGetHeightExceedPolicy(void) +{ + tet_infoline("UtcDaliTextViewSetAndGetHeightExceedPolicy: "); + + ToolkitTestApplication application; + + const TextView::ExceedPolicy EXCEED_POLICIES[] = { TextView::Original, TextView::Fade, TextView::ShrinkToFit }; + const unsigned int NUM_EXCEED_POLICIES = sizeof( EXCEED_POLICIES ) / sizeof( unsigned int ); + + TextView textView = TextView::New( "Hello world!" ); + + for( unsigned int epIndex = 0; epIndex < NUM_EXCEED_POLICIES; ++epIndex ) + { + textView.SetHeightExceedPolicy( EXCEED_POLICIES[epIndex] ); + + DALI_TEST_EQUALS( textView.GetHeightExceedPolicy(), EXCEED_POLICIES[epIndex], TEST_LOCATION ); + } + END_TEST; +} + +int UtcDaliTextViewTestLayoutOptions01(void) +{ + tet_infoline("UtcDaliTextViewTestLayoutOptions01: "); + + ToolkitTestApplication application; + + const std::string text( "앞서 농식품부 주이석 검역검사본부\n" + "동물방역부장을 단장으로 하는\n" + "민관합동조사단은 지난달 30일부터\n" + "12일간의 현지 조사활동을 마치고\n" + "11일 새벽 귀국했습니다." ); + + const TextView::MultilinePolicy MULTILINE_POLICIES[] = { TextView::SplitByNewLineChar, TextView::SplitByWord, TextView::SplitByChar }; + const TextView::ExceedPolicy EXCEED_WIDTH_POLICIES[] = { TextView::Original, TextView::Fade, TextView::Split, TextView::ShrinkToFit, TextView::EllipsizeEnd }; + const TextView::ExceedPolicy EXCEED_HEIGHT_POLICIES[] = { TextView::Original, TextView::Fade, TextView::ShrinkToFit }; + const Alignment::Type TEXT_ALIGNMENT[] = { static_cast( Alignment::HorizontalLeft | Alignment::VerticalTop ), + static_cast( Alignment::HorizontalLeft | Alignment::VerticalCenter ), + static_cast( Alignment::HorizontalLeft | Alignment::VerticalBottom ), + static_cast( Alignment::HorizontalCenter | Alignment::VerticalTop ), + static_cast( Alignment::HorizontalCenter | Alignment::VerticalCenter ), + static_cast( Alignment::HorizontalCenter | Alignment::VerticalBottom ), + static_cast( Alignment::HorizontalRight | Alignment::VerticalTop ), + static_cast( Alignment::HorizontalRight | Alignment::VerticalCenter ), + static_cast( Alignment::HorizontalRight | Alignment::VerticalBottom ) }; + const TextView::LineJustification LINE_JUSTIFICATION[] = { TextView::Left, TextView::Center, TextView::Right, TextView::Justified }; + + const unsigned int NUM_MULTILINE_POLICIES = sizeof( MULTILINE_POLICIES ) / sizeof( unsigned int ); + const unsigned int NUM_WIDTH_EXCEED_POLICIES = sizeof( EXCEED_WIDTH_POLICIES ) / sizeof( unsigned int ); + const unsigned int NUM_HEIGHT_EXCEED_POLICIES = sizeof( EXCEED_HEIGHT_POLICIES ) / sizeof( unsigned int ); + const unsigned int NUM_TEXT_ALIGNMENT = sizeof( TEXT_ALIGNMENT ) / sizeof( unsigned int ); + const unsigned int NUM_LINE_JUSTIFICATION = sizeof( LINE_JUSTIFICATION ) / sizeof( unsigned int ); + + TextView textView = TextView::New( text ); + textView.SetSnapshotModeEnabled( false ); // Disables offscreen rendering. + + Stage::GetCurrent().Add( textView ); + + TextView::TextLayoutInfo textLayoutInfo; + + for( unsigned int mlpIndex = 0; mlpIndex < NUM_MULTILINE_POLICIES; ++mlpIndex ) + { + textView.SetMultilinePolicy( MULTILINE_POLICIES[mlpIndex] ); + for( unsigned int ewpIndex = 0; ewpIndex < NUM_WIDTH_EXCEED_POLICIES; ++ewpIndex ) + { + textView.SetWidthExceedPolicy( EXCEED_WIDTH_POLICIES[ewpIndex] ); + for( unsigned int ehpIndex = 0; ehpIndex < NUM_HEIGHT_EXCEED_POLICIES; ++ehpIndex ) + { + textView.SetHeightExceedPolicy( EXCEED_HEIGHT_POLICIES[ehpIndex] ); + for( unsigned int taIndex = 0; taIndex < NUM_TEXT_ALIGNMENT; ++taIndex ) + { + textView.SetTextAlignment( TEXT_ALIGNMENT[taIndex] ); + for( unsigned int ljIndex = 0; ljIndex < NUM_LINE_JUSTIFICATION; ++ljIndex ) + { + textView.SetLineJustification( LINE_JUSTIFICATION[ljIndex] ); + + try + { + textView.GetTextLayoutInfo( textLayoutInfo ); + + application.SendNotification(); + application.Render(); + } + catch( Dali::DaliException& e ) + { + DALI_TEST_EQUALS( e.mCondition, "!\"TextView::CombineExceedPolicies() Invalid width and height exceed policies combination\"", TEST_LOCATION ); + } + catch( ... ) + { + tet_printf( "Tet case fails\n" ); + tet_printf( " MultilinePolicy : %d\n", MULTILINE_POLICIES[mlpIndex] ); + tet_printf( " Width ExceedPolicy : %d\n", EXCEED_WIDTH_POLICIES[ewpIndex] ); + tet_printf( " Height ExceedPolicy : %d\n", EXCEED_HEIGHT_POLICIES[ehpIndex] ); + tet_printf( " TextAlignment : %d\n", TEXT_ALIGNMENT[taIndex] ); + tet_printf( " LineJustification : %d\n", LINE_JUSTIFICATION[ljIndex] ); + tet_result(TET_FAIL); + } + + DALI_TEST_CHECK( LINE_JUSTIFICATION[ljIndex] == textView.GetLineJustification() ); + } + DALI_TEST_CHECK( TEXT_ALIGNMENT[taIndex] == textView.GetTextAlignment() ); + } + DALI_TEST_CHECK( EXCEED_HEIGHT_POLICIES[ehpIndex] == textView.GetHeightExceedPolicy() ); + } + DALI_TEST_CHECK( EXCEED_WIDTH_POLICIES[ewpIndex] == textView.GetWidthExceedPolicy() ); + } + DALI_TEST_CHECK( MULTILINE_POLICIES[mlpIndex] == textView.GetMultilinePolicy() ); + } + END_TEST; +} + +int UtcDaliTextViewTestLayoutOptions02(void) +{ + tet_infoline("UtcDaliTextViewTestLayoutOptions02: "); + ToolkitTestApplication application; + + // Check some configurations. + + TextView textView = TextView::New(); + textView.SetSnapshotModeEnabled( false ); // Disables offscreen rendering. + + Stage::GetCurrent().Add( textView ); + + // SplitByWord and ShrinkToFit. + // Centered alignment. + // Centered justification. + // Don't create a text actor per character. + + textView.SetMultilinePolicy( TextView::SplitByWord ); + textView.SetWidthExceedPolicy( TextView::ShrinkToFit ); + textView.SetHeightExceedPolicy( TextView::ShrinkToFit ); + textView.SetTextAlignment( static_cast( Alignment::HorizontalCenter | Alignment::VerticalTop ) ); + textView.SetLineJustification( TextView::Center ); + textView.SetSize( 136.56252f, 100.f ); + + textView.SetText( "Hello world!" ); + + application.SendNotification(); + application.Render(); + + std::vector sizes; + sizes.push_back( Size( 34.14063f, 11.380210f ) ); // + sizes.push_back( Size( 56.90105f, 11.380210f ) ); // + sizes.push_back( Size( 45.52084f, 11.380210f ) ); // By default characters have width and height values of 11.380210. + // The result should be a line with the text 'Hello world' as shown below. + std::vector positions; // ____________ + positions.push_back( Vector3( 0.000008f, 11.380209f, 0.f ) ); // |Hello world!| + positions.push_back( Vector3( 34.14063f, 11.380209f, 0.f ) ); // ------------ + positions.push_back( Vector3( 91.04168f, 11.380209f, 0.f ) ); // + + DALI_TEST_CHECK( positions.size() == textView.GetChildCount() ); // Check text has two text-actors. + + for( std::size_t index = 0, num = textView.GetChildCount(); index < num; ++index ) + { + const Vector3& size = textView.GetChildAt(index).GetCurrentSize(); + const Vector3& position = textView.GetChildAt(index).GetCurrentPosition(); + + DALI_TEST_EQUALS( size.width, sizes[index].width, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( size.height, sizes[index].height, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( position.width, positions[index].width, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( position.height, positions[index].height, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + } + + textView.SetSize( 50.f, 50.f ); + textView.SetTextAlignment( static_cast( Alignment::HorizontalCenter | Alignment::VerticalCenter ) ); + textView.SetSizePolicy( Toolkit::Control::Fixed, Toolkit::Control::Fixed ); + textView.SetLineJustification( Toolkit::TextView::Left ); + + application.SendNotification(); + application.Render(); + + sizes.clear(); + sizes.push_back( Size( 24.999999f, 8.333333f ) ); // + sizes.push_back( Size( 24.999999f, 8.333333f ) ); // + sizes.push_back( Size( 16.666666f, 8.333333f ) ); // Longest word is 'world!' (6 characters x 11.380210) which doesn't fit in the 50x50 box. + sizes.push_back( Size( 33.333332f, 8.333333f ) ); // The scale factor is 0.732265339, so the character size is 8.333333. + // Text should be split in two lines, centered in the vertical dimension and fitted in the horizontal one. + positions.clear(); // As shown below, the text is two lines and centered in the vertical dimension and + positions.push_back( Vector3( 0.000008f, 25.223114f, 0.f ) ); // it should start in middle height (~25). + positions.push_back( Vector3( 24.999999f, 25.223114f, 0.f ) ); // ______ + positions.push_back( Vector3( 0.000006f, 33.556446f, 0.f ) ); // | | + positions.push_back( Vector3( 16.666666f, 33.556446f, 0.f ) ); // |Hello | + // |world!| + // |______| + // + + DALI_TEST_CHECK( positions.size() == textView.GetChildCount() ); // Check text has two text-actors. + + for( std::size_t index = 0, num = textView.GetChildCount(); index < num; ++index ) + { + const Vector3& size = textView.GetChildAt(index).GetCurrentSize(); + const Vector3& position = textView.GetChildAt(index).GetCurrentPosition(); + + DALI_TEST_EQUALS( size.width, sizes[index].width, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( size.height, sizes[index].height, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( position.width, positions[index].width, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( position.height, positions[index].height, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + } + + // TODO: Add more tests when TextView implementation is finished. + END_TEST; +} + +int UtcDaliTextViewInsertRemoveText(void) +{ + tet_infoline("UtcDaliTextViewInsertRemoveText: "); + ToolkitTestApplication application; + + std::string text("Hello "); + + MarkupProcessor::StyledTextArray styledText; + MarkupProcessor::GetStyledTextArray( text, styledText, true ); + + TextView view = TextView::New( "world!" ); + + view.InsertTextAt( 0, styledText ); + + DALI_TEST_EQUALS( view.GetText(), std::string("Hello world!"), TEST_LOCATION ); + + view.RemoveTextFrom( 4, 5 ); + + DALI_TEST_EQUALS( view.GetText(), std::string("Hellld!"), TEST_LOCATION ); + + view.InsertTextAt( 0, "Hello " ); + + DALI_TEST_EQUALS( view.GetText(), std::string("Hello Hellld!"), TEST_LOCATION ); + + + view.InsertTextAt( 0, "Hello " ); + view.InsertTextAt( 0, "Hello " ); + view.InsertTextAt( 0, "Hello " ); + view.InsertTextAt( 0, "Hello " ); + view.RemoveTextFrom( 4, 2 ); + view.RemoveTextFrom( 4, 2 ); + view.RemoveTextFrom( 4, 2 ); + view.RemoveTextFrom( 4, 2 ); + view.RemoveTextFrom( 4, 2 ); + view.SetText( "Hello world!" ); + + DALI_TEST_EQUALS( view.GetText(), std::string("Hello world!"), TEST_LOCATION ); + + view.ReplaceTextFromTo( 5, 1, "" ); + + DALI_TEST_EQUALS( view.GetText(), std::string("Helloworld!"), TEST_LOCATION ); + + view.ReplaceTextFromTo( 0, 11, styledText ); + + DALI_TEST_EQUALS( view.GetText(), std::string("Hello "), TEST_LOCATION ); + END_TEST; +} + +int UtcDaliTextViewSnapshotEnable(void) +{ + tet_infoline("UtcDaliTextViewSnapshotEnable: "); + ToolkitTestApplication application; + + // Avoids the frame buffer texture to throw an exception. + application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + + TextView view = TextView::New( "Hello world! This is a snapshot test." ); + + Stage::GetCurrent().Add( view ); + + view.SetSnapshotModeEnabled( true ); // VCC. By default the snapshot mode should be enabled but it has been temporary disabled. + // This line should be removed when text-view is set to use the snapshot mode by default. + + // Snapshot is enabled by default. + DALI_TEST_CHECK( view.IsSnapshotModeEnabled() ); + + application.SendNotification(); + application.Render(); + + // TextView should have only two actors: + // the root (Actor) and the image (ImageActor). + + DALI_TEST_EQUALS( view.GetChildCount(), 2u, TEST_LOCATION ); + + view.SetSnapshotModeEnabled( false ); + DALI_TEST_CHECK( !view.IsSnapshotModeEnabled() ); + + application.SendNotification(); + application.Render(); + + // TextView should have one text-actor per word. + + DALI_TEST_EQUALS( view.GetChildCount(), 7u, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliTextViewScroll(void) +{ + tet_infoline("UtcDaliTextViewScroll: "); + ToolkitTestApplication application; + + // Avoids the frame buffer texture to throw an exception. + application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + + TextView view = TextView::New( "Hello world! This is a scroll test." ); + view.SetSize( 100.f, 100.f ); + view.SetSnapshotModeEnabled( false ); + + Stage::GetCurrent().Add( view ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK( !view.IsScrollEnabled() ); // Scroll should be disabled by default. + + view.SetScrollEnabled( true ); + view.ScrolledSignal().Connect( &TestTextScrolled ); + + DALI_TEST_CHECK( view.IsScrollEnabled() ); + DALI_TEST_CHECK( view.IsSnapshotModeEnabled() ); // Scroll should enable snapshot mode. + + gTextScrolled = false; + gScrollDelta = Vector2::ZERO; + view.SetScrollPosition( Vector2( 400.f, 400.f ) ); + + application.SendNotification(); + application.Render(); + + const Vector2& scrollPosition = view.GetScrollPosition(); + DALI_TEST_EQUALS( scrollPosition, Vector2( 149.153656f, 0.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + + DALI_TEST_CHECK( gTextScrolled ); + DALI_TEST_EQUALS( gScrollDelta, Vector2( 149.153656f, 0.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + + DALI_TEST_CHECK( view.IsScrollPositionTrimmed() ); + END_TEST; +} + +int UtcDaliTextViewSetProperty(void) +{ + tet_infoline("UtcDaliTextViewSetAndGetText: "); + ToolkitTestApplication application; + + TextView view = TextView::New( "Hello world!" ); + Stage::GetCurrent().Add( view ); + + //Test multiline policy property + view.SetProperty(view.GetPropertyIndex(PROPERTY_MULTILINE_POLICY), "SplitByNewLineChar"); + DALI_TEST_CHECK( Toolkit::TextView::SplitByNewLineChar == view.GetMultilinePolicy() ); + + view.SetProperty(view.GetPropertyIndex(PROPERTY_MULTILINE_POLICY), "SplitByWord"); + DALI_TEST_CHECK( Toolkit::TextView::SplitByWord == view.GetMultilinePolicy() ); + + view.SetProperty(view.GetPropertyIndex(PROPERTY_MULTILINE_POLICY), "SplitByChar"); + DALI_TEST_CHECK( Toolkit::TextView::SplitByChar == view.GetMultilinePolicy() ); + + //Test width exceed policy property + view.SetProperty(view.GetPropertyIndex(PROPERTY_WIDTH_EXCEED_POLICY), "Original"); + view.SetProperty(view.GetPropertyIndex(PROPERTY_HEIGHT_EXCEED_POLICY), "Original"); + DALI_TEST_CHECK( Toolkit::TextView::Original == view.GetWidthExceedPolicy() ); + DALI_TEST_CHECK( Toolkit::TextView::Original == view.GetHeightExceedPolicy() ); + + view.SetProperty(view.GetPropertyIndex(PROPERTY_WIDTH_EXCEED_POLICY), "Fade"); + view.SetProperty(view.GetPropertyIndex(PROPERTY_HEIGHT_EXCEED_POLICY), "Fade"); + DALI_TEST_CHECK( Toolkit::TextView::Fade == view.GetWidthExceedPolicy() ); + DALI_TEST_CHECK( Toolkit::TextView::Fade == view.GetHeightExceedPolicy() ); + + view.SetProperty(view.GetPropertyIndex(PROPERTY_WIDTH_EXCEED_POLICY), "ShrinkToFit"); + view.SetProperty(view.GetPropertyIndex(PROPERTY_HEIGHT_EXCEED_POLICY), "ShrinkToFit"); + DALI_TEST_CHECK( Toolkit::TextView::ShrinkToFit == view.GetWidthExceedPolicy() ); + DALI_TEST_CHECK( Toolkit::TextView::ShrinkToFit == view.GetHeightExceedPolicy() ); + + //Test line justification property + view.SetProperty(view.GetPropertyIndex(PROPERTY_LINE_JUSTIFICATION), "Left"); + DALI_TEST_CHECK( Toolkit::TextView::Left == view.GetLineJustification() ); + + view.SetProperty(view.GetPropertyIndex(PROPERTY_LINE_JUSTIFICATION), "Center"); + DALI_TEST_CHECK( Toolkit::TextView::Center == view.GetLineJustification() ); + + view.SetProperty(view.GetPropertyIndex(PROPERTY_LINE_JUSTIFICATION), "Right"); + DALI_TEST_CHECK( Toolkit::TextView::Right == view.GetLineJustification() ); + + view.SetProperty(view.GetPropertyIndex(PROPERTY_LINE_JUSTIFICATION), "Justified"); + DALI_TEST_CHECK( Toolkit::TextView::Justified == view.GetLineJustification() ); + + //Test fade boundary property + unsigned int testValue = 23; + PixelSize leftFadeBoundary(testValue); + view.SetProperty(view.GetPropertyIndex(PROPERTY_FADE_BOUNDARY_LEFT), testValue); + DALI_TEST_CHECK( leftFadeBoundary == view.GetFadeBoundary().mLeft ); + + testValue = 26; + PixelSize rightFadeBoundary(testValue); + view.SetProperty(view.GetPropertyIndex(PROPERTY_FADE_BOUNDARY_RIGHT), testValue); + DALI_TEST_CHECK( rightFadeBoundary == view.GetFadeBoundary().mRight ); + + testValue = 2; + PixelSize topFadeBoundary(testValue); + view.SetProperty(view.GetPropertyIndex(PROPERTY_FADE_BOUNDARY_TOP), testValue); + DALI_TEST_CHECK( topFadeBoundary == view.GetFadeBoundary().mTop ); + + testValue = 11; + PixelSize bottomFadeBoundary(testValue); + view.SetProperty(view.GetPropertyIndex(PROPERTY_FADE_BOUNDARY_BOTTOM), testValue); + DALI_TEST_CHECK( bottomFadeBoundary == view.GetFadeBoundary().mBottom ); + + //Test Line height offset property + float testOffsetValue = 14.04f; + view.SetProperty(view.GetPropertyIndex(PROPERTY_LINE_HEIGHT_OFFSET), testOffsetValue); + DALI_TEST_CHECK( PointSize(testOffsetValue) == view.GetLineHeightOffset() ); + + //Test alignment property + view.SetProperty(view.GetPropertyIndex(PROPERTY_HORIZONTAL_ALIGNMENT), "HorizontalLeft"); + view.SetProperty(view.GetPropertyIndex(PROPERTY_VERTICAL_ALIGNMENT), "VerticalTop"); + DALI_TEST_CHECK( (Toolkit::Alignment::HorizontalLeft | Toolkit::Alignment::VerticalTop) == view.GetTextAlignment() ); + END_TEST; +} + +int UtcDaliTextViewSetSortModifier(void) +{ + tet_infoline("UtcDaliTextViewSetAndGetText: "); + ToolkitTestApplication application; + + TextView view = TextView::New( "Hello world!" ); + Stage::GetCurrent().Add( view ); + + view.SetSortModifier( 10.f ); + view.SetSnapshotModeEnabled( false ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( RenderableActor::DownCast(view.GetChildAt(0)).GetSortModifier(), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliTextViewUnderlineText(void) +{ + tet_infoline("UtcDaliTextViewUnderlineText: "); + ToolkitTestApplication application; + + TextView textView = TextView::New( "gggggggggggggg" ); + textView.SetSnapshotModeEnabled( false ); + + textView.SetSize( 150.f, 100.f ); + + Stage::GetCurrent().Add( textView ); + + application.SendNotification(); + application.Render(); + + std::vector positions; + positions.push_back( 6.448784f ); + positions.push_back( 9.862847f ); + positions.push_back( 13.276909f ); + positions.push_back( 16.690973f ); + positions.push_back( 13.276909f ); + positions.push_back( 9.862847f ); + positions.push_back( 6.448784f ); + + for( std::size_t index = 0, num = textView.GetChildCount(); index < num; ++index ) + { + TextStyle style = TextActor::DownCast( textView.GetChildAt(index) ).GetTextStyle(); + + DALI_TEST_EQUALS( 4.17274f, style.GetUnderlineThickness(), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( positions[index], style.GetUnderlinePosition(), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + } + END_TEST; +} diff --git a/automated-tests/style/application.js b/automated-tests/style/application.js new file mode 100644 index 0000000..147094f --- /dev/null +++ b/automated-tests/style/application.js @@ -0,0 +1,194 @@ +function getScrollTop() { + return f_scrollTop(); +} + +function f_scrollTop() { + return f_filterResults($(window) ? $(window).scrollTop() : 0, + document.documentElement ? document.documentElement.scrollTop : 0, + document.body ? document.body.scrollTop : 0); +} +function f_filterResults(n_win, n_docel, n_body) { + var n_result = n_win ? n_win : 0; + if (n_docel && (!n_result || (n_result > n_docel))) + n_result = n_docel; + return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result; +} + +function setScrollTop() { + $(window) ? $(window).scrollTop(0) : 0; + document.documentElement ? document.documentElement.scrollTop = 0 : 0; + document.body ? document.body.scrollTop = 0 : 0; +} + +function goTopEx() { + $node = $('#goTopBtn'); + if (getScrollTop() > 0) { + $node.show(); + } else { + $node.hide(); + } + + $(window).scroll(function() { + if (getScrollTop() > 0) { + $node.show(); + } else { + $node.hide(); + } + }); + + $node.click(function() { + setScrollTop(); + }); +} + +function drawRatio() { + $('.suite_item').each(function(i, node) { + drawSuiteRatio(node) + }); +} + +$(".see_all").click(function(){ + $("#see_all").show(); + $("#see_fail").hide(); + $("#see_block").hide(); + $("#see_na").hide(); + updateToggles(); + return false; +}); + +$(".see_failed").click(function(){ + $("#see_all").hide(); + $("#see_fail").show(); + $("#see_block").hide(); + $("#see_na").hide(); + updateToggles(); + return false; +}); + +$(".see_blocked").click(function(){ + $("#see_all").hide(); + $("#see_fail").hide(); + $("#see_block").show(); + $("#see_na").hide(); + updateToggles(); + return false; +}); + +$(".see_na").click(function(){ + $("#see_all").hide(); + $("#see_fail").hide(); + $("#see_block").hide(); + $("#see_na").show(); + updateToggles(); + return false; +}); + +$("a.test_case_popup").click(function(){ + var $this = $(this); + Popup.show($this.attr('id')); + return false; +}); + +$(".see_capabilities").click(function(){ + if ($('#capability_table').css('display') == 'none') { + $("#capability_table").show(); + }else{ + $("#capability_table").hide(); + } + return false; +}); + +function drawSuiteRatio(node) { + arrTitle = new Array("Passed", "Failed", "Blocked", "Not Executed"); + var $node = $(node); + var $total = $node.find('.total'); + var $pass = $node.find('.pass'); + var $fail = $node.find('.fail'); + var $block = $node.find('.block'); + var $na = $node.find('.na'); + var $div = $node.find('.RatioGraphic'); + + var total_int = parseInt($total.text()); + var pass_int = parseInt($pass.text()); + var fail_int = parseInt($fail.text()); + var block_int = parseInt($block.text()); + var na_int = parseInt($na.text()); + + var pass_rate = pass_int * 100 / total_int; + var fail_rate = fail_int * 100 / total_int; + var block_rate = block_int * 100 / total_int; + var na_rate = na_int * 100 / total_int; + + var areaWidth = 380; + + var pass_width = areaWidth * pass_rate / 100; + var fail_width = areaWidth * fail_rate / 100; + var block_width = areaWidth * block_rate / 100; + var na_width = areaWidth * na_rate / 100; + + pass_rate = pass_rate.toFixed(2); + fail_rate = fail_rate.toFixed(2); + block_rate = block_rate.toFixed(2); + na_rate = na_rate.toFixed(2); + + var pass_style = "padding:3px 0px 0px 0px;font-size:9pt;height:17px;text-align:center;color:white;font-weight:bold;background:url("./style/blue.jpg");" + var fail_style = "padding:3px 0px 0px 0px;font-size:9pt;height:17px;text-align:center;color:white;font-weight:bold;background:url("./style/red.jpg");" + var block_style = "padding:3px 0px 0px 0px;font-size:9pt;height:17px;text-align:center;color:white;font-weight:bold;background:url("./style/orange.jpg");" + var na_style = "padding:3px 0px 0px 0px;font-size:9pt;height:17px;text-align:center;color:white;font-weight:bold;background:url("./style/gray.jpg");" + + var html = ""; + if (pass_width > 0){ + html += ""; + } + if (fail_width > 0){ + html += ""; + } + if (block_width > 0){ + html += ""; + } + if (na_width > 0){ + html += ""; + } + html += "
"; + if (pass_width > 20){ + html += pass_rate + "%" + } + html += ""; + if (fail_width > 20){ + html += fail_rate + "%" + } + html += ""; + if (block_width > 20){ + html += block_rate + "%" + } + html += ""; + if (na_width > 20){ + html += na_rate + "%" + } + html += "
"; + $div.html(html); +} diff --git a/automated-tests/style/back_top.png b/automated-tests/style/back_top.png new file mode 100644 index 0000000..19cbd76 Binary files /dev/null and b/automated-tests/style/back_top.png differ diff --git a/automated-tests/style/blue.jpg b/automated-tests/style/blue.jpg new file mode 100644 index 0000000..d1db8f7 Binary files /dev/null and b/automated-tests/style/blue.jpg differ diff --git a/automated-tests/style/gray.jpg b/automated-tests/style/gray.jpg new file mode 100644 index 0000000..f1acfdb Binary files /dev/null and b/automated-tests/style/gray.jpg differ diff --git a/automated-tests/style/jquery.min.js b/automated-tests/style/jquery.min.js new file mode 100644 index 0000000..198b3ff --- /dev/null +++ b/automated-tests/style/jquery.min.js @@ -0,0 +1,4 @@ +/*! jQuery v1.7.1 jquery.com | jquery.org/license */ +(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;g=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="
"+""+"
",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="
t
",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")}; +f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function() +{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); \ No newline at end of file diff --git a/automated-tests/style/orange.jpg b/automated-tests/style/orange.jpg new file mode 100644 index 0000000..ac4c749 Binary files /dev/null and b/automated-tests/style/orange.jpg differ diff --git a/automated-tests/style/popup.js b/automated-tests/style/popup.js new file mode 100644 index 0000000..5f994f4 --- /dev/null +++ b/automated-tests/style/popup.js @@ -0,0 +1,1215 @@ +/** + * Copyright (c)2005-2009 Matt Kruse (javascripttoolbox.com) + * + * Dual licensed under the MIT and GPL licenses. + * This basically means you can use this code however you want for + * free, but don't claim to have written it yourself! + * Donations always accepted: http://www.JavascriptToolbox.com/donate/ + * + * Please do not link to the .js files on javascripttoolbox.com from + * your site. Copy the files locally to your server instead. + * + */ +/* ******************************************************************* */ +/* UTIL FUNCTIONS */ +/* ******************************************************************* */ +var Util = {'$VERSION':1.06}; + +// Util functions - these are GLOBAL so they +// look like built-in functions. + +// Determine if an object is an array +function isArray(o) { + return (o!=null && typeof(o)=="object" && typeof(o.length)=="number" && (o.length==0 || defined(o[0]))); +}; + +// Determine if an object is an Object +function isObject(o) { + return (o!=null && typeof(o)=="object" && defined(o.constructor) && o.constructor==Object && !defined(o.nodeName)); +}; + +// Determine if a reference is defined +function defined(o) { + return (typeof(o)!="undefined"); +}; + +// Iterate over an array, object, or list of items and run code against each item +// Similar functionality to Perl's map() function +function map(func) { + var i,j,o; + var results = []; + if (typeof(func)=="string") { + func = new Function('$_',func); + } + for (i=1; i>>=4; + } + while(hex.length<6) { hex='0'+hex; } + return "#" + hex; + }; + + // Convert hyphen style names like border-width to camel case like borderWidth + css.hyphen2camel = function(property) { + if (!defined(property) || property==null) { return null; } + if (property.indexOf("-")<0) { return property; } + var str = ""; + var c = null; + var l = property.length; + for (var i=0; i0) { + return bodies[0]; + } + } + return null; + }; + + // Get the amount that the main document has scrolled from top + // -------------------------------------------------------------------- + screen.getScrollTop = function() { + if (document.documentElement && defined(document.documentElement.scrollTop) && document.documentElement.scrollTop>0) { + return document.documentElement.scrollTop; + } + if (document.body && defined(document.body.scrollTop)) { + return document.body.scrollTop; + } + return null; + }; + + // Get the amount that the main document has scrolled from left + // -------------------------------------------------------------------- + screen.getScrollLeft = function() { + if (document.documentElement && defined(document.documentElement.scrollLeft) && document.documentElement.scrollLeft>0) { + return document.documentElement.scrollLeft; + } + if (document.body && defined(document.body.scrollLeft)) { + return document.body.scrollLeft; + } + return null; + }; + + // Util function to default a bad number to 0 + // -------------------------------------------------------------------- + screen.zero = function(n) { + return (!defined(n) || isNaN(n))?0:n; + }; + + // Get the width of the entire document + // -------------------------------------------------------------------- + screen.getDocumentWidth = function() { + var width = 0; + var body = screen.getBody(); + if (document.documentElement && (!document.compatMode || document.compatMode=="CSS1Compat")) { + var rightMargin = parseInt(CSS.get(body,'marginRight'),10) || 0; + var leftMargin = parseInt(CSS.get(body,'marginLeft'), 10) || 0; + width = Math.max(body.offsetWidth + leftMargin + rightMargin, document.documentElement.clientWidth); + } + else { + width = Math.max(body.clientWidth, body.scrollWidth); + } + if (isNaN(width) || width==0) { + width = screen.zero(self.innerWidth); + } + return width; + }; + + // Get the height of the entire document + // -------------------------------------------------------------------- + screen.getDocumentHeight = function() { + var body = screen.getBody(); + var innerHeight = (defined(self.innerHeight)&&!isNaN(self.innerHeight))?self.innerHeight:0; + if (document.documentElement && (!document.compatMode || document.compatMode=="CSS1Compat")) { + var topMargin = parseInt(CSS.get(body,'marginTop'),10) || 0; + var bottomMargin = parseInt(CSS.get(body,'marginBottom'), 10) || 0; + return Math.max(body.offsetHeight + topMargin + bottomMargin, document.documentElement.clientHeight, document.documentElement.scrollHeight, screen.zero(self.innerHeight)); + } + return Math.max(body.scrollHeight, body.clientHeight, screen.zero(self.innerHeight)); + }; + + // Get the width of the viewport (viewable area) in the browser window + // -------------------------------------------------------------------- + screen.getViewportWidth = function() { + if (document.documentElement && (!document.compatMode || document.compatMode=="CSS1Compat")) { + return document.documentElement.clientWidth; + } + else if (document.compatMode && document.body) { + return document.body.clientWidth; + } + return screen.zero(self.innerWidth); + }; + + // Get the height of the viewport (viewable area) in the browser window + // -------------------------------------------------------------------- + screen.getViewportHeight = function() { + if (!window.opera && document.documentElement && (!document.compatMode || document.compatMode=="CSS1Compat")) { + return document.documentElement.clientHeight; + } + else if (document.compatMode && !window.opera && document.body) { + return document.body.clientHeight; + } + return screen.zero(self.innerHeight); + }; + + return screen; +})();var Sort = (function(){ + var sort = {}; + sort.AlphaNumeric = function(a,b) { + if (a==b) { return 0; } + if (a0 && document.anchors[0].x) { + for (var i=0; i0) { + top -= el.scrollTop; + } + if (el.scrollLeft && el.scrollLeft>0) { + left -= el.scrollLeft; + } + } + } + // If this node is also the offsetParent, add on the offsets and reset to the new offsetParent + if (el == offsetParent) { + left += o.offsetLeft; + if (el.clientLeft && el.nodeName!="TABLE") { + left += el.clientLeft; + } + top += o.offsetTop; + if (el.clientTop && el.nodeName!="TABLE") { + top += el.clientTop; + } + o = el; + if (o.offsetParent==null) { + if (o.offsetLeft) { + left += o.offsetLeft; + } + if (o.offsetTop) { + top += o.offsetTop; + } + } + offsetParent = o.offsetParent; + } + } + + + if (originalObject.offsetWidth) { + width = originalObject.offsetWidth; + } + if (originalObject.offsetHeight) { + height = originalObject.offsetHeight; + } + + return {'left':left, 'top':top, 'width':width, 'height':height + }; + }; + + // Retrieve the position of an object's center point + // ================================================= + pos.getCenter = function(o) { + var c = this.get(o); + if (c==null) { return null; } + c.left = c.left + (c.width/2); + c.top = c.top + (c.height/2); + return c; + }; + + return pos; +})();// CLASS CONSTRUCTOR +// -------------------------------------------------------------------- +var Popup = function(div, options) { + this.div = defined(div)?div:null; + this.index = Popup.maxIndex++; + this.ref = "Popup.objects["+this.index+"]"; + Popup.objects[this.index] = this; + // Store a reference to the DIV by id, also + if (typeof(this.div)=="string") { + Popup.objectsById[this.div] = this; + } + if (defined(this.div) && this.div!=null && defined(this.div.id)) { + Popup.objectsById[this.div.id] = this.div.id; + } + // Apply passed-in options + if (defined(options) && options!=null && typeof(options)=="object") { + for (var i in options) { + this[i] = options[i]; + } + } + return this; +}; + +// CLASS PROPERTIES +// -------------------------------------------------------------------- +// Index of popup objects, to maintain a global reference if necessary +Popup.maxIndex = 0; +Popup.objects = {}; +Popup.objectsById = {}; + +// The z-index value that popups will start at +Popup.minZIndex = 101; + +// Class names to assign to other objects +Popup.screenClass = "PopupScreen"; +Popup.iframeClass = "PopupIframe"; +Popup.screenIframeClass = "PopupScreenIframe"; + +// CLASS METHODS +// -------------------------------------------------------------------- + +// Hide all currently-visible non-modal dialogs +Popup.hideAll = function() { + for (var i in Popup.objects) { + var p = Popup.objects[i]; + if (!p.modal && p.autoHide) { + p.hide(); + } + } +}; +// Catch global events as a trigger to hide auto-hide popups +Event.add(document, "mouseup", Popup.hideAll, false); + +// A simple class method to show a popup without creating an instance +Popup.show = function(divObject, referenceObject, position, options, modal) { + var popup; + if (defined(divObject)) { + popup = new Popup(divObject); + } + else { + popup = new Popup(); + popup.destroyDivOnHide = true; + } + if (defined(referenceObject)) { popup.reference = DOM.resolve(referenceObject); } + if (defined(position)) { popup.position = position; } + if (defined(options) && options!=null && typeof(options)=="object") { + for (var i in options) { + popup[i] = options[i]; + } + } + if (typeof(modal)=="boolean") { + popup.modal = modal; + } + popup.destroyObjectsOnHide = true; + popup.show(); + return popup; +}; + +// A simple class method to show a modal popup +Popup.showModal = function(divObject, referenceObject, position, options) { + Popup.show(divObject, referenceObject, position, options, true); +}; + +// A method to retrieve a popup object based on a div ID +Popup.get = function(divId) { + if (defined(Popup.objectsById[divId])) { + return Popup.objectsById[divId]; + } + return null; +}; + +// A method to hide a popup based on a div id +Popup.hide = function(divId) { + var popup = Popup.get(divId); + if (popup!=null) { + popup.hide(); + } +}; + +// PROTOTYPE PROPERTIES +// -------------------------------------------------------------------- +Popup.prototype.content = null; +Popup.prototype.className = "PopupDiv"; +Popup.prototype.style = null; // Styles to be applied to the DIV +Popup.prototype.width = null; +Popup.prototype.height = null; +Popup.prototype.top = null; +Popup.prototype.left = null; +Popup.prototype.offsetLeft = 0; +Popup.prototype.offsetTop = 0; +Popup.prototype.constrainToScreen = true; +Popup.prototype.autoHide = true; +Popup.prototype.useIframeShim = false; /*@cc_on @*/ /*@if (@_win32) {Popup.prototype.useIframeShim = true;} @end @*/ +Popup.prototype.iframe = null; +Popup.prototype.position = null; // vertical: "above top center bottom below", horizontal: "adjacent-left,left,center,right,adjacent-right" +Popup.prototype.reference = null; +Popup.prototype.modal = false; +Popup.prototype.destroyDivOnHide = false; +Popup.prototype.destroyObjectsOnHide = false; +Popup.prototype.screen = null; +Popup.prototype.screenIframeShim = null; +Popup.prototype.screenOpacity=.4; +Popup.prototype.screenColor="#cccccc"; + +// INSTANCE METHODS +// -------------------------------------------------------------------- + +// Show the popup +// -------------------------------------------------------------------- +Popup.prototype.show = function(options, modal) { + this.modal = this.modal || (typeof(modal)=="boolean" && modal); + if (defined(options) && options!=null && typeof(options)=="object") { + for (var i in options) { + this[i] = options[i]; + } + } + this.div = DOM.resolve(this.div); + CSS.setStyle(this.div,'position','absolute'); + + // If there is no div pre-defined to use, create one + if (this.div==null) { + this.div = this.createDiv(); + } + if (this.content!=null) { + this.div.innerHTML = this.content; + this.content = null; + } + if (this.className!=null) { + this.div.className = this.className; + } + if (this.style!=null) { + this.applyStyle(); + } + if (this.width!=null) { + this.div.style.width = this.width+"px"; + this.div.style.overflowX="auto"; + } + if (this.height!=null) { + this.div.style.height = this.height+"px"; + this.div.style.overflowY="auto"; + } + + // Do the actual display - this is a separate method so display transitions can be implemented + this.transition(); + + // Make sure clicks on the DIV don't bubble up to the document + this.div.onclick = function(e) { + Event.cancelBubble(Event.resolve(e)); + }; + this.div.onmouseup = this.div.onclick; + + // Focus to the DIV if possible + if (this.modal && this.div.focus) { + this.div.focus(); + } +}; + +// Show the popup but make it modal +// -------------------------------------------------------------------- +Popup.prototype.transition = function() { + if (this.modal) { + this.addScreen(); + } + + // Make the DIV displayed but hidden so its size can be measured + CSS.setStyle(this.div,'visibility','hidden'); + CSS.setStyle(this.div,'display','block'); + + // Position the popup + this.setPosition(); + + // Add the shim if necessary + if (this.useIframeShim) { + this.addIframeShim(); + } + + // Make sure the DIV is higher than the shim + this.div.style.zIndex = Popup.minZIndex++; + + CSS.setStyle(this.div,'display','block'); + CSS.setStyle(this.div,'visibility','visible'); +}; + +// Show the popup but make it modal +// -------------------------------------------------------------------- +Popup.prototype.showModal = function(options) { + this.show(options,true); +}; + +// Apply user styles to the DIV +// -------------------------------------------------------------------- +Popup.prototype.applyStyle = function() { + if (this.div!=null && this.style!=null && typeof(this.style)=="object") { + for (var i in this.style) { + this.div.style[i] = this.style[i]; + } + } +}; + +// Hide the popup +// -------------------------------------------------------------------- +Popup.prototype.hide = function() { + // If this was a temp object creating on-the-fly, then remove objects from the DOM so + // The document doesn't get littered with extra objects + if (this.destroyDivOnHide) { + DOM.removeNode(this.div); + this.div = null; + delete Popup.objects[this.id]; + } + else if (this.div!=null) { + CSS.setStyle(this.div,'display','none'); + } + + if (this.destroyObjectsOnHide) { + DOM.removeNode(this.iframe); + DOM.removeNode(this.screen); + DOM.removeNode(this.screenIframeShim); + } + else { + if (this.iframe!=null) { + this.iframe.style.display = "none"; + } + if (this.screen!=null) { + this.screen.style.display = "none"; + } + if (this.screenIframeShim!=null) { + this.screenIframeShim.style.display = "none"; + } + } +}; + +// Util funcs for position +// -------------------------------------------------------------------- +Popup.prototype.setTop = function(top) { + this.div.style.top = top+"px"; +}; +Popup.prototype.setLeft = function(left) { + this.div.style.left = left+"px"; +}; +Popup.prototype.getTop = function() { + return parseInt(CSS.getStyle(this.div,"top"),10); +}; +Popup.prototype.getLeft = function() { + return parseInt(CSS.getStyle(this.div,"left"),10); +}; + +// All the logic to position the popup based on various criteria +// -------------------------------------------------------------------- +Popup.prototype.setPosition = function() { + if (this.position!=null) { + var m = this.position.match(/^(\S+)\s+(\S+)/); + if (m!=null && m.length==3) { + var v = m[1]; + var h = m[2]; + + var ref = this.reference; + if (ref==null) { ref = Screen.getBody(); } + var p = Position.get(ref); + var refTop = p.top; + var refLeft = p.left; + var refWidth = DOM.getOuterWidth(ref); + var refHeight = DOM.getOuterHeight(ref); + + var width = DOM.getOuterWidth(this.div); + var height = DOM.getOuterHeight(this.div); + + var scrollLeft = Screen.getScrollLeft(); + var scrollTop = Screen.getScrollTop(); + + // Set vertical position relative to reference object + if (v=="above") { this.setTop(refTop-height+this.offsetTop); } + else if (v=="top") { this.setTop(refTop+this.offsetTop); } + else if (v=="center") { this.setTop(refTop+(refHeight/2)-(height/2)+this.offsetTop); } + else if (v=="bottom") { this.setTop(refTop+refHeight-height+this.offsetTop); } + else if (v=="below") { this.setTop(refTop+refHeight+this.offsetTop); } + + // Set horizontal position relative to reference object + if (h=="adjacent-left") { this.setLeft(refLeft-width+this.offsetLeft); } + else if (h=="left") { this.setLeft(refLeft+this.offsetLeft); } + else if (h=="center") { this.setLeft(refLeft+(refWidth/2)-(width/2)+this.offsetLeft); } + else if (h=="right") { this.setLeft(refLeft+refWidth-width+this.offsetLeft); } + else if (h=="adjacent-right") { this.setLeft(refLeft+refWidth+this.offsetLeft); } + } + } + else if (this.top==null && this.left==null) { + this.center(); + } + else { + if (this.top==null) { this.top=0; } + if (this.left==null) { this.left=0; } + this.div.style.top = this.top+this.offsetTop+"px"; + this.div.style.left = this.left+this.offsetLeft+"px"; + } + + // Re-position to make sure it stays on the screen + if (this.constrainToScreen) { + this.fitToScreen(); + } +}; + +// Append an object to the body +// -------------------------------------------------------------------- +Popup.prototype.appendToBody = function(o) { + var body = Screen.getBody(); + if (body && body.appendChild) { + body.appendChild(o); + } +}; + +// Create a new DIV object to be used for a popup +// -------------------------------------------------------------------- +Popup.prototype.createDiv = function() { + if (document.createElement) { + var d = document.createElement("DIV"); + d.style.position="absolute"; + d.style.display="block"; + d.style.visibility="hidden"; + this.appendToBody(d); + return d; + } + alert("ERROR: Couldn't create DIV element in Popup.prototype.createDiv()"); + return null; +}; + +// Create a new IFRAME object to be used behind the popup +// -------------------------------------------------------------------- +Popup.prototype.createIframe = function() { + if (document.createElement) { + var i= document.createElement("IFRAME"); + i.style.position="absolute"; + i.style.display="block"; + i.style.visibility="hidden"; + i.style.background="none"; + this.appendToBody(i); + return i; + } + else { + alert("ERROR: Couldn't create IFRAME object in Popup.prototype.createIframe()"); + } +}; + +// Add an IFRAME shim for the DIV +// -------------------------------------------------------------------- +Popup.prototype.addIframeShim = function() { + if (this.iframe==null) { + this.iframe = this.createIframe(); + } + this.iframe.className = Popup.iframeClass; + CSS.setStyle(this.iframe,'top',this.getTop()+"px"); + CSS.setStyle(this.iframe,'left',this.getLeft()+"px"); + CSS.setStyle(this.iframe,'width',DOM.getOuterWidth(this.div) + "px"); + CSS.setStyle(this.iframe,'height',DOM.getOuterHeight(this.div) + "px"); + CSS.setStyle(this.iframe,'zIndex',Popup.minZIndex++); + CSS.setStyle(this.iframe,'opacity',0); + CSS.setStyle(this.iframe,'visibility','visible'); + CSS.setStyle(this.iframe,'display','block'); +}; + +// Create a "screen" to make a popup modal +// -------------------------------------------------------------------- +Popup.prototype.addScreen = function() { + if (this.screen==null) { + this.screen = this.createDiv(); + this.screen.style.top="0px"; + this.screen.style.left="0px"; + this.screen.style.backgroundColor = this.screenColor; + this.screen.className=Popup.screenClass;; + CSS.setStyle(this.screen,"opacity",this.screenOpacity); + this.screen.onclick = function(e) { Event.cancelBubble(Event.resolve(e)); } + } + if (this.screenIframeShim==null) { + this.screenIframeShim = this.createIframe(); + this.screenIframeShim.style.top="0px"; + this.screenIframeShim.style.left="0px"; + this.screenIframeShim.className=Popup.screenIframeClass; + CSS.setStyle(this.screenIframeShim,"opacity",0); + } + this.screen.style.width = Screen.getDocumentWidth()+"px"; + this.screen.style.height = Screen.getDocumentHeight()+"px"; + this.screenIframeShim.style.width = Screen.getDocumentWidth()+"px"; + this.screenIframeShim.style.height = Screen.getDocumentHeight()+"px"; + this.screenIframeShim.style.zIndex = Popup.minZIndex++; + this.screenIframeShim.style.visibility="visible"; + this.screenIframeShim.style.display="block"; + this.screen.style.zIndex = Popup.minZIndex++; + this.screen.style.visibility="visible"; + this.screen.style.display="block"; +}; + +// Re-position the DIV so it stays on the screen +// -------------------------------------------------------------------- +Popup.prototype.fitToScreen = function() { + var width = DOM.getOuterWidth(this.div); + var height = DOM.getOuterHeight(this.div); + var top = this.getTop(); + var left = this.getLeft(); + + var clientWidth = Screen.getViewportWidth(); + var clientHeight = Screen.getViewportHeight(); + + var scrollLeft = Screen.getScrollLeft(); + var scrollTop = Screen.getScrollTop(); + + if (top-scrollTop+height>clientHeight) { + top = top - ((top+height) - (scrollTop+clientHeight)); + this.div.style.top = top + "px"; + } + if (left-scrollLeft+width>clientWidth) { + left = left - ((left+width) - (scrollLeft+clientWidth)); + this.div.style.left = left + "px"; + } + if (top + + + + + + + + + + + + + + \n + + + + +
+ + + +
+ + + +
+
+
diff --git a/automated-tests/style/testresult.xsl b/automated-tests/style/testresult.xsl new file mode 100644 index 0000000..019b445 --- /dev/null +++ b/automated-tests/style/testresult.xsl @@ -0,0 +1,571 @@ + + + + + + + + + + + + + + + \n + + + + +
+ + + +
+ + + +
+
+
diff --git a/automated-tests/style/tests.css b/automated-tests/style/tests.css new file mode 100644 index 0000000..487bca0 --- /dev/null +++ b/automated-tests/style/tests.css @@ -0,0 +1,195 @@ +@charset "UTF-8"; +/* CSS Document */ +#testcasepage div,#testcasepage h1,#testcasepage p,#testcasepage table,#testcasepage tr,#testcasepage th,#testcasepage td + { + margin: 0; + padding: 0; + border: 0; + font-weight: inherit; + font-style: inherit; + font-size: 0.96em; + font-family: arial; + vertical-align: baseline; +} + +#title td, #btc td{ + margin: 0; + padding: 0; + border: 0; + font-weight: inherit; + font-style: inherit; + font-size: 0.96em; + font-family: arial; + vertical-align: baseline; +} + +td.Ratio { + text-align: left; + font-weight: normal; + padding: 4px 10px 4px 5px; + vertical-align: middle; +} + +th.Ratio { + width: 400px; +} + +#testcasepage p { + text-align: left; +} + +#suite_title { + text-align: left; +} + +#btc { + text-align: right; +} + +#btc table { + position: absolute; + right: 0px; + width: 600px; +} + +#testcasepage table { + border-collapse: separate; + border-spacing: 0; + margin-bottom: 1.4em; + vertical-align: middle; +} + +#testcasepage th,#testcasepage td { + text-align: left; + font-weight: normal; + padding: 4px 10px 4px 5px; + vertical-align: middle; +} + +#cases table { + width: 101%; +} + +#cases td { + border-left: 0px; + font-weight: normal; + border-bottom: 0px; +} + +#suite_summary table { + width: 100%; +} + + +#overview table { + width: 101%; +} + +#overview table, #overview td, #overview tr { + border-left: none; + border-bottom: none; + border-right: none; + vertical-align: top; +} + +#overview td{ + width: 50%; +} + +#capability table { + width: 50%; +} + +#fail_cases table { + width: 101%; +} + +#title table { + width: 101%; +} + +#device table { + width: 100%; +} + +#summary table { + width: 100%; +} + +#testcasepage th { + border-bottom: 1px solid #000; + background-color: #AAAAAA; + border-left: 1px solid #000; + border-top: 1px solid #000; + color: #000; + font-weight: bold; + vertical-align: bottom; +} + +#summary th:last-child,#summary td:last-child, #device th:last-child,#device td:last-child, #suite_summary th:last-child,#suite_summary td:last-child,#cases th:last-child,#cases td:last-child,#capability th:last-child,#capability td:last-child { + border-right: 1px solid #000; +} + +#testcasepage td { + font-weight: normal; +} + +#summary td, #device td, #capability td, #suite_summary td, #cases td{ + border-left: 1px solid; + font-weight: normal; + border-bottom: 1px solid; +} + +#testcasepage td.yellow_rate { + background-color: #ffcc00; +} + +#testcasepage td.green_rate { + background-color: #1E90FF; +} + +#testcasepage td.dgreen_rate { + background-color: #339933; +} + +#testcasepage td.red_rate { + background-color: #FF3333; +} + +#testcasepage td.orange_rate { + background-color: #FFA500; +} + +#testcasepage td.gray_rate { + background-color: #AAAAAA; +} + +#title table,#title tr,#title td { + border-left: none; + border-bottom: none; + text-align: center; +} + +#title td:last-child { + border-right: none; +} + +#testcasepage h1 { + font-size: 2em; + font-family: Arial, sans-serif; + font-weight: bold; + line-height: 1; + color: #000; + margin-bottom: 0.75em; + padding-top: 0.25em; + font-weight: bold; +} + +#goTopBtn { + right: 0px; + bottom: 0px; + position: fixed; + + position: absolute; + top: expression(parseInt(document.body.scrollTop)+document.body.clientHeight-40 + ); +} diff --git a/automated-tests/summary.xml b/automated-tests/summary.xml new file mode 100644 index 0000000..fd5b7f8 --- /dev/null +++ b/automated-tests/summary.xml @@ -0,0 +1,42 @@ + + + + + + 2014-03-21_18_52_41 + 2014-03-21_18_57_54 + + + 231 + 222 + 96.10 + 9 + 3.90 + 0 + 0.00 + 0 + 0.00 + + + 33 + 31 + 93.94 + 2 + 6.06 + 0 + 0.00 + 0 + 0.00 + + + 311 + 290 + 93.25 + 21 + 6.75 + 0 + 0.00 + 0 + 0.00 + + diff --git a/automated-tests/tcbuild b/automated-tests/tcbuild new file mode 120000 index 0000000..89c2de7 --- /dev/null +++ b/automated-tests/tcbuild @@ -0,0 +1 @@ +scripts/tcbuild.sh \ No newline at end of file diff --git a/automated-tests/tests.xml b/automated-tests/tests.xml new file mode 100644 index 0000000..fd0a3f4 --- /dev/null +++ b/automated-tests/tests.xml @@ -0,0 +1,1563 @@ + + + + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumLayoutNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetAndGetItemSizeFunction + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetAndGetScrollSpeedFactor + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetAndGetMaximumSwipeSpeed + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumLayoutSetAndGetItemFlickAnimationDuration + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetNumOfItems + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetStackNum + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetPosition + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetRotationX + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetRotationZ + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetScale + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetColor + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetCenterPosition + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetSetCenterScale + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetSetCenterColor + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetStackPosition + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetSetStackScale + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetStackColor + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBendyUninitializedEffect + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBendyPropertyNamesEffect + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBendyDefaultValuesEffect + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBendyCustomValuesEffect + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBlindEffectUninitialized + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBlindEffectPropertyNames + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBlindEffectDefaultValues + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBlindEffectCustomValues + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBloomViewUninitialized + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBloomViewNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBloomViewDownCast + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBloomViewPropertyNames + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBloomViewAddRemove + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBloomActivateDeactivate + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBuilderTextActorCreateFromStyle + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBuilderTextActorCreateAnimation + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBuilderTextActorApplyFromStyle + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBuilderAddActors + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBuilderAddActorsOther + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBuilderStyles + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBuilderSetProperty + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCarouselEffectUninitialized + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCarouselEffectPropertyNames + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCarouselEffectDefaultValues + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCarouselEffectCustomValues + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCheckBoxButtonSetGetChecked + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCheckBoxButtonSetImages + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliClusterNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliClusterDownCast + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliClusterAddAndRemoveChild + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliClusterExpandAndCollapseChild + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliClusterSetAndGetStyle + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionWaveEffectNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionCrossEffectNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionFoldEffectNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionEffectSetGetTransitionDuration + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionEffectSetGetCubeDisplacement + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionEffectGetRoot + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionEffectIsTransiting + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionEffectSetCurrentImage + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionEffectSetTargetImage + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionWaveEffectStartTransition + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionCrossEffectStartTransition + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionFoldEffectStartTransition + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionEffectSignalTransitionCompleted + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionEffectPauseResumeTransition + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionWaveEffectStopTransition + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionCrossEffectStopTransition + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionFoldEffectStopTransition + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutSetAndGetNumberOfColumns + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutSetAndGetNumberOfRows + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutSetAndGetRowSpacing + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutSetAndGetTiltAngle + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutSetAndGetItemSizeFunction + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutSetAndGetBottomMarginFunction + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutSetAndGetItemTiltAngle + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutSetAndGetColumnPositionFunction + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutSetAndGetScrollSpeedFactor + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutSetAndGetMaximumSwipeSpeed + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutSetAndGetItemFlickAnimationDuration + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutConstraintLeft + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutConstraintRight + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutConstraintUp + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutConstraintDown + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutGetScrollToPosition + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutScrollDirection + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDisplacementEffectUninitialized + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDisplacementEffectNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDisplacementEffectPropertyNames + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDisplacementEffectTestSetProperty + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDistanceFieldEffectUninitialized + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDistanceFieldEffectPropertyNames + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDistanceFieldEffectDefaultValues + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDistanceFieldEffectCustomValues + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliGaussianBlurViewUninitialized + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliGaussianBlurViewNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliGaussianBlurViewDownCast + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliGaussianBlurViewPropertyNames + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliGaussianBlurViewAddRemove + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliGaussianBlurActivateDeactivate + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliGaussianBlurViewSetGetBackgroundColor + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliGaussianBlurViewSetGetRenderTarget + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliJsonParserMethod01 + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliJsonParserMethod02 + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliJsonParserMethod03 + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliJsonParserMethod04 + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliJsonParserMethod05 + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliJsonParserMethod06 + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliJsonParserMethod07 + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliJsonParserMethod08 + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliJsonParserMethod09 + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliJsonParserMethod10 + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliKeyInputFocusManagerGet + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliKeyInputFocusManagerSetFocus + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliKeyInputFocusManagerGetCurrentFocusControl + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliKeyInputFocusManagerRemoveFocus + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliKeyInputFocusManagerIsKeyboardListener + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliKeyInputFocusManagerSignalKeyInputFocusChanged + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliKeyInputFocusManagerSignalUnhandledKeyEvent + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationControlNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationControlDownCast + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationControlPushItem + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationControlPopItem + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationControlGetItemCount + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationControlGetItem + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationControlGetCurrentItem + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationControlSetBackground + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationControlCreateNavigationToolBar + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationControlCreateNavigationTitleBar + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutColumns + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutSetGetOrientation + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutTestConstraintLeft + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutTestConstraintRight + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutTestConstraintUp + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutTestConstraintDown + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutScrollDirection + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutSetGetColumnSpacing + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutSetGetTopMargin + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutSetGetBottomMargin + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutSetGetScrollSpeedFactor + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutSetGetMaximumSwipeSpeed + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutSetAndGetItemFlickAnimationDuration + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutGetScrollToPosition + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliOverlayConstructor + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliOverlayUninitializedEffect + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageDownCast + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageSetGetTitle + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageSetGetSubTitle + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageSetGetTitleIcon + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageAddGetToolBarControl + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageAddGetTitleBarControl + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageSetGetPopupMenu + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageTurnEffectApply + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageTurnEffectConstruct + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageTurnPortraitViewNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageTurnLandscapeViewNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageTurnViewSetAndGetSpineShadowParameter + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageTurnViewGoToPageAndGetCurrentPage + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageTurnViewEnterLeaveEditMode + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageTurnViewGetHitActor + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageTurnViewRefresh + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageTurnViewSignals + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRollLayoutNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRollLayoutSetAndGetRowSpacing + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRollLayoutSetAndGetItemSizeFunction + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRollLayoutSetAndGetScrollSpeedFactor + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRollLayoutSetAndGetMaximumSwipeSpeed + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRollLayoutSetAndGetItemFlickAnimationDuration + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRollLayoutConstraintLeft + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRollLayoutConstraintRight + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRollLayoutConstraintUp + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRollLayoutConstraintDown + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRollLayoutScrollDirection + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRotatingSelectorNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRotatingSelectorSetSelected + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRotatingSelectorSetSelectedAndUnSelectedActor + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRotatingSelectorSetSelectable + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRotatingSelectorSignalSelected + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewDownCast + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewScrollToPosition + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewScrollToPage + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewScrollToActor + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewScrollToSnapPoint + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewRulerScale + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewTransformTo + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewRefreshInterval + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewWrapMode + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewActorAutoSnap + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewSignalsStartComplete + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewSignalsUpdate + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewSignalsClamped + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewScrollSensitive + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewTouchesRequired + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewAxisAutoLock + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewAxisAutoLockGradient + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewConstraints + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewBind + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRulerEnableDisable + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRulerDomainEnableDisable + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRulerSnapAndClamp + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRulerFixedRulerSpacing + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewOvershoot + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewSnapAlphaFunction + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewSnapDuration + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewSignalsSnapStart + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewSetMouseWheelScrollDistanceStep + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewGetSet + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliShadowViewUninitialized + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliShadowViewNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliShadowViewDownCast + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliShadowViewPropertyNames + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliShadowViewAddRemove + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliShadowViewActivateDeactivate + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliShearEffectUninitialized + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliShearEffectPropertyNames + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliShearEffectDefaultValues + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliShearEffectCustomValues + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSliderNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSliderDestructor + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSliderDownCast + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSliderSignals + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSoftButtonEffectUninitialized + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSoftButtonEffectNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSoftButtonEffectPropertyNames + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralLayoutNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralSetAndGetItemSizeFunction + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralSetAndGetItemSpacing + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralSetAndGetRevolutionDistance + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralSetAndGetSpiralRadiusFunction + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralSetAndGetTopItemAlignment + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralSetAndGetScrollSpeedFactor + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralSetAndGetMaximumSwipeSpeed + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralLayoutSetAndGetItemFlickAnimationDuration + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralLayoutConstraintLeft + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralLayoutConstraintRight + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralLayoutConstraintUp + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralLayoutConstraintDown + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralLayoutScrollDirection + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralLayoutGetScrollToPosition + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpotUninitializedEffect + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpotPropertyNamesEffect + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpotDefaultValuesEffect + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpotCustomValuesEffect + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSquareDissolveEffectUninitialized + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSquareDissolveEffectPropertyNames + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSquareDissolveEffectDefaultValues + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSquareDissolveEffectCustomValues + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTableViewNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTableViewMetricsPadding + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTableViewMetricsFixed + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTableViewMetricsRelative + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTableViewAnimation + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTableViewChild + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTableViewAdd + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTableViewCells + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTableViewChildAssert + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTableViewMetricsAssert + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliToolBarNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliToolBarSetBackground + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliToolBarAddControl01 + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliToolBarAddControl02 + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliToolBarRemoveControl01 + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliToolBarRemoveControl02 + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliViewNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliViewAddGetRemoveContentLayer01 + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliViewAddGetRemoveContentLayer02 + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliViewSetGetBackgroundLayer01 + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliViewSetGetBackgroundLayer02 + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliViewSetOrientationFunction + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliViewOrientationChanged + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcSetAutoRotate + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliWaterEffectUninitialized + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliWaterEffectPropertyNames + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliWaterEffectOutOfBounds + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliWaterEffectDefaultValues + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliWaterEffectCustomValues + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliWaterEffectGetAmplitudePositive + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliWaterEffectGetAmplitudeNegative + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliWaterEffectGetCenterPositive + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliWaterEffectGetCenterNegative + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliWaterEffectGetPropagationPositive + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliWaterEffectGetPropagationNegative + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliButtonNew + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliButtonProperties + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliButtonSetGetDimmed + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliControlImplTypeRegistry + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliControlImplMouseWheelEvent + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDefaultControlsCreateCheckBoxButton + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliItemViewAddAndGetLayout + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliItemViewAddAndRemoveLayout + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliItemViewActivateLayoutAndGetActiveLayout + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliKeyboardFocusManagerGet + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliKeyboardFocusManagerMoveFocus + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliKeyboardFocusManagerSignalFocusGroupChanged + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewPageCubeEffectSetup + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewPageCarouselEffectSetup + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewCarouselEffectSetup + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewDepthEffectSetup + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewPageCubeEffectTest + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewPageCarouselEffectTest + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewCarouselEffectTest + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewDepthEffectTest + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTextInputSetActiveStyle + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTextInputApplyStyleToSelectedText + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTextInputApplyStyleToAll + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTextInputGetStyleAtCursor + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTextInputSetAndGetTextAlignment + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTextInputSetAndGetMultilinePolicy + + + + + build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTextInputSetAndGetExceedEnabled + + + + + diff --git a/build/slp/configure.ac b/build/slp/configure.ac index af20022..81b9f5f 100644 --- a/build/slp/configure.ac +++ b/build/slp/configure.ac @@ -81,7 +81,6 @@ AC_CONFIG_FILES([ Makefile dali-toolkit/Makefile dali-toolkit.pc - ../../automated-tests/rules.mk ]) AC_OUTPUT