From: David Steele Date: Thu, 10 Jul 2014 14:29:01 +0000 (+0100) Subject: Removed TET test cases from automated-tests X-Git-Tag: dali_1.0.1~11 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=bd5afd18e57a93de6a3448fc8099882349417964 Removed TET test cases from automated-tests Change-Id: Ied615dc672cfab433e1e04ffeed84851b4a7980b Signed-off-by: David Steele --- diff --git a/automated-tests/TET/.gitignore b/automated-tests/TET/.gitignore deleted file mode 100644 index 807a3b2..0000000 --- a/automated-tests/TET/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -!Makefile -tet_captured -results-desktop -results-target -results -rules.mk -dali.info diff --git a/automated-tests/TET/_export_desktop.sh b/automated-tests/TET/_export_desktop.sh deleted file mode 100644 index eeea3ed..0000000 --- a/automated-tests/TET/_export_desktop.sh +++ /dev/null @@ -1,33 +0,0 @@ -export ARCH=desktop - - -if [ -z "$DESKTOP_PREFIX" ] ; then - if [ -z "$PREFIX" ] ; then - echo "####################################################" - echo "# DESKTOP_PREFIX is not set. Recommend running #" - echo "# dali_env -s to create setenv script #" - echo "####################################################" - else - echo "####################################################" - echo "# DESKTOP_PREFIX is not set. Using PREFIX instead. #" - echo "# #" - echo "# Warning, PREFIX is deprecated, please use #" - echo "# dali_env to set up your environment. #" - echo "####################################################" - export DESKTOP_PREFIX=$PREFIX - fi -fi - -export TET_INSTALL_PATH=$HOME/Packages/tetware-desktop # Your tetware root path -export PATH=$TET_INSTALL_PATH/bin:$PATH -export LD_LIBRARY_PATH=$TET_INSTALL_PATH/lib/tet3:$LD_LIBRARY_PATH -export TET_ROOT=$TET_INSTALL_PATH -export DALI_IMAGE_DIR=$DESKTOP_PREFIX/share/app.dalimenu/images/ -export DALI_MODEL_DIR=$DESKTOP_PREFIX/share/app.dalimenu/models/ -export DALI_STYLE_DIR=$DESKTOP_PREFIX/share/themes/dali/ - -set $(pwd) -export TET_SUITE_ROOT=$1 - -set $(date +%s) -FILE_NAME_EXTENSION=$1 diff --git a/automated-tests/TET/_export_env.sh b/automated-tests/TET/_export_env.sh deleted file mode 100755 index 4e2dc90..0000000 --- a/automated-tests/TET/_export_env.sh +++ /dev/null @@ -1,17 +0,0 @@ -export ARCH=target - -export TET_INSTALL_PATH=/scratchbox/TETware # tetware root path -export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path -export PATH=$TET_TARGET_PATH/bin:$PATH -export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH -export DALI_IMAGE_DIR=/opt/share/app.dalimenu/images/ -export DALI_MODEL_DIR=/opt/share/app.dalimenu/models/ -export DALI_STYLE_DIR=/opt/share/themes/dali/ - -export TET_ROOT=$TET_TARGET_PATH - -set $(pwd) -export TET_SUITE_ROOT=$1 - -set $(date +%s) -FILE_NAME_EXTENSION=$1 diff --git a/automated-tests/TET/_export_sbs.sh b/automated-tests/TET/_export_sbs.sh deleted file mode 100644 index bc5a4af..0000000 --- a/automated-tests/TET/_export_sbs.sh +++ /dev/null @@ -1,17 +0,0 @@ -export ARCH=target - -export TET_INSTALL_PATH=$HOME/git/TETware # tetware root path -export TET_TARGET_PATH=$TET_INSTALL_PATH -export PATH=$TET_TARGET_PATH/bin:$PATH -export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH -export DALI_IMAGE_DIR=/opt/share/app.dalimenu/images/ -export DALI_MODEL_DIR=/opt/share/app.dalimenu/models/ -export DALI_STYLE_DIR=/opt/share/themes/dali/ - -export TET_ROOT=$TET_TARGET_PATH - -set $(pwd) -export TET_SUITE_ROOT=$1 - -set $(date +%s) -FILE_NAME_EXTENSION=$1 diff --git a/automated-tests/TET/_export_target_env.sh b/automated-tests/TET/_export_target_env.sh deleted file mode 100755 index 4c1b135..0000000 --- a/automated-tests/TET/_export_target_env.sh +++ /dev/null @@ -1,17 +0,0 @@ -export ARCH=target - -export TET_INSTALL_PATH=/mnt/nfs/git/TETware # path to mount -export TET_TARGET_PATH=$TET_INSTALL_PATH -export PATH=$TET_TARGET_PATH/bin:$PATH -export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH -export DALI_IMAGE_DIR=/opt/share/app.dalimenu/images/ -export DALI_MODEL_DIR=/opt/share/app.dalimenu/models/ -export DALI_STYLE_DIR=/opt/share/themes/dali/ - -export TET_ROOT=$TET_TARGET_PATH - -set $(pwd) -export TET_SUITE_ROOT=$1 - -set $(date +%s) -FILE_NAME_EXTENSION=$1 diff --git a/automated-tests/TET/build.sh b/automated-tests/TET/build.sh deleted file mode 100755 index d857de3..0000000 --- a/automated-tests/TET/build.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/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/TET/build_out.sh b/automated-tests/TET/build_out.sh deleted file mode 100755 index efb93a1..0000000 --- a/automated-tests/TET/build_out.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -./build.sh -v $* diff --git a/automated-tests/TET/coverage.mk b/automated-tests/TET/coverage.mk deleted file mode 100644 index 5012fd4..0000000 --- a/automated-tests/TET/coverage.mk +++ /dev/null @@ -1 +0,0 @@ -LDFLAGS += --coverage diff --git a/automated-tests/TET/coverage.sh b/automated-tests/TET/coverage.sh deleted file mode 100755 index 98798db..0000000 --- a/automated-tests/TET/coverage.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/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/TET/dali-internal-test-suite/master-makefile.mk b/automated-tests/TET/dali-internal-test-suite/master-makefile.mk deleted file mode 100644 index b68b0ed..0000000 --- a/automated-tests/TET/dali-internal-test-suite/master-makefile.mk +++ /dev/null @@ -1,53 +0,0 @@ -# -# Copyright (c) 2014 Samsung Electronics Co., Ltd. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -CC = g++ - -TARGETS = -include file.list - -PKGS = dali-core dali dali-toolkit dali-test-suite-utils -include ../../rules.mk -include ../../coverage.mk - -TOOLKIT_TEST_UTILS_DIR=../../dali-toolkit-test-utils/ - -CXXFLAGS += -I$(TOOLKIT_TEST_UTILS_DIR) - -TOOLKIT_TEST_UTILS_SRC_FILES = \ - $(TOOLKIT_TEST_UTILS_DIR)/toolkit-application.cpp \ - $(TOOLKIT_TEST_UTILS_DIR)/toolkit-adaptor.cpp \ - $(TOOLKIT_TEST_UTILS_DIR)/toolkit-clipboard-event-notifier.cpp \ - $(TOOLKIT_TEST_UTILS_DIR)/toolkit-accessibility-manager.cpp \ - $(TOOLKIT_TEST_UTILS_DIR)/toolkit-physical-keyboard.cpp \ - $(TOOLKIT_TEST_UTILS_DIR)/toolkit-style-monitor.cpp \ - $(TOOLKIT_TEST_UTILS_DIR)/toolkit-timer.cpp \ - $(TOOLKIT_TEST_UTILS_DIR)/toolkit-orientation.cpp - -all: $(TARGETS) - -%: %.cpp $(TOOLKIT_TEST_UTILS_SRC_FILES) - $(CC) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) - -clean: - @rm -f $(notdir $(TARGETS)) - @rm -f tet_captured - @rm -f *~ - @rm -f *.gcda *.gcno - -coverage: - @lcov --directory . -c -o dali.info - @lcov --remove dali.info "*boost*" "/usr/include/*" "*/automated-tests/*" -o dali.info diff --git a/automated-tests/TET/dali-internal-test-suite/tc-gen.sh b/automated-tests/TET/dali-internal-test-suite/tc-gen.sh deleted file mode 120000 index b8e6201..0000000 --- a/automated-tests/TET/dali-internal-test-suite/tc-gen.sh +++ /dev/null @@ -1 +0,0 @@ -../dali-test-suite/tc-gen.sh \ No newline at end of file diff --git a/automated-tests/TET/dali-internal-test-suite/text-input/.gitignore b/automated-tests/TET/dali-internal-test-suite/text-input/.gitignore deleted file mode 100644 index 0f77dca..0000000 --- a/automated-tests/TET/dali-internal-test-suite/text-input/.gitignore +++ /dev/null @@ -1 +0,0 @@ -utc-Dali-TextInput diff --git a/automated-tests/TET/dali-internal-test-suite/text-input/Makefile b/automated-tests/TET/dali-internal-test-suite/text-input/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-internal-test-suite/text-input/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-internal-test-suite/text-input/file.list b/automated-tests/TET/dali-internal-test-suite/text-input/file.list deleted file mode 100644 index 1e6d688..0000000 --- a/automated-tests/TET/dali-internal-test-suite/text-input/file.list +++ /dev/null @@ -1,2 +0,0 @@ -TARGETS += \ - utc-Dali-TextInput \ diff --git a/automated-tests/TET/dali-internal-test-suite/text-input/tslist b/automated-tests/TET/dali-internal-test-suite/text-input/tslist deleted file mode 100644 index 7bbabc6..0000000 --- a/automated-tests/TET/dali-internal-test-suite/text-input/tslist +++ /dev/null @@ -1 +0,0 @@ -/dali-internal-test-suite/text-input/utc-Dali-TextInput diff --git a/automated-tests/TET/dali-internal-test-suite/text-input/utc-Dali-TextInput.cpp b/automated-tests/TET/dali-internal-test-suite/text-input/utc-Dali-TextInput.cpp deleted file mode 100644 index cefd710..0000000 --- a/automated-tests/TET/dali-internal-test-suite/text-input/utc-Dali-TextInput.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -#include - -// Internal includes -#include - -using namespace Dali; -using namespace Dali::Toolkit; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliInternalTextInputTextSelection, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputSetGetExceedEnabled, POSITIVE_TC_IDX ); -// TEST_FUNCTION( UtcDaliTextInputMethod02, NEGATIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - - -/** - * Test: Selected is replaced by new input text. - **/ -static void UtcDaliInternalTextInputTextSelection() -{ - const char* testChar = "v"; - - ToolkitTestApplication application; - - tet_infoline("Testing Text Selection with replace."); - - Toolkit::TextInput textInput = Toolkit::TextInput::New(); - - DALI_TEST_CHECK(textInput); - - Stage::GetCurrent().Add(textInput); - - textInput.SetInitialText("Test String"); - - std::string initialText = textInput.GetText(); - - tet_printf("Set Initial text: %s\n", initialText.c_str() ); - - textInput.SetKeyInputFocus(); - - GetImpl(textInput).SelectText(0,11); - - tet_printf("Select all of Initial text\n"); - - Integration::KeyEvent event(testChar, testChar, 0, 0, 0, Integration::KeyEvent::Down ); - - application.ProcessEvent( event ); - - tet_printf("Simulate pressing of a key: %s\n", testChar ); - - std::string newText = textInput.GetText(); - - tet_printf("Check current text (%s) is the new text \n", newText.c_str() ); - - DALI_TEST_EQUALS("v",textInput.GetText(), TEST_LOCATION); -} - -static void UtcDaliTextInputSetGetExceedEnabled() -{ - tet_infoline("UtcDaliTextInputSetGetExceedEnabled: "); - - ToolkitTestApplication application; - - Toolkit::TextInput textInput = Toolkit::TextInput::New(); - textInput.SetMultilinePolicy( Toolkit::TextView::SplitByWord ); - textInput.SetWidthExceedPolicy( Toolkit::TextView::Split ); - textInput.SetHeightExceedPolicy( Toolkit::TextView::Original ); - - DALI_TEST_CHECK( textInput.GetExceedEnabled() ); - - Toolkit::Internal::TextInput& textInputImpl = static_cast( textInput.GetImplementation() ); - - textInput.SetSize( 50.f, 50.f ); - textInput.SetExceedEnabled( false ); - - DALI_TEST_CHECK( !textInput.GetExceedEnabled() ); - - - textInputImpl.InsertAt( Text("He"), 0 ); - - DALI_TEST_EQUALS("He",textInput.GetText(), TEST_LOCATION); - - textInputImpl.InsertAt( Text("llo"), 2 ); - - DALI_TEST_EQUALS("Hello",textInput.GetText(), TEST_LOCATION); - - textInputImpl.InsertAt( Text(" world! hello world hello world hello world"), 5 ); // Doesn't fit so is not added. - - DALI_TEST_EQUALS("Hello",textInput.GetText(), TEST_LOCATION); -} diff --git a/automated-tests/TET/dali-internal-test-suite/text-view/.gitignore b/automated-tests/TET/dali-internal-test-suite/text-view/.gitignore deleted file mode 100644 index 881389b..0000000 --- a/automated-tests/TET/dali-internal-test-suite/text-view/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -utc-Dali-TextView -utc-Dali-TextView-HelperAndDebug -utc-Dali-TextView-Processor -utc-Dali-TextView-Processor-Types -utc-Dali-TextView-Relayout-Utilities diff --git a/automated-tests/TET/dali-internal-test-suite/text-view/Makefile b/automated-tests/TET/dali-internal-test-suite/text-view/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-internal-test-suite/text-view/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-internal-test-suite/text-view/file.list b/automated-tests/TET/dali-internal-test-suite/text-view/file.list deleted file mode 100644 index 7e75352..0000000 --- a/automated-tests/TET/dali-internal-test-suite/text-view/file.list +++ /dev/null @@ -1,6 +0,0 @@ -TARGETS += \ - utc-Dali-TextView \ - utc-Dali-TextView-HelperAndDebug \ - utc-Dali-TextView-Processor \ - utc-Dali-TextView-Processor-Types \ - utc-Dali-TextView-Relayout-Utilities \ \ No newline at end of file diff --git a/automated-tests/TET/dali-internal-test-suite/text-view/tslist b/automated-tests/TET/dali-internal-test-suite/text-view/tslist deleted file mode 100644 index 5ee4f51..0000000 --- a/automated-tests/TET/dali-internal-test-suite/text-view/tslist +++ /dev/null @@ -1,5 +0,0 @@ -/dali-internal-test-suite/text-view/utc-Dali-TextView -/dali-internal-test-suite/text-view/utc-Dali-TextView-Processor -/dali-internal-test-suite/text-view/utc-Dali-TextView-Processor-Types -/dali-internal-test-suite/text-view/utc-Dali-TextView-Relayout-Utilities -/dali-internal-test-suite/text-view/utc-Dali-TextView-HelperAndDebug diff --git a/automated-tests/TET/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 deleted file mode 100644 index 4a336de..0000000 --- a/automated-tests/TET/dali-internal-test-suite/text-view/utc-Dali-TextView-HelperAndDebug.cpp +++ /dev/null @@ -1,305 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#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; - -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 - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliTextViewGetIndicesFromGlobalCharacterIndex, POSITIVE_TC_IDX ); // Tests correctness when indices to lines, groups, words and characters are worked out from a given global position. -TEST_FUNCTION( UtcDaliTextViewDebugCouts, POSITIVE_TC_IDX ); // Tests debug functions just to not to penalize the coverage. - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliTextViewGetIndicesFromGlobalCharacterIndex() -{ - 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 ); -} - -static void UtcDaliTextViewDebugCouts() -{ - ///////////////////////////////////////////////////// - // 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 ); -} diff --git a/automated-tests/TET/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 deleted file mode 100644 index a929cb9..0000000 --- a/automated-tests/TET/dali-internal-test-suite/text-view/utc-Dali-TextView-Processor-Types.cpp +++ /dev/null @@ -1,312 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -// Internal headers are allowed here -#include - -using namespace Dali; -using namespace Dali::Toolkit; -using namespace Dali::Toolkit::Internal; - -namespace -{ -// Data structures used to create an 'experiment' in TET cases - -////////////////////////////////////////////////////////////////// -} // namespace - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliTextViewDefaultConstructorDestructor, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextViewCopyConstructorOperator, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextViewEqualityOperator, POSITIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliTextViewDefaultConstructorDestructor() -{ - 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 ); -} - -static void UtcDaliTextViewCopyConstructorOperator() -{ - 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 ); -} - -static void UtcDaliTextViewEqualityOperator() -{ - 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 ); -} diff --git a/automated-tests/TET/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 deleted file mode 100644 index e90fcb8..0000000 --- a/automated-tests/TET/dali-internal-test-suite/text-view/utc-Dali-TextView-Processor.cpp +++ /dev/null @@ -1,429 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -// Internal headers are allowed here -#include - -using namespace Dali; -using namespace Dali::Toolkit; -using namespace Dali::Toolkit::Internal; - -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 - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliTextViewSplitInLines, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextViewSplitInWords, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextViewBeginsRightToLeftCharacter, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextViewContainsRightToLeftCharacter, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextViewFindNearestWord, POSITIVE_TC_IDX ); -// TEST_FUNCTION( , POSITIVE_TC_IDX ); -// TEST_FUNCTION( , NEGATIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliTextViewSplitInLines() -{ - 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 ); -} - -static void UtcDaliTextViewSplitInWords() -{ - 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 ); -} - -static void UtcDaliTextViewBeginsRightToLeftCharacter() -{ - 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 ); -} - -static void UtcDaliTextViewContainsRightToLeftCharacter() -{ - 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 ); -} - -static void UtcDaliTextViewFindNearestWord() -{ - 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 ); -} diff --git a/automated-tests/TET/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 deleted file mode 100644 index 5f29c1c..0000000 --- a/automated-tests/TET/dali-internal-test-suite/text-view/utc-Dali-TextView-Relayout-Utilities.cpp +++ /dev/null @@ -1,857 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -// Internal headers are allowed here -#include -#include - -using namespace Dali; -using namespace Dali::Toolkit; -using namespace Dali::Toolkit::Internal; - -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 - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliTextViewDefaultConstructorDestructor, POSITIVE_TC_IDX ); // Calls structs's default constructor and destructors and checks their default values. -TEST_FUNCTION( UtcDaliTextViewCalculateSubLineLayout, POSITIVE_TC_IDX ); // Checks the function which calculates the layout info of the portion of the line which fits on the text-view width. -TEST_FUNCTION( UtcDaliTextViewCalculateAlignmentOffsets, POSITIVE_TC_IDX ); // Checks the horizontal and vertical alignaments (for the whole text). -TEST_FUNCTION( UtcDaliTextViewCalculateJustificationOffsets, POSITIVE_TC_IDX ); // Checks the justification alignment (line per line). -TEST_FUNCTION( UtcDaliTextViewCalculateVisibility, POSITIVE_TC_IDX ); // Checks the text-actor visibility within the text-view with a rectangle intersection test. - -TEST_FUNCTION( UtcDaliTextViewMiscelaneousAsserts, NEGATIVE_TC_IDX ); // Tests some strange asserts. - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliTextViewDefaultConstructorDestructor() -{ - 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 ); -} - -static void UtcDaliTextViewCalculateSubLineLayout() -{ - 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 ); -} - -static void UtcDaliTextViewCalculateAlignmentOffsets() -{ - 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 ); -} - -static void UtcDaliTextViewCalculateJustificationOffsets() -{ - 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 ); -} - - -static void UtcDaliTextViewCalculateVisibility() -{ - 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 ); -} - -static void UtcDaliTextViewMiscelaneousAsserts() -{ - 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 ); - -} diff --git a/automated-tests/TET/dali-internal-test-suite/text-view/utc-Dali-TextView.cpp b/automated-tests/TET/dali-internal-test-suite/text-view/utc-Dali-TextView.cpp deleted file mode 100644 index 7ab767b..0000000 --- a/automated-tests/TET/dali-internal-test-suite/text-view/utc-Dali-TextView.cpp +++ /dev/null @@ -1,2932 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#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; - -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 - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliTextViewCreateTextInfo, POSITIVE_TC_IDX ); // Tests data structures are built well. -TEST_FUNCTION( UtcDaliTextViewUpdateTextInfo, POSITIVE_TC_IDX ); // Tests update operations within a whole text (insert, remove, replace). -TEST_FUNCTION( UtcDaliTextViewSplitWord, POSITIVE_TC_IDX ); // Tests the split word operation. -TEST_FUNCTION( UtcDaliTextViewSplitWordGroup, POSITIVE_TC_IDX ); // Tests the split group of words operation. -TEST_FUNCTION( UtcDaliTextViewSplitLine, POSITIVE_TC_IDX ); // Tests the split line operation. -TEST_FUNCTION( UtcDaliTextViewMergeWord01, POSITIVE_TC_IDX ); // Tests the merge word operation. -TEST_FUNCTION( UtcDaliTextViewMergeWord02, NEGATIVE_TC_IDX ); // Tests invalid inputs in the merge word operation. -TEST_FUNCTION( UtcDaliTextViewMergeGroup01, POSITIVE_TC_IDX ); // Tests the merge group of words operation. -TEST_FUNCTION( UtcDaliTextViewMergeGroup02, NEGATIVE_TC_IDX ); // Tests invalid inputs in the merge group of words operation. -TEST_FUNCTION( UtcDaliTextViewMergeLine01, POSITIVE_TC_IDX ); // Tests the merge line operation. -TEST_FUNCTION( UtcDaliTextViewMergeLine02, NEGATIVE_TC_IDX ); // Tests invalid inputs in the merge line operation. -TEST_FUNCTION( UtcDaliTextViewRemoveCharactersFromWord, POSITIVE_TC_IDX ); // Tests the remove characters from a word operation. -TEST_FUNCTION( UtcDaliTextViewRemoveWordsFromGroup, POSITIVE_TC_IDX ); // Tests the remove words from a group of words operation. -TEST_FUNCTION( UtcDaliTextViewRemoveGroupsFromLine, POSITIVE_TC_IDX ); // Tests the remove groups of words from a line operation. - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliTextViewCreateTextInfo() -{ - 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 ) ); -} - -static void UtcDaliTextViewSplitWord() -{ - 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 ); -} - -static void UtcDaliTextViewUpdateTextInfo() -{ - 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 ); -} - -static void UtcDaliTextViewSplitWordGroup() -{ - 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 ); -} - -static void UtcDaliTextViewSplitLine() -{ - 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 ); -} - -static void UtcDaliTextViewMergeWord01() -{ - 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 ); -} - -static void UtcDaliTextViewMergeWord02() -{ - // 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 ); - } -} - -static void UtcDaliTextViewMergeGroup01() -{ - 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); -} - -static void UtcDaliTextViewMergeGroup02() -{ - 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 ); - } -} - -static void UtcDaliTextViewMergeLine01() -{ - 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 ); -} - -static void UtcDaliTextViewMergeLine02() -{ - 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 ); - } -} - -void UtcDaliTextViewRemoveCharactersFromWord() -{ - 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 ); -} - -static void UtcDaliTextViewRemoveWordsFromGroup() -{ - // 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 ); -} - -static void UtcDaliTextViewRemoveGroupsFromLine() -{ - // 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 ); -} diff --git a/automated-tests/TET/dali-internal-test-suite/utc-MODULE-CLASS.cpp.in b/automated-tests/TET/dali-internal-test-suite/utc-MODULE-CLASS.cpp.in deleted file mode 100644 index 72df4d6..0000000 --- a/automated-tests/TET/dali-internal-test-suite/utc-MODULE-CLASS.cpp.in +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -// Internal headers are allowed here - -using namespace Dali; -using namespace Dali::Toolkit; -using namespace Dali::Toolkit::Internal; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( Utc@MODULE@@CLASS@Method01, POSITIVE_TC_IDX ); -TEST_FUNCTION( Utc@MODULE@@CLASS@Method02, NEGATIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - - -// Positive test case for a method -static void Utc@MODULE@@CLASS@Method01() -{ - ToolkitTestApplication application; - - tet_infoline("Journaled printf Output"); - tet_result(TET_FAIL); -#if 0 - tet_result(TET_PASS); -#endif -} - - -// Negative test case for a method -static void Utc@MODULE@@CLASS@Method02() -{ - ToolkitTestApplication application; // Exceptions require ToolkitTestApplication - - try - { - /* My test code and results */ - DALI_TEST_EQUALS(myVar, expectedValue, TEST_LOCATION); - } - 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_EQUALS(e.mCondition, "assert conditional", TEST_LOCATION); - } -} - diff --git a/automated-tests/TET/dali-test-suite/.gitignore b/automated-tests/TET/dali-test-suite/.gitignore deleted file mode 100644 index 45486c6..0000000 --- a/automated-tests/TET/dali-test-suite/.gitignore +++ /dev/null @@ -1 +0,0 @@ -utc-Dali-ScrollViewEffect diff --git a/automated-tests/TET/dali-test-suite/alignment/.gitignore b/automated-tests/TET/dali-test-suite/alignment/.gitignore deleted file mode 100644 index 31af42e..0000000 --- a/automated-tests/TET/dali-test-suite/alignment/.gitignore +++ /dev/null @@ -1 +0,0 @@ -utc-Dali-Alignment diff --git a/automated-tests/TET/dali-test-suite/alignment/Makefile b/automated-tests/TET/dali-test-suite/alignment/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-test-suite/alignment/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-test-suite/alignment/file.list b/automated-tests/TET/dali-test-suite/alignment/file.list deleted file mode 100644 index 7a4d9f1..0000000 --- a/automated-tests/TET/dali-test-suite/alignment/file.list +++ /dev/null @@ -1,2 +0,0 @@ -TARGETS += \ - utc-Dali-Alignment \ diff --git a/automated-tests/TET/dali-test-suite/alignment/tslist b/automated-tests/TET/dali-test-suite/alignment/tslist deleted file mode 100644 index 76ce95e..0000000 --- a/automated-tests/TET/dali-test-suite/alignment/tslist +++ /dev/null @@ -1 +0,0 @@ -/dali-test-suite/alignment/utc-Dali-Alignment diff --git a/automated-tests/TET/dali-test-suite/alignment/utc-Dali-Alignment.cpp b/automated-tests/TET/dali-test-suite/alignment/utc-Dali-Alignment.cpp deleted file mode 100644 index cfb3880..0000000 --- a/automated-tests/TET/dali-test-suite/alignment/utc-Dali-Alignment.cpp +++ /dev/null @@ -1,1128 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include -#include -#include - -#include - -using namespace Dali; -using namespace Dali::Toolkit; - -static void Startup(); -static void Cleanup(); - -namespace -{ -static bool gObjectCreatedCallBackCalled; - -static void TestCallback(BaseHandle handle) -{ - gObjectCreatedCallBackCalled = true; -} -} // namespace - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliAlignmentConstructorNegative, NEGATIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliAlignmentConstructorPositive, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliAlignmentConstructorRegister, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliAlignmentSetAlignmentTypePositiveOffStage, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliAlignmentSetAlignmentTypePositiveOnStage, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliAlignmentSetAlignmentTypeNegative, NEGATIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliAlignmentGetAlignmentType, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliAlignmentSetScaling, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliAlignmentGetScaling, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliAlignmentSetPaddingPositive, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliAlignmentSetPaddingNegative, NEGATIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliAlignmentGetPadding, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliAlignmentChildAddAndRemove, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliAlignmentOnSizeSet, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliAlignmentOnTouchEvent, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliAlignmentOnKeyEvent, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliAlignmentOnSizeAnimation, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliAlignmentCopyAndAssignment, POSITIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliAlignmentConstructorNegative() -{ - 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); - } - } -} - -static void UtcDaliAlignmentConstructorPositive() -{ - 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 ); -} - -static void UtcDaliAlignmentConstructorRegister() -{ - 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 ); -} - -static void UtcDaliAlignmentSetAlignmentTypePositiveOffStage() -{ - 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); - } -} - -static void UtcDaliAlignmentSetAlignmentTypePositiveOnStage() -{ - 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(); - } -} - -static void UtcDaliAlignmentSetAlignmentTypeNegative() -{ - 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); - } - } - } -} - -static void UtcDaliAlignmentGetAlignmentType() -{ - 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(); - } -} - -static void UtcDaliAlignmentSetScaling() -{ - 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(); - } -} - -static void UtcDaliAlignmentGetScaling() -{ - 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); - } - -} - -static void UtcDaliAlignmentSetPaddingPositive() -{ - 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 ) ); -} - -static void UtcDaliAlignmentSetPaddingNegative() -{ - 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); - } - } -} - -static void UtcDaliAlignmentGetPadding() -{ - 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 ) ); -} - -static void UtcDaliAlignmentChildAddAndRemove() -{ - 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); -} - -static void UtcDaliAlignmentOnSizeSet() -{ - 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); -} - -/////////////////////////////////////////////////////////////////////////////// -static bool TouchEventCallback(Actor actor, const TouchEvent& event) -{ - return false; -} - -/////////////////////////////////////////////////////////////////////////////// - -static void UtcDaliAlignmentOnTouchEvent() -{ - 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. -} - -static void UtcDaliAlignmentOnKeyEvent() -{ - 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. -} - -static void UtcDaliAlignmentOnSizeAnimation() -{ - 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. -} - -static void UtcDaliAlignmentCopyAndAssignment() -{ - 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); -} diff --git a/automated-tests/TET/dali-test-suite/bubble-emitter/.gitignore b/automated-tests/TET/dali-test-suite/bubble-emitter/.gitignore deleted file mode 100644 index f514af1..0000000 --- a/automated-tests/TET/dali-test-suite/bubble-emitter/.gitignore +++ /dev/null @@ -1 +0,0 @@ -utc-Dali-BubbleEmitter diff --git a/automated-tests/TET/dali-test-suite/bubble-emitter/Makefile b/automated-tests/TET/dali-test-suite/bubble-emitter/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-test-suite/bubble-emitter/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-test-suite/bubble-emitter/file.list b/automated-tests/TET/dali-test-suite/bubble-emitter/file.list deleted file mode 100644 index 2d1ab31..0000000 --- a/automated-tests/TET/dali-test-suite/bubble-emitter/file.list +++ /dev/null @@ -1,2 +0,0 @@ -TARGETS += \ - utc-Dali-BubbleEmitter \ diff --git a/automated-tests/TET/dali-test-suite/bubble-emitter/tslist b/automated-tests/TET/dali-test-suite/bubble-emitter/tslist deleted file mode 100644 index c73cb09..0000000 --- a/automated-tests/TET/dali-test-suite/bubble-emitter/tslist +++ /dev/null @@ -1 +0,0 @@ -/dali-test-suite/bubble-emitter/utc-Dali-BubbleEmitter diff --git a/automated-tests/TET/dali-test-suite/bubble-emitter/utc-Dali-BubbleEmitter.cpp b/automated-tests/TET/dali-test-suite/bubble-emitter/utc-Dali-BubbleEmitter.cpp deleted file mode 100644 index b4a43d3..0000000 --- a/automated-tests/TET/dali-test-suite/bubble-emitter/utc-Dali-BubbleEmitter.cpp +++ /dev/null @@ -1,424 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; -using namespace Dali::Toolkit; - -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 - */ -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 - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliBubbleEmitterNew, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliBubbleEmitterGetRootActor, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliBubbleEmitterSetBackground, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliBubbleEmitterSetShapeImage, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliBubbleEmitterSetBubbleScale, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliBubbleEmitterSetBubbleDensity01, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliBubbleEmitterSetBubbleDensity02, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliBubbleEmitterSetBlendMode, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliBubbleEmitterEmitBubble, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliBubbleEmitterStartExplosion, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliBubbleEmitterRestore, POSITIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliBubbleEmitterNew() -{ - 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 ); -} - -static void UtcDaliBubbleEmitterGetRootActor() -{ - 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 ); -} - -static void UtcDaliBubbleEmitterSetBackground() -{ - 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 ); -} - -static void UtcDaliBubbleEmitterSetShapeImage() -{ - 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 ); -} - -static void UtcDaliBubbleEmitterSetBubbleScale() -{ - 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 ); -} - -static void UtcDaliBubbleEmitterSetBubbleDensity01() -{ - 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 ); - } -} - -static void UtcDaliBubbleEmitterSetBubbleDensity02() -{ - 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 ); - } -} - -static void UtcDaliBubbleEmitterSetBlendMode() -{ - 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 ); -} - -static void UtcDaliBubbleEmitterEmitBubble() -{ - 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 ); -} - -static void UtcDaliBubbleEmitterStartExplosion() -{ - 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 ); -} - -static void UtcDaliBubbleEmitterRestore() -{ - 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 ); -} diff --git a/automated-tests/TET/dali-test-suite/builder/.gitignore b/automated-tests/TET/dali-test-suite/builder/.gitignore deleted file mode 100644 index 12fbec7..0000000 --- a/automated-tests/TET/dali-test-suite/builder/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -utc-Dali-Builder -utc-Dali-JsonParser diff --git a/automated-tests/TET/dali-test-suite/builder/Makefile b/automated-tests/TET/dali-test-suite/builder/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-test-suite/builder/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-test-suite/builder/file.list b/automated-tests/TET/dali-test-suite/builder/file.list deleted file mode 100644 index b178c6f..0000000 --- a/automated-tests/TET/dali-test-suite/builder/file.list +++ /dev/null @@ -1,3 +0,0 @@ -TARGETS += \ - Dali/utc-Dali-Builder \ - Dali/utc-Dali-JsonParser \ diff --git a/automated-tests/TET/dali-test-suite/builder/tslist b/automated-tests/TET/dali-test-suite/builder/tslist deleted file mode 100644 index d5d6ef9..0000000 --- a/automated-tests/TET/dali-test-suite/builder/tslist +++ /dev/null @@ -1,2 +0,0 @@ -/dali-test-suite/builder/utc-Dali-Builder -/dali-test-suite/builder/utc-Dali-JsonParser diff --git a/automated-tests/TET/dali-test-suite/builder/utc-Dali-Builder.cpp b/automated-tests/TET/dali-test-suite/builder/utc-Dali-Builder.cpp deleted file mode 100644 index f385ad3..0000000 --- a/automated-tests/TET/dali-test-suite/builder/utc-Dali-Builder.cpp +++ /dev/null @@ -1,522 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#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 JSON_CONSTANTS("\ -{ \ - 'constants': \ - { \ - 'HELLO':'Hello World', \ - 'HELLO2':'Hello {WORLD}' \ - }, \ - 'styles': \ - { \ - 'basic-text': { \ - 'type':'TextActor', \ - 'text':'{HELLO2}' \ - } \ - }, \ - 'animations': \ - { \ - 'rotate': \ - { \ - 'duration': 10, \ - 'properties': \ - [ \ - { \ - 'actor':'{ACTOR}', \ - 'property':'rotation', \ - 'value':[0, 3, 0, 0], \ - 'alpha-function': 'EASE_IN_OUT', \ - 'time-period': {'delay': 0, 'duration': 3 } \ - } \ - ] \ - } \ - }, \ - 'stage': \ - [ \ - {'name':'txt1', \ - 'type':'TextActor', \ - 'text':'{HELLO}' \ - } \ - ] \ -} \ -"); - - - 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 - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliBuilderConstants(); -static void UtcDaliBuilderTextActorCreateFromStyle(); -static void UtcDaliBuilderTextActorCreateAnimation(); -static void UtcDaliBuilderTextActorApplyFromStyle(); -static void UtcDaliBuilderStyles(); -static void UtcDaliBuilderAddActorsOther(); -static void UtcDaliBuilderAddActors(); -static void UtcDaliBuilderSetProperty(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -TEST_FUNCTION( UtcDaliBuilderConstants , POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliBuilderTextActorCreateFromStyle , POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliBuilderTextActorCreateAnimation , POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliBuilderTextActorApplyFromStyle , POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliBuilderStyles , POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliBuilderAddActorsOther , POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliBuilderAddActors , POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliBuilderSetProperty , POSITIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliBuilderConstants() -{ - ToolkitTestApplication application; - Stage stage = Stage::GetCurrent(); - - tet_infoline(" UtcDaliBuilderConstants"); - - Builder builder = Builder::New(); - - PropertyValueMap userMap; - userMap["WORLD"] = "World"; - builder.AddConstants(userMap); - - builder.LoadFromString( ReplaceQuotes(JSON_CONSTANTS) ); - - // constants in json - Layer layer = stage.GetRootLayer(); - size_t count = layer.GetChildCount(); - - builder.AddActors( layer ); - DALI_TEST_CHECK( layer.GetChildCount() == count + 1 ); - - TextActor actor = TextActor::DownCast( layer.GetChildAt( count ) ); - DALI_TEST_CHECK( actor ); - DALI_TEST_CHECK( actor.GetText() == std::string("Hello World") ); - - // global constants - PropertyValueMap map; - map["HELLO2"] = "Hi"; - - builder.AddConstants( map ); - - actor = TextActor::DownCast( builder.CreateFromStyle("basic-text") ); - DALI_TEST_CHECK( actor ); - DALI_TEST_CHECK( actor.GetText() == std::string("Hi") ); - - // user overriding - userMap["HELLO2"] = "Hello Dali"; - actor = TextActor::DownCast( builder.CreateFromStyle("basic-text", userMap) ); - DALI_TEST_CHECK( actor ); - DALI_TEST_CHECK( actor.GetText() == std::string("Hello Dali") ); - - // animation constants - actor = TextActor::DownCast( layer.GetChildAt( count ) ); - actor.SetName("rotate-me"); - userMap["ACTOR"] = actor.GetName(); - - Animation anim = builder.CreateAnimation("rotate", userMap); - DALI_TEST_CHECK( anim ); - DALI_TEST_CHECK( 10.0f == anim.GetDuration() ); - -} - -static void UtcDaliBuilderTextActorCreateFromStyle() -{ - 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); - -} - -static void UtcDaliBuilderTextActorCreateAnimation() -{ - 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() ); - -} - -static void UtcDaliBuilderTextActorApplyFromStyle() -{ - 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"); - -} - -static void UtcDaliBuilderAddActors() -{ - 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"); - -} - -static void UtcDaliBuilderAddActorsOther() -{ - 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"); - -} - - -static void UtcDaliBuilderStyles() -{ - 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() ); - -} - -static void UtcDaliBuilderSetProperty() -{ - 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" ); - -} diff --git a/automated-tests/TET/dali-test-suite/builder/utc-Dali-JsonParser.cpp b/automated-tests/TET/dali-test-suite/builder/utc-Dali-JsonParser.cpp deleted file mode 100644 index 0f5c598..0000000 --- a/automated-tests/TET/dali-test-suite/builder/utc-Dali-JsonParser.cpp +++ /dev/null @@ -1,641 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; -using namespace Dali::Toolkit; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -TEST_FUNCTION( UtcDaliJsonParserMethod01, NEGATIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliJsonParserMethod02, NEGATIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliJsonParserMethod03, NEGATIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliJsonParserMethod04, NEGATIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliJsonParserMethod05, NEGATIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliJsonParserMethod06, NEGATIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliJsonParserMethod07, NEGATIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliJsonParserMethod08, NEGATIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliJsonParserMethod09, NEGATIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliJsonParserMethod10, NEGATIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -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; -} - - -static void UtcDaliJsonParserMethod01() -{ - 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'} \ -} \ -")); - - 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); -} - -static void UtcDaliJsonParserMethod02() -{ - 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); -} - - -static void UtcDaliJsonParserMethod03() -{ - 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); -} - -static void UtcDaliJsonParserMethod04() -{ - 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); -} - -static void UtcDaliJsonParserMethod05() -{ - 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); -} - - -static const int NUMBER_OK_TESTS = 36; -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']]]]]]]]]]]]]]]]]]]", -}; - - -static void UtcDaliJsonParserMethod06() -{ - 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); -} - - -static const int NUMBER_FAIL_TESTS = 32; -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']", -}; - -static void UtcDaliJsonParserMethod07() -{ - 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); -} - -static void UtcDaliJsonParserMethod08() -{ - 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); -} - -static void UtcDaliJsonParserMethod09() -{ - 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); -} - -static void UtcDaliJsonParserMethod10() -{ - 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); -} diff --git a/automated-tests/TET/dali-test-suite/buttons/.gitignore b/automated-tests/TET/dali-test-suite/buttons/.gitignore deleted file mode 100644 index f4f0d52..0000000 --- a/automated-tests/TET/dali-test-suite/buttons/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -utc-Dali-CheckBoxButton -utc-Dali-PushButton -utc-Dali-Button diff --git a/automated-tests/TET/dali-test-suite/buttons/Makefile b/automated-tests/TET/dali-test-suite/buttons/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-test-suite/buttons/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-test-suite/buttons/file.list b/automated-tests/TET/dali-test-suite/buttons/file.list deleted file mode 100644 index 3a8cef4..0000000 --- a/automated-tests/TET/dali-test-suite/buttons/file.list +++ /dev/null @@ -1,4 +0,0 @@ -TARGETS += \ - utc-Dali-CheckBoxButton \ - utc-Dali-PushButton \ - utc-Dali-Button \ diff --git a/automated-tests/TET/dali-test-suite/buttons/tslist b/automated-tests/TET/dali-test-suite/buttons/tslist deleted file mode 100644 index b8108d0..0000000 --- a/automated-tests/TET/dali-test-suite/buttons/tslist +++ /dev/null @@ -1,3 +0,0 @@ -/dali-test-suite/buttons/utc-Dali-CheckBoxButton -/dali-test-suite/buttons/utc-Dali-PushButton -/dali-test-suite/buttons/utc-Dali-Button diff --git a/automated-tests/TET/dali-test-suite/buttons/utc-Dali-Button.cpp b/automated-tests/TET/dali-test-suite/buttons/utc-Dali-Button.cpp deleted file mode 100644 index 56fbe9d..0000000 --- a/automated-tests/TET/dali-test-suite/buttons/utc-Dali-Button.cpp +++ /dev/null @@ -1,394 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include - -using namespace Dali; -using namespace Toolkit; - -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 bool gObjectCreatedCallBackCalled; - -static void TestObjectCreatedCallback(BaseHandle handle) -{ - gObjectCreatedCallBackCalled = true; -} - -static float ANIMATION_TIME( 0.5f ); -} // namespace - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliButtonNew, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliButtonProperties, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliButtonSetGetDimmed, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliButtonSize, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliButtonClicked, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliButtonConnectSignal, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliButtonSetGetAnimationTime, POSITIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - - -// Positive test case for a method -static void UtcDaliButtonNew() -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliButtonNew"); - - CheckBoxButton checkBoxButton = CheckBoxButton::New(); - - DALI_TEST_CHECK( checkBoxButton ); - - PushButton pushButton = PushButton::New(); - - DALI_TEST_CHECK( pushButton ); - - CheckBoxButton checkBoxButton2( checkBoxButton ); - - DALI_TEST_CHECK( checkBoxButton2 ); - - PushButton pushButton2( pushButton ); - - DALI_TEST_CHECK( pushButton2 ); - - checkBoxButton2 = NULL; - pushButton2 = 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; - handleButton = pushButton; - Button downCastPushButton = Button::DownCast( handleButton ); - DALI_TEST_CHECK( downCastPushButton ); - PushButton downCastPushButton2 = PushButton::DownCast( handleButton ); - DALI_TEST_CHECK( downCastPushButton2 ); - - handleButton = checkBoxButton; - Button downCastCheckBoxButton = Button::DownCast( handleButton ); - DALI_TEST_CHECK( downCastCheckBoxButton ); - CheckBoxButton downCastCheckBoxButton2 = CheckBoxButton::DownCast( handleButton ); - DALI_TEST_CHECK( downCastCheckBoxButton2 ); -} - -static void UtcDaliButtonProperties() -{ - tet_infoline("UtcDaliButtonSetProperty: "); - ToolkitTestApplication application; - - CheckBoxButton checkBoxButton = CheckBoxButton::New(); - PushButton pushButton = PushButton::New(); - - //Test various properties - checkBoxButton.SetProperty( Button::PROPERTY_DIMMED, false ); - DALI_TEST_CHECK( false == checkBoxButton.IsDimmed() ); - DALI_TEST_CHECK( false == checkBoxButton.GetProperty< bool >( Button::PROPERTY_DIMMED ) ); - checkBoxButton.SetProperty( Button::PROPERTY_DIMMED, true ); - DALI_TEST_CHECK( true == checkBoxButton.IsDimmed() ); - DALI_TEST_CHECK( true == checkBoxButton.GetProperty< bool >( Button::PROPERTY_DIMMED ) ); - - pushButton.SetProperty( Button::PROPERTY_DIMMED, false ); - DALI_TEST_CHECK( false == pushButton.IsDimmed() ); - DALI_TEST_CHECK( false == pushButton.GetProperty< bool >( Button::PROPERTY_DIMMED ) ); - pushButton.SetProperty( Button::PROPERTY_DIMMED, true ); - DALI_TEST_CHECK( true == pushButton.IsDimmed() ); - DALI_TEST_CHECK( true == pushButton.GetProperty< bool >( Button::PROPERTY_DIMMED ) ); -} - -static void UtcDaliButtonSetGetDimmed() -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliButtonSetGetDimmed"); - - CheckBoxButton checkBoxButton = CheckBoxButton::New(); - PushButton pushButton = PushButton::New(); - - checkBoxButton.SetDimmed( true ); - pushButton.SetDimmed( true ); - - DALI_TEST_CHECK( checkBoxButton.IsDimmed() ); - DALI_TEST_CHECK( pushButton.IsDimmed() ); - - checkBoxButton.SetDimmed( false ); - pushButton.SetDimmed( false ); - - DALI_TEST_CHECK( !checkBoxButton.IsDimmed() ); - DALI_TEST_CHECK( !pushButton.IsDimmed() ); - - checkBoxButton.SetDimmed( true ); - pushButton.SetDimmed( true ); - - DALI_TEST_CHECK( checkBoxButton.IsDimmed() ); - DALI_TEST_CHECK( pushButton.IsDimmed() ); - - checkBoxButton.SetDimmed( false ); - pushButton.SetDimmed( false ); - - DALI_TEST_CHECK( !checkBoxButton.IsDimmed() ); - DALI_TEST_CHECK( !pushButton.IsDimmed() ); -} - -static void UtcDaliButtonSize() -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliButtonSize"); - - // Creates 100x50 images. - ImageActor image01 = CreateSolidColorActor( Color::RED ); - image01.SetSize( 100, 50 ); - - CheckBoxButton checkBoxButton; - 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 ); -} - -static void UtcDaliButtonClicked() -{ - 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 ); -} - -static bool gClickedCallBackCalled; - -static bool TestClickedCallback(Button button) -{ - gClickedCallBackCalled = true; - return true; -} - -static void UtcDaliButtonConnectSignal() -{ - 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 ); -} - -static void UtcDaliButtonSetGetAnimationTime() -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliButtonSetGetAnimationTime"); - - CheckBoxButton checkBoxButton = CheckBoxButton::New(); - PushButton pushButton = PushButton::New(); - - checkBoxButton.SetAnimationTime( ANIMATION_TIME ); - pushButton.SetAnimationTime( ANIMATION_TIME ); - - DALI_TEST_EQUALS( checkBoxButton.GetAnimationTime(), ANIMATION_TIME, TEST_LOCATION ); - DALI_TEST_EQUALS( pushButton.GetAnimationTime(), ANIMATION_TIME, TEST_LOCATION ); - -} diff --git a/automated-tests/TET/dali-test-suite/buttons/utc-Dali-CheckBoxButton.cpp b/automated-tests/TET/dali-test-suite/buttons/utc-Dali-CheckBoxButton.cpp deleted file mode 100644 index c2d7f30..0000000 --- a/automated-tests/TET/dali-test-suite/buttons/utc-Dali-CheckBoxButton.cpp +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include -#include - -#include - -using namespace Dali; -using namespace Toolkit; - -namespace -{ -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; -} - -static bool gCheckBoxButtonState = false; -bool CheckBoxButtonClicked( Button button ) -{ - gCheckBoxButtonState = static_cast( button ).IsChecked(); - return true; -} -} // namespace - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliCheckBoxButtonSetGetChecked, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliCheckBoxButtonSetImages, POSITIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliCheckBoxButtonSetGetChecked() -{ - 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 ); -} - -static void UtcDaliCheckBoxButtonSetImages() -{ - 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 ); -} diff --git a/automated-tests/TET/dali-test-suite/buttons/utc-Dali-PushButton.cpp b/automated-tests/TET/dali-test-suite/buttons/utc-Dali-PushButton.cpp deleted file mode 100644 index e792bc3..0000000 --- a/automated-tests/TET/dali-test-suite/buttons/utc-Dali-PushButton.cpp +++ /dev/null @@ -1,1356 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include - -#include - -using namespace Dali; -using namespace Toolkit; - -namespace -{ -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; -} - -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 ); -} // namespace - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -////////////////////////////////////////////////////////// - -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 - -////////////////////////////////////////////////////////// - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliPushButtonSetGetAutoRepeating, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPushButtonSetGetToggleButton, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPushButtonSetGetAutoRepeatingAndToggleButton, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPushButtonSetGetToggled01, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPushButtonSetGetToggled02, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPushButtonSetGetAutorepeatingDelayValues01, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPushButtonSetGetAutorepeatingDelayValues02, NEGATIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPushButtonSetImages, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPushButtonSetLabelText, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPushButtonPressed, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPushButtonReleased, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPushButtonToggled, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPushButtonInterruptEventWhenInsensitive, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPushButtonInterruptEventWhenNonVisible, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPushButtonProperties, POSITIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - - -static void UtcDaliPushButtonSetGetAutoRepeating() -{ - 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() ); -} - -static void UtcDaliPushButtonSetGetToggleButton() -{ - 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() ); -} - -static void UtcDaliPushButtonSetGetAutoRepeatingAndToggleButton() -{ - 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() ); -} - -static void UtcDaliPushButtonSetGetToggled01() -{ - 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 ); -} - -static void UtcDaliPushButtonSetGetToggled02() -{ - 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 ); -} - -static void UtcDaliPushButtonSetGetAutorepeatingDelayValues01() -{ - 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 ); -} - -static void UtcDaliPushButtonSetGetAutorepeatingDelayValues02() -{ - 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 ); -} - -static void UtcDaliPushButtonSetImages() -{ - 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 ); -} - -static void UtcDaliPushButtonSetLabelText() -{ - 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() ); -} - -static void UtcDaliPushButtonPressed() -{ - 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 ); -} - -static void UtcDaliPushButtonReleased() -{ - 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 ); -} - -static void UtcDaliPushButtonToggled() -{ - 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 ); -} - -static void UtcDaliPushButtonInterruptEventWhenInsensitive() -{ - 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 ); -} - -static void UtcDaliPushButtonInterruptEventWhenNonVisible() -{ - 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 ); -} - -void UtcDaliPushButtonProperties() -{ - 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 ); - } -} diff --git a/automated-tests/TET/dali-test-suite/cluster/.gitignore b/automated-tests/TET/dali-test-suite/cluster/.gitignore deleted file mode 100644 index 0f1bba7..0000000 --- a/automated-tests/TET/dali-test-suite/cluster/.gitignore +++ /dev/null @@ -1 +0,0 @@ -utc-Dali-Cluster diff --git a/automated-tests/TET/dali-test-suite/cluster/Makefile b/automated-tests/TET/dali-test-suite/cluster/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-test-suite/cluster/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-test-suite/cluster/file.list b/automated-tests/TET/dali-test-suite/cluster/file.list deleted file mode 100644 index 3025d80..0000000 --- a/automated-tests/TET/dali-test-suite/cluster/file.list +++ /dev/null @@ -1,2 +0,0 @@ -TARGETS += \ - utc-Dali-Cluster \ diff --git a/automated-tests/TET/dali-test-suite/cluster/tslist b/automated-tests/TET/dali-test-suite/cluster/tslist deleted file mode 100644 index d3e3708..0000000 --- a/automated-tests/TET/dali-test-suite/cluster/tslist +++ /dev/null @@ -1 +0,0 @@ -/dali-test-suite/cluster/utc-Dali-Cluster diff --git a/automated-tests/TET/dali-test-suite/cluster/utc-Dali-Cluster.cpp b/automated-tests/TET/dali-test-suite/cluster/utc-Dali-Cluster.cpp deleted file mode 100644 index deea31d..0000000 --- a/automated-tests/TET/dali-test-suite/cluster/utc-Dali-Cluster.cpp +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; -using namespace Dali::Toolkit; - -namespace -{ - -static bool gObjectCreatedCallBackCalled; - -static void TestCallback(BaseHandle handle) -{ - gObjectCreatedCallBackCalled = true; -} - -} // namespace - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliClusterNew, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliClusterDownCast, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliClusterAddAndRemoveChild, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliClusterExpandAndCollapseChild, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliClusterSetAndGetStyle, POSITIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliClusterNew() -{ - 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 ); -} - -static void UtcDaliClusterDownCast() -{ - 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 ); -} - -static void UtcDaliClusterAddAndRemoveChild() -{ - 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 ); -} - -static void UtcDaliClusterExpandAndCollapseChild() -{ - 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); -} - -static void UtcDaliClusterSetAndGetStyle() -{ - 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 ); -} diff --git a/automated-tests/TET/dali-test-suite/control/.gitignore b/automated-tests/TET/dali-test-suite/control/.gitignore deleted file mode 100644 index 17a0b4b..0000000 --- a/automated-tests/TET/dali-test-suite/control/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -utc-Dali-ControlImpl -utc-Dali-Control diff --git a/automated-tests/TET/dali-test-suite/control/Makefile b/automated-tests/TET/dali-test-suite/control/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-test-suite/control/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-test-suite/control/dummy-control.h b/automated-tests/TET/dali-test-suite/control/dummy-control.h deleted file mode 100644 index e4b9de1..0000000 --- a/automated-tests/TET/dali-test-suite/control/dummy-control.h +++ /dev/null @@ -1,241 +0,0 @@ -#ifndef __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__ -#define __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// 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() - : mCustomSlot1Called(false) - { - } - - DummyControl(const DummyControl& control) - : Control( control ), - mCustomSlot1Called(false) - { - } - - virtual ~DummyControl() - { - } - - static DummyControl New( bool override = false ); - - static DummyControl DownCast( BaseHandle handle ) - { - return Control::DownCast(handle); - } - - DummyControl& operator=(const DummyControl& control) - { - Control::operator=( control ); - return *this; - } - - // Used to test signal connections - void CustomSlot1( Actor actor, const Vector3& value ) - { - mCustomSlot1Called = true; - mCustomSlot1Value = 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() - { - IntrusivePtr< DummyControlImpl > impl = new DummyControlImpl; - DummyControl control( *impl ); - impl->Initialize(); - return control; - } - -public: - void EnableGestureDetection(Gesture::Type type) { ControlImpl::EnableGestureDetection(type); } - void DisableGestureDetection(Gesture::Type type) { ControlImpl::DisableGestureDetection(type); } - PinchGestureDetector GetPinchGestureDetector() const { return ControlImpl::GetPinchGestureDetector(); } - PanGestureDetector GetPanGestureDetector() const { return ControlImpl::GetPanGestureDetector(); } - TapGestureDetector GetTapGestureDetector() const { return ControlImpl::GetTapGestureDetector(); } - LongPressGestureDetector GetLongPressGestureDetector() const { return ControlImpl::GetLongPressGestureDetector(); } - -protected: - - DummyControlImpl() - : ControlImpl(true) - { - } - - 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() - { - IntrusivePtr< DummyControlImplOverride > impl = new DummyControlImplOverride; - DummyControl control( *impl ); - impl->Initialize(); - return control; - } - -private: - - DummyControlImplOverride() - : DummyControlImpl(), - initializeCalled(false), - themeChangeCalled(false), - fontChangeCalled( 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) - { - } - - virtual ~DummyControlImplOverride() { } - -private: // From ControlImpl - - virtual void OnInitialize() { initializeCalled = true; } - virtual void OnThemeChange( StyleManager styleManager ) { themeChangeCalled = true } - virtual void OnFontChange( bool defaultFontChange, bool defaultFontSizeChange ) { fontChangeCalled = true;} - virtual void OnPinch(PinchGesture pinch) { pinchCalled = true; } - virtual void OnPan(PanGesture pan) { panCalled = true; } - virtual void OnTap(TapGesture tap) { tapCalled = true; } - virtual void OnLongPress(LongPressGesture longPress) { longPressCalled = true; } - -private: // From CustomActorImpl - - virtual void OnStageConnection() { stageConnectionCalled = true; } - virtual void OnStageDisconnection() { stageDisconnectionCalled = true; } - virtual void OnChildAdd(Actor& child) { childAddCalled = true; } - virtual void OnChildRemove(Actor& child) { childRemoveCalled = true; } - virtual void OnSizeSet(const Vector3& targetSize) { sizeSetCalled = true; } - virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize) { sizeAnimationCalled = true; } - virtual bool OnTouchEvent(const TouchEvent& event) { touchEventCalled = true; return false; } - virtual bool OnMouseWheelEvent(const MouseWheelEvent& event) { mouseWheelEventCalled = true; return false; } - virtual bool OnKeyEvent(const KeyEvent& event) { keyEventCalled = true; return false;} - virtual void OnKeyInputFocusGained() { keyInputFocusGained = true; } - virtual void OnKeyInputFocusLost() { keyInputFocusLost = true; } - -public: - - bool initializeCalled; - bool themeChangeCalled; - bool fontChangeCalled; - 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; -}; - -DummyControl DummyControl::New( bool override ) -{ - DummyControl control; - - if (override) - { - control = DummyControlImplOverride::New(); - } - else - { - control = DummyControlImpl::New(); - } - - return control; -} - -DummyControl::DummyControl( DummyControlImpl& implementation ) -: Control( implementation ) -{ -} - -DummyControl::DummyControl( Dali::Internal::CustomActor* internal ) -: Control( internal ) -{ - VerifyCustomActorPointer(internal); -} - -} // namespace Toolkit - -} // namespace Dali - -#endif // __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__ diff --git a/automated-tests/TET/dali-test-suite/control/file.list b/automated-tests/TET/dali-test-suite/control/file.list deleted file mode 100644 index 7efd89d..0000000 --- a/automated-tests/TET/dali-test-suite/control/file.list +++ /dev/null @@ -1,3 +0,0 @@ -TARGETS += \ - utc-Dali-ControlImpl \ - utc-Dali-Control \ diff --git a/automated-tests/TET/dali-test-suite/control/tslist b/automated-tests/TET/dali-test-suite/control/tslist deleted file mode 100644 index e2ff777..0000000 --- a/automated-tests/TET/dali-test-suite/control/tslist +++ /dev/null @@ -1,2 +0,0 @@ -/dali-test-suite/control/utc-Dali-ControlImpl -/dali-test-suite/control/utc-Dali-Control diff --git a/automated-tests/TET/dali-test-suite/control/utc-Dali-Control.cpp b/automated-tests/TET/dali-test-suite/control/utc-Dali-Control.cpp deleted file mode 100644 index c236b77..0000000 --- a/automated-tests/TET/dali-test-suite/control/utc-Dali-Control.cpp +++ /dev/null @@ -1,369 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -#include "dummy-control.h" - -using namespace Dali; -using namespace Dali::Toolkit; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliControlConstructor, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliControlNew, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliControlRegister, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliControlCopyAndAssignment, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliControlDownCast, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliControlDownCastTemplate, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliControlKeyInputFocus, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliControlGetImplementation, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliControlSignalConnectDisconnect, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliControlSignalAutomaticDisconnect, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliControlTestParameters, POSITIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliControlConstructor() -{ - ToolkitTestApplication application; // Exceptions require ToolkitTestApplication - - DummyControl dummy; - - DALI_TEST_CHECK( !Control::DownCast(dummy) ); - - dummy = DummyControl::New(); - - DALI_TEST_CHECK( Control::DownCast(dummy) ); -} - -static void UtcDaliControlNew() -{ - ToolkitTestApplication application; // Exceptions require ToolkitTestApplication - - Control control; - - DALI_TEST_CHECK( !Control::DownCast(control) ); - - control = Control::New(); - - DALI_TEST_CHECK( Control::DownCast(control) ); -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// - -static bool gObjectCreatedCallBackCalled; - -static void TestCallback(BaseHandle handle) -{ - gObjectCreatedCallBackCalled = true; -} - -static void UtcDaliControlRegister() -{ - 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 ); -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// - -static void UtcDaliControlCopyAndAssignment() -{ - 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 ); -} - -static void UtcDaliControlDownCast() -{ - 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 ) ); -} - -static void UtcDaliControlDownCastTemplate() -{ - 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 ) ); -} - -static void UtcDaliControlKeyInputFocus() -{ - 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() ); -} - -static void UtcDaliControlGetImplementation() -{ - 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); - } - } -} - -static void UtcDaliControlSignalConnectDisconnect() -{ - 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 ); - } -} - -static void UtcDaliControlSignalAutomaticDisconnect() -{ - 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 ); -} - -static void UtcDaliControlTestParameters() -{ - 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; -} diff --git a/automated-tests/TET/dali-test-suite/control/utc-Dali-ControlImpl.cpp b/automated-tests/TET/dali-test-suite/control/utc-Dali-ControlImpl.cpp deleted file mode 100644 index 6efc1dc..0000000 --- a/automated-tests/TET/dali-test-suite/control/utc-Dali-ControlImpl.cpp +++ /dev/null @@ -1,830 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "dummy-control.h" - -using namespace Dali; -using namespace Dali::Toolkit; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliControlImplNew, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliControlImplTypeRegistry, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliControlImplEnableGestureDetector, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliControlImplDisableGestureDetector, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliControlImplOnGestureMethods, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliControlImplChildAddAndRemove, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliControlImplStageConnection, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliControlImplSizeSet, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliControlImplSizeAnimation, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliControlImplTouchEvent, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliControlImplMouseWheelEvent, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliControlImplKeyEvent, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliControlImplStyleChange, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliControlImplKeyInputFocusGained, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliControlImplKeyInputFocusLost, POSITIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliControlImplNew() -{ - ToolkitTestApplication application; // Exceptions require ToolkitTestApplication - - Control control; - - DALI_TEST_CHECK( !Control::DownCast(control) ); - - control = ControlImpl::New(); - - DALI_TEST_CHECK( Control::DownCast(control) ); -} - -static void UtcDaliControlImplTypeRegistry() -{ - 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) ); -} - -static void UtcDaliControlImplEnableGestureDetector() -{ - 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() ); - } -} - -static void UtcDaliControlImplDisableGestureDetector() -{ - 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 ); - } -} - -static void UtcDaliControlImplOnGestureMethods() -{ - 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); - } -} - -static void UtcDaliControlImplChildAddAndRemove() -{ - 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); - } -} - -static void UtcDaliControlImplStageConnection() -{ - 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 ); - } -} - -static void UtcDaliControlImplSizeSet() -{ - 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); - } -} - -static void UtcDaliControlImplSizeAnimation() -{ - 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); - } -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// - -static void UtcDaliControlImplTouchEvent() -{ - 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); - } -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// - -static bool MouseWheelEventCallback(Actor actor, const MouseWheelEvent& event) -{ - return false; -} - -static void UtcDaliControlImplMouseWheelEvent() -{ - 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); - } -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// - -static void UtcDaliControlImplKeyEvent() -{ - 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); - } -} - -static void UtcDaliControlImplStyleChange() -{ - 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; - application.GetAdaptor().GetToolkitStyleMonitor().EmitSignalStyleChange(styleChange); - DALI_TEST_EQUALS( dummyImpl.styleChangeCalled, true, TEST_LOCATION ); - - Stage::GetCurrent().Remove(dummy); -} - -static void UtcDaliControlImplKeyInputFocusGained() -{ - 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); - } -} - -static void UtcDaliControlImplKeyInputFocusLost() -{ - 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); - } -} diff --git a/automated-tests/TET/dali-test-suite/default-controls/.gitignore b/automated-tests/TET/dali-test-suite/default-controls/.gitignore deleted file mode 100644 index fa84f53..0000000 --- a/automated-tests/TET/dali-test-suite/default-controls/.gitignore +++ /dev/null @@ -1 +0,0 @@ -utc-Dali-DefaultControls diff --git a/automated-tests/TET/dali-test-suite/default-controls/Makefile b/automated-tests/TET/dali-test-suite/default-controls/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-test-suite/default-controls/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-test-suite/default-controls/file.list b/automated-tests/TET/dali-test-suite/default-controls/file.list deleted file mode 100644 index 91c147c..0000000 --- a/automated-tests/TET/dali-test-suite/default-controls/file.list +++ /dev/null @@ -1,2 +0,0 @@ -TARGETS += \ - utc-Dali-DefaultControls \ diff --git a/automated-tests/TET/dali-test-suite/default-controls/tslist b/automated-tests/TET/dali-test-suite/default-controls/tslist deleted file mode 100644 index 7dc630b..0000000 --- a/automated-tests/TET/dali-test-suite/default-controls/tslist +++ /dev/null @@ -1 +0,0 @@ -/dali-test-suite/default-controls/utc-Dali-DefaultControls diff --git a/automated-tests/TET/dali-test-suite/default-controls/utc-Dali-DefaultControls.cpp b/automated-tests/TET/dali-test-suite/default-controls/utc-Dali-DefaultControls.cpp deleted file mode 100644 index 0dcffa9..0000000 --- a/automated-tests/TET/dali-test-suite/default-controls/utc-Dali-DefaultControls.cpp +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -using namespace Dali; -using namespace Toolkit; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliDefaultControlsCreateSolidColorActor, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliDefaultControlsCreatePushButton, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliDefaultControlsCreateCheckBoxButton, POSITIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliDefaultControlsCreateSolidColorActor() -{ - 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); -} - -static void UtcDaliDefaultControlsCreatePushButton() -{ - 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 ); -} - -static void UtcDaliDefaultControlsCreateCheckBoxButton() -{ - 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 ); -} diff --git a/automated-tests/TET/dali-test-suite/focus-manager/.gitignore b/automated-tests/TET/dali-test-suite/focus-manager/.gitignore deleted file mode 100644 index 000ce4a..0000000 --- a/automated-tests/TET/dali-test-suite/focus-manager/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -utc-Dali-FocusManager -utc-Dali-KeyInputFocusManager -utc-Dali-KeyboardFocusManager diff --git a/automated-tests/TET/dali-test-suite/focus-manager/Makefile b/automated-tests/TET/dali-test-suite/focus-manager/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-test-suite/focus-manager/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-test-suite/focus-manager/file.list b/automated-tests/TET/dali-test-suite/focus-manager/file.list deleted file mode 100644 index 13851a6..0000000 --- a/automated-tests/TET/dali-test-suite/focus-manager/file.list +++ /dev/null @@ -1,4 +0,0 @@ -TARGETS += \ - utc-Dali-FocusManager \ - utc-Dali-KeyInputFocusManager \ - utc-Dali-KeyboardFocusManager diff --git a/automated-tests/TET/dali-test-suite/focus-manager/tslist b/automated-tests/TET/dali-test-suite/focus-manager/tslist deleted file mode 100644 index 409996a..0000000 --- a/automated-tests/TET/dali-test-suite/focus-manager/tslist +++ /dev/null @@ -1,3 +0,0 @@ -/dali-test-suite/focus-manager/utc-Dali-FocusManager -/dali-test-suite/focus-manager/utc-Dali-KeyInputFocusManager -/dali-test-suite/focus-manager/utc-Dali-KeyboardFocusManager diff --git a/automated-tests/TET/dali-test-suite/focus-manager/utc-Dali-FocusManager.cpp b/automated-tests/TET/dali-test-suite/focus-manager/utc-Dali-FocusManager.cpp deleted file mode 100644 index 4139d14..0000000 --- a/automated-tests/TET/dali-test-suite/focus-manager/utc-Dali-FocusManager.cpp +++ /dev/null @@ -1,1071 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; -using namespace Toolkit; - -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 - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliFocusManagerGet, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliFocusManagerSetAndGetAccessibilityAttribute, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliFocusManagerSetAndGetFocusOrder, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliFocusManagerGenerateNewFocusOrder, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliFocusManagerGetActorByFocusOrder, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliFocusManagerSetAndGetCurrentFocusActor, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliFocusManagerGetCurrentFocusGroup, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliFocusManagerGetCurrentFocusOrder, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliFocusManagerMoveFocusForward, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliFocusManagerMoveFocusBackward, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliFocusManagerClearFocus, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliFocusManagerReset, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliFocusManagerFocusGroup, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliFocusManagerSetAndGetFocusIndicator, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliFocusManagerSignalFocusChanged, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliFocusManagerSignalFocusOvershot, POSITIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliFocusManagerGet() -{ - 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); -} - -static void UtcDaliFocusManagerSetAndGetAccessibilityAttribute() -{ - 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"); -} - -static void UtcDaliFocusManagerSetAndGetFocusOrder() -{ - 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"); -} - -static void UtcDaliFocusManagerGenerateNewFocusOrder() -{ - 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); -} - -static void UtcDaliFocusManagerGetActorByFocusOrder() -{ - 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()); -} - -static void UtcDaliFocusManagerSetAndGetCurrentFocusActor() -{ - 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); -} - -static void UtcDaliFocusManagerGetCurrentFocusGroup() -{ - 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); - -} - -static void UtcDaliFocusManagerGetCurrentFocusOrder() -{ - 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); -} - -static void UtcDaliFocusManagerMoveFocusForward() -{ - 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"); -} - -static void UtcDaliFocusManagerMoveFocusBackward() -{ - 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"); -} - -static void UtcDaliFocusManagerClearFocus() -{ - 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()); -} - -static void UtcDaliFocusManagerReset() -{ - 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); -} - -static void UtcDaliFocusManagerFocusGroup() -{ - 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); -} - -static void UtcDaliFocusManagerSetAndGetFocusIndicator() -{ - 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); -} - -static void UtcDaliFocusManagerSignalFocusChanged() -{ - 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); -} - -static void UtcDaliFocusManagerSignalFocusOvershot() -{ - 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); -} diff --git a/automated-tests/TET/dali-test-suite/focus-manager/utc-Dali-KeyInputFocusManager.cpp b/automated-tests/TET/dali-test-suite/focus-manager/utc-Dali-KeyInputFocusManager.cpp deleted file mode 100644 index 4faa306..0000000 --- a/automated-tests/TET/dali-test-suite/focus-manager/utc-Dali-KeyInputFocusManager.cpp +++ /dev/null @@ -1,336 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#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 - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliKeyInputFocusManagerGet, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliKeyInputFocusManagerSetFocus, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliKeyInputFocusManagerGetCurrentFocusControl, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliKeyInputFocusManagerRemoveFocus, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliKeyInputFocusManagerIsKeyboardListener, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliKeyInputFocusManagerSignalKeyInputFocusChanged, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliKeyInputFocusManagerSignalUnhandledKeyEvent, POSITIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliKeyInputFocusManagerGet() -{ - 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); -} - -static void UtcDaliKeyInputFocusManagerSetFocus() -{ - 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()); -} - -static void UtcDaliKeyInputFocusManagerGetCurrentFocusControl() -{ - 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()); -} - -static void UtcDaliKeyInputFocusManagerRemoveFocus() -{ - 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()); -} - -static void UtcDaliKeyInputFocusManagerIsKeyboardListener() -{ - 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)); -} - -static void UtcDaliKeyInputFocusManagerSignalKeyInputFocusChanged() -{ - 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() ); -} - -static void UtcDaliKeyInputFocusManagerSignalUnhandledKeyEvent() -{ - 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 ); -} diff --git a/automated-tests/TET/dali-test-suite/focus-manager/utc-Dali-KeyboardFocusManager.cpp b/automated-tests/TET/dali-test-suite/focus-manager/utc-Dali-KeyboardFocusManager.cpp deleted file mode 100644 index 6044803..0000000 --- a/automated-tests/TET/dali-test-suite/focus-manager/utc-Dali-KeyboardFocusManager.cpp +++ /dev/null @@ -1,737 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -#include - -using namespace Dali; -using namespace Dali::Toolkit; - -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 - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliKeyboardFocusManagerGet, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliKeyboardFocusManagerSetAndGetCurrentFocusActor, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliKeyboardFocusManagerMoveFocus, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliKeyboardFocusManagerClearFocus, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliKeyboardFocusManagerSetAndGetFocusGroupLoop, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliKeyboardFocusManagerSetAsFocusGroup, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliKeyboardFocusManagerGetFocusGroup, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliKeyboardFocusManagerSetAndGetFocusIndicator, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliKeyboardFocusManagerSignalFocusGroupChanged, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliKeyboardFocusManagerSignalFocusedActorActivated, POSITIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliKeyboardFocusManagerGet() -{ - 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); -} - -static void UtcDaliKeyboardFocusManagerSetAndGetCurrentFocusActor() -{ - ToolkitTestApplication application; - - tet_infoline(" UtcDaliKeyboardFocusManagerSetAndGetCurrentFocusActor"); - - // 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); - - // 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); -} - -static void UtcDaliKeyboardFocusManagerMoveFocus() -{ - 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(); -} - -static void UtcDaliKeyboardFocusManagerClearFocus() -{ - ToolkitTestApplication application; - - tet_infoline(" UtcDaliKeyboardFocusManagerClearFocus"); - - // 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); - - // 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()); -} - -static void UtcDaliKeyboardFocusManagerSetAndGetFocusGroupLoop() -{ - ToolkitTestApplication application; - - tet_infoline(" UtcDaliKeyboardFocusManagerSetAndGetFocusGroupLoop"); - - // 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); - - // 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); -} - -static void UtcDaliKeyboardFocusManagerSetAsFocusGroup() -{ - ToolkitTestApplication application; - - tet_infoline(" UtcDaliKeyboardFocusManagerSetAsFocusGroup"); - - // 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); - - // 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); -} - -static void UtcDaliKeyboardFocusManagerGetFocusGroup() -{ - ToolkitTestApplication application; - - tet_infoline(" UtcDaliKeyboardFocusManagerGetFocusGroup"); - - // 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); - - // 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); -} - -static void UtcDaliKeyboardFocusManagerSetAndGetFocusIndicator() -{ - ToolkitTestApplication application; - - tet_infoline(" UtcDaliKeyboardFocusManagerSetAndGetFocusIndicator"); - - // 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); - - Actor defaultFocusIndicatorActor = manager.GetFocusIndicatorActor(); - DALI_TEST_CHECK(defaultFocusIndicatorActor); - - Actor newFocusIndicatorActor = Actor::New(); - manager.SetFocusIndicatorActor(newFocusIndicatorActor); - DALI_TEST_CHECK(manager.GetFocusIndicatorActor() == newFocusIndicatorActor); -} - -static void UtcDaliKeyboardFocusManagerSignalFocusGroupChanged() -{ - 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(); -} - -static void UtcDaliKeyboardFocusManagerSignalFocusedActorActivated() -{ - ToolkitTestApplication application; - - tet_infoline(" UtcDaliKeyboardFocusManagerSignalFocusedActorActivated"); - - // 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 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(); -} diff --git a/automated-tests/TET/dali-test-suite/item-view/.gitignore b/automated-tests/TET/dali-test-suite/item-view/.gitignore deleted file mode 100644 index 390c9e4..0000000 --- a/automated-tests/TET/dali-test-suite/item-view/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -utc-Dali-ItemView -utc-Dali-ItemLayout -utc-Dali-GridLayout -utc-Dali-DepthLayout -utc-Dali-SpiralLayout -utc-Dali-NavigationLayout -utc-Dali-AlbumLayout -utc-Dali-RollLayout diff --git a/automated-tests/TET/dali-test-suite/item-view/Makefile b/automated-tests/TET/dali-test-suite/item-view/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-test-suite/item-view/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-test-suite/item-view/file.list b/automated-tests/TET/dali-test-suite/item-view/file.list deleted file mode 100644 index 37417ed..0000000 --- a/automated-tests/TET/dali-test-suite/item-view/file.list +++ /dev/null @@ -1,9 +0,0 @@ -TARGETS += \ - utc-Dali-ItemView \ - utc-Dali-ItemLayout \ - utc-Dali-GridLayout \ - utc-Dali-DepthLayout \ - utc-Dali-SpiralLayout \ - utc-Dali-NavigationLayout \ - utc-Dali-AlbumLayout \ - utc-Dali-RollLayout \ diff --git a/automated-tests/TET/dali-test-suite/item-view/tslist b/automated-tests/TET/dali-test-suite/item-view/tslist deleted file mode 100644 index e6beeab..0000000 --- a/automated-tests/TET/dali-test-suite/item-view/tslist +++ /dev/null @@ -1,8 +0,0 @@ -/dali-test-suite/item-view/utc-Dali-ItemView -/dali-test-suite/item-view/utc-Dali-ItemLayout -/dali-test-suite/item-view/utc-Dali-GridLayout -/dali-test-suite/item-view/utc-Dali-DepthLayout -/dali-test-suite/item-view/utc-Dali-SpiralLayout -/dali-test-suite/item-view/utc-Dali-NavigationLayout -/dali-test-suite/item-view/utc-Dali-AlbumLayout -/dali-test-suite/item-view/utc-Dali-RollLayout diff --git a/automated-tests/TET/dali-test-suite/item-view/utc-Dali-AlbumLayout.cpp b/automated-tests/TET/dali-test-suite/item-view/utc-Dali-AlbumLayout.cpp deleted file mode 100755 index e6957df..0000000 --- a/automated-tests/TET/dali-test-suite/item-view/utc-Dali-AlbumLayout.cpp +++ /dev/null @@ -1,403 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#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 - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliAlbumLayoutNew(); -static void UtcDaliAlbumSetAndGetItemSizeFunction(); -static void UtcDaliAlbumSetAndGetScrollSpeedFactor(); -static void UtcDaliAlbumSetAndGetMaximumSwipeSpeed(); -static void UtcDaliAlbumLayoutSetAndGetItemFlickAnimationDuration(); -static void UtcDaliAlbumSetNumOfItems(); -static void UtcDaliAlbumSetStackNum(); -static void UtcDaliAlbumSetPosition(); -static void UtcDaliAlbumSetRotationX(); -static void UtcDaliAlbumSetRotationZ(); -static void UtcDaliAlbumSetScale(); -static void UtcDaliAlbumSetColor(); -static void UtcDaliAlbumSetCenterPosition(); -static void UtcDaliAlbumSetSetCenterScale(); -static void UtcDaliAlbumSetSetCenterColor(); -static void UtcDaliAlbumSetStackPosition(); -static void UtcDaliAlbumSetSetStackScale(); -static void UtcDaliAlbumSetStackColor(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliAlbumLayoutNew, POSITIVE_TC_IDX }, - { UtcDaliAlbumSetAndGetItemSizeFunction, POSITIVE_TC_IDX }, - { UtcDaliAlbumSetAndGetScrollSpeedFactor, POSITIVE_TC_IDX }, - { UtcDaliAlbumSetAndGetMaximumSwipeSpeed, POSITIVE_TC_IDX }, - { UtcDaliAlbumLayoutSetAndGetItemFlickAnimationDuration, POSITIVE_TC_IDX }, - { UtcDaliAlbumSetNumOfItems, POSITIVE_TC_IDX }, - { UtcDaliAlbumSetStackNum, POSITIVE_TC_IDX }, - { UtcDaliAlbumSetPosition, POSITIVE_TC_IDX }, - { UtcDaliAlbumSetRotationX, POSITIVE_TC_IDX }, - { UtcDaliAlbumSetRotationZ, POSITIVE_TC_IDX }, - { UtcDaliAlbumSetScale, POSITIVE_TC_IDX }, - { UtcDaliAlbumSetColor, POSITIVE_TC_IDX }, - { UtcDaliAlbumSetCenterPosition, POSITIVE_TC_IDX }, - { UtcDaliAlbumSetSetCenterScale, POSITIVE_TC_IDX }, - { UtcDaliAlbumSetSetCenterColor, POSITIVE_TC_IDX }, - { UtcDaliAlbumSetStackPosition, POSITIVE_TC_IDX }, - { UtcDaliAlbumSetSetStackScale, POSITIVE_TC_IDX }, - { UtcDaliAlbumSetStackColor, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliAlbumLayoutNew() -{ - ToolkitTestApplication application; - - // Create a album layout - AlbumLayoutPtr albumLayout = AlbumLayout::New(); - - DALI_TEST_CHECK(albumLayout); -} - -static void UtcDaliAlbumSetAndGetItemSizeFunction() -{ - 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); -} - -static void UtcDaliAlbumSetAndGetScrollSpeedFactor() -{ - 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 ); -} - -static void UtcDaliAlbumSetAndGetMaximumSwipeSpeed() -{ - 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 ); -} - -static void UtcDaliAlbumLayoutSetAndGetItemFlickAnimationDuration() -{ - 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 ); -} - -static void UtcDaliAlbumSetNumOfItems() -{ - AlbumLayoutPtr albumLayout = AlbumLayout::New(); - - albumLayout->SetNumOfItems(15); - - DALI_TEST_CHECK(albumLayout->GetNumOfItems() == 15); -} - -static void UtcDaliAlbumSetStackNum() -{ - AlbumLayoutPtr albumLayout = AlbumLayout::New(); - - albumLayout->SetStackNum(30); - - DALI_TEST_CHECK(albumLayout->GetStackNum() == 30); -} - -static void UtcDaliAlbumSetPosition() -{ - 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); -} - -static void UtcDaliAlbumSetRotationX() -{ - AlbumLayoutPtr albumLayout = AlbumLayout::New(); - - albumLayout->SetRotationX(Math::PI/4.0f); - - DALI_TEST_CHECK(albumLayout->GetRotationX() == Math::PI/4.0f); -} - -static void UtcDaliAlbumSetRotationZ() -{ - 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); -} - -static void UtcDaliAlbumSetScale() -{ - 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); -} - -static void UtcDaliAlbumSetColor() -{ - // 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); -} - -static void UtcDaliAlbumSetCenterPosition() -{ - 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)); -} - -static void UtcDaliAlbumSetSetCenterScale() -{ - AlbumLayoutPtr albumLayout = AlbumLayout::New(); - - albumLayout->SetCenterScale(1.75f); - - DALI_TEST_CHECK(albumLayout->GetCenterScale() == 1.75f); -} - -static void UtcDaliAlbumSetSetCenterColor() -{ - AlbumLayoutPtr albumLayout = AlbumLayout::New(); - - albumLayout->SetCenterColor(Vector2(1.0f,1.0f)); - - DALI_TEST_CHECK(albumLayout->GetCenterColor() == Vector2(1.0f,1.0f)); -} - -static void UtcDaliAlbumSetStackPosition() -{ - 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)); -} - -static void UtcDaliAlbumSetSetStackScale() -{ - AlbumLayoutPtr albumLayout = AlbumLayout::New(); - - albumLayout->SetStackScale(1.0f,1.0f); - - DALI_TEST_CHECK(albumLayout->GetRightStackScale() == 1.0f && albumLayout->GetLeftStackScale() == 1.0f); -} - -static void UtcDaliAlbumSetStackColor() -{ - 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)); -} diff --git a/automated-tests/TET/dali-test-suite/item-view/utc-Dali-DepthLayout.cpp b/automated-tests/TET/dali-test-suite/item-view/utc-Dali-DepthLayout.cpp deleted file mode 100644 index bfcfe44..0000000 --- a/automated-tests/TET/dali-test-suite/item-view/utc-Dali-DepthLayout.cpp +++ /dev/null @@ -1,659 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include // for FLT_MAX -#include -#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 - -static void Startup(); -static void Cleanup(); - -// 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; - } -}; - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliDepthLayoutNew(); -static void UtcDaliDepthLayoutSetAndGetNumberOfColumns(); -static void UtcDaliDepthLayoutSetAndGetNumberOfRows(); -static void UtcDaliDepthLayoutSetAndGetRowSpacing(); -static void UtcDaliDepthLayoutSetAndGetTiltAngle(); -static void UtcDaliDepthLayoutSetAndGetItemSizeFunction(); -static void UtcDaliDepthLayoutSetAndGetBottomMarginFunction(); -static void UtcDaliDepthLayoutSetAndGetItemTiltAngle(); -static void UtcDaliDepthLayoutSetAndGetColumnPositionFunction(); -static void UtcDaliDepthLayoutSetAndGetScrollSpeedFactor(); -static void UtcDaliDepthLayoutSetAndGetMaximumSwipeSpeed(); -static void UtcDaliDepthLayoutSetAndGetItemFlickAnimationDuration(); -static void UtcDaliDepthLayoutConstraintLeft(); -static void UtcDaliDepthLayoutConstraintRight(); -static void UtcDaliDepthLayoutConstraintUp(); -static void UtcDaliDepthLayoutConstraintDown(); -static void UtcDaliDepthLayoutGetScrollToPosition(); -static void UtcDaliDepthLayoutScrollDirection(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliDepthLayoutNew, POSITIVE_TC_IDX }, - { UtcDaliDepthLayoutScrollDirection, POSITIVE_TC_IDX }, - { UtcDaliDepthLayoutSetAndGetNumberOfColumns, POSITIVE_TC_IDX }, - { UtcDaliDepthLayoutSetAndGetNumberOfRows, POSITIVE_TC_IDX }, - { UtcDaliDepthLayoutSetAndGetRowSpacing, POSITIVE_TC_IDX }, - { UtcDaliDepthLayoutSetAndGetTiltAngle, POSITIVE_TC_IDX }, - { UtcDaliDepthLayoutSetAndGetItemSizeFunction, POSITIVE_TC_IDX }, - { UtcDaliDepthLayoutSetAndGetBottomMarginFunction, POSITIVE_TC_IDX }, - { UtcDaliDepthLayoutSetAndGetItemTiltAngle, POSITIVE_TC_IDX }, - { UtcDaliDepthLayoutSetAndGetColumnPositionFunction, POSITIVE_TC_IDX }, - { UtcDaliDepthLayoutSetAndGetScrollSpeedFactor, POSITIVE_TC_IDX }, - { UtcDaliDepthLayoutSetAndGetMaximumSwipeSpeed, POSITIVE_TC_IDX }, - { UtcDaliDepthLayoutSetAndGetItemFlickAnimationDuration, POSITIVE_TC_IDX }, - { UtcDaliDepthLayoutConstraintLeft, POSITIVE_TC_IDX }, - { UtcDaliDepthLayoutConstraintRight, POSITIVE_TC_IDX }, - { UtcDaliDepthLayoutConstraintUp, POSITIVE_TC_IDX }, - { UtcDaliDepthLayoutConstraintDown, POSITIVE_TC_IDX }, - { UtcDaliDepthLayoutGetScrollToPosition, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliDepthLayoutNew() -{ - ToolkitTestApplication application; - - // Create a depth layout - DepthLayoutPtr depthLayout = DepthLayout::New(); - - DALI_TEST_CHECK(depthLayout); -} - -static void UtcDaliDepthLayoutSetAndGetNumberOfColumns() -{ - 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); -} - -static void UtcDaliDepthLayoutSetAndGetNumberOfRows() -{ - 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); -} - -static void UtcDaliDepthLayoutSetAndGetRowSpacing() -{ - 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 ); -} - -static void UtcDaliDepthLayoutSetAndGetTiltAngle() -{ - 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 ); -} - -static void UtcDaliDepthLayoutSetAndGetItemSizeFunction() -{ - 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); -} - -static void UtcDaliDepthLayoutSetAndGetBottomMarginFunction() -{ - 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); -} - -static void UtcDaliDepthLayoutSetAndGetItemTiltAngle() -{ - 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 ); -} - -static void UtcDaliDepthLayoutSetAndGetColumnPositionFunction() -{ - 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); -} - -static void UtcDaliDepthLayoutSetAndGetScrollSpeedFactor() -{ - 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 ); -} - -static void UtcDaliDepthLayoutSetAndGetMaximumSwipeSpeed() -{ - 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 ); -} - -static void UtcDaliDepthLayoutSetAndGetItemFlickAnimationDuration() -{ - 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 ); -} - -static void UtcDaliDepthLayoutConstraintLeft() -{ - 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); -} - -static void UtcDaliDepthLayoutConstraintRight() -{ - 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); -} - -static void UtcDaliDepthLayoutConstraintUp() -{ - 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); -} - -static void UtcDaliDepthLayoutConstraintDown() -{ - 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); -} - -static void UtcDaliDepthLayoutGetScrollToPosition() -{ - 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); -} - -static void UtcDaliDepthLayoutScrollDirection() -{ - 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); -} diff --git a/automated-tests/TET/dali-test-suite/item-view/utc-Dali-GridLayout.cpp b/automated-tests/TET/dali-test-suite/item-view/utc-Dali-GridLayout.cpp deleted file mode 100644 index cdf88a9..0000000 --- a/automated-tests/TET/dali-test-suite/item-view/utc-Dali-GridLayout.cpp +++ /dev/null @@ -1,580 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include // for FLT_MAX -#include - -#include -#include -#include - -using namespace Dali; -using namespace Toolkit; - -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); -} - -} // namespace - -static void Startup(); -static void Cleanup(); - -// 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; - } -}; - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliGridLayoutNew(); -static void UtcDaliGridLayoutSetAndGetNumberOfColumns(); -static void UtcDaliGridLayoutSetAndGetRowSpacing(); -static void UtcDaliGridLayoutSetAndGetColumnSpacing(); -static void UtcDaliGridLayoutSetAndGetTopMargin(); -static void UtcDaliGridLayoutSetAndGetBottomMargin(); -static void UtcDaliGridLayoutSetAndGetSideMargin(); -static void UtcDaliGridLayoutSetAndGetZGap(); -static void UtcDaliGridLayoutSetAndGetItemSizeFunction(); -static void UtcDaliGridLayoutSetAndGetScrollSpeedFactor(); -static void UtcDaliGridLayoutSetAndGetMaximumSwipeSpeed(); -static void UtcDaliGridLayoutSetAndGetItemFlickAnimationDuration(); -static void UtcDaliGridLayoutConstraintLeft(); -static void UtcDaliGridLayoutConstraintRight(); -static void UtcDaliGridLayoutConstraintUp(); -static void UtcDaliGridLayoutConstraintDown(); -static void UtcDaliGridLayoutScrollDirection(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliGridLayoutNew, POSITIVE_TC_IDX }, - { UtcDaliGridLayoutSetAndGetNumberOfColumns, POSITIVE_TC_IDX }, - { UtcDaliGridLayoutSetAndGetRowSpacing, POSITIVE_TC_IDX }, - { UtcDaliGridLayoutSetAndGetColumnSpacing, POSITIVE_TC_IDX }, - { UtcDaliGridLayoutSetAndGetTopMargin, POSITIVE_TC_IDX }, - { UtcDaliGridLayoutSetAndGetBottomMargin, POSITIVE_TC_IDX }, - { UtcDaliGridLayoutSetAndGetSideMargin, POSITIVE_TC_IDX }, - { UtcDaliGridLayoutSetAndGetZGap, POSITIVE_TC_IDX }, - { UtcDaliGridLayoutSetAndGetItemSizeFunction, POSITIVE_TC_IDX }, - { UtcDaliGridLayoutSetAndGetScrollSpeedFactor, POSITIVE_TC_IDX }, - { UtcDaliGridLayoutSetAndGetMaximumSwipeSpeed, POSITIVE_TC_IDX }, - { UtcDaliGridLayoutSetAndGetItemFlickAnimationDuration, POSITIVE_TC_IDX }, - { UtcDaliGridLayoutConstraintLeft, POSITIVE_TC_IDX }, - { UtcDaliGridLayoutConstraintRight, POSITIVE_TC_IDX }, - { UtcDaliGridLayoutConstraintUp, POSITIVE_TC_IDX }, - { UtcDaliGridLayoutConstraintDown, POSITIVE_TC_IDX }, - { UtcDaliGridLayoutScrollDirection, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliGridLayoutNew() -{ - ToolkitTestApplication application; - - // Create a grid layout - GridLayoutPtr gridLayout = GridLayout::New(); - - DALI_TEST_CHECK(gridLayout); -} - -static void UtcDaliGridLayoutSetAndGetNumberOfColumns() -{ - 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); -} - -static void UtcDaliGridLayoutSetAndGetRowSpacing() -{ - 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 ); -} - -static void UtcDaliGridLayoutSetAndGetColumnSpacing() -{ - 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 ); -} - -static void UtcDaliGridLayoutSetAndGetTopMargin() -{ - 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 ); -} - -static void UtcDaliGridLayoutSetAndGetBottomMargin() -{ - 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 ); -} - -static void UtcDaliGridLayoutSetAndGetSideMargin() -{ - 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 ); -} - -static void UtcDaliGridLayoutSetAndGetZGap() -{ - 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 ); -} - -static void UtcDaliGridLayoutSetAndGetItemSizeFunction() -{ - 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); -} - -static void UtcDaliGridLayoutSetAndGetScrollSpeedFactor() -{ - 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 ); -} - -static void UtcDaliGridLayoutSetAndGetMaximumSwipeSpeed() -{ - 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 ); -} - -static void UtcDaliGridLayoutSetAndGetItemFlickAnimationDuration() -{ - 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 ); -} - -static void UtcDaliGridLayoutConstraintLeft() -{ - 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); -} - -static void UtcDaliGridLayoutConstraintRight() -{ - 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); -} - -static void UtcDaliGridLayoutConstraintUp() -{ - 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); -} - -static void UtcDaliGridLayoutConstraintDown() -{ - 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); -} - -static void UtcDaliGridLayoutScrollDirection() -{ - 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); -} diff --git a/automated-tests/TET/dali-test-suite/item-view/utc-Dali-ItemLayout.cpp b/automated-tests/TET/dali-test-suite/item-view/utc-Dali-ItemLayout.cpp deleted file mode 100644 index 3235d74..0000000 --- a/automated-tests/TET/dali-test-suite/item-view/utc-Dali-ItemLayout.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include - -#include - -#include - -using namespace Dali; -using namespace Toolkit; - -namespace -{ -const unsigned int TOTAL_ITEM_NUMBER = 200; -const char* TEST_IMAGE_FILE_NAME = DALI_IMAGE_DIR "gallery_image_01.jpg"; -} // namespace - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliItemLayoutSetAndGetOrientation(); -static void UtcDaliItemLayoutGetScrollHints(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliItemLayoutSetAndGetOrientation, POSITIVE_TC_IDX }, - { UtcDaliItemLayoutGetScrollHints, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -// 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; - } -}; - -static void UtcDaliItemLayoutSetAndGetOrientation() -{ - 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); -} - -static void UtcDaliItemLayoutGetScrollHints() -{ - 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); -} diff --git a/automated-tests/TET/dali-test-suite/item-view/utc-Dali-ItemView.cpp b/automated-tests/TET/dali-test-suite/item-view/utc-Dali-ItemView.cpp deleted file mode 100644 index 78ec833..0000000 --- a/automated-tests/TET/dali-test-suite/item-view/utc-Dali-ItemView.cpp +++ /dev/null @@ -1,576 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include // for FLT_MAX -#include - -#include -#include - -#include - -using namespace Dali; -using namespace Toolkit; - -namespace -{ -const unsigned int TOTAL_ITEM_NUMBER = 100; -const char* TEST_IMAGE_FILE_NAME = DALI_IMAGE_DIR "gallery_image_01.jpg"; - -static bool gObjectCreatedCallBackCalled; - -static void TestCallback(BaseHandle handle) -{ - gObjectCreatedCallBackCalled = true; -} - -} // namespace - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliItemViewNew(); -static void UtcDaliItemViewDownCast(); -static void UtcDaliItemViewAddAndGetLayout(); -static void UtcDaliItemViewAddAndRemoveLayout(); -static void UtcDaliItemViewActivateLayoutAndGetActiveLayout(); -static void UtcDaliItemViewDeactivateCurrentLayout(); -static void UtcDaliItemViewGetItemAndGetItemId(); -static void UtcDaliItemViewRemoveItem(); -static void UtcDaliItemViewGetCurrentLayoutPosition(); -static void UtcDaliItemViewSetAndGetMinimumSwipeSpeed(); -static void UtcDaliItemViewSetAndGetMinimumSwipeDistance(); -static void UtcDaliItemViewSetAndGetAnchoring(); -static void UtcDaliItemViewSetAndGetAnchoringDuration(); -static void UtcDaliItemViewSetAndGetRefreshInterval(); -static void UtcDaliItemViewScrollToItem(); -static void UtcDaliItemViewSetAndGetMouseWheelScrollDistanceStep(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliItemViewNew, POSITIVE_TC_IDX }, - { UtcDaliItemViewDownCast, POSITIVE_TC_IDX }, - { UtcDaliItemViewAddAndGetLayout, POSITIVE_TC_IDX }, - { UtcDaliItemViewAddAndRemoveLayout, POSITIVE_TC_IDX }, - { UtcDaliItemViewActivateLayoutAndGetActiveLayout, POSITIVE_TC_IDX }, - { UtcDaliItemViewDeactivateCurrentLayout, POSITIVE_TC_IDX }, - { UtcDaliItemViewGetItemAndGetItemId, POSITIVE_TC_IDX }, - { UtcDaliItemViewRemoveItem, POSITIVE_TC_IDX }, - { UtcDaliItemViewGetCurrentLayoutPosition, POSITIVE_TC_IDX }, - { UtcDaliItemViewSetAndGetMinimumSwipeSpeed, POSITIVE_TC_IDX }, - { UtcDaliItemViewSetAndGetMinimumSwipeDistance, POSITIVE_TC_IDX }, - { UtcDaliItemViewSetAndGetAnchoring, POSITIVE_TC_IDX }, - { UtcDaliItemViewSetAndGetAnchoringDuration, POSITIVE_TC_IDX }, - { UtcDaliItemViewSetAndGetRefreshInterval, POSITIVE_TC_IDX }, - { UtcDaliItemViewScrollToItem, POSITIVE_TC_IDX }, - { UtcDaliItemViewSetAndGetMouseWheelScrollDistanceStep, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -// 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; - } -}; - -static void UtcDaliItemViewNew() -{ - 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 ); -} - -static void UtcDaliItemViewDownCast() -{ - 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 ); -} - -static void UtcDaliItemViewAddAndGetLayout() -{ - 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); -} - -static void UtcDaliItemViewAddAndRemoveLayout() -{ - 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); -} - -static void UtcDaliItemViewActivateLayoutAndGetActiveLayout() -{ - 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); -} - -static void UtcDaliItemViewDeactivateCurrentLayout() -{ - 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); -} - -static void UtcDaliItemViewGetItemAndGetItemId() -{ - 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); -} - -static void UtcDaliItemViewRemoveItem() -{ - 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); -} - -static void UtcDaliItemViewGetCurrentLayoutPosition() -{ - 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 ); -} - -static void UtcDaliItemViewSetAndGetMinimumSwipeSpeed() -{ - 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 ); -} - -static void UtcDaliItemViewSetAndGetMinimumSwipeDistance() -{ - 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 ); -} - -static void UtcDaliItemViewSetAndGetAnchoring() -{ - 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); -} - -static void UtcDaliItemViewSetAndGetAnchoringDuration() -{ - 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 ); -} - -static void UtcDaliItemViewSetAndGetRefreshInterval() -{ - 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); -} - -static void UtcDaliItemViewScrollToItem() -{ - 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); -} - -static void UtcDaliItemViewSetAndGetMouseWheelScrollDistanceStep() -{ - 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 ); -} diff --git a/automated-tests/TET/dali-test-suite/item-view/utc-Dali-NavigationLayout.cpp b/automated-tests/TET/dali-test-suite/item-view/utc-Dali-NavigationLayout.cpp deleted file mode 100644 index 6a52409..0000000 --- a/automated-tests/TET/dali-test-suite/item-view/utc-Dali-NavigationLayout.cpp +++ /dev/null @@ -1,617 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include // for FLT_MAX -#include - -#include -#include -#include -#include - -using namespace Dali; -using namespace Toolkit; - -namespace -{ -const unsigned int TOTAL_ITEM_NUMBER = 200; -} // namespace - -static void Startup(); -static void Cleanup(); - -// 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; - } -}; - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliNavigationLayoutNew(); -static void UtcDaliNavigationLayoutColumns(); -static void UtcDaliNavigationLayoutSetGetOrientation(); -static void UtcDaliNavigationLayoutTestConstraintLeft(); -static void UtcDaliNavigationLayoutTestConstraintRight(); -static void UtcDaliNavigationLayoutTestConstraintUp(); -static void UtcDaliNavigationLayoutTestConstraintDown(); -static void UtcDaliNavigationLayoutScrollDirection(); -static void UtcDaliNavigationLayoutSetGetColumnSpacing(); -static void UtcDaliNavigationLayoutSetGetTopMargin(); -static void UtcDaliNavigationLayoutSetGetBottomMargin(); -static void UtcDaliNavigationLayoutSetGetScrollSpeedFactor(); -static void UtcDaliNavigationLayoutSetGetMaximumSwipeSpeed(); -static void UtcDaliNavigationLayoutSetAndGetItemFlickAnimationDuration(); -static void UtcDaliNavigationLayoutGetScrollToPosition(); - - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliNavigationLayoutNew, POSITIVE_TC_IDX }, - { UtcDaliNavigationLayoutColumns, POSITIVE_TC_IDX }, - { UtcDaliNavigationLayoutSetGetOrientation, POSITIVE_TC_IDX }, - { UtcDaliNavigationLayoutTestConstraintLeft, POSITIVE_TC_IDX }, - { UtcDaliNavigationLayoutTestConstraintRight, POSITIVE_TC_IDX }, - { UtcDaliNavigationLayoutTestConstraintUp, POSITIVE_TC_IDX }, - { UtcDaliNavigationLayoutTestConstraintDown, POSITIVE_TC_IDX }, - { UtcDaliNavigationLayoutScrollDirection, POSITIVE_TC_IDX }, - { UtcDaliNavigationLayoutSetGetColumnSpacing, POSITIVE_TC_IDX }, - { UtcDaliNavigationLayoutSetGetTopMargin, POSITIVE_TC_IDX }, - { UtcDaliNavigationLayoutSetGetBottomMargin, POSITIVE_TC_IDX }, - { UtcDaliNavigationLayoutSetGetScrollSpeedFactor, POSITIVE_TC_IDX }, - { UtcDaliNavigationLayoutSetGetMaximumSwipeSpeed, POSITIVE_TC_IDX }, - { UtcDaliNavigationLayoutSetAndGetItemFlickAnimationDuration, POSITIVE_TC_IDX }, - { UtcDaliNavigationLayoutGetScrollToPosition, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - - -// Positive test case for a method -static void UtcDaliNavigationLayoutNew() -{ - ToolkitTestApplication application; - - // Create a navigation layout - NavigationLayoutPtr navigationLayout = NavigationLayout::New(); - navigationLayout->SetNumberOfColumns(6); - DALI_TEST_CHECK(navigationLayout); -} - -static void UtcDaliNavigationLayoutColumns() -{ - ToolkitTestApplication application; - NavigationLayoutPtr navigationLayout = NavigationLayout::New(); - - navigationLayout->SetNumberOfColumns(6); - // Check whether we get the correct number of columns - DALI_TEST_CHECK(navigationLayout->GetNumberOfColumns() == 6); -} - -static void UtcDaliNavigationLayoutSetGetOrientation() -{ - ToolkitTestApplication application; - NavigationLayoutPtr navigationLayout = NavigationLayout::New(); - - navigationLayout->SetNumberOfColumns(6); - navigationLayout->SetOrientation(ControlOrientation::Right); - DALI_TEST_CHECK(navigationLayout->GetOrientation() == ControlOrientation::Right); -} - -static void UtcDaliNavigationLayoutTestConstraintLeft() -{ - 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); -} - -static void UtcDaliNavigationLayoutTestConstraintRight() -{ - 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); -} - -static void UtcDaliNavigationLayoutTestConstraintUp() -{ - 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); -} - -static void UtcDaliNavigationLayoutTestConstraintDown() -{ - 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); -} - - -static void UtcDaliNavigationLayoutScrollDirection() -{ - 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); -} - -static void UtcDaliNavigationLayoutSetGetColumnSpacing() -{ - ToolkitTestApplication application; - NavigationLayoutPtr navigationLayout = NavigationLayout::New(); - const float testValue = 11.0f; - - navigationLayout->SetNumberOfColumns(6); - navigationLayout->SetColumnSpacing(testValue); - DALI_TEST_CHECK(navigationLayout->GetColumnSpacing() == testValue); -} - -static void UtcDaliNavigationLayoutSetGetTopMargin() -{ - ToolkitTestApplication application; - NavigationLayoutPtr navigationLayout = NavigationLayout::New(); - const float testValue = 11.0f; - - navigationLayout->SetNumberOfColumns(6); - navigationLayout->SetTopMargin(testValue); - DALI_TEST_CHECK(navigationLayout->GetTopMargin() == testValue); -} - -static void UtcDaliNavigationLayoutSetGetBottomMargin() -{ - ToolkitTestApplication application; - NavigationLayoutPtr navigationLayout = NavigationLayout::New(); - const float testValue = 12.0f; - - navigationLayout->SetNumberOfColumns(6); - navigationLayout->SetBottomMargin(testValue); - DALI_TEST_CHECK(navigationLayout->GetBottomMargin() == testValue); -} - -static void UtcDaliNavigationLayoutSetGetScrollSpeedFactor() -{ - ToolkitTestApplication application; - NavigationLayoutPtr navigationLayout = NavigationLayout::New(); - const float testValue = 15.0f; - - navigationLayout->SetNumberOfColumns(6); - navigationLayout->SetScrollSpeedFactor(testValue); - DALI_TEST_CHECK(navigationLayout->GetScrollSpeedFactor() == testValue); -} - -static void UtcDaliNavigationLayoutSetGetMaximumSwipeSpeed() -{ - ToolkitTestApplication application; - NavigationLayoutPtr navigationLayout = NavigationLayout::New(); - const float testValue = 10.0f; - - navigationLayout->SetNumberOfColumns(6); - navigationLayout->SetMaximumSwipeSpeed(testValue); - DALI_TEST_CHECK(navigationLayout->GetMaximumSwipeSpeed() == testValue); -} - -static void UtcDaliNavigationLayoutSetAndGetItemFlickAnimationDuration() -{ - 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 ); -} - -static void UtcDaliNavigationLayoutGetScrollToPosition() -{ - 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); -} diff --git a/automated-tests/TET/dali-test-suite/item-view/utc-Dali-RollLayout.cpp b/automated-tests/TET/dali-test-suite/item-view/utc-Dali-RollLayout.cpp deleted file mode 100644 index ea549e8..0000000 --- a/automated-tests/TET/dali-test-suite/item-view/utc-Dali-RollLayout.cpp +++ /dev/null @@ -1,472 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#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 - -static void Startup(); -static void Cleanup(); - -// 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; - } -}; - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliRollLayoutNew(); -static void UtcDaliRollLayoutSetAndGetRowSpacing(); -static void UtcDaliRollLayoutSetAndGetItemSizeFunction(); -static void UtcDaliRollLayoutSetAndGetScrollSpeedFactor(); -static void UtcDaliRollLayoutSetAndGetMaximumSwipeSpeed(); -static void UtcDaliRollLayoutSetAndGetItemFlickAnimationDuration(); -static void UtcDaliRollLayoutConstraintLeft(); -static void UtcDaliRollLayoutConstraintRight(); -static void UtcDaliRollLayoutConstraintUp(); -static void UtcDaliRollLayoutConstraintDown(); -static void UtcDaliRollLayoutScrollDirection(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliRollLayoutNew, POSITIVE_TC_IDX }, - { UtcDaliRollLayoutSetAndGetRowSpacing, POSITIVE_TC_IDX }, - { UtcDaliRollLayoutSetAndGetItemSizeFunction, POSITIVE_TC_IDX }, - { UtcDaliRollLayoutSetAndGetScrollSpeedFactor, POSITIVE_TC_IDX }, - { UtcDaliRollLayoutSetAndGetMaximumSwipeSpeed, POSITIVE_TC_IDX }, - { UtcDaliRollLayoutSetAndGetItemFlickAnimationDuration, POSITIVE_TC_IDX }, - { UtcDaliRollLayoutConstraintLeft, POSITIVE_TC_IDX }, - { UtcDaliRollLayoutConstraintRight, POSITIVE_TC_IDX }, - { UtcDaliRollLayoutConstraintUp, POSITIVE_TC_IDX }, - { UtcDaliRollLayoutConstraintDown, POSITIVE_TC_IDX }, - { UtcDaliRollLayoutScrollDirection, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - - -static void UtcDaliRollLayoutNew() -{ - ToolkitTestApplication application; - - // Create a roll layout - RollLayoutPtr rollLayout = RollLayout::New(); - - DALI_TEST_CHECK(rollLayout); -} - -static void UtcDaliRollLayoutSetAndGetRowSpacing() -{ - 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 ); -} - -static void UtcDaliRollLayoutSetAndGetItemSizeFunction() -{ - 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); -} - -static void UtcDaliRollLayoutSetAndGetScrollSpeedFactor() -{ - 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 ); -} - -static void UtcDaliRollLayoutSetAndGetMaximumSwipeSpeed() -{ - 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 ); -} - -static void UtcDaliRollLayoutSetAndGetItemFlickAnimationDuration() -{ - 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 ); -} - -static void UtcDaliRollLayoutConstraintLeft() -{ - 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); -} - -static void UtcDaliRollLayoutConstraintRight() -{ - 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); -} - -static void UtcDaliRollLayoutConstraintUp() -{ - 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); -} - -static void UtcDaliRollLayoutConstraintDown() -{ - 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); -} - -static void UtcDaliRollLayoutScrollDirection() -{ - 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); -} diff --git a/automated-tests/TET/dali-test-suite/item-view/utc-Dali-SpiralLayout.cpp b/automated-tests/TET/dali-test-suite/item-view/utc-Dali-SpiralLayout.cpp deleted file mode 100644 index 9547a78..0000000 --- a/automated-tests/TET/dali-test-suite/item-view/utc-Dali-SpiralLayout.cpp +++ /dev/null @@ -1,607 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include // for FLT_MAX -#include - -#include -#include -#include -#include - -using namespace Dali; -using namespace Toolkit; - -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; -} -} // namespace - -static void Startup(); -static void Cleanup(); - -// 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; - } -}; - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliSpiralLayoutNew(); -static void UtcDaliSpiralSetAndGetItemSizeFunction(); -static void UtcDaliSpiralSetAndGetItemSpacing(); -static void UtcDaliSpiralSetAndGetRevolutionDistance(); -static void UtcDaliSpiralSetAndGetSpiralRadiusFunction(); -static void UtcDaliSpiralSetAndGetTopItemAlignment(); -static void UtcDaliSpiralSetAndGetScrollSpeedFactor(); -static void UtcDaliSpiralSetAndGetMaximumSwipeSpeed(); -static void UtcDaliSpiralLayoutSetAndGetItemFlickAnimationDuration(); -static void UtcDaliSpiralLayoutConstraintLeft(); -static void UtcDaliSpiralLayoutConstraintRight(); -static void UtcDaliSpiralLayoutConstraintUp(); -static void UtcDaliSpiralLayoutConstraintDown(); -static void UtcDaliSpiralLayoutGetScrollToPosition(); -static void UtcDaliSpiralLayoutScrollDirection(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliSpiralLayoutScrollDirection, POSITIVE_TC_IDX }, - { UtcDaliSpiralLayoutNew, POSITIVE_TC_IDX }, - { UtcDaliSpiralSetAndGetItemSizeFunction, POSITIVE_TC_IDX }, - { UtcDaliSpiralSetAndGetItemSpacing, POSITIVE_TC_IDX }, - { UtcDaliSpiralSetAndGetRevolutionDistance, POSITIVE_TC_IDX }, - { UtcDaliSpiralSetAndGetSpiralRadiusFunction, POSITIVE_TC_IDX }, - { UtcDaliSpiralSetAndGetTopItemAlignment, POSITIVE_TC_IDX }, - { UtcDaliSpiralSetAndGetScrollSpeedFactor, POSITIVE_TC_IDX }, - { UtcDaliSpiralSetAndGetMaximumSwipeSpeed, POSITIVE_TC_IDX }, - { UtcDaliSpiralLayoutSetAndGetItemFlickAnimationDuration, POSITIVE_TC_IDX }, - { UtcDaliSpiralLayoutConstraintLeft, POSITIVE_TC_IDX }, - { UtcDaliSpiralLayoutConstraintRight, POSITIVE_TC_IDX }, - { UtcDaliSpiralLayoutConstraintUp, POSITIVE_TC_IDX }, - { UtcDaliSpiralLayoutConstraintDown, POSITIVE_TC_IDX }, - { UtcDaliSpiralLayoutGetScrollToPosition, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliSpiralLayoutNew() -{ - ToolkitTestApplication application; - - // Create a spiral layout - SpiralLayoutPtr spiralLayout = SpiralLayout::New(); - - DALI_TEST_CHECK(spiralLayout); -} - -static void UtcDaliSpiralSetAndGetItemSizeFunction() -{ - 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); -} - -static void UtcDaliSpiralSetAndGetItemSpacing() -{ - 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 ); -} - -static void UtcDaliSpiralSetAndGetRevolutionDistance() -{ - 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 ); -} - -static void UtcDaliSpiralSetAndGetSpiralRadiusFunction() -{ - 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); -} - -static void UtcDaliSpiralSetAndGetTopItemAlignment() -{ - 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 ); -} - -static void UtcDaliSpiralSetAndGetScrollSpeedFactor() -{ - 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 ); -} - -static void UtcDaliSpiralSetAndGetMaximumSwipeSpeed() -{ - 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 ); -} - -static void UtcDaliSpiralLayoutSetAndGetItemFlickAnimationDuration() -{ - 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 ); -} - -static void UtcDaliSpiralLayoutConstraintLeft() -{ - 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); -} - -static void UtcDaliSpiralLayoutConstraintRight() -{ - 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); -} - -static void UtcDaliSpiralLayoutConstraintUp() -{ - 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); -} - -static void UtcDaliSpiralLayoutConstraintDown() -{ - 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); -} - -static void UtcDaliSpiralLayoutScrollDirection() -{ - 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); -} - -static void UtcDaliSpiralLayoutGetScrollToPosition() -{ - 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); -} diff --git a/automated-tests/TET/dali-test-suite/master-makefile.mk b/automated-tests/TET/dali-test-suite/master-makefile.mk deleted file mode 100644 index fb3d3e4..0000000 --- a/automated-tests/TET/dali-test-suite/master-makefile.mk +++ /dev/null @@ -1,53 +0,0 @@ -# -# Copyright (c) 2014 Samsung Electronics Co., Ltd. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -CC = g++ - -TARGETS = -include file.list - -PKGS = dali-core dali dali-toolkit dali-test-suite-utils -include ../../rules.mk -include ../../coverage.mk - -TOOLKIT_TEST_UTILS_DIR=../../dali-toolkit-test-utils/ - -CXXFLAGS += -I$(TOOLKIT_TEST_UTILS_DIR) - -TOOLKIT_TEST_UTILS_SRC_FILES = \ - $(TOOLKIT_TEST_UTILS_DIR)/toolkit-application.cpp \ - $(TOOLKIT_TEST_UTILS_DIR)/toolkit-adaptor.cpp \ - $(TOOLKIT_TEST_UTILS_DIR)/toolkit-clipboard-event-notifier.cpp \ - $(TOOLKIT_TEST_UTILS_DIR)/toolkit-accessibility-manager.cpp \ - $(TOOLKIT_TEST_UTILS_DIR)/toolkit-orientation.cpp \ - $(TOOLKIT_TEST_UTILS_DIR)/toolkit-physical-keyboard.cpp \ - $(TOOLKIT_TEST_UTILS_DIR)/toolkit-style-monitor.cpp \ - $(TOOLKIT_TEST_UTILS_DIR)/toolkit-timer.cpp - -all: $(TARGETS) - -%: %.cpp $(TOOLKIT_TEST_UTILS_SRC_FILES) - $(CC) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) - -clean: - @rm -f $(notdir $(TARGETS)) - @rm -f tet_captured - @rm -f *~ - @rm -f *.gcda *.gcno - -coverage: - @lcov --directory . -c -o dali.info - @lcov --remove dali.info "*boost*" "/usr/include/*" "*/automated-tests/*" -o dali.info diff --git a/automated-tests/TET/dali-test-suite/navigation-frame/.gitignore b/automated-tests/TET/dali-test-suite/navigation-frame/.gitignore deleted file mode 100644 index 00d2413..0000000 --- a/automated-tests/TET/dali-test-suite/navigation-frame/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -utc-Dali-NavigationControl -utc-Dali-Page diff --git a/automated-tests/TET/dali-test-suite/navigation-frame/Makefile b/automated-tests/TET/dali-test-suite/navigation-frame/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-test-suite/navigation-frame/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-test-suite/navigation-frame/file.list b/automated-tests/TET/dali-test-suite/navigation-frame/file.list deleted file mode 100644 index 20ceb42..0000000 --- a/automated-tests/TET/dali-test-suite/navigation-frame/file.list +++ /dev/null @@ -1,3 +0,0 @@ -TARGETS += \ - utc-Dali-NavigationControl \ - utc-Dali-Page \ diff --git a/automated-tests/TET/dali-test-suite/navigation-frame/tslist b/automated-tests/TET/dali-test-suite/navigation-frame/tslist deleted file mode 100644 index 77cb9f4..0000000 --- a/automated-tests/TET/dali-test-suite/navigation-frame/tslist +++ /dev/null @@ -1,2 +0,0 @@ -/dali-test-suite/navigation-frame/utc-Dali-NavigationControl -/dali-test-suite/navigation-frame/utc-Dali-Page diff --git a/automated-tests/TET/dali-test-suite/navigation-frame/utc-Dali-NavigationControl.cpp b/automated-tests/TET/dali-test-suite/navigation-frame/utc-Dali-NavigationControl.cpp deleted file mode 100644 index f086f05..0000000 --- a/automated-tests/TET/dali-test-suite/navigation-frame/utc-Dali-NavigationControl.cpp +++ /dev/null @@ -1,389 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include -#include - -using namespace Dali; -using namespace Dali::Toolkit; - -static void Startup(); -static void Cleanup(); - -namespace -{ - -static bool gObjectCreatedCallBackCalled; -static void TestCallback(BaseHandle handle) -{ - gObjectCreatedCallBackCalled = true; -} - -} - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliNavigationControlNew(); -static void UtcDaliNavigationControlDownCast(); -static void UtcDaliNavigationControlPushItem(); -static void UtcDaliNavigationControlPopItem(); -static void UtcDaliNavigationControlGetItemCount(); -static void UtcDaliNavigationControlGetItem(); -static void UtcDaliNavigationControlGetCurrentItem(); -static void UtcDaliNavigationControlSetBackground(); -static void UtcDaliNavigationControlCreateNavigationToolBar(); -static void UtcDaliNavigationControlCreateNavigationTitleBar(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliNavigationControlNew, POSITIVE_TC_IDX }, - { UtcDaliNavigationControlDownCast, POSITIVE_TC_IDX }, - { UtcDaliNavigationControlPushItem, POSITIVE_TC_IDX }, - { UtcDaliNavigationControlPopItem, POSITIVE_TC_IDX }, - { UtcDaliNavigationControlGetItemCount, POSITIVE_TC_IDX }, - { UtcDaliNavigationControlGetItem, POSITIVE_TC_IDX }, - { UtcDaliNavigationControlGetCurrentItem, POSITIVE_TC_IDX }, - { UtcDaliNavigationControlSetBackground, POSITIVE_TC_IDX }, - { UtcDaliNavigationControlCreateNavigationToolBar, POSITIVE_TC_IDX }, - { UtcDaliNavigationControlCreateNavigationTitleBar, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - - -static void UtcDaliNavigationControlNew() -{ - 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 ); -} - -static void UtcDaliNavigationControlDownCast() -{ - 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 ); -} - -static void UtcDaliNavigationControlPushItem() -{ - 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() ); -} - -static void UtcDaliNavigationControlPopItem() -{ - 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() ); -} - -static void UtcDaliNavigationControlGetItemCount() -{ - 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 ); -} - -static void UtcDaliNavigationControlGetItem() -{ - 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); -} - -static void UtcDaliNavigationControlGetCurrentItem() -{ - 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 ); -} - -static void UtcDaliNavigationControlSetBackground() -{ - 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); -} - -static void UtcDaliNavigationControlCreateNavigationToolBar() -{ - 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() ); - -} - -static void UtcDaliNavigationControlCreateNavigationTitleBar() -{ - 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() ); -} diff --git a/automated-tests/TET/dali-test-suite/navigation-frame/utc-Dali-Page.cpp b/automated-tests/TET/dali-test-suite/navigation-frame/utc-Dali-Page.cpp deleted file mode 100644 index 6170ad7..0000000 --- a/automated-tests/TET/dali-test-suite/navigation-frame/utc-Dali-Page.cpp +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -using namespace Dali; -using namespace Dali::Toolkit; - -static void Startup(); -static void Cleanup(); - -namespace -{ - -static bool gObjectCreatedCallBackCalled; -static void TestCallback(BaseHandle handle) -{ - gObjectCreatedCallBackCalled = true; -} - -} - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliPageNew(); -static void UtcDaliPageDownCast(); -static void UtcDaliPageSetGetTitle(); -static void UtcDaliPageSetGetSubTitle(); -static void UtcDaliPageSetGetTitleIcon(); -static void UtcDaliPageAddGetToolBarControl(); -static void UtcDaliPageAddGetTitleBarControl(); -static void UtcDaliPageSetGetPopupMenu(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliPageNew, POSITIVE_TC_IDX }, - { UtcDaliPageDownCast, POSITIVE_TC_IDX }, - { UtcDaliPageSetGetTitle, POSITIVE_TC_IDX }, - { UtcDaliPageSetGetSubTitle, POSITIVE_TC_IDX }, - { UtcDaliPageSetGetTitleIcon, POSITIVE_TC_IDX }, - { UtcDaliPageAddGetToolBarControl, POSITIVE_TC_IDX }, - { UtcDaliPageAddGetTitleBarControl, POSITIVE_TC_IDX }, - { UtcDaliPageSetGetPopupMenu, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - - -static void UtcDaliPageNew() -{ - 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 ); -} - -static void UtcDaliPageDownCast() -{ - 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 ); -} - -static void UtcDaliPageSetGetTitle() -{ - 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 ); -} - -static void UtcDaliPageSetGetSubTitle() -{ - 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 ); -} - -static void UtcDaliPageSetGetTitleIcon() -{ - 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 ); -} - -static void UtcDaliPageAddGetToolBarControl() -{ - 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 ); -} - -static void UtcDaliPageAddGetTitleBarControl() -{ - 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 ); -} - -static void UtcDaliPageSetGetPopupMenu() -{ - 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() ); -} diff --git a/automated-tests/TET/dali-test-suite/page-turn-view/.gitignore b/automated-tests/TET/dali-test-suite/page-turn-view/.gitignore deleted file mode 100644 index eb12504..0000000 --- a/automated-tests/TET/dali-test-suite/page-turn-view/.gitignore +++ /dev/null @@ -1 +0,0 @@ -utc-Dali-PageTurnView diff --git a/automated-tests/TET/dali-test-suite/page-turn-view/Makefile b/automated-tests/TET/dali-test-suite/page-turn-view/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-test-suite/page-turn-view/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-test-suite/page-turn-view/file.list b/automated-tests/TET/dali-test-suite/page-turn-view/file.list deleted file mode 100644 index dfbf699..0000000 --- a/automated-tests/TET/dali-test-suite/page-turn-view/file.list +++ /dev/null @@ -1,2 +0,0 @@ -TARGETS += \ - utc-Dali-PageTurnView \ diff --git a/automated-tests/TET/dali-test-suite/page-turn-view/tslist b/automated-tests/TET/dali-test-suite/page-turn-view/tslist deleted file mode 100644 index adceb9d..0000000 --- a/automated-tests/TET/dali-test-suite/page-turn-view/tslist +++ /dev/null @@ -1 +0,0 @@ -/dali-test-suite/page-turn-view/utc-Dali-PageTurnView diff --git a/automated-tests/TET/dali-test-suite/page-turn-view/utc-Dali-PageTurnView.cpp b/automated-tests/TET/dali-test-suite/page-turn-view/utc-Dali-PageTurnView.cpp deleted file mode 100644 index 65d4e0b..0000000 --- a/automated-tests/TET/dali-test-suite/page-turn-view/utc-Dali-PageTurnView.cpp +++ /dev/null @@ -1,665 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -#include -#include -#include -#include - -#include - -using namespace Dali; -using namespace Dali::Toolkit; - -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; -}; - - -static void UtcDaliPageTurnPortraitViewNew() -{ - 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 ); -} - -static void UtcDaliPageTurnLandscapeViewNew() -{ - 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 ); - -} - -static void UtcDaliPageTurnViewSetAndGetSpineShadowParameter() -{ - 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); -} - -static void UtcDaliPageTurnViewGoToPageAndGetCurrentPage() -{ - 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 ); -} - -static void UtcDaliPageTurnViewEnterLeaveEditMode() -{ - 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 ); -} - -static void UtcDaliPageTurnViewGetHitActor() -{ - 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 ); -} - -static void UtcDaliPageTurnViewRefresh() -{ - 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 ); -} - -static void UtcDaliPageTurnViewSignals() -{ - 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); -} diff --git a/automated-tests/TET/dali-test-suite/popup/.gitignore b/automated-tests/TET/dali-test-suite/popup/.gitignore deleted file mode 100644 index 914e48c..0000000 --- a/automated-tests/TET/dali-test-suite/popup/.gitignore +++ /dev/null @@ -1 +0,0 @@ -utc-Dali-Popup diff --git a/automated-tests/TET/dali-test-suite/popup/Makefile b/automated-tests/TET/dali-test-suite/popup/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-test-suite/popup/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-test-suite/popup/file.list b/automated-tests/TET/dali-test-suite/popup/file.list deleted file mode 100644 index 3a915c1..0000000 --- a/automated-tests/TET/dali-test-suite/popup/file.list +++ /dev/null @@ -1,2 +0,0 @@ -TARGETS += \ - utc-Dali-Popup \ diff --git a/automated-tests/TET/dali-test-suite/popup/tslist b/automated-tests/TET/dali-test-suite/popup/tslist deleted file mode 100644 index d1d8cf6..0000000 --- a/automated-tests/TET/dali-test-suite/popup/tslist +++ /dev/null @@ -1 +0,0 @@ -/dali-test-suite/popup/utc-Dali-Popup diff --git a/automated-tests/TET/dali-test-suite/popup/utc-Dali-Popup.cpp b/automated-tests/TET/dali-test-suite/popup/utc-Dali-Popup.cpp deleted file mode 100644 index 182866c..0000000 --- a/automated-tests/TET/dali-test-suite/popup/utc-Dali-Popup.cpp +++ /dev/null @@ -1,471 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include -#include - -#include - -using namespace Dali; -using namespace Toolkit; - -static void Startup(); -static void Cleanup(); - -namespace -{ -static bool gObjectCreatedCallBackCalled; - -static void TestCallback(BaseHandle handle) -{ - gObjectCreatedCallBackCalled = true; -} -} // namespace - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliPopupNew, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPopupDestructor, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPopupDownCast, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPopoupSetProperty, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPopupSetBackgroundImage, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPopupSetTitle, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPopupSetTitleText, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPopupAddButton, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPopupSetState, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPopupSetStateSlow, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPopupShowHide, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPopupShowHideTail, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPopupOnTouchedOutside, POSITIVE_TC_IDX ); - - -namespace -{ -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 ); -} - -static bool gTouchedOutside; - -static void OnPopupTouchedOutside() -{ - gTouchedOutside = true; -} - -static void UtcDaliPopupOnTouchedOutside() -{ - 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); -} diff --git a/automated-tests/TET/dali-test-suite/scroll-view/.gitignore b/automated-tests/TET/dali-test-suite/scroll-view/.gitignore deleted file mode 100644 index d0282f7..0000000 --- a/automated-tests/TET/dali-test-suite/scroll-view/.gitignore +++ /dev/null @@ -1 +0,0 @@ -utc-Dali-ScrollView diff --git a/automated-tests/TET/dali-test-suite/scroll-view/Makefile b/automated-tests/TET/dali-test-suite/scroll-view/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-test-suite/scroll-view/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-test-suite/scroll-view/file.list b/automated-tests/TET/dali-test-suite/scroll-view/file.list deleted file mode 100644 index f6ae037..0000000 --- a/automated-tests/TET/dali-test-suite/scroll-view/file.list +++ /dev/null @@ -1,3 +0,0 @@ -TARGETS += \ - utc-Dali-ScrollView \ - utc-Dali-ScrollViewEffect \ diff --git a/automated-tests/TET/dali-test-suite/scroll-view/tslist b/automated-tests/TET/dali-test-suite/scroll-view/tslist deleted file mode 100644 index 74541a9..0000000 --- a/automated-tests/TET/dali-test-suite/scroll-view/tslist +++ /dev/null @@ -1,2 +0,0 @@ -/dali-test-suite/scroll-view/utc-Dali-ScrollView -/dali-test-suite/scroll-view/utc-Dali-ScrollViewEffect diff --git a/automated-tests/TET/dali-test-suite/scroll-view/utc-Dali-ScrollView.cpp b/automated-tests/TET/dali-test-suite/scroll-view/utc-Dali-ScrollView.cpp deleted file mode 100644 index e74e80f..0000000 --- a/automated-tests/TET/dali-test-suite/scroll-view/utc-Dali-ScrollView.cpp +++ /dev/null @@ -1,1579 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include -#include -#include - -#include - -using namespace Dali; -using namespace Toolkit; - -static void Startup(); -static void Cleanup(); - -namespace -{ -static bool gObjectCreatedCallBackCalled; - -static void TestCallback(BaseHandle handle) -{ - gObjectCreatedCallBackCalled = true; -} -} // namespace - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -TEST_FUNCTION( UtcDaliScrollViewNew, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewDownCast, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewScrollToPosition, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewScrollToPage, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewScrollToActor, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewScrollToSnapPoint, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewRulerScale, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewTransformTo, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewRefreshInterval, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewWrapMode, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewActorAutoSnap, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewSignalsStartComplete, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewSignalsUpdate, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewSignalsClamped, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewSignalsSnapStart, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewScrollSensitive, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewTouchesRequired, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewAxisAutoLock, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewAxisAutoLockGradient, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewConstraints, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewBind, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewOvershoot, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewSnapAlphaFunction, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewSnapDuration, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliRulerEnableDisable, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliRulerDomainEnableDisable, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliRulerSnapAndClamp, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliRulerFixedRulerSpacing, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewUIComponent, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewSetMouseWheelScrollDistanceStep, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliScrollViewGetSet, POSITIVE_TC_IDX ); - - -namespace // unnamed 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. - -// 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) - -// Create bitmap image -BitmapImage CreateBitmapImage() -{ - BitmapImage image = BitmapImage::New(4,4,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] = 0xFF; - pixbuf[i*4+1] = 0xFF; - pixbuf[i*4+2] = 0xFF; - pixbuf[i*4+3] = 0xFF; - } - - return image; -} - -// 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 - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliScrollViewNew() -{ - 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 ); -} - -static void UtcDaliScrollViewDownCast() -{ - 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 ); -} - -static void UtcDaliScrollViewScrollToPosition() -{ - 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); -} - -static void UtcDaliScrollViewScrollToPage() -{ - 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); -} - -static void UtcDaliScrollViewScrollToActor() -{ - 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 ); -} - -static void UtcDaliScrollViewScrollToSnapPoint() -{ - 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 ); -} - -static void UtcDaliScrollViewRulerScale() -{ - 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 ); -} - -static void UtcDaliScrollViewTransformTo() -{ - 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 ); -} - -static void UtcDaliScrollViewRefreshInterval() -{ - 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); -} - -static void UtcDaliScrollViewWrapMode() -{ - 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 ); -} - -static void UtcDaliScrollViewActorAutoSnap() -{ - 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 ); -} - -static void UtcDaliScrollViewSignalsStartComplete() -{ - 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); -} - -static void UtcDaliScrollViewSignalsUpdate() -{ - 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); -} - -// 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). -static void UtcDaliScrollViewSignalsClamped() -{ - 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 ); -} - -static void UtcDaliScrollViewTouchesRequired() -{ - 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 ); -} - -static void UtcDaliScrollViewAxisAutoLock() -{ - 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()); -} - -static void UtcDaliScrollViewAxisAutoLockGradient() -{ - 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); -} - -static void UtcDaliScrollViewConstraints() -{ - 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 ); -} - -static void UtcDaliScrollViewBind() -{ - 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 ); -} - -static void UtcDaliRulerEnableDisable() -{ - 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() ); -} - -static void UtcDaliRulerDomainEnableDisable() -{ - 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 ); -} - -static void UtcDaliRulerSnapAndClamp() -{ - 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 ); -} - -static void UtcDaliRulerFixedRulerSpacing() -{ - 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 ); -} - -static void UtcDaliScrollViewOvershoot() -{ - 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) ); -} - -static void UtcDaliScrollViewSnapAlphaFunction() -{ - 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 ); -} - -static void UtcDaliScrollViewSnapDuration() -{ - 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 ); -} - -static void UtcDaliScrollViewSignalsSnapStart() -{ - 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 ); -} - -static void UtcDaliScrollViewUIComponent() -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliScrollViewUIComponent"); - - // Set up a scrollView... - ScrollView scrollView = ScrollView::New(); - DALI_TEST_CHECK( !scrollView.IsScrollComponentEnabled(Scrollable::HorizontalScrollBar) ); - DALI_TEST_CHECK( !scrollView.IsScrollComponentEnabled(Scrollable::VerticalScrollBar) ); - DALI_TEST_CHECK( scrollView.IsScrollComponentEnabled(Scrollable::OvershootIndicator) ); - - scrollView.EnableScrollComponent( Scrollable::VerticalScrollBar ); - DALI_TEST_CHECK( !scrollView.IsScrollComponentEnabled(Scrollable::HorizontalScrollBar) ); - DALI_TEST_CHECK( scrollView.IsScrollComponentEnabled(Scrollable::VerticalScrollBar) ); - DALI_TEST_CHECK( scrollView.IsScrollComponentEnabled(Scrollable::OvershootIndicator) ); - - scrollView.EnableScrollComponent( Scrollable::HorizontalScrollBar ); - DALI_TEST_CHECK( scrollView.IsScrollComponentEnabled(Scrollable::HorizontalScrollBar) ); - DALI_TEST_CHECK( scrollView.IsScrollComponentEnabled(Scrollable::VerticalScrollBar) ); - DALI_TEST_CHECK( scrollView.IsScrollComponentEnabled(Scrollable::OvershootIndicator) ); - - scrollView.EnableScrollComponent( Scrollable::OvershootIndicator ); - DALI_TEST_CHECK( scrollView.IsScrollComponentEnabled(Scrollable::HorizontalScrollBar) ); - DALI_TEST_CHECK( scrollView.IsScrollComponentEnabled(Scrollable::VerticalScrollBar) ); - DALI_TEST_CHECK( scrollView.IsScrollComponentEnabled(Scrollable::OvershootIndicator) ); - - scrollView.DisableScrollComponent( Scrollable::VerticalScrollBar ); - DALI_TEST_CHECK( scrollView.IsScrollComponentEnabled(Scrollable::HorizontalScrollBar) ); - DALI_TEST_CHECK( !scrollView.IsScrollComponentEnabled(Scrollable::VerticalScrollBar) ); - DALI_TEST_CHECK( scrollView.IsScrollComponentEnabled(Scrollable::OvershootIndicator) ); - - scrollView.DisableScrollComponent( Scrollable::HorizontalScrollBar ); - DALI_TEST_CHECK( !scrollView.IsScrollComponentEnabled(Scrollable::HorizontalScrollBar) ); - DALI_TEST_CHECK( !scrollView.IsScrollComponentEnabled(Scrollable::VerticalScrollBar) ); - DALI_TEST_CHECK( scrollView.IsScrollComponentEnabled(Scrollable::OvershootIndicator) ); - - scrollView.DisableScrollComponent( Scrollable::OvershootIndicator ); - DALI_TEST_CHECK( !scrollView.IsScrollComponentEnabled(Scrollable::HorizontalScrollBar) ); - DALI_TEST_CHECK( !scrollView.IsScrollComponentEnabled(Scrollable::VerticalScrollBar) ); - DALI_TEST_CHECK( !scrollView.IsScrollComponentEnabled(Scrollable::OvershootIndicator) ); - - // Create scroll bar - ScrollBar scrollBar = ScrollBar::New(scrollView, true); - scrollBar.Show(); - scrollBar.Hide(); - - // Check downcast - const ScrollBar scrollBarVertical = ScrollBar(scrollBar); - BaseHandle handle(scrollBarVertical); - - ScrollBar newScrollBar = ScrollBar::DownCast( handle ); - DALI_TEST_CHECK( scrollBarVertical ); - DALI_TEST_CHECK( newScrollBar == scrollBarVertical ); - - ScrollComponent scrollComponent = ScrollComponent(scrollBarVertical); - handle = scrollComponent; - - ScrollComponent newScrollComponent = ScrollComponent::DownCast( handle ); - DALI_TEST_CHECK( scrollComponent ); - DALI_TEST_CHECK( scrollComponent == scrollComponent ); -} - -static void UtcDaliScrollViewSetMouseWheelScrollDistanceStep() -{ - 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); -} - -static void UtcDaliScrollViewGetSet() -{ - 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); -} diff --git a/automated-tests/TET/dali-test-suite/scroll-view/utc-Dali-ScrollViewEffect.cpp b/automated-tests/TET/dali-test-suite/scroll-view/utc-Dali-ScrollViewEffect.cpp deleted file mode 100644 index 78af508..0000000 --- a/automated-tests/TET/dali-test-suite/scroll-view/utc-Dali-ScrollViewEffect.cpp +++ /dev/null @@ -1,935 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include -#include -#include - -#include - -using namespace Dali; -using namespace Toolkit; - -static void Startup(); -static void Cleanup(); - -namespace -{ -static bool gObjectCreatedCallBackCalled; - -static void TestCallback(BaseHandle handle) -{ - gObjectCreatedCallBackCalled = true; -} -} // namespace - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliScrollViewCustomEffectSetup(); -static void UtcDaliScrollViewCubeEffectSetup(); -static void UtcDaliScrollViewPageCubeEffectSetup(); -static void UtcDaliScrollViewSpiralEffectSetup(); -static void UtcDaliScrollViewPageCarouselEffectSetup(); -static void UtcDaliScrollViewCarouselEffectSetup(); -static void UtcDaliScrollViewDepthEffectSetup(); -static void UtcDaliScrollViewSlideEffectSetup(); -static void UtcDaliScrollViewTwistEffectSetup(); - -static void UtcDaliScrollViewCubeEffectTest(); -static void UtcDaliScrollViewPageCubeEffectTest(); -static void UtcDaliScrollViewSpiralEffectTest(); -static void UtcDaliScrollViewPageCarouselEffectTest(); -static void UtcDaliScrollViewCarouselEffectTest(); -static void UtcDaliScrollViewDepthEffectTest(); -static void UtcDaliScrollViewSlideEffectTest(); -static void UtcDaliScrollViewTwistEffectTest(); -static void UtcDaliScrollViewCustomEffectTest(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliScrollViewCustomEffectSetup, POSITIVE_TC_IDX }, - { UtcDaliScrollViewCubeEffectSetup, POSITIVE_TC_IDX }, - { UtcDaliScrollViewPageCubeEffectSetup, POSITIVE_TC_IDX }, - { UtcDaliScrollViewSpiralEffectSetup, POSITIVE_TC_IDX }, - { UtcDaliScrollViewPageCarouselEffectSetup, POSITIVE_TC_IDX }, - { UtcDaliScrollViewCarouselEffectSetup, POSITIVE_TC_IDX }, - { UtcDaliScrollViewDepthEffectSetup, POSITIVE_TC_IDX }, - { UtcDaliScrollViewSlideEffectSetup, POSITIVE_TC_IDX }, - { UtcDaliScrollViewTwistEffectSetup, POSITIVE_TC_IDX }, - { UtcDaliScrollViewCubeEffectTest, POSITIVE_TC_IDX }, - { UtcDaliScrollViewPageCubeEffectTest, POSITIVE_TC_IDX }, - { UtcDaliScrollViewSpiralEffectTest, POSITIVE_TC_IDX }, - { UtcDaliScrollViewPageCarouselEffectTest, POSITIVE_TC_IDX }, - { UtcDaliScrollViewCarouselEffectTest, POSITIVE_TC_IDX }, - { UtcDaliScrollViewDepthEffectTest, POSITIVE_TC_IDX }, - { UtcDaliScrollViewSlideEffectTest, POSITIVE_TC_IDX }, - { UtcDaliScrollViewTwistEffectTest, POSITIVE_TC_IDX }, - { UtcDaliScrollViewCustomEffectTest, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -namespace // unnamed 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 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 - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliScrollViewCustomEffectSetup() -{ - 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 ); - -} - -static void UtcDaliScrollViewCubeEffectSetup() -{ - 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 ); -} - -static void UtcDaliScrollViewPageCubeEffectSetup() -{ - 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 ); -} - -static void UtcDaliScrollViewSpiralEffectSetup() -{ - 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 ); -} - -static void UtcDaliScrollViewPageCarouselEffectSetup() -{ - 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 ); -} - -static void UtcDaliScrollViewCarouselEffectSetup() -{ - 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 ); -} - -static void UtcDaliScrollViewDepthEffectSetup() -{ - 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 ); -} - -static void UtcDaliScrollViewSlideEffectSetup() -{ - 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 ); -} - -static void UtcDaliScrollViewTwistEffectSetup() -{ - 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 ); -} - -static void UtcDaliScrollViewCubeEffectTest() -{ - 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(); -} - -static void UtcDaliScrollViewPageCubeEffectTest() -{ - 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(); -} - -static void UtcDaliScrollViewSpiralEffectTest() -{ - 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(); -} - -static void UtcDaliScrollViewPageCarouselEffectTest() -{ - 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(); -} - -static void UtcDaliScrollViewCarouselEffectTest() -{ - 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(); -} - -static void UtcDaliScrollViewDepthEffectTest() -{ - 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(); -} - -static void UtcDaliScrollViewSlideEffectTest() -{ - 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(); -} - -static void UtcDaliScrollViewTwistEffectTest() -{ - 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(); -} - -static void UtcDaliScrollViewCustomEffectTest() -{ - 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(); -} diff --git a/automated-tests/TET/dali-test-suite/selectors/.gitignore b/automated-tests/TET/dali-test-suite/selectors/.gitignore deleted file mode 100644 index 7113688..0000000 --- a/automated-tests/TET/dali-test-suite/selectors/.gitignore +++ /dev/null @@ -1 +0,0 @@ -utc-Dali-RotatingSelector diff --git a/automated-tests/TET/dali-test-suite/selectors/Makefile b/automated-tests/TET/dali-test-suite/selectors/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-test-suite/selectors/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-test-suite/selectors/file.list b/automated-tests/TET/dali-test-suite/selectors/file.list deleted file mode 100644 index 58ab7be..0000000 --- a/automated-tests/TET/dali-test-suite/selectors/file.list +++ /dev/null @@ -1,2 +0,0 @@ -TARGETS += \ - utc-Dali-RotatingSelector \ diff --git a/automated-tests/TET/dali-test-suite/selectors/tslist b/automated-tests/TET/dali-test-suite/selectors/tslist deleted file mode 100644 index 6301f5a..0000000 --- a/automated-tests/TET/dali-test-suite/selectors/tslist +++ /dev/null @@ -1 +0,0 @@ -/dali-test-suite/selectors/utc-Dali-RotatingSelector diff --git a/automated-tests/TET/dali-test-suite/selectors/utc-Dali-RotatingSelector.cpp b/automated-tests/TET/dali-test-suite/selectors/utc-Dali-RotatingSelector.cpp deleted file mode 100644 index 0bde0b0..0000000 --- a/automated-tests/TET/dali-test-suite/selectors/utc-Dali-RotatingSelector.cpp +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include -#include - -#include - -using namespace Dali; -using namespace Toolkit; - -static void Startup(); -static void Cleanup(); - -namespace -{ -static bool gObjectCreatedCallBackCalled; - -static void TestCallback(BaseHandle handle) -{ - gObjectCreatedCallBackCalled = true; -} -} // namespace - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliRotatingSelectorNew(); -static void UtcDaliRotatingSelectorSetSelected(); -static void UtcDaliRotatingSelectorSetSelectedAndUnSelectedActor(); -static void UtcDaliRotatingSelectorSetSelectable(); -static void UtcDaliRotatingSelectorSignalSelected(); - -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 ); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliRotatingSelectorNew, POSITIVE_TC_IDX }, - { UtcDaliRotatingSelectorSetSelected, POSITIVE_TC_IDX }, - { UtcDaliRotatingSelectorSetSelectedAndUnSelectedActor, POSITIVE_TC_IDX }, - { UtcDaliRotatingSelectorSetSelectable, POSITIVE_TC_IDX }, - { UtcDaliRotatingSelectorSignalSelected, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - - -static void UtcDaliRotatingSelectorNew() -{ - 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 ); -} - -// Callback test function -void OnSelectedSignal(RotatingSelector actor, bool selected) -{ - gSelectedSignalReceived = true; - gSelected = selected; -} - -static void UtcDaliRotatingSelectorSetSelected() -{ - 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() ); -} - -static void UtcDaliRotatingSelectorSetSelectedAndUnSelectedActor() -{ - 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 ); - -} - - -static void UtcDaliRotatingSelectorSetSelectable() -{ - 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() ); -} - -static void UtcDaliRotatingSelectorSignalSelected() -{ - 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 ); - -} diff --git a/automated-tests/TET/dali-test-suite/shader-effects/.gitignore b/automated-tests/TET/dali-test-suite/shader-effects/.gitignore deleted file mode 100644 index 7d83a0c..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -utc-Dali-BendyEffect -utc-Dali-DissolveEffect -utc-Dali-RippleEffect -utc-Dali-Ripple2DEffect -utc-Dali-SpotEffect -utc-Dali-SwirlEffect -utc-Dali-WaterEffect -utc-Dali-BlindEffect -utc-Dali-IrisEffect -utc-Dali-DissolveEffect -utc-Dali-DistanceFieldEffect -utc-Dali-SquareDissolveEffect -utc-Dali-CarouselEffect -utc-Dali-ShearEffect -utc-Dali-BloomView -utc-Dali-GaussianBlurView -utc-Dali-ShadowView -utc-Dali-SoftButtonEffect -utc-Dali-DisplacementEffect -utc-Dali-OverlayEffect -utc-Dali-MaskEffect -utc-Dali-NinePatchMaskEffect -utc-Dali-PageTurnEffect diff --git a/automated-tests/TET/dali-test-suite/shader-effects/Makefile b/automated-tests/TET/dali-test-suite/shader-effects/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-test-suite/shader-effects/file.list b/automated-tests/TET/dali-test-suite/shader-effects/file.list deleted file mode 100644 index b7a9acd..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/file.list +++ /dev/null @@ -1,23 +0,0 @@ -TARGETS += \ - utc-Dali-BendyEffect \ - utc-Dali-DissolveEffect \ - utc-Dali-RippleEffect \ - utc-Dali-Ripple2DEffect \ - utc-Dali-SpotEffect \ - utc-Dali-SwirlEffect \ - utc-Dali-WaterEffect \ - utc-Dali-BlindEffect \ - utc-Dali-IrisEffect \ - utc-Dali-SquareDissolveEffect \ - utc-Dali-CarouselEffect \ - utc-Dali-DistanceFieldEffect \ - utc-Dali-ShearEffect \ - utc-Dali-BloomView \ - utc-Dali-GaussianBlurView \ - utc-Dali-ShadowView \ - utc-Dali-SoftButtonEffect \ - utc-Dali-DisplacementEffect \ - utc-Dali-OverlayEffect \ - utc-Dali-MaskEffect \ - utc-Dali-NinePatchMaskEffect \ - utc-Dali-PageTurnEffect \ diff --git a/automated-tests/TET/dali-test-suite/shader-effects/tslist b/automated-tests/TET/dali-test-suite/shader-effects/tslist deleted file mode 100644 index c9268e2..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/tslist +++ /dev/null @@ -1,22 +0,0 @@ -/dali-test-suite/shader-effects/utc-Dali-BendyEffect -/dali-test-suite/shader-effects/utc-Dali-DissolveEffect -/dali-test-suite/shader-effects/utc-Dali-RippleEffect -/dali-test-suite/shader-effects/utc-Dali-Ripple2DEffect -/dali-test-suite/shader-effects/utc-Dali-SpotEffect -/dali-test-suite/shader-effects/utc-Dali-SwirlEffect -/dali-test-suite/shader-effects/utc-Dali-WaterEffect -/dali-test-suite/shader-effects/utc-Dali-BlindEffect -/dali-test-suite/shader-effects/utc-Dali-IrisEffect -/dali-test-suite/shader-effects/utc-Dali-SquareDissolveEffect -/dali-test-suite/shader-effects/utc-Dali-CarouselEffect -/dali-test-suite/shader-effects/utc-Dali-ShearEffect -/dali-test-suite/shader-effects/utc-Dali-DistanceFieldEffect -/dali-test-suite/shader-effects/utc-Dali-BloomView -/dali-test-suite/shader-effects/utc-Dali-GaussianBlurView -/dali-test-suite/shader-effects/utc-Dali-ShadowView -/dali-test-suite/shader-effects/utc-Dali-SoftButtonEffect -/dali-test-suite/shader-effects/utc-Dali-DisplacementEffect -/dali-test-suite/shader-effects/utc-Dali-OverlayEffect -/dali-test-suite/shader-effects/utc-Dali-MaskEffect -/dali-test-suite/shader-effects/utc-Dali-NinePatchMaskEffect -/dali-test-suite/shader-effects/utc-Dali-PageTurnEffect diff --git a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-BendyEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-BendyEffect.cpp deleted file mode 100644 index 6bb47f5..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-BendyEffect.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliBendyUninitializedEffect, NEGATIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliBendyPropertyNamesEffect, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliBendyDefaultValuesEffect, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliBendyCustomValuesEffect, POSITIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -// Create bitmap image -BitmapImage CreateBitmapImage() -{ - BitmapImage image = BitmapImage::New(4,4,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] = 0xFF; - pixbuf[i*4+1] = 0xFF; - pixbuf[i*4+2] = 0xFF; - pixbuf[i*4+3] = 0xFF; - } - - return image; -} - -static void UtcDaliBendyUninitializedEffect() -{ - 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); - } -} - -static void UtcDaliBendyPropertyNamesEffect() -{ - 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 ); -} - -static void UtcDaliBendyDefaultValuesEffect() -{ - 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 ) ); -} - -static void UtcDaliBendyCustomValuesEffect() -{ - 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 ) ); -} diff --git a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-BlindEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-BlindEffect.cpp deleted file mode 100644 index e6d75a3..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-BlindEffect.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliBlindEffectUninitialized(); -static void UtcDaliBlindEffectPropertyNames(); -static void UtcDaliBlindEffectDefaultValues(); -static void UtcDaliBlindEffectCustomValues(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliBlindEffectUninitialized, NEGATIVE_TC_IDX }, - { UtcDaliBlindEffectPropertyNames, POSITIVE_TC_IDX }, - { UtcDaliBlindEffectDefaultValues, POSITIVE_TC_IDX }, - { UtcDaliBlindEffectCustomValues, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -// Create bitmap image -BitmapImage CreateBitmapImage() -{ - BitmapImage image = BitmapImage::New(4,4,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] = 0xFF; - pixbuf[i*4+1] = 0xFF; - pixbuf[i*4+2] = 0xFF; - pixbuf[i*4+3] = 0xFF; - } - - return image; -} - -static void UtcDaliBlindEffectUninitialized() -{ - 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); - } -} - -static void UtcDaliBlindEffectPropertyNames() -{ - 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 ); -} - -static void UtcDaliBlindEffectDefaultValues() -{ - 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 ) ); -} - -static void UtcDaliBlindEffectCustomValues() -{ - 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 ) ); -} diff --git a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-BloomView.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-BloomView.cpp deleted file mode 100644 index 621603b..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-BloomView.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; -using namespace Dali::Toolkit; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliBloomViewUninitialized(); -static void UtcDaliBloomViewNew(); -static void UtcDaliBloomViewDownCast(); -static void UtcDaliBloomViewPropertyNames(); -static void UtcDaliBloomViewAddRemove(); -static void UtcDaliBloomActivateDeactivate(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliBloomViewUninitialized, NEGATIVE_TC_IDX }, - { UtcDaliBloomViewNew, POSITIVE_TC_IDX }, - { UtcDaliBloomViewDownCast, POSITIVE_TC_IDX }, - { UtcDaliBloomViewPropertyNames, POSITIVE_TC_IDX }, - { UtcDaliBloomViewAddRemove, POSITIVE_TC_IDX }, - { UtcDaliBloomActivateDeactivate, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -// Negative test case for a method -static void UtcDaliBloomViewUninitialized() -{ - 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); - } -} - -// Positive test case for a method -static void UtcDaliBloomViewNew() -{ - 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 ); -} - -// Positive test case for a method -static void UtcDaliBloomViewDownCast() -{ - 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 ); -} - - -// Positive test case for a method -static void UtcDaliBloomViewPropertyNames() -{ - 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 ); -} - -// Positive test case for a method -static void UtcDaliBloomViewAddRemove() -{ - 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() ); -} - -// Positive test case for a method -static void UtcDaliBloomActivateDeactivate() -{ - 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() ); -} diff --git a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-CarouselEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-CarouselEffect.cpp deleted file mode 100644 index 0cf8f80..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-CarouselEffect.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliCarouselEffectUninitialized(); -static void UtcDaliCarouselEffectPropertyNames(); -static void UtcDaliCarouselEffectDefaultValues(); -static void UtcDaliCarouselEffectCustomValues(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliCarouselEffectUninitialized, NEGATIVE_TC_IDX }, - { UtcDaliCarouselEffectPropertyNames, POSITIVE_TC_IDX }, - { UtcDaliCarouselEffectDefaultValues, POSITIVE_TC_IDX }, - { UtcDaliCarouselEffectCustomValues, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -// Create bitmap image -BitmapImage CreateBitmapImage() -{ - BitmapImage image = BitmapImage::New(4,4,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] = 0xFF; - pixbuf[i*4+1] = 0xFF; - pixbuf[i*4+2] = 0xFF; - pixbuf[i*4+3] = 0xFF; - } - - return image; -} - -static void UtcDaliCarouselEffectUninitialized() -{ - 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); - } -} - -static void UtcDaliCarouselEffectPropertyNames() -{ - 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 ); -} - -static void UtcDaliCarouselEffectDefaultValues() -{ - 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 ) ); -} - -static void UtcDaliCarouselEffectCustomValues() -{ - 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 ) ); -} diff --git a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-DisplacementEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-DisplacementEffect.cpp deleted file mode 100644 index 04909bd..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-DisplacementEffect.cpp +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; -using namespace Dali::Toolkit; - -namespace -{ -const char* TEST_IMAGE_FILE_NAME = DALI_IMAGE_DIR "gallery_image_01.jpg"; -} // namespace - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliDisplacementEffectUninitialized(); -static void UtcDaliDisplacementEffectNew(); -static void UtcDaliDisplacementEffectPropertyNames(); -static void UtcDaliDisplacementEffectTestSetProperty(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliDisplacementEffectUninitialized, NEGATIVE_TC_IDX }, - { UtcDaliDisplacementEffectNew, POSITIVE_TC_IDX }, - { UtcDaliDisplacementEffectPropertyNames, POSITIVE_TC_IDX }, - { UtcDaliDisplacementEffectTestSetProperty, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -// Negative test case for a method -static void UtcDaliDisplacementEffectUninitialized() -{ - 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); - } -} - -// Positive test case for a method -static void UtcDaliDisplacementEffectNew() -{ - 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 ); -} - -// Positive test case for a method -static void UtcDaliDisplacementEffectPropertyNames() -{ - 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 ); -} - -// Positive test case for a method -static void UtcDaliDisplacementEffectTestSetProperty() -{ - 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 ); -} diff --git a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-DissolveEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-DissolveEffect.cpp deleted file mode 100644 index bd784bc..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-DissolveEffect.cpp +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliDissolveUninitializedEffect(); -static void UtcDaliDissolvePropertyNamesEffect(); -static void UtcDaliDissolveDefaultValuesEffect(); -static void UtcDaliDissolveCustomValuesEffect(); -static void UtcDaliSetEffectImageEffect(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliDissolveUninitializedEffect, NEGATIVE_TC_IDX }, - { UtcDaliDissolvePropertyNamesEffect, POSITIVE_TC_IDX }, - { UtcDaliDissolveDefaultValuesEffect, POSITIVE_TC_IDX }, - { UtcDaliDissolveCustomValuesEffect, POSITIVE_TC_IDX }, - { UtcDaliSetEffectImageEffect, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -// Create bitmap image -BitmapImage CreateBitmapImage() -{ - BitmapImage image = BitmapImage::New(4,4,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] = 0xFF; - pixbuf[i*4+1] = 0xFF; - pixbuf[i*4+2] = 0xFF; - pixbuf[i*4+3] = 0xFF; - } - - return image; -} - -static void UtcDaliDissolveUninitializedEffect() -{ - 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); - } -} - -static void UtcDaliDissolvePropertyNamesEffect() -{ - 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 ); -} - -static void UtcDaliDissolveDefaultValuesEffect() -{ - 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 ); -} - -static void UtcDaliDissolveCustomValuesEffect() -{ - 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 ); -} - -static void UtcDaliSetEffectImageEffect() -{ - 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 ); -} diff --git a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-DistanceFieldEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-DistanceFieldEffect.cpp deleted file mode 100644 index ef44cb7..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-DistanceFieldEffect.cpp +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include -#include - -#include - -using namespace Dali; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliDistanceFieldEffectUninitialized(); -static void UtcDaliDistanceFieldEffectPropertyNames(); -static void UtcDaliDistanceFieldEffectDefaultValues(); -static void UtcDaliDistanceFieldEffectCustomValues(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliDistanceFieldEffectUninitialized, NEGATIVE_TC_IDX }, - { UtcDaliDistanceFieldEffectPropertyNames, POSITIVE_TC_IDX }, - { UtcDaliDistanceFieldEffectDefaultValues, POSITIVE_TC_IDX }, - { UtcDaliDistanceFieldEffectCustomValues, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -// 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; -} - -static void UtcDaliDistanceFieldEffectUninitialized() -{ - 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); - } -} - -static void UtcDaliDistanceFieldEffectPropertyNames() -{ - 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 ); - -} - -static void UtcDaliDistanceFieldEffectDefaultValues() -{ - 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 )); -} - -static void UtcDaliDistanceFieldEffectCustomValues() -{ - 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 ) ); -} - diff --git a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-GaussianBlurView.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-GaussianBlurView.cpp deleted file mode 100644 index deac4ff..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-GaussianBlurView.cpp +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; -using namespace Dali::Toolkit; - -namespace -{ -const char* TEST_IMAGE_FILE_NAME = DALI_IMAGE_DIR "gallery_image_01.jpg"; -} // namespace - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliGaussianBlurViewUninitialized(); -static void UtcDaliGaussianBlurViewNew(); -static void UtcDaliGaussianBlurViewDownCast(); -static void UtcDaliGaussianBlurViewPropertyNames(); -static void UtcDaliGaussianBlurViewAddRemove(); -static void UtcDaliGaussianBlurActivateDeactivate(); -static void UtcDaliGaussianBlurViewSetGetBackgroundColor(); -static void UtcDaliGaussianBlurViewSetGetRenderTarget(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliGaussianBlurViewUninitialized, NEGATIVE_TC_IDX }, - { UtcDaliGaussianBlurViewNew, POSITIVE_TC_IDX }, - { UtcDaliGaussianBlurViewDownCast, POSITIVE_TC_IDX }, - { UtcDaliGaussianBlurViewPropertyNames, POSITIVE_TC_IDX }, - { UtcDaliGaussianBlurViewAddRemove, POSITIVE_TC_IDX }, - { UtcDaliGaussianBlurActivateDeactivate, POSITIVE_TC_IDX }, - { UtcDaliGaussianBlurViewSetGetBackgroundColor, POSITIVE_TC_IDX }, - { UtcDaliGaussianBlurViewSetGetRenderTarget, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -// Negative test case for a method -static void UtcDaliGaussianBlurViewUninitialized() -{ - 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); - } -} - -// Positive test case for a method -static void UtcDaliGaussianBlurViewNew() -{ - 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 ); -} - -// Positive test case for a method -static void UtcDaliGaussianBlurViewDownCast() -{ - 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 ); -} - - -// Positive test case for a method -static void UtcDaliGaussianBlurViewPropertyNames() -{ - 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 ); -} - -// Positive test case for a method -static void UtcDaliGaussianBlurViewAddRemove() -{ - 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() ); -} - -// Positive test case for a method -static void UtcDaliGaussianBlurActivateDeactivate() -{ - 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() ); -} - -// Positive test case for a method -static void UtcDaliGaussianBlurViewSetGetBackgroundColor() -{ - 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 ); -} - -// Positive test case for a method -static void UtcDaliGaussianBlurViewSetGetRenderTarget() -{ - 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 ); -} diff --git a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-IrisEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-IrisEffect.cpp deleted file mode 100644 index b33ef9c..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-IrisEffect.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliIrisEffectUninitialized(); -static void UtcDaliIrisEffectPropertyNames(); -static void UtcDaliIrisEffectDefaultValues(); -static void UtcDaliIrisEffectCustomValues(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliIrisEffectUninitialized, NEGATIVE_TC_IDX }, - { UtcDaliIrisEffectPropertyNames, POSITIVE_TC_IDX }, - { UtcDaliIrisEffectDefaultValues, POSITIVE_TC_IDX }, - { UtcDaliIrisEffectCustomValues, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -// Create bitmap image -BitmapImage CreateBitmapImage() -{ - BitmapImage image = BitmapImage::New(4,4,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] = 0xFF; - pixbuf[i*4+1] = 0xFF; - pixbuf[i*4+2] = 0xFF; - pixbuf[i*4+3] = 0xFF; - } - - return image; -} - -static void UtcDaliIrisEffectUninitialized() -{ - 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); - } -} - -static void UtcDaliIrisEffectPropertyNames() -{ - 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 ); -} - -static void UtcDaliIrisEffectDefaultValues() -{ - 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 ) ); -} - -static void UtcDaliIrisEffectCustomValues() -{ - 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 ) ); -} diff --git a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-MaskEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-MaskEffect.cpp deleted file mode 100644 index cf7b227..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-MaskEffect.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliMaskEffectCreateEffect, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliMaskEffectDestructor, POSITIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -// Create bitmap image -static BitmapImage CreateBitmapImage() -{ - BitmapImage image = BitmapImage::New(4,4,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] = 0xFF; - pixbuf[i*4+1] = 0xFF; - pixbuf[i*4+2] = 0xFF; - pixbuf[i*4+3] = 0xFF; - } - - return image; -} - -static void UtcDaliMaskEffectCreateEffect() -{ - ToolkitTestApplication application; - - BitmapImage image = CreateBitmapImage(); - - ShaderEffect effect = Toolkit::MaskEffect::New( image ); - DALI_TEST_CHECK( effect ); -} - -static void UtcDaliMaskEffectDestructor() -{ - ToolkitTestApplication application; - - Toolkit::MaskEffect* effect = new Toolkit::MaskEffect(); - delete effect; - - DALI_TEST_CHECK( true ); -} diff --git a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-NinePatchMaskEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-NinePatchMaskEffect.cpp deleted file mode 100644 index be048fe..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-NinePatchMaskEffect.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliNinePatchMaskEffectApply, POSITIVE_TC_IDX ); - - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -// Create bitmap image -static BitmapImage CreateBitmapImage() -{ - BitmapImage image = BitmapImage::New(4,4,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] = 0xFF; - pixbuf[i*4+1] = 0xFF; - pixbuf[i*4+2] = 0xFF; - pixbuf[i*4+3] = 0xFF; - } - - return image; -} - -static void UtcDaliNinePatchMaskEffectApply() -{ - 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 ); -} - diff --git a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-OverlayEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-OverlayEffect.cpp deleted file mode 100644 index b3f8a2d..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-OverlayEffect.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; -using namespace Dali::Toolkit; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliOverlayConstructor(); -static void UtcDaliOverlayUninitializedEffect(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliOverlayConstructor, POSITIVE_TC_IDX }, - { UtcDaliOverlayUninitializedEffect, NEGATIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -// Create bitmap image -BitmapImage CreateBitmapImage() -{ - BitmapImage image = BitmapImage::New(4,4,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] = 0xFF; - pixbuf[i*4+1] = 0xFF; - pixbuf[i*4+2] = 0xFF; - pixbuf[i*4+3] = 0xFF; - } - - return image; -} - -static void UtcDaliOverlayConstructor() -{ - 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(); - -} - -static void UtcDaliOverlayUninitializedEffect() -{ - 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); - } -} diff --git a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-PageTurnEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-PageTurnEffect.cpp deleted file mode 100644 index 2299f95..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-PageTurnEffect.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliPageTurnEffectApply, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliPageTurnEffectConstruct, POSITIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -// Create bitmap image -static BitmapImage CreateBitmapImage() -{ - BitmapImage image = BitmapImage::New(4,4,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] = 0xFF; - pixbuf[i*4+1] = 0xFF; - pixbuf[i*4+2] = 0xFF; - pixbuf[i*4+3] = 0xFF; - } - - return image; -} - -static void UtcDaliPageTurnEffectApply() -{ - 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 ) ); -} - -static void UtcDaliPageTurnEffectConstruct() -{ - ToolkitTestApplication application; - - Toolkit::PageTurnEffect* effect = new Toolkit::PageTurnEffect(); - delete effect; - - DALI_TEST_CHECK( true ); -} diff --git a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-Ripple2DEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-Ripple2DEffect.cpp deleted file mode 100644 index 1addac2..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-Ripple2DEffect.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliRipple2DEffectUninitialized(); -static void UtcDaliRipple2DEffectPropertyNames(); -static void UtcDaliRipple2DEffectDefaultValues(); -static void UtcDaliRipple2DEffectCustomValues(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliRipple2DEffectUninitialized, NEGATIVE_TC_IDX }, - { UtcDaliRipple2DEffectPropertyNames, POSITIVE_TC_IDX }, - { UtcDaliRipple2DEffectDefaultValues, POSITIVE_TC_IDX }, - { UtcDaliRipple2DEffectCustomValues, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -// Create bitmap image -BitmapImage CreateBitmapImage() -{ - BitmapImage image = BitmapImage::New(4,4,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] = 0xFF; - pixbuf[i*4+1] = 0xFF; - pixbuf[i*4+2] = 0xFF; - pixbuf[i*4+3] = 0xFF; - } - - return image; -} - -static void UtcDaliRipple2DEffectUninitialized() -{ - 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); - } -} - -static void UtcDaliRipple2DEffectPropertyNames() -{ - 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 ); -} - -static void UtcDaliRipple2DEffectDefaultValues() -{ - 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 ) ); -} - -static void UtcDaliRipple2DEffectCustomValues() -{ - 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 ) ); -} diff --git a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-RippleEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-RippleEffect.cpp deleted file mode 100644 index 77cfa86..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-RippleEffect.cpp +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliRippleUninitializedEffect(); -static void UtcDaliRipplePropertyNamesEffect(); -static void UtcDaliRippleDefaultValuesEffect(); -static void UtcDaliRippleCustomValuesEffect(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliRippleUninitializedEffect, NEGATIVE_TC_IDX }, - { UtcDaliRipplePropertyNamesEffect, POSITIVE_TC_IDX }, - { UtcDaliRippleDefaultValuesEffect, POSITIVE_TC_IDX }, - { UtcDaliRippleCustomValuesEffect, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -// Create bitmap image -BitmapImage CreateBitmapImage() -{ - BitmapImage image = BitmapImage::New(4,4,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] = 0xFF; - pixbuf[i*4+1] = 0xFF; - pixbuf[i*4+2] = 0xFF; - pixbuf[i*4+3] = 0xFF; - } - - return image; -} - -static void UtcDaliRippleUninitializedEffect() -{ - 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); - } -} - -static void UtcDaliRipplePropertyNamesEffect() -{ - 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 ); - -} - -static void UtcDaliRippleDefaultValuesEffect() -{ - 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 ) ); -} - -static void UtcDaliRippleCustomValuesEffect() -{ - 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 ) ); -} diff --git a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-ShadowView.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-ShadowView.cpp deleted file mode 100644 index 8dfe4ed..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-ShadowView.cpp +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; -using namespace Dali::Toolkit; - - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliShadowViewUninitialized(); -static void UtcDaliShadowViewNew(); -static void UtcDaliShadowViewDownCast(); -static void UtcDaliShadowViewPropertyNames(); -static void UtcDaliShadowViewAddRemove(); -static void UtcDaliShadowViewActivateDeactivate(); - - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliShadowViewUninitialized, NEGATIVE_TC_IDX }, - { UtcDaliShadowViewNew, POSITIVE_TC_IDX }, - { UtcDaliShadowViewDownCast, POSITIVE_TC_IDX }, - { UtcDaliShadowViewPropertyNames, POSITIVE_TC_IDX }, - { UtcDaliShadowViewAddRemove, POSITIVE_TC_IDX }, - { UtcDaliShadowViewActivateDeactivate, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -// Negative test case for a method -static void UtcDaliShadowViewUninitialized() -{ - 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); - } -} - -// Positive test case for a method -static void UtcDaliShadowViewNew() -{ - 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 ); -} - -// Positive test case for a method -static void UtcDaliShadowViewDownCast() -{ - 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 ); -} - -// Positive test case for a method -static void UtcDaliShadowViewPropertyNames() -{ - 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 ); -} - -// Positive test case for a method -static void UtcDaliShadowViewAddRemove() -{ - 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() ); -} - -// Positive test case for a method -static void UtcDaliShadowViewActivateDeactivate() -{ - 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() ); -} diff --git a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-ShearEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-ShearEffect.cpp deleted file mode 100644 index e74817e..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-ShearEffect.cpp +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliShearEffectUninitialized(); -static void UtcDaliShearEffectPropertyNames(); -static void UtcDaliShearEffectDefaultValues(); -static void UtcDaliShearEffectCustomValues(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliShearEffectUninitialized, NEGATIVE_TC_IDX }, - { UtcDaliShearEffectPropertyNames, POSITIVE_TC_IDX }, - { UtcDaliShearEffectDefaultValues, POSITIVE_TC_IDX }, - { UtcDaliShearEffectCustomValues, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -// Create bitmap image -BitmapImage CreateBitmapImage() -{ - BitmapImage image = BitmapImage::New(4,4,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] = 0xFF; - pixbuf[i*4+1] = 0xFF; - pixbuf[i*4+2] = 0xFF; - pixbuf[i*4+3] = 0xFF; - } - - return image; -} - -static void UtcDaliShearEffectUninitialized() -{ - 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); - } -} - -static void UtcDaliShearEffectPropertyNames() -{ - 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 ); -} - -/** - * 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; -} - -static void UtcDaliShearEffectDefaultValues() -{ - 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) ) ); -} - -static void UtcDaliShearEffectCustomValues() -{ - 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) ) ); -} diff --git a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-SoftButtonEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-SoftButtonEffect.cpp deleted file mode 100644 index 8efbd2b..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-SoftButtonEffect.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; -using namespace Dali::Toolkit; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliSoftButtonEffectUninitialized(); -static void UtcDaliSoftButtonEffectNew(); -static void UtcDaliSoftButtonEffectPropertyNames(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliSoftButtonEffectUninitialized, NEGATIVE_TC_IDX }, - { UtcDaliSoftButtonEffectNew, POSITIVE_TC_IDX }, - { UtcDaliSoftButtonEffectPropertyNames, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -// Negative test case for a method -static void UtcDaliSoftButtonEffectUninitialized() -{ - 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); -} - -// Positive test case for a method -static void UtcDaliSoftButtonEffectNew() -{ - ToolkitTestApplication application; - tet_infoline("UtcDaliGaussianBlurViewNew"); - - Toolkit::SoftButtonEffect effect = Toolkit::SoftButtonEffect::New(Toolkit::SoftButtonEffect::ELLIPTICAL); - DALI_TEST_CHECK( effect ); -} - -// Positive test case for a method -static void UtcDaliSoftButtonEffectPropertyNames() -{ - 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 ); -} diff --git a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-SpotEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-SpotEffect.cpp deleted file mode 100644 index 78e419d..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-SpotEffect.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliSpotUninitializedEffect(); -static void UtcDaliSpotPropertyNamesEffect(); -static void UtcDaliSpotDefaultValuesEffect(); -static void UtcDaliSpotCustomValuesEffect(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliSpotUninitializedEffect, NEGATIVE_TC_IDX }, - { UtcDaliSpotPropertyNamesEffect, POSITIVE_TC_IDX }, - { UtcDaliSpotDefaultValuesEffect, POSITIVE_TC_IDX }, - { UtcDaliSpotCustomValuesEffect, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -// Create bitmap image -BitmapImage CreateBitmapImage() -{ - BitmapImage image = BitmapImage::New(4,4,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] = 0xFF; - pixbuf[i*4+1] = 0xFF; - pixbuf[i*4+2] = 0xFF; - pixbuf[i*4+3] = 0xFF; - } - - return image; -} - -static void UtcDaliSpotUninitializedEffect() -{ - 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); - } -} - -static void UtcDaliSpotPropertyNamesEffect() -{ - 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 ); -} - -static void UtcDaliSpotDefaultValuesEffect() -{ - 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 ) ); -} - -static void UtcDaliSpotCustomValuesEffect() -{ - 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 ) ); -} diff --git a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-SquareDissolveEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-SquareDissolveEffect.cpp deleted file mode 100644 index 4d3122d..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-SquareDissolveEffect.cpp +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliSquareDissolveEffectUninitialized(); -static void UtcDaliSquareDissolveEffectPropertyNames(); -static void UtcDaliSquareDissolveEffectDefaultValues(); -static void UtcDaliSquareDissolveEffectCustomValues(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliSquareDissolveEffectUninitialized, NEGATIVE_TC_IDX }, - { UtcDaliSquareDissolveEffectPropertyNames, POSITIVE_TC_IDX }, - { UtcDaliSquareDissolveEffectDefaultValues, POSITIVE_TC_IDX }, - { UtcDaliSquareDissolveEffectCustomValues, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -// Create bitmap image -BitmapImage CreateBitmapImage() -{ - BitmapImage image = BitmapImage::New(4,4,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] = 0xFF; - pixbuf[i*4+1] = 0xFF; - pixbuf[i*4+2] = 0xFF; - pixbuf[i*4+3] = 0xFF; - } - - return image; -} - -static void UtcDaliSquareDissolveEffectUninitialized() -{ - 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); - } -} - -static void UtcDaliSquareDissolveEffectPropertyNames() -{ - 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 ); -} - -static void UtcDaliSquareDissolveEffectDefaultValues() -{ - 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) ) ); -} - -static void UtcDaliSquareDissolveEffectCustomValues() -{ - 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) ) ); -} diff --git a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-SwirlEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-SwirlEffect.cpp deleted file mode 100644 index 542b9a9..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-SwirlEffect.cpp +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliSwirlUninitializedEffect(); -static void UtcDaliSwirlPropertyNamesEffect(); -static void UtcDaliSwirlDefaultValuesEffect(); -static void UtcDaliSwirlCustomValuesEffect(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliSwirlUninitializedEffect, NEGATIVE_TC_IDX }, - { UtcDaliSwirlPropertyNamesEffect, POSITIVE_TC_IDX }, - { UtcDaliSwirlDefaultValuesEffect, POSITIVE_TC_IDX }, - { UtcDaliSwirlCustomValuesEffect, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -// Create bitmap image -BitmapImage CreateBitmapImage() -{ - BitmapImage image = BitmapImage::New(4,4,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] = 0xFF; - pixbuf[i*4+1] = 0xFF; - pixbuf[i*4+2] = 0xFF; - pixbuf[i*4+3] = 0xFF; - } - - return image; -} - -static void UtcDaliSwirlUninitializedEffect() -{ - 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); - } -} - -static void UtcDaliSwirlPropertyNamesEffect() -{ - 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 ); -} - -static void UtcDaliSwirlDefaultValuesEffect() -{ - 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 ) ); -} - -static void UtcDaliSwirlCustomValuesEffect() -{ - 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 ) ); -} diff --git a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-WaterEffect.cpp b/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-WaterEffect.cpp deleted file mode 100644 index 1eba361..0000000 --- a/automated-tests/TET/dali-test-suite/shader-effects/utc-Dali-WaterEffect.cpp +++ /dev/null @@ -1,379 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliWaterEffectUninitialized, NEGATIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliWaterEffectPropertyNames, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliWaterEffectOutOfBounds, NEGATIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliWaterEffectDefaultValues, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliWaterEffectCustomValues, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliWaterEffectGetAmplitudePositive, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliWaterEffectGetAmplitudeNegative, NEGATIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliWaterEffectGetCenterPositive, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliWaterEffectGetCenterNegative, NEGATIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliWaterEffectGetPropagationPositive, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliWaterEffectGetPropagationNegative, NEGATIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -// Create bitmap image -BitmapImage CreateBitmapImage() -{ - BitmapImage image = BitmapImage::New(4,4,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] = 0xFF; - pixbuf[i*4+1] = 0xFF; - pixbuf[i*4+2] = 0xFF; - pixbuf[i*4+3] = 0xFF; - } - - return image; -} - -static void UtcDaliWaterEffectUninitialized() -{ - 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); - } -} - -static void UtcDaliWaterEffectPropertyNames() -{ - 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 ); -} - -static void UtcDaliWaterEffectOutOfBounds() -{ - 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 ); - } -} - -static void UtcDaliWaterEffectDefaultValues() -{ - 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 ) ); - } -} - -static void UtcDaliWaterEffectCustomValues() -{ - 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 ) ); -} - -static void UtcDaliWaterEffectGetAmplitudePositive() -{ - 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); -} - -static void UtcDaliWaterEffectGetAmplitudeNegative() -{ - 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); - } - } -} - -static void UtcDaliWaterEffectGetCenterPositive() -{ - 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); -} - -static void UtcDaliWaterEffectGetCenterNegative() -{ - 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); - } - } -} - -static void UtcDaliWaterEffectGetPropagationPositive() -{ - 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); -} - -static void UtcDaliWaterEffectGetPropagationNegative() -{ - 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); - } - } -} diff --git a/automated-tests/TET/dali-test-suite/slider/.gitignore b/automated-tests/TET/dali-test-suite/slider/.gitignore deleted file mode 100644 index 1403d3c..0000000 --- a/automated-tests/TET/dali-test-suite/slider/.gitignore +++ /dev/null @@ -1 +0,0 @@ -utc-Dali-Slider diff --git a/automated-tests/TET/dali-test-suite/slider/Makefile b/automated-tests/TET/dali-test-suite/slider/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-test-suite/slider/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-test-suite/slider/file.list b/automated-tests/TET/dali-test-suite/slider/file.list deleted file mode 100644 index a7db699..0000000 --- a/automated-tests/TET/dali-test-suite/slider/file.list +++ /dev/null @@ -1,2 +0,0 @@ -TARGETS += \ - utc-Dali-Slider \ diff --git a/automated-tests/TET/dali-test-suite/slider/tslist b/automated-tests/TET/dali-test-suite/slider/tslist deleted file mode 100644 index 976e985..0000000 --- a/automated-tests/TET/dali-test-suite/slider/tslist +++ /dev/null @@ -1 +0,0 @@ -/dali-test-suite/slider/utc-Dali-Slider diff --git a/automated-tests/TET/dali-test-suite/slider/utc-Dali-Slider.cpp b/automated-tests/TET/dali-test-suite/slider/utc-Dali-Slider.cpp deleted file mode 100644 index 9f7611c..0000000 --- a/automated-tests/TET/dali-test-suite/slider/utc-Dali-Slider.cpp +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include -#include -#include - -#include - -using namespace Dali; -using namespace Dali::Toolkit; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliSliderNew(); -static void UtcDaliSliderDestructor(); -static void UtcDaliSliderDownCast(); -static void UtcDaliSliderSignals(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliSliderNew, POSITIVE_TC_IDX }, - { UtcDaliSliderDestructor, POSITIVE_TC_IDX }, - { UtcDaliSliderDownCast, POSITIVE_TC_IDX }, - { UtcDaliSliderSignals, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static bool gObjectCreatedCallBackCalled; - -static void TestCallback(BaseHandle handle) -{ - gObjectCreatedCallBackCalled = true; -} - -static void UtcDaliSliderNew() -{ - 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 ); -} - -static void UtcDaliSliderDestructor() -{ - ToolkitTestApplication application; - - Slider* slider = new Slider(); - delete slider; - - DALI_TEST_CHECK( true ); -} - -static void UtcDaliSliderDownCast() -{ - ToolkitTestApplication application; - - Handle handle = Slider::New(); - - Slider slider = Slider::DownCast( handle ); - - DALI_TEST_CHECK( slider == handle ); -} - -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; -} - -static void UtcDaliSliderSignals() -{ - 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::MARKS_PROPERTY, marks ); - slider.SetProperty( Slider::MARK_TOLERANCE_PROPERTY, 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); -} diff --git a/automated-tests/TET/dali-test-suite/super-blur-view/.gitignore b/automated-tests/TET/dali-test-suite/super-blur-view/.gitignore deleted file mode 100644 index 7e95e96..0000000 --- a/automated-tests/TET/dali-test-suite/super-blur-view/.gitignore +++ /dev/null @@ -1 +0,0 @@ -utc-Dali-SuperBlurView diff --git a/automated-tests/TET/dali-test-suite/super-blur-view/Makefile b/automated-tests/TET/dali-test-suite/super-blur-view/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-test-suite/super-blur-view/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-test-suite/super-blur-view/file.list b/automated-tests/TET/dali-test-suite/super-blur-view/file.list deleted file mode 100644 index 7e2bf9e..0000000 --- a/automated-tests/TET/dali-test-suite/super-blur-view/file.list +++ /dev/null @@ -1,2 +0,0 @@ -TARGETS += \ - utc-Dali-SuperBlurView \ diff --git a/automated-tests/TET/dali-test-suite/super-blur-view/tslist b/automated-tests/TET/dali-test-suite/super-blur-view/tslist deleted file mode 100644 index 7095b08..0000000 --- a/automated-tests/TET/dali-test-suite/super-blur-view/tslist +++ /dev/null @@ -1 +0,0 @@ -/dali-test-suite/super-blur-view/utc-Dali-SuperBlurView diff --git a/automated-tests/TET/dali-test-suite/super-blur-view/utc-Dali-SuperBlurView.cpp b/automated-tests/TET/dali-test-suite/super-blur-view/utc-Dali-SuperBlurView.cpp deleted file mode 100644 index 6d867f3..0000000 --- a/automated-tests/TET/dali-test-suite/super-blur-view/utc-Dali-SuperBlurView.cpp +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; -using namespace Dali::Toolkit; - -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 - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliSuperBlurViewNew(); -static void UtcDaliSuperBlurViewSetImage(); -static void UtcDaliSuperBlurViewSetGetBlurStrength(); -static void UtcDaliSuperBlurViewGetBlurStrengthPropertyIndex(); -static void UtcDaliSuperBlurViewGetBlurredImage(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliSuperBlurViewNew, POSITIVE_TC_IDX }, - { UtcDaliSuperBlurViewSetImage, POSITIVE_TC_IDX }, - { UtcDaliSuperBlurViewSetGetBlurStrength, POSITIVE_TC_IDX }, - { UtcDaliSuperBlurViewGetBlurStrengthPropertyIndex, POSITIVE_TC_IDX }, - { UtcDaliSuperBlurViewGetBlurredImage, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliSuperBlurViewNew() -{ - 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 ); -} - -static void UtcDaliSuperBlurViewSetImage() -{ - 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); -} - -static void UtcDaliSuperBlurViewSetGetBlurStrength() -{ - 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 ); -} - -static void UtcDaliSuperBlurViewGetBlurStrengthPropertyIndex() -{ - 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 ); -} - -static void UtcDaliSuperBlurViewGetBlurredImage() -{ - 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 ) ); - -} diff --git a/automated-tests/TET/dali-test-suite/table-view/.gitignore b/automated-tests/TET/dali-test-suite/table-view/.gitignore deleted file mode 100644 index 98a4fb6..0000000 --- a/automated-tests/TET/dali-test-suite/table-view/.gitignore +++ /dev/null @@ -1 +0,0 @@ -utc-Dali-TableView diff --git a/automated-tests/TET/dali-test-suite/table-view/Makefile b/automated-tests/TET/dali-test-suite/table-view/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-test-suite/table-view/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-test-suite/table-view/file.list b/automated-tests/TET/dali-test-suite/table-view/file.list deleted file mode 100644 index 8ad8d0f..0000000 --- a/automated-tests/TET/dali-test-suite/table-view/file.list +++ /dev/null @@ -1,2 +0,0 @@ -TARGETS += \ - utc-Dali-TableView \ diff --git a/automated-tests/TET/dali-test-suite/table-view/tslist b/automated-tests/TET/dali-test-suite/table-view/tslist deleted file mode 100644 index 9543070..0000000 --- a/automated-tests/TET/dali-test-suite/table-view/tslist +++ /dev/null @@ -1 +0,0 @@ -/dali-test-suite/table-view/utc-Dali-TableView diff --git a/automated-tests/TET/dali-test-suite/table-view/utc-Dali-TableView.cpp b/automated-tests/TET/dali-test-suite/table-view/utc-Dali-TableView.cpp deleted file mode 100644 index d8993cc..0000000 --- a/automated-tests/TET/dali-test-suite/table-view/utc-Dali-TableView.cpp +++ /dev/null @@ -1,576 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; -using namespace Toolkit; - -static void Startup(); -static void Cleanup(); - -namespace -{ -static bool gObjectCreatedCallBackCalled; - -static void TestCallback(BaseHandle handle) -{ - gObjectCreatedCallBackCalled = true; -} -} // namespace - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void UtcDaliTableViewNew(); -static void UtcDaliTableViewMetricsPadding(); -static void UtcDaliTableViewMetricsFixed(); -static void UtcDaliTableViewMetricsRelative(); -static void UtcDaliTableViewAnimation(); -static void UtcDaliTableViewChild(); -static void UtcDaliTableViewAdd(); -static void UtcDaliTableViewCells(); -static void UtcDaliTableViewChildAssert(); -static void UtcDaliTableViewMetricsAssert(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { UtcDaliTableViewNew, POSITIVE_TC_IDX }, - { UtcDaliTableViewMetricsPadding, POSITIVE_TC_IDX }, - { UtcDaliTableViewMetricsFixed, POSITIVE_TC_IDX }, - { UtcDaliTableViewMetricsRelative, POSITIVE_TC_IDX }, - { UtcDaliTableViewAnimation, POSITIVE_TC_IDX }, - { UtcDaliTableViewChild, POSITIVE_TC_IDX }, - { UtcDaliTableViewAdd, POSITIVE_TC_IDX }, - { UtcDaliTableViewCells, POSITIVE_TC_IDX }, - { UtcDaliTableViewChildAssert, POSITIVE_TC_IDX }, - { UtcDaliTableViewMetricsAssert, POSITIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -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)); -} - -static void UtcDaliTableViewNew() -{ - 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 ); -} - -// Test adjusting the metric values for the cell. -static void UtcDaliTableViewMetricsPadding() -{ - 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 ); -} - -// Test adjusting the metric values for the cell. -static void UtcDaliTableViewMetricsFixed() -{ - 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 ); -} - -// Test adjusting the metric values for the cell. -static void UtcDaliTableViewMetricsRelative() -{ - 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 ); -} - - -// Test animation duration setting. -static void UtcDaliTableViewAnimation() -{ - 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); -} - -// Test Adding/Removing/Finding Children. -static void UtcDaliTableViewChild() -{ - 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)) ); -} - -// Test calling Add on it's own (to invoke the OnChildAdd) -static void UtcDaliTableViewAdd() -{ - 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); - } -} - -// Test cell modification. -static void UtcDaliTableViewCells() -{ - 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 ); -} - -static void UtcDaliTableViewChildAssert() -{ - 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); - } -} - -static void UtcDaliTableViewMetricsAssert() -{ - 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); - } -} diff --git a/automated-tests/TET/dali-test-suite/tc-gen.sh b/automated-tests/TET/dali-test-suite/tc-gen.sh deleted file mode 100755 index 178f24d..0000000 --- a/automated-tests/TET/dali-test-suite/tc-gen.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh - -TMPSTR=$0 -SCRIPT=${TMPSTR##*/} - -if [ $# -ne 1 ]; then - echo "Usage) $SCRIPT ClassName" - exit 1 -fi - -MODULE="Dali" -SECTION=${PWD##*/} -CLASS=$1 - -TESTSUITEPATH=`dirname $PWD` -TESTSUITENAME=${TESTSUITEPATH##*/} - -TEMPLATE=../utc-MODULE-CLASS.cpp.in -TESTCASE=utc-${MODULE}-${CLASS} - -# Create .cpp file -if [ ! -e "$TESTCASE.cpp" ]; then - sed -e ' - s^@CLASS@^'"$CLASS"'^g - s^@MODULE@^'"$MODULE"'^g - ' $TEMPLATE > $TESTCASE.cpp -fi - -if [ ! -e "$TESTCASE.cpp" ]; then - echo "Failed" - exit 1 -fi - - -# file.list -if ! [ -f file.list ]; then - touch file.list - echo "TARGETS += \\" >> file.list -fi -echo " $TESTCASE \\" >> file.list - -# tslist -if ! [ -f tslist ]; then - touch tslist -fi -echo "/$TESTSUITENAME/$SECTION/$TESTCASE" >> tslist - -# Makefile -if ! [ -f Makefile ]; then - ln -s ../master-makefile.mk Makefile -fi - -echo "$TESTCASE" >> .gitignore - -echo "Testcase file is $TESTCASE.cpp" -echo "$TESTCASE is added to tslist" -echo "$TESTCASE is added to file.list" -echo "Done" diff --git a/automated-tests/TET/dali-test-suite/text-input/.gitignore b/automated-tests/TET/dali-test-suite/text-input/.gitignore deleted file mode 100644 index 0f77dca..0000000 --- a/automated-tests/TET/dali-test-suite/text-input/.gitignore +++ /dev/null @@ -1 +0,0 @@ -utc-Dali-TextInput diff --git a/automated-tests/TET/dali-test-suite/text-input/Makefile b/automated-tests/TET/dali-test-suite/text-input/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-test-suite/text-input/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-test-suite/text-input/file.list b/automated-tests/TET/dali-test-suite/text-input/file.list deleted file mode 100644 index 3f0dba0..0000000 --- a/automated-tests/TET/dali-test-suite/text-input/file.list +++ /dev/null @@ -1,2 +0,0 @@ -TARGETS += \ - utc-Dali-TextInput \ diff --git a/automated-tests/TET/dali-test-suite/text-input/tslist b/automated-tests/TET/dali-test-suite/text-input/tslist deleted file mode 100644 index eace898..0000000 --- a/automated-tests/TET/dali-test-suite/text-input/tslist +++ /dev/null @@ -1 +0,0 @@ -/dali-test-suite/text-input/utc-Dali-TextInput diff --git a/automated-tests/TET/dali-test-suite/text-input/utc-Dali-TextInput.cpp b/automated-tests/TET/dali-test-suite/text-input/utc-Dali-TextInput.cpp deleted file mode 100644 index 74ee54a..0000000 --- a/automated-tests/TET/dali-test-suite/text-input/utc-Dali-TextInput.cpp +++ /dev/null @@ -1,984 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include - -#include - -#include - - -#include - -using namespace Dali; -using namespace Toolkit; - -static void Startup(); -static void Cleanup(); - -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; - } - } -} - -} // namespace - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} -namespace -{ -static bool gHasEndSignalBeenReceived; -static bool gHasStartSignalBeenReceived; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliTextInputConstruction, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputDownCast, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputGetText, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputGetMarkupText, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputSetMaxCharacterLength, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputSetAndGetNumberOfLines, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputGetNumberOfCharacters, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputSetAndGetPlaceholderText, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputSetInitialText, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputSetEditableAndIsEditable, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputSetEditOnTouch, POSITIVE_TC_IDX ); - -TEST_FUNCTION( UtcDaliTextInputSetTextSelectable, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputTextSelection, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputEnableGrabHandleAndIsGrabHandleEnabled, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputSetAndGetBoundingRectangle, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputSetActiveStyle, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputApplyStyleToSelectedText, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputApplyStyleToAll, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputGetStyleAtCursor, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputSetAndGetTextAlignment, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputSetAndGetMultilinePolicy, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputSetAndGetExceedEnabled, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputSetSortModifier, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputSetAndGetSnapshotModeEnabled, POSITIVE_TC_IDX ); - -TEST_FUNCTION( UtcDaliTextInputEndSignalEmit, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputStartSignalEmit, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputExceedMaxCharacters, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputSetAndGetFadeBoundary, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputSetAndGetWidthExceedPolicy, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputSetAndGetHeightExceedPolicy, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextInputScroll, POSITIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - - -// Positive test case for a method -static void UtcDaliTextInputConstruction() -{ - 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 ); -} - - -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 -static void UtcDaliTextInputDownCast() -{ - 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 -} - -// Positive test case for a method -static void UtcDaliTextInputGetText() -{ - 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 - -} - -static void UtcDaliTextInputGetMarkupText() -{ - 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); -} - -// Positive test case for a method -static void UtcDaliTextInputSetMaxCharacterLength() -{ - 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); -} - - -static void UtcDaliTextInputSetAndGetNumberOfLines() -{ - 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); -} - -static void UtcDaliTextInputGetNumberOfCharacters() -{ - 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); -} - -static void UtcDaliTextInputSetAndGetPlaceholderText() -{ - 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); -} - -// Positive test case for a method -static void UtcDaliTextInputSetInitialText() -{ - 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); -} - -static void UtcDaliTextInputSetEditableAndIsEditable() -{ - ToolkitTestApplication application; - - tet_infoline("Testing SetEditable And IsEditable"); - - const std::string initialString = "initial text"; - - TextInput textInput = TextInput::New(); // create empty TextInput - - Stage::GetCurrent().Add(textInput); - - textInput.SetInitialText( initialString ); - - application.SendNotification(); - application.Render(); - - bool editableStateFalse ( false ); - bool editableStateTrue ( true ); - - textInput.SetEditable ( editableStateFalse ); - DALI_TEST_EQUALS( editableStateFalse, textInput.IsEditable() , TEST_LOCATION); - - textInput.SetEditable ( editableStateTrue ); - DALI_TEST_EQUALS( editableStateTrue, textInput.IsEditable() , TEST_LOCATION); -} - -static void UtcDaliTextInputSetEditOnTouch() -{ - 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); -} - -static void UtcDaliTextInputSetTextSelectable() -{ - 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); -} - -static void UtcDaliTextInputTextSelection() -{ - 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); -} - - -static void UtcDaliTextInputEnableGrabHandleAndIsGrabHandleEnabled() -{ - 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); - -} - -static void UtcDaliTextInputSetAndGetBoundingRectangle() -{ - 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); -} - -static void UtcDaliTextInputSetActiveStyle() -{ - 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); -} - -static void UtcDaliTextInputApplyStyleToSelectedText() -{ - 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); -} - -static void UtcDaliTextInputApplyStyleToAll() -{ - 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); -} - -static void UtcDaliTextInputGetStyleAtCursor() -{ - 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); - - - -} - -static void UtcDaliTextInputSetAndGetTextAlignment() -{ - 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 ); -} - -static void UtcDaliTextInputSetAndGetMultilinePolicy() -{ - 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 ); - } -} - -static void UtcDaliTextInputSetAndGetExceedEnabled() -{ - 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 ); - } -} - -static void UtcDaliTextInputSetSortModifier() -{ - 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 ); -} - -static void UtcDaliTextInputSetAndGetSnapshotModeEnabled() -{ - 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); -} - -// Callback test function -void OnEndInput(TextInput textInput) -{ - gHasEndSignalBeenReceived = true; -} - -static void UtcDaliTextInputEndSignalEmit() -{ - 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); -} - - -// Callback test function -void OnStartInput(TextInput textInput) -{ - gHasStartSignalBeenReceived = true; -} - -static void UtcDaliTextInputStartSignalEmit() -{ - 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); -} - - - -static void UtcDaliTextInputExceedMaxCharacters() -{ - 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); - - 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.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 -} - - - -static void UtcDaliTextInputSetAndGetFadeBoundary() -{ - tet_infoline("UtcDaliTextViewSetAndGetFadeBoundary: "); - - ToolkitTestApplication application; - - TextView::FadeBoundary fadeBoundary( PixelSize( 0 ), PixelSize( 20 ), PixelSize( 0 ), PixelSize( 10 ) ); - - TextInput textInput = TextInput::New(); - textInput.SetInitialText( "Hello world!" ); - - 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 ); -} - -static void UtcDaliTextInputSetAndGetWidthExceedPolicy() -{ - 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 ); - } -} - -static void UtcDaliTextInputSetAndGetHeightExceedPolicy() -{ - 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 ); - } -} - -static void UtcDaliTextInputScroll() -{ - 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 ); -} diff --git a/automated-tests/TET/dali-test-suite/text-view/.gitignore b/automated-tests/TET/dali-test-suite/text-view/.gitignore deleted file mode 100644 index bd332d7..0000000 --- a/automated-tests/TET/dali-test-suite/text-view/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -utc-Dali-TextView -utc-Dali-MarkupProcessor diff --git a/automated-tests/TET/dali-test-suite/text-view/Makefile b/automated-tests/TET/dali-test-suite/text-view/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-test-suite/text-view/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-test-suite/text-view/file.list b/automated-tests/TET/dali-test-suite/text-view/file.list deleted file mode 100644 index 006e1f5..0000000 --- a/automated-tests/TET/dali-test-suite/text-view/file.list +++ /dev/null @@ -1,3 +0,0 @@ -TARGETS += \ - utc-Dali-TextView \ - utc-Dali-MarkupProcessor \ diff --git a/automated-tests/TET/dali-test-suite/text-view/tslist b/automated-tests/TET/dali-test-suite/text-view/tslist deleted file mode 100644 index b37b02d..0000000 --- a/automated-tests/TET/dali-test-suite/text-view/tslist +++ /dev/null @@ -1,2 +0,0 @@ -/dali-test-suite/text-view/utc-Dali-TextView -/dali-test-suite/text-view/utc-Dali-MarkupProcessor diff --git a/automated-tests/TET/dali-test-suite/text-view/utc-Dali-MarkupProcessor.cpp b/automated-tests/TET/dali-test-suite/text-view/utc-Dali-MarkupProcessor.cpp deleted file mode 100644 index 8e23a9f..0000000 --- a/automated-tests/TET/dali-test-suite/text-view/utc-Dali-MarkupProcessor.cpp +++ /dev/null @@ -1,419 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; - -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 - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliMarkupProcessor, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliMarkupProcessorSetTextStyle01, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliMarkupProcessorSetTextStyle02, NEGATIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliMarkupProcessorTestColors, POSITIVE_TC_IDX ); - - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - - -// Positive test case for a method -static void UtcDaliMarkupProcessor() -{ - 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 ); -} - -static void UtcDaliMarkupProcessorSetTextStyle01() -{ - 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 ); -} - -static void UtcDaliMarkupProcessorSetTextStyle02() -{ - 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 ); -} - -static void UtcDaliMarkupProcessorTestColors() -{ - 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 ); -} diff --git a/automated-tests/TET/dali-test-suite/text-view/utc-Dali-TextView.cpp b/automated-tests/TET/dali-test-suite/text-view/utc-Dali-TextView.cpp deleted file mode 100644 index 67acb5e..0000000 --- a/automated-tests/TET/dali-test-suite/text-view/utc-Dali-TextView.cpp +++ /dev/null @@ -1,853 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include - -#include - -#include -#include - -using namespace Dali; -using namespace Toolkit; - -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 - -static void Startup(); -static void Cleanup(); - -extern "C" -{ -void (*tet_startup)() = Startup; -void (*tet_cleanup)() = Cleanup; -} - -enum -{ - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliTextViewNew, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextViewSetAndGetText, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextViewSetStyleToCurrentText, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextViewSetAndGetLineHeight, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextViewSetAndGetFadeBoundary, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextViewSetAndGetEllipsizeText, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextViewSetAndGetWidthExceedPolicy, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextViewSetAndGetHeightExceedPolicy, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextViewTestLayoutOptions01, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextViewTestLayoutOptions02, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextViewInsertRemoveText, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextViewSnapshotEnable, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextViewScroll, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextViewSetProperty, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextViewSetSortModifier, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliTextViewUnderlineText, POSITIVE_TC_IDX ); - -// Called only once before first test is run. - -static void Startup() -{ -} - -// Called only once after last test is run - -static void Cleanup() -{ -} - -static void UtcDaliTextViewNew() -{ - 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 ); -} - -static void UtcDaliTextViewSetAndGetText() -{ - 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 ); -} - -static void UtcDaliTextViewSetStyleToCurrentText() -{ - 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 ); -} - -static void UtcDaliTextViewSetAndGetLineHeight() -{ - 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 ); -} - -static void UtcDaliTextViewSetAndGetFadeBoundary() -{ - 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 ); -} - -static void UtcDaliTextViewSetAndGetEllipsizeText() -{ - 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 ); - -} - -static void UtcDaliTextViewSetAndGetWidthExceedPolicy() -{ - 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 ); - } -} - -static void UtcDaliTextViewSetAndGetHeightExceedPolicy() -{ - 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 ); - } -} - -static void UtcDaliTextViewTestLayoutOptions01() -{ - 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() ); - } -} - -static void UtcDaliTextViewTestLayoutOptions02() -{ - 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. -} - -static void UtcDaliTextViewInsertRemoveText() -{ - 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 ); -} - -static void UtcDaliTextViewSnapshotEnable() -{ - 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 ); -} - -static void UtcDaliTextViewScroll() -{ - 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() ); -} - -static void UtcDaliTextViewSetProperty() -{ - 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() ); -} - -static void UtcDaliTextViewSetSortModifier() -{ - 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 ); -} - -static void UtcDaliTextViewUnderlineText() -{ - std::cout << "##############################" << std::endl; - - 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 ); - } -} diff --git a/automated-tests/TET/dali-test-suite/toolbar/.gitignore b/automated-tests/TET/dali-test-suite/toolbar/.gitignore deleted file mode 100644 index 3434380..0000000 --- a/automated-tests/TET/dali-test-suite/toolbar/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -utc-Dali-Alignment -utc-Dali-ToolBar diff --git a/automated-tests/TET/dali-test-suite/toolbar/Makefile b/automated-tests/TET/dali-test-suite/toolbar/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-test-suite/toolbar/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-test-suite/toolbar/file.list b/automated-tests/TET/dali-test-suite/toolbar/file.list deleted file mode 100644 index 3182196..0000000 --- a/automated-tests/TET/dali-test-suite/toolbar/file.list +++ /dev/null @@ -1,2 +0,0 @@ -TARGETS += \ - utc-Dali-ToolBar \ diff --git a/automated-tests/TET/dali-test-suite/toolbar/tslist b/automated-tests/TET/dali-test-suite/toolbar/tslist deleted file mode 100644 index 70926d4..0000000 --- a/automated-tests/TET/dali-test-suite/toolbar/tslist +++ /dev/null @@ -1 +0,0 @@ -/dali-test-suite/toolbar/utc-Dali-ToolBar diff --git a/automated-tests/TET/dali-test-suite/toolbar/utc-Dali-ToolBar.cpp b/automated-tests/TET/dali-test-suite/toolbar/utc-Dali-ToolBar.cpp deleted file mode 100644 index a2173e6..0000000 --- a/automated-tests/TET/dali-test-suite/toolbar/utc-Dali-ToolBar.cpp +++ /dev/null @@ -1,289 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include -#include -#include - -using namespace Dali; -using namespace Toolkit; - -static void Startup(); -static void Cleanup(); - -namespace -{ -static bool gObjectCreatedCallBackCalled; - -static void TestCallback(BaseHandle handle) -{ - gObjectCreatedCallBackCalled = true; -} -} // namespace - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliToolBarNew, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliToolBarSetBackground, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliToolBarAddControl01, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliToolBarAddControl02, NEGATIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliToolBarRemoveControl01, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliToolBarRemoveControl02, NEGATIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - - -static void UtcDaliToolBarNew() -{ - 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 ); -} - -static void UtcDaliToolBarSetBackground() -{ - 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!! -} - -static void UtcDaliToolBarAddControl01() -{ - 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); -} - -static void UtcDaliToolBarAddControl02() -{ - 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); - } -} - -static void UtcDaliToolBarRemoveControl01() -{ - 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); -} - -static void UtcDaliToolBarRemoveControl02() -{ - 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); -} diff --git a/automated-tests/TET/dali-test-suite/transition-effects/.gitignore b/automated-tests/TET/dali-test-suite/transition-effects/.gitignore deleted file mode 100644 index a0f6f7c..0000000 --- a/automated-tests/TET/dali-test-suite/transition-effects/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -utc-Dali-CubeTransitionEffect -utc-Dali-CubeTransitionWaveEffect -utc-Dali-CubeTransitionCrossEffect diff --git a/automated-tests/TET/dali-test-suite/transition-effects/Makefile b/automated-tests/TET/dali-test-suite/transition-effects/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-test-suite/transition-effects/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-test-suite/transition-effects/file.list b/automated-tests/TET/dali-test-suite/transition-effects/file.list deleted file mode 100644 index d1d503d..0000000 --- a/automated-tests/TET/dali-test-suite/transition-effects/file.list +++ /dev/null @@ -1,2 +0,0 @@ -TARGETS += \ - utc-Dali-CubeTransitionEffect \ diff --git a/automated-tests/TET/dali-test-suite/transition-effects/tslist b/automated-tests/TET/dali-test-suite/transition-effects/tslist deleted file mode 100644 index 665718d..0000000 --- a/automated-tests/TET/dali-test-suite/transition-effects/tslist +++ /dev/null @@ -1 +0,0 @@ -/dali-test-suite/transition-effects/utc-Dali-CubeTransitionEffect diff --git a/automated-tests/TET/dali-test-suite/transition-effects/utc-Dali-CubeTransitionEffect.cpp b/automated-tests/TET/dali-test-suite/transition-effects/utc-Dali-CubeTransitionEffect.cpp deleted file mode 100644 index 9eeba56..0000000 --- a/automated-tests/TET/dali-test-suite/transition-effects/utc-Dali-CubeTransitionEffect.cpp +++ /dev/null @@ -1,966 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include - -#include -#include -#include -#include - -#include - -using namespace Dali; -using namespace Dali::Toolkit; - -static void Startup(); -static void Cleanup(); - -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); - } -} - - -ImageActor CreateSolidColorImageActor( ToolkitTestApplication& application, const Vector4& color, unsigned int width, unsigned int height ) -{ - BitmapImage imageData = BitmapImage::New( width, height, Pixel::RGBA8888 ); - ImageActor imageActor = ImageActor::New( imageData ); - Stage::GetCurrent().Add( imageActor ); - - // 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 imageActor; -} - -//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 - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliCubeTransitionWaveEffectNew, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliCubeTransitionCrossEffectNew, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliCubeTransitionFoldEffectNew, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliCubeTransitionEffectSetGetTransitionDuration, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliCubeTransitionEffectSetGetCubeDisplacement, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliCubeTransitionEffectGetRoot, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliCubeTransitionEffectIsTransiting, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliCubeTransitionEffectSetCurrentImage, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliCubeTransitionEffectSetTargetImage, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliCubeTransitionWaveEffectStartTransition, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliCubeTransitionCrossEffectStartTransition, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliCubeTransitionFoldEffectStartTransition, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliCubeTransitionEffectSignalTransitionCompleted, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliCubeTransitionEffectPauseResumeTransition, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliCubeTransitionWaveEffectStopTransition, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliCubeTransitionCrossEffectStopTransition, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliCubeTransitionFoldEffectStopTransition, POSITIVE_TC_IDX ); - - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliCubeTransitionWaveEffectNew() -{ - 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 ); -} - -static void UtcDaliCubeTransitionCrossEffectNew() -{ - 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 ); -} - -static void UtcDaliCubeTransitionFoldEffectNew() -{ - 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 ); -} - -static void UtcDaliCubeTransitionEffectSetGetTransitionDuration() -{ - 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 ); -} - -static void UtcDaliCubeTransitionEffectSetGetCubeDisplacement() -{ - 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 -} - -//Test common codes in base class -static void UtcDaliCubeTransitionEffectGetRoot() -{ - 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() ); -} - -static void UtcDaliCubeTransitionEffectIsTransiting() -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliCubeTransitionEffectIsTransiting "); - - 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() ); - -} - -//Test common codes in base class -static void UtcDaliCubeTransitionEffectSetCurrentImage() -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliCubeTransitionEffectSetCurrentImage "); - - 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 ); -} - -//Test common codes in base class -static void UtcDaliCubeTransitionEffectSetTargetImage() -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliCubeTransitionEffectSetTargetImage "); - - 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 ); -} - -static void UtcDaliCubeTransitionWaveEffectStartTransition() -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliCubeTransitionWaveEffectStartTransition "); - - 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 ); -} - -static void UtcDaliCubeTransitionCrossEffectStartTransition() -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliCubeTransitionCrossEffectStartTransition "); - - 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 ); -} - -static void UtcDaliCubeTransitionFoldEffectStartTransition() -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliCubeTransitionFoldEffectStartTransition "); - - 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 ); -} - -static void UtcDaliCubeTransitionEffectSignalTransitionCompleted() -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliCubeTransitionEffectSignalTransitionCompleted "); - - 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 ); -} - -static void UtcDaliCubeTransitionEffectPauseResumeTransition() -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliCubeTransitionEffectPauseResumeTransition "); - - 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); -} - -static void UtcDaliCubeTransitionWaveEffectStopTransition() -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliCubeTransitionWaveEffectStopTransition "); - - 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 ); -} - -static void UtcDaliCubeTransitionCrossEffectStopTransition() -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliCubeTransitionCrossEffectStopTransition "); - - 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 ); -} - -static void UtcDaliCubeTransitionFoldEffectStopTransition() -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliCubeTransitionFoldEffectStopTransition "); - - 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 ); -} diff --git a/automated-tests/TET/dali-test-suite/ui-builder/.gitignore b/automated-tests/TET/dali-test-suite/ui-builder/.gitignore deleted file mode 100644 index eaf4664..0000000 --- a/automated-tests/TET/dali-test-suite/ui-builder/.gitignore +++ /dev/null @@ -1 +0,0 @@ -utc-Dali-UIBuilder diff --git a/automated-tests/TET/dali-test-suite/ui-builder/file.list b/automated-tests/TET/dali-test-suite/ui-builder/file.list deleted file mode 100644 index 868f5c9..0000000 --- a/automated-tests/TET/dali-test-suite/ui-builder/file.list +++ /dev/null @@ -1,2 +0,0 @@ -TARGETS += \ - utc-Dali-UIBuilder \ diff --git a/automated-tests/TET/dali-test-suite/utc-MODULE-CLASS.cpp.in b/automated-tests/TET/dali-test-suite/utc-MODULE-CLASS.cpp.in deleted file mode 100644 index 336c8a2..0000000 --- a/automated-tests/TET/dali-test-suite/utc-MODULE-CLASS.cpp.in +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include - -#include - -using namespace Dali; -using namespace Dali::Toolkit; - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -static void Utc@MODULE@@CLASS@Method01(); -static void Utc@MODULE@@CLASS@Method02(); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -// Add test functionality for all APIs in the class (Positive and Negative) -extern "C" { - struct tet_testlist tet_testlist[] = { - { Utc@MODULE@@CLASS@Method01, POSITIVE_TC_IDX }, - { Utc@MODULE@@CLASS@Method02, NEGATIVE_TC_IDX }, - { NULL, 0 } - }; -} - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - - -// Positive test case for a method -static void Utc@MODULE@@CLASS@Method01() -{ - ToolkitTestApplication application; - - tet_infoline("Journaled printf Output"); - tet_result(TET_FAIL); -#if 0 - tet_result(TET_PASS); -#endif -} - - -// Negative test case for a method -static void Utc@MODULE@@CLASS@Method02() -{ - ToolkitTestApplication application; // Exceptions require ToolkitTestApplication - - try - { - /* My test code and results */ - DALI_TEST_EQUALS(myVar, expectedValue, TEST_LOCATION); - } - 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_EQUALS(e.mCondition, "assert conditional", TEST_LOCATION); - } -} - diff --git a/automated-tests/TET/dali-test-suite/view/.gitignore b/automated-tests/TET/dali-test-suite/view/.gitignore deleted file mode 100644 index 4960a6d..0000000 --- a/automated-tests/TET/dali-test-suite/view/.gitignore +++ /dev/null @@ -1 +0,0 @@ -utc-Dali-View diff --git a/automated-tests/TET/dali-test-suite/view/Makefile b/automated-tests/TET/dali-test-suite/view/Makefile deleted file mode 120000 index c88d5a7..0000000 --- a/automated-tests/TET/dali-test-suite/view/Makefile +++ /dev/null @@ -1 +0,0 @@ -../master-makefile.mk \ No newline at end of file diff --git a/automated-tests/TET/dali-test-suite/view/file.list b/automated-tests/TET/dali-test-suite/view/file.list deleted file mode 100644 index 46616fb..0000000 --- a/automated-tests/TET/dali-test-suite/view/file.list +++ /dev/null @@ -1,2 +0,0 @@ -TARGETS += \ - utc-Dali-View \ diff --git a/automated-tests/TET/dali-test-suite/view/tslist b/automated-tests/TET/dali-test-suite/view/tslist deleted file mode 100644 index 5a8a0c3..0000000 --- a/automated-tests/TET/dali-test-suite/view/tslist +++ /dev/null @@ -1 +0,0 @@ -/dali-test-suite/view/utc-Dali-View diff --git a/automated-tests/TET/dali-test-suite/view/utc-Dali-View.cpp b/automated-tests/TET/dali-test-suite/view/utc-Dali-View.cpp deleted file mode 100644 index bc9c30e..0000000 --- a/automated-tests/TET/dali-test-suite/view/utc-Dali-View.cpp +++ /dev/null @@ -1,414 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include - -#include -#include -#include - -#include - -using namespace Dali; -using namespace Toolkit; - -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; -} - - -} - -static void Startup(); -static void Cleanup(); - -extern "C" { - void (*tet_startup)() = Startup; - void (*tet_cleanup)() = Cleanup; -} - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -#define MAX_NUMBER_OF_TESTS 10000 -extern "C" { - struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS]; -} - -// Add test functionality for all APIs in the class (Positive and Negative) -TEST_FUNCTION( UtcDaliViewNew, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliViewAddGetRemoveContentLayer01, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliViewAddGetRemoveContentLayer02, NEGATIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliViewSetGetBackgroundLayer01, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliViewSetGetBackgroundLayer02, NEGATIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliViewSetOrientationFunction, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcDaliViewOrientationChanged, POSITIVE_TC_IDX ); -TEST_FUNCTION( UtcSetAutoRotate, POSITIVE_TC_IDX ); - -// Called only once before first test is run. -static void Startup() -{ -} - -// Called only once after last test is run -static void Cleanup() -{ -} - -static void UtcDaliViewNew() -{ - 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 ); -} - -static void UtcDaliViewAddGetRemoveContentLayer01() -{ - 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 ); -} - -static void UtcDaliViewAddGetRemoveContentLayer02() -{ - 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); -} - -static void UtcDaliViewSetGetBackgroundLayer01() -{ - 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 ); -} - -static void UtcDaliViewSetGetBackgroundLayer02() -{ - 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 ); -} - -static void UtcDaliViewSetOrientationFunction() -{ - 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); -} - -static void UtcDaliViewOrientationChanged() -{ - 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 ); -} - -static void UtcSetAutoRotate() -{ - 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 ); -} diff --git a/automated-tests/TET/dali-toolkit-test-utils/dali-toolkit-test-suite-utils.h b/automated-tests/TET/dali-toolkit-test-utils/dali-toolkit-test-suite-utils.h deleted file mode 100644 index 4ab1a69..0000000 --- a/automated-tests/TET/dali-toolkit-test-utils/dali-toolkit-test-suite-utils.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __DALI_TOOLKIT_TEST_SUITE_UTILS_H__ -#define __DALI_TOOLKIT_TEST_SUITE_UTILS_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// INTERNAL INCLUDES -#include - -#include "toolkit-test-application.h" -#include "toolkit-application.h" - -#endif // __DALI_TOOLKIT_TEST_SUITE_UTILS_H__ diff --git a/automated-tests/TET/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp b/automated-tests/TET/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp deleted file mode 100644 index 80ac3a2..0000000 --- a/automated-tests/TET/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "toolkit-accessibility-manager.h" - -#include -#include -#include - -namespace Dali -{ - -namespace -{ -ToolkitAccessibilityManager* gToolkitAccessibilityManager(NULL); -} // unnamed namespace - -namespace Internal -{ - -namespace Adaptor -{ - -/** - * Stub for the AccessibilityManager - */ -class AccessibilityManager : public BaseObject -{ -public: // Creation & Destruction - - static Dali::AccessibilityManager Get(); - - AccessibilityManager(); - AccessibilityManager(ToolkitAccessibilityManager *accessibilityActionDetector); - ~AccessibilityManager(); - -public: - - bool IsEnabled() const; - void SetActionHandler(Dali::AccessibilityActionHandler& handler); - void SetGestureHandler(Dali::AccessibilityGestureHandler& handler); - -public: // Signals - - Dali::AccessibilityManager::AccessibilityActionSignalV2& SignalStatusChanged(); - Dali::AccessibilityManager::AccessibilityActionSignalV2& SignalActionNext(); - Dali::AccessibilityManager::AccessibilityActionSignalV2& SignalActionPrevious(); - Dali::AccessibilityManager::AccessibilityActionSignalV2& SignalActionActivate(); - Dali::AccessibilityManager::AccessibilityActionSignalV2& SignalActionRead(); - Dali::AccessibilityManager::AccessibilityActionSignalV2& SignalActionReadNext(); - Dali::AccessibilityManager::AccessibilityActionSignalV2& SignalActionReadPrevious(); - Dali::AccessibilityManager::AccessibilityActionSignalV2& SignalActionUp(); - Dali::AccessibilityManager::AccessibilityActionSignalV2& SignalActionDown(); - Dali::AccessibilityManager::AccessibilityActionSignalV2& SignalActionClearFocus(); - Dali::AccessibilityManager::AccessibilityActionSignalV2& SignalActionBack(); - Dali::AccessibilityManager::AccessibilityActionSignalV2& SignalActionControlPanelOpen(); - -private: - - ToolkitAccessibilityManager* mToolkitAccessibilityManager; - 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 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; - -}; - -Dali::AccessibilityManager AccessibilityManager::Get() -{ - return gToolkitAccessibilityManager->GetAccessibilityManager(); -} - -AccessibilityManager::AccessibilityManager() -: mToolkitAccessibilityManager(NULL), - mIsEnabled(false) -{ -} - -AccessibilityManager::AccessibilityManager(ToolkitAccessibilityManager *accessibilityActionDetector) -: mToolkitAccessibilityManager(accessibilityActionDetector), - 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::SignalStatusChanged() -{ - return mStatusChangedSignal; -} - -Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::SignalActionNext() -{ - return mActionNextSignal; -} - -Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::SignalActionPrevious() -{ - return mActionPreviousSignal; -} - -Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::SignalActionActivate() -{ - return mActionActivateSignal; -} - -Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::SignalActionRead() -{ - return mActionReadSignal; -} - -Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::SignalActionReadNext() -{ - return mActionReadNextSignal; -} - -Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::SignalActionReadPrevious() -{ - return mActionReadPreviousSignal; -} - -Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::SignalActionUp() -{ - return mActionUpSignal; -} - -Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::SignalActionDown() -{ - return mActionDownSignal; -} - -Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::SignalActionClearFocus() -{ - return mActionClearFocusSignal; -} - -Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::SignalActionBack() -{ - return mActionBackSignal; -} - -Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::SignalActionControlPanelOpen() -{ - return mActionControlPanelOpenSignal; -} - -} // namespace Adaptor - -} // namespace Internal - -//////////////////////////////////////////////////////////////////////////////////////////////////// - -ToolkitAccessibilityManager::ToolkitAccessibilityManager() -: mAccessibilityManagerStub(new Internal::Adaptor::AccessibilityManager(this)), - mAccessibilityManager( mAccessibilityManagerStub ) -{ - gToolkitAccessibilityManager = this; -} - -ToolkitAccessibilityManager::~ToolkitAccessibilityManager() -{ - gToolkitAccessibilityManager = NULL; -} - -AccessibilityManager ToolkitAccessibilityManager::GetAccessibilityManager() -{ - return mAccessibilityManager; -} - -} // namespace Dali diff --git a/automated-tests/TET/dali-toolkit-test-utils/toolkit-accessibility-manager.h b/automated-tests/TET/dali-toolkit-test-utils/toolkit-accessibility-manager.h deleted file mode 100644 index 501fe23..0000000 --- a/automated-tests/TET/dali-toolkit-test-utils/toolkit-accessibility-manager.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__ -#define __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include - -// PUBLIC INCLUDES -#include - -namespace Dali -{ - -namespace Internal -{ -namespace Adaptor -{ -class AccessibilityManager; -} -} - -/** - * This creates a stubbed AccessibilityManager so that internal Toolkit Adaptor calls work. - */ -class ToolkitAccessibilityManager -{ -public: // Construction & Destruction - - ToolkitAccessibilityManager(); - ~ToolkitAccessibilityManager(); - -public: // Getters - - AccessibilityManager GetAccessibilityManager(); - -public: // Signal Emissions - - AccessibilityManager::AccessibilityActionSignalV2& SignalStatusChanged(); - AccessibilityManager::AccessibilityActionSignalV2& SignalActionNext(); - AccessibilityManager::AccessibilityActionSignalV2& SignalActionPrevious(); - AccessibilityManager::AccessibilityActionSignalV2& SignalActionActivate(); - AccessibilityManager::AccessibilityActionSignalV2& SignalActionRead(); - AccessibilityManager::AccessibilityActionSignalV2& SignalActionReadNext(); - AccessibilityManager::AccessibilityActionSignalV2& SignalActionReadPrevious(); - AccessibilityManager::AccessibilityActionSignalV2& SignalActionUp(); - AccessibilityManager::AccessibilityActionSignalV2& SignalActionDown(); - AccessibilityManager::AccessibilityActionSignalV2& SignalActionClearFocus(); - AccessibilityManager::AccessibilityActionSignalV2& SignalActionBack(); - AccessibilityManager::AccessibilityActionSignalV2& SignalActionControlPanelOpen(); - -private: - - Internal::Adaptor::AccessibilityManager* mAccessibilityManagerStub; - friend class Internal::Adaptor::AccessibilityManager; - AccessibilityManager mAccessibilityManager; // Hold a handle ourselves. -}; - -} // namespace Dali - -#endif // __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__ diff --git a/automated-tests/TET/dali-toolkit-test-utils/toolkit-adaptor.cpp b/automated-tests/TET/dali-toolkit-test-utils/toolkit-adaptor.cpp deleted file mode 100644 index 244111e..0000000 --- a/automated-tests/TET/dali-toolkit-test-utils/toolkit-adaptor.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "toolkit-adaptor.h" - -#include -#include -#include - -namespace Dali -{ - -//////////////////////////////////////////////////////////////////////////////////////////////////// - -/** - * Stub for RenderSurface - */ -class RenderSurface -{ -}; - -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; - RenderSurface 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), - mAdaptorStub(new Adaptor(*this)) -{ - gAdaptor = mAdaptorStub; -} - -ToolkitAdaptor::~ToolkitAdaptor() -{ - delete mAdaptorStub; - gAdaptor = NULL; -} - -void ToolkitAdaptor::EmitSignalResize() -{ - mAdaptorStub->EmitSignalResize(); -} - -} // namespace Dali diff --git a/automated-tests/TET/dali-toolkit-test-utils/toolkit-adaptor.h b/automated-tests/TET/dali-toolkit-test-utils/toolkit-adaptor.h deleted file mode 100644 index 8d75373..0000000 --- a/automated-tests/TET/dali-toolkit-test-utils/toolkit-adaptor.h +++ /dev/null @@ -1,260 +0,0 @@ -#ifndef __DALI_TOOLKIT_TOOLKIT_ADAPTOR_H__ -#define __DALI_TOOLKIT_TOOLKIT_ADAPTOR_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include - -// INTERNAL INCLUDES -#include -#include - -#include "toolkit-style-monitor.h" -#include "toolkit-accessibility-manager.h" -#include "toolkit-physical-keyboard.h" -#include "toolkit-clipboard-event-notifier.h" -#include "toolkit-timer.h" - -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; - } - - ToolkitStyleMonitor& GetToolkitStyleMonitor() - { - return mStyleMonitor; - } - - ToolkitAccessibilityManager& 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 - ToolkitStyleMonitor mStyleMonitor; - - // Stub for Timer - ToolkitTimer mToolkitTimer; - - // Stub for AccessibilityManager - ToolkitAccessibilityManager mAccessibilityManager; - - // Stub for PhysicalKeyboard - ToolkitPhysicalKeyboard mPhysicalKeyboard; - - // Stub for ClipboardEventNotifier - ToolkitClipboardEventNotifier mClipboardEventNotifier; - - // The Adaptor Stub - Adaptor* mAdaptorStub; - friend class Adaptor; -}; - -} // namespace Dali - -#endif // __DALI_TOOLKIT_TOOLKIT_ADAPTOR_H__ diff --git a/automated-tests/TET/dali-toolkit-test-utils/toolkit-application.cpp b/automated-tests/TET/dali-toolkit-test-utils/toolkit-application.cpp deleted file mode 100644 index fcca008..0000000 --- a/automated-tests/TET/dali-toolkit-test-utils/toolkit-application.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "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/TET/dali-toolkit-test-utils/toolkit-application.h b/automated-tests/TET/dali-toolkit-test-utils/toolkit-application.h deleted file mode 100644 index 7178b68..0000000 --- a/automated-tests/TET/dali-toolkit-test-utils/toolkit-application.h +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef __DALI_TOOLKIT_TOOLKIT_APPLICATION_H__ -#define __DALI_TOOLKIT_TOOLKIT_APPLICATION_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -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/TET/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp b/automated-tests/TET/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp deleted file mode 100644 index e4dc0cc..0000000 --- a/automated-tests/TET/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "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/TET/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.h b/automated-tests/TET/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.h deleted file mode 100644 index c862356..0000000 --- a/automated-tests/TET/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef __DALI_TOOLKIT_CLIPBOARD_EVENT_NOTIFIER_H__ -#define __DALI_TOOLKIT_CLIPBOARD_EVENT_NOTIFIER_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// 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/TET/dali-toolkit-test-utils/toolkit-orientation.cpp b/automated-tests/TET/dali-toolkit-test-utils/toolkit-orientation.cpp deleted file mode 100644 index e7e2568..0000000 --- a/automated-tests/TET/dali-toolkit-test-utils/toolkit-orientation.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "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/TET/dali-toolkit-test-utils/toolkit-orientation.h b/automated-tests/TET/dali-toolkit-test-utils/toolkit-orientation.h deleted file mode 100644 index c5bcd7d..0000000 --- a/automated-tests/TET/dali-toolkit-test-utils/toolkit-orientation.h +++ /dev/null @@ -1,130 +0,0 @@ -#ifndef __DALI_TOOLKIT_TOOLKIT_ORIENTATION_H__ -#define __DALI_TOOLKIT_TOOLKIT_ORIENTATION_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// 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/TET/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp b/automated-tests/TET/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp deleted file mode 100644 index 29849a9..0000000 --- a/automated-tests/TET/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "toolkit-physical-keyboard.h" - -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace Adaptor -{ - -/** - * Stub for the PhysicalKeyboard - */ -class PhysicalKeyboard : public BaseObject -{ -public: // Creation & Destruction - - PhysicalKeyboard(); - PhysicalKeyboard(ToolkitPhysicalKeyboard *toolkitPhysicalKeyboard); - ~PhysicalKeyboard(); - static Dali::PhysicalKeyboard Get(); - -public: - - bool IsAttached() const; - -public: // Signals - - Dali::PhysicalKeyboard::Signal& StatusChangedSignal(); - -private: - - ToolkitPhysicalKeyboard* mToolkitPhysicalKeyboard; - Dali::PhysicalKeyboard::Signal mStatusChangedSignal; - - bool mIsAttached; -}; - -namespace -{ -PhysicalKeyboard* gPhysicalKeyboard = NULL; -} - -PhysicalKeyboard::PhysicalKeyboard() -: mToolkitPhysicalKeyboard(NULL), - mIsAttached(true) -{ -} - -PhysicalKeyboard::PhysicalKeyboard(ToolkitPhysicalKeyboard *toolkitPhysicalKeyboard) -: mToolkitPhysicalKeyboard(toolkitPhysicalKeyboard), - mIsAttached(true) -{ -} - -PhysicalKeyboard::~PhysicalKeyboard() -{ -} - -Dali::PhysicalKeyboard PhysicalKeyboard::Get() -{ - DALI_ASSERT_ALWAYS(gPhysicalKeyboard); - return Dali::PhysicalKeyboard(gPhysicalKeyboard); -} - -bool PhysicalKeyboard::IsAttached() const -{ - return mIsAttached; -} - -Dali::PhysicalKeyboard::Signal& PhysicalKeyboard::StatusChangedSignal() -{ - return mStatusChangedSignal; -} - -} // namespace Adaptor - -} // namespace Internal - -//////////////////////////////////////////////////////////////////////////////////////////////////// - -ToolkitPhysicalKeyboard::ToolkitPhysicalKeyboard() -: mPhysicalKeyboardStub(new Internal::Adaptor::PhysicalKeyboard(this)), - mPhysicalKeyboard( mPhysicalKeyboardStub ) -{ - Dali::Internal::Adaptor::gPhysicalKeyboard = mPhysicalKeyboardStub; -} - -ToolkitPhysicalKeyboard::~ToolkitPhysicalKeyboard() -{ -} - -PhysicalKeyboard ToolkitPhysicalKeyboard::GetPhysicalKeyboard() -{ - return mPhysicalKeyboard; -} - -} // namespace Dali diff --git a/automated-tests/TET/dali-toolkit-test-utils/toolkit-physical-keyboard.h b/automated-tests/TET/dali-toolkit-test-utils/toolkit-physical-keyboard.h deleted file mode 100644 index 217b83c..0000000 --- a/automated-tests/TET/dali-toolkit-test-utils/toolkit-physical-keyboard.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef __DALI_TOOLKIT_PHYSICAL_KEYBOARD_H__ -#define __DALI_TOOLKIT_PHYSICAL_KEYBOARD_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include - -// PUBLIC INCLUDES -#include - -namespace Dali -{ - -namespace Internal -{ -namespace Adaptor -{ -class PhysicalKeyboard; -} -} - -/** - * This creates a stubbed PhysicalKeyboard so that internal Toolkit Adaptor calls work. - */ -class ToolkitPhysicalKeyboard -{ -public: // Constants - -public: // Construction & Destruction - - ToolkitPhysicalKeyboard(); - ~ToolkitPhysicalKeyboard(); - -public: // Getters - - Dali::PhysicalKeyboard GetPhysicalKeyboard(); - -public: // Signal Emissions - - PhysicalKeyboard::Signal& StatusChangedSignal(); - -public: // TEST FUNCTIONS - -private: - - Internal::Adaptor::PhysicalKeyboard* mPhysicalKeyboardStub; - friend class Internal::Adaptor::PhysicalKeyboard; - PhysicalKeyboard mPhysicalKeyboard; // Hold a handle ourselves. -}; - -} // namespace Dali - -#endif // __DALI_TOOLKIT_PHYSICAL_KEYBOARD_H__ diff --git a/automated-tests/TET/dali-toolkit-test-utils/toolkit-style-monitor.cpp b/automated-tests/TET/dali-toolkit-test-utils/toolkit-style-monitor.cpp deleted file mode 100644 index ccca855..0000000 --- a/automated-tests/TET/dali-toolkit-test-utils/toolkit-style-monitor.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "toolkit-style-monitor.h" - -#include -#include -#include - -namespace Dali -{ - -namespace -{ -ToolkitStyleMonitor* gToolkitStyleMonitor(NULL); -} // unnamed namespace - -namespace Internal -{ - -namespace Adaptor -{ - -/** - * Stub for the StyleMonitor - */ -class StyleMonitor : public BaseObject -{ -public: // Creation & Destruction - - static Dali::StyleMonitor Get(); - StyleMonitor(); - StyleMonitor(ToolkitStyleMonitor *styleMonitor); - ~StyleMonitor(); - -public: // Style Information - - std::string GetDefaultFontFamily() const; - float GetDefaultFontSize() const; - -public: // Signals - - Dali::StyleMonitor::StyleChangeSignalV2& StyleChangeSignal(); - - void EmitStyleChangeSignal(StyleChange styleChange) - { - mStyleChangeSignal.Emit(Dali::StyleMonitor(this), styleChange); - } - -private: - - Dali::StyleMonitor::StyleChangeSignalV2 mStyleChangeSignal; - - ToolkitStyleMonitor* mToolkitStyleMonitor; -}; - -Dali::StyleMonitor StyleMonitor::Get() -{ - return gToolkitStyleMonitor->GetStyleMonitor(); -} - -StyleMonitor::StyleMonitor() -: mToolkitStyleMonitor(NULL) -{ -} - -StyleMonitor::StyleMonitor(ToolkitStyleMonitor *styleMonitor) -: mToolkitStyleMonitor(styleMonitor) -{ -} - -StyleMonitor::~StyleMonitor() -{ -} - -std::string StyleMonitor::GetDefaultFontFamily() const -{ - mToolkitStyleMonitor->mFunctionsCalled.GetDefaultFontFamily = true; - return ToolkitStyleMonitor::DEFAULT_FONT_FAMILY; -} - -float StyleMonitor::GetDefaultFontSize() const -{ - mToolkitStyleMonitor->mFunctionsCalled.GetDefaultFontSize = true; - return ToolkitStyleMonitor::DEFAULT_FONT_SIZE; -} - -Dali::StyleMonitor::StyleChangeSignalV2& StyleMonitor::StyleChangeSignal() -{ - mToolkitStyleMonitor->mFunctionsCalled.SignalStyleChange = true; - return mStyleChangeSignal; -} - -} // namespace Adaptor - -} // namespace Internal - -//////////////////////////////////////////////////////////////////////////////////////////////////// - -const std::string ToolkitStyleMonitor::DEFAULT_FONT_FAMILY("DefaultFont"); -const float ToolkitStyleMonitor::DEFAULT_FONT_SIZE(1.0f); - -ToolkitStyleMonitor::ToolkitStyleMonitor() -: mStyleMonitorStub(new Internal::Adaptor::StyleMonitor(this)), - mStyleMonitor( mStyleMonitorStub ) -{ - gToolkitStyleMonitor = this; -} - -ToolkitStyleMonitor::~ToolkitStyleMonitor() -{ - gToolkitStyleMonitor = NULL; -} - -StyleMonitor ToolkitStyleMonitor::GetStyleMonitor() -{ - return mStyleMonitor; -} - -void ToolkitStyleMonitor::EmitSignalStyleChange(StyleChange styleChange) -{ - mStyleMonitorStub->EmitStyleChangeSignal(styleChange); -} - -} // namespace Dali diff --git a/automated-tests/TET/dali-toolkit-test-utils/toolkit-style-monitor.h b/automated-tests/TET/dali-toolkit-test-utils/toolkit-style-monitor.h deleted file mode 100644 index 40e0428..0000000 --- a/automated-tests/TET/dali-toolkit-test-utils/toolkit-style-monitor.h +++ /dev/null @@ -1,131 +0,0 @@ -#ifndef __DALI_TOOLKIT_TOOLKIT_STYLE_MONITOR_H__ -#define __DALI_TOOLKIT_TOOLKIT_STYLE_MONITOR_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -namespace Internal -{ -namespace Adaptor -{ -class StyleMonitor; -} -} - -/** - * This creates a stubbed StyleMonitor so that internal Toolkit Adaptor calls work. - * Furthermore, it provides an interface to see if certain methods were invoked. - */ -class ToolkitStyleMonitor -{ -public: // Constants - - static const std::string DEFAULT_FONT_FAMILY; - static const float DEFAULT_FONT_SIZE; - -public: // Construction & Destruction - - ToolkitStyleMonitor(); - ~ToolkitStyleMonitor(); - -public: // Getters - - StyleMonitor GetStyleMonitor(); - -public: // Signal Emissions - - void EmitSignalStyleChange(StyleChange styleChange); - -public: // TEST FUNCTIONS - - // Enumeration of Adaptor methods - enum TestFuncEnum - { - GetDefaultFontFamilyType, - GetDefaultFontSizeType, - SignalStyleChangeType, - }; - - void Reset() - { - mFunctionsCalled.Reset(); - } - - bool WasCalled(TestFuncEnum func) - { - switch(func) - { - case GetDefaultFontFamilyType: return mFunctionsCalled.GetDefaultFontFamily; - case GetDefaultFontSizeType: return mFunctionsCalled.GetDefaultFontSize; - case SignalStyleChangeType: return mFunctionsCalled.SignalStyleChange; - } - return false; - } - - void ResetCallStatistics(TestFuncEnum func) - { - switch(func) - { - case GetDefaultFontFamilyType: mFunctionsCalled.GetDefaultFontFamily = false; break; - case GetDefaultFontSizeType: mFunctionsCalled.GetDefaultFontSize = false; break; - case SignalStyleChangeType: mFunctionsCalled.SignalStyleChange = false; break; - } - } - -private: - - struct TestFunctions - { - TestFunctions() - : GetDefaultFontFamily(false), - GetDefaultFontSize(false), - SignalStyleChange(false) - { - } - - void Reset() - { - GetDefaultFontFamily = false; - GetDefaultFontSize = false; - SignalStyleChange = false; - } - - bool GetDefaultFontFamily; - bool GetDefaultFontSize; - bool SignalStyleChange; - }; - - TestFunctions mFunctionsCalled; - - // The StyleMonitor stub - Internal::Adaptor::StyleMonitor* mStyleMonitorStub; - friend class Internal::Adaptor::StyleMonitor; - StyleMonitor mStyleMonitor; // Hold a handle ourselves. -}; - -} // namespace Dali - -#endif // __DALI_TOOLKIT_TOOLKIT_STYLE_MONITOR_H__ diff --git a/automated-tests/TET/dali-toolkit-test-utils/toolkit-test-application.h b/automated-tests/TET/dali-toolkit-test-utils/toolkit-test-application.h deleted file mode 100644 index d664bd8..0000000 --- a/automated-tests/TET/dali-toolkit-test-utils/toolkit-test-application.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef __DALI_TOOLKIT_TEST_APPLICATION_H__ -#define __DALI_TOOLKIT_TEST_APPLICATION_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// 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; - } - - ToolkitAdaptor& GetAdaptor() - { - return mAdaptor; - } - - ToolkitOrientation& GetOrientation() - { - return mOrientation; - } - -private: - ToolkitAdaptor mAdaptor; - ToolkitOrientation mOrientation; -}; - -} // namespace Dali - -#endif // __DALI_TOOLKIT_TEST_APPLICATION_H__ diff --git a/automated-tests/TET/dali-toolkit-test-utils/toolkit-timer.cpp b/automated-tests/TET/dali-toolkit-test-utils/toolkit-timer.cpp deleted file mode 100644 index 20107b9..0000000 --- a/automated-tests/TET/dali-toolkit-test-utils/toolkit-timer.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "toolkit-timer.h" -// INTERNAL INCLUDES - -#include -#include -#include - -namespace Dali -{ - -namespace -{ - -Timer gTimer; - -/* - * This is a global signal that all users of this stub will connect to. - * If we were to use a timer stub with real ticks we may wish to have this as a member variable created with each New Timer. - * Currently unable to get the boost singal connect to work with the stub timer when using a member hence this global. - */ -Dali::Timer::TimerSignalV2 gTimerTick; -} - -/** - * Stub for the Timer - */ - -Timer Timer::New( unsigned int milliSec ) -{ - DALI_ASSERT_ALWAYS( gTimer ); - - return gTimer; -} - -Timer::TimerSignalV2& Timer::TickSignal() -{ - return gTimerTick; -} - -bool Timer::IsRunning() const -{ - return true; -} - -Timer::Timer( const Timer& timer ) -: BaseHandle(timer) -{ -} - -Timer::~Timer() -{ -} - - -void Timer::Start() -{ -} - -void Timer::Stop() -{ -} - -namespace Internal -{ - -namespace Adaptor -{ - -/** - * Stub for the Internal Timer - */ -class Timer : public BaseObject -{ -public: // Creation & Destruction - - Timer(); - Timer(ToolkitTimer *timer); - ~Timer(); - - void Start(); - - void Stop(); - - bool IsRunning() const; - -public: // Signals - -private: - - ToolkitTimer* mToolkitTimer; - bool mRunning; -}; - -Timer::Timer() -: mToolkitTimer(NULL), - mRunning( true ) -{ -} - -Timer::Timer(ToolkitTimer *timer) -: mToolkitTimer(timer), - mRunning( true ) -{ -} - -Timer::~Timer() -{ -} - -void Timer::Start() -{ - DALI_ASSERT_ALWAYS( gTimer ); -} - -void Timer::Stop() -{ - DALI_ASSERT_ALWAYS( gTimer ); -} - -bool Timer::IsRunning() const -{ - DALI_ASSERT_ALWAYS( gTimer ); - return mRunning; -} - -} // namespace Adaptor - -} // namespace Internal - -//////////////////////////////////////////////////////////////////////////////////////////////////// - -ToolkitTimer::ToolkitTimer() -: mTimerStub(new Internal::Adaptor::Timer(this)), - mTimer( mTimerStub ) -{ - if ( mTimer ) - { - gTimer = mTimer; - } -} - -ToolkitTimer::~ToolkitTimer() -{ - gTimer.Reset(); -} - -Timer ToolkitTimer::GetTimer() -{ - return mTimer; -} - -} // namespace Dali diff --git a/automated-tests/TET/dali-toolkit-test-utils/toolkit-timer.h b/automated-tests/TET/dali-toolkit-test-utils/toolkit-timer.h deleted file mode 100644 index d7bdf2e..0000000 --- a/automated-tests/TET/dali-toolkit-test-utils/toolkit-timer.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef __DALI_TOOLKIT_TOOLKIT_TIMER_H__ -#define __DALI_TOOLKIT_TOOLKIT_TIMER_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include - -// PUBLIC INCLUDES -#include - -namespace Dali -{ - -namespace Internal -{ -namespace Adaptor -{ -class Timer; - -} -} - -/** - * This creates a stubbed Timer so that internal Toolkit Adaptor calls work. - */ -class ToolkitTimer -{ -public: // Constants - -public: // Construction & Destruction - - ToolkitTimer(); - ~ToolkitTimer(); - -public: - - Timer GetTimer(); - -public: // Signal Emissions - - Dali::Timer::TimerSignalV2& TickSignal(); - -public: // TEST FUNCTIONS - -private: - - Internal::Adaptor::Timer* mTimerStub; - friend class Internal::Adaptor::Timer; - Timer mTimer; // Hold a handle ourselves. -}; - -} // namespace Dali - -#endif // __DALI_TOOLKIT_TOOLKIT_TIMER_H__ diff --git a/automated-tests/TET/debug.sh b/automated-tests/TET/debug.sh deleted file mode 100755 index c01d55a..0000000 --- a/automated-tests/TET/debug.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/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 - -tmp_script=/tmp/tetexec$$ - -cat > $tmp_script <&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 - -tmp_script=/tmp/tetexec$$ - -cat > $tmp_script <&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/TET/execute_target.sh b/automated-tests/TET/execute_target.sh deleted file mode 100755 index 7aaed5f..0000000 --- a/automated-tests/TET/execute_target.sh +++ /dev/null @@ -1,39 +0,0 @@ -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_target_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 -grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/automated-tests/TET/rules.mk.in b/automated-tests/TET/rules.mk.in deleted file mode 100644 index c0df185..0000000 --- a/automated-tests/TET/rules.mk.in +++ /dev/null @@ -1,11 +0,0 @@ -LDFLAGS = `pkg-config --libs $(PKGS)` -LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o -LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s -LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s - -CXXFLAGS = -I. -I../../.. `pkg-config --cflags $(PKGS)` -CXXFLAGS += -I$(TET_ROOT)/inc/tet3 -CXXFLAGS += -Wall -g -O0 -Wno-write-strings -CXXFLAGS += -DDALI_IMAGE_DIR=\"$(DALI_IMAGE_DIR)\" -CXXFLAGS += -DDALI_STYLE_DIR=\"$(DALI_STYLE_DIR)\" -CXXFLAGS += @DALI_TOOLKIT_CFLAGS@ diff --git a/automated-tests/TET/tbp.pl b/automated-tests/TET/tbp.pl deleted file mode 100755 index f69a4d3..0000000 --- a/automated-tests/TET/tbp.pl +++ /dev/null @@ -1,339 +0,0 @@ -#!/usr/bin/perl - -use strict; - -my $num; -my $scen; -my $ref; -my $part; -my $timestamp; -my $testcase; -my $built=0; -my $build_failed=0; -my $build_count=0; -my $build_failure_count=0; -my $ic=0; -my $ic2=0; -my $x=0; -my $tc=0; -my $v; -my $test; -my $time; -my $date; -my %build_tests; -my %build_summary; - -my $executed_testcases=0; -my $execute_no_file=0; -my $executed=0; -my %execute; -my %execute_summary; - -sub parse_file -{ - while(<>) - { - ($num, $scen, $ref) = split(m!\|!, $_); - chomp $ref; - - if($num == 0) - { - ($v, $time, $date) = split(/\s/, $scen); - } -# Execution - elsif($num == 10) # 10|0 /dali-test-suite/actors/utc-Dali-Actor 16:58:27|TC Start, scenario ref 2-0 - { - ($part, $testcase, $timestamp) = split(/\s/, $scen); - $executed_testcases++; - } - elsif($num == 50) # 50||(exec.c, 131): can't exec /home/SERILOCAL/david.steele/Git/HQ-Dali/dali-core/automated-tests/./tet_tmp_dir/24242aa/dali-test-suite/geometry/utc-Dali-MeshData, reply code = ER_NOENT - { - $execute_no_file++; - } - elsif($num == 80) # 80|19 0 16:58:47|TC End, scenario ref 21-0 - { - } - elsif($num == 400) #400|13 1 142 16:58:40|IC Start - { - ($test, $ic, $x, $timestamp) = split(/\s/, $scen); - } - elsif($num == 410) #410|19 1 9 16:58:46|IC End - { - } - elsif($num == 200) #200|13 1 16:58:40|TP Start - { - $execute_summary{"Total"}++; - } - elsif($num == 220) - { - ($test, $tc, $ic2, $timestamp) = split(/\s/, $scen); - $execute{$testcase}->{$ic}->{$tc} = $ref; - $execute_summary{$ref}++; - $executed++; - } - -# Build - elsif($num == 110) # Build - { - ($part, $testcase, $timestamp) = split(/\s/, $scen); - $build_failed=0; - $build_count++; - $build_summary{"Total"}++; - } - - elsif($num == 100) - { - if( ( $ref =~ /utc-/ && $ref =~ m!error!i ) - || - ($ref =~ /^Makefile/ && $ref =~ m!Stop!i ) - || - ($ref =~ /^make/ && ($ref =~ m!Stop!i || $ref =~ m!Error 1! ) ) ) - { - $build_failed = 1; - } - } - - elsif($num == 130) - { - if($build_failed) - { - $build_failure_count++; - $build_summary{"Failure"}++; - } - else - { - $build_summary{"Success"}++; - } - $build_tests{$testcase} = !$build_failed; - } - } - $built = $build_count - $build_failure_count; -} - - -sub heading -{ - print < - - -TETware Test Run Report - - -

-

-TETware Test Run Report

-

- - - - - - - - -
Date of test run:$date
Start time:$time

-
-EOH -} - -sub summary -{ - my $heading = shift; - my $summary_ref = shift; - - print < - -
$heading

-

- - - - -EOS1 - - my ($success_string, @blah) = grep(/(Success|PASS)/, keys(%$summary_ref)); - my $successes = $summary_ref->{$success_string}; - print < - - - -EOS2 - - foreach my $key (sort(grep(!/(Success|PASS|Total)/, keys(%$summary_ref)))) - { - my $fails = $summary_ref->{$key}; - print < - - - -EOS3 - } - - my $total = $summary_ref->{"Total"}; - print < - - - -
ResultCount
$success_string$successes
$key$fails
Total$total

-EOS4 -} - - -sub build_breakdown -{ - print < -

-
-Build mode result breakdown

-

- - - - -EOB - - foreach my $key (sort(keys(%build_tests))) - { - my $success = $build_tests{$key}; - my $class = $success?"success":"failure"; - my $Class = $success?"Success":"Failure"; - my $color = $success?"#33cc33":"#ff5555"; - print("\n"); - print("\n"); - } - print("
TestcaseResult
$key$Class

"); -} - - -sub execute_breakdown -{ - print < -

-
-Execute mode result breakdown

-EOE - - #Constructed with: - #$execute{$testcase}->{$ic}->{$tc} = $ref; - - my %results; - foreach my $testcase (sort(keys(%execute))) - { - #print STDOUT "$testcase\n"; - foreach my $ic (sort(keys(%{$execute{$testcase}}))) - { - my $ic_ref = $execute{$testcase}->{$ic}; - foreach my $tc (sort { $a <=> $b } (keys(%{$ic_ref}))) - { - my $result = $execute{$testcase}->{$ic}->{$tc}; - chomp($result); - $results{$result}->{$testcase} .= ", $ic.$tc"; - #print STDOUT "$testcase $ic.$tc $result\n"; - #print STDOUT "STRUCT:" . "\$results\{" . $result . "\}->\{$testcase\} => " . $results{$result}->{$testcase} . "\n"; - } - } - } - - foreach my $result ( "PASS", (sort(grep(!/PASS/, keys(%results))))) - { - print "

$result

\n"; - print < - - - - -EOE2 - - my $bgcolor = "#ff5555"; - if ($result =~ /PASS/) - { - $bgcolor = "#33cc33"; - } - - #print STDOUT "Result: $result OUT:" . $results{$result} . "\n"; - foreach my $testcase (sort(keys(%{$results{$result}}))) - { - #print STDOUT "$testcase\n"; - my $tests = substr($results{$result}->{$testcase}, 2); - print < - - - -EOE3 - } - print "
TestcaseTest purposes (IC.TP)
$testcase$tests
"; - } -} - - -sub footer -{ - print "
\n\n\n"; -} - -sub report -{ - my $file = shift; - open(my $fh, ">", $file) || die "Can't create $file"; - select $fh; - heading; - - if($build_count) - { - summary("Build mode summary", \%build_summary); - build_breakdown; - } - if(scalar(keys(%execute))) - { - summary("Execute mode summary", \%execute_summary); - execute_breakdown; - } - footer; - select STDOUT; - close $fh; -} - - -## MAIN - -die "No args" if scalar(@ARGV) == 0; -my $htmlname = $ARGV[0]; -$htmlname =~ s/.journal/.html/; - -parse_file(); -report($htmlname); - - -if($build_count) -{ - foreach my $key (sort(keys(%build_tests))) - { - if(!$build_tests{$key}) - { - print STDOUT "$key: Failed\n"; - } - } - print STDOUT "Built $built of $build_count\n"; -} - -if($executed) -{ - my $num_exes=$executed_testcases-$execute_no_file; - print STDOUT "Executed $num_exes of $executed_testcases testcases\n"; - my $passed = $execute_summary{"PASS"}; - my $total = $execute_summary{"Total"}; - my $passRate = ($num_exes / $executed_testcases ) * ( $passed / $total )*100; - print STDOUT "Passed $passed of $total - Pass rate=" . sprintf("%4.1f%%", $passRate) ."\n"; -} - -print "Report output: $htmlname\n"; diff --git a/automated-tests/TET/tet_scen b/automated-tests/TET/tet_scen deleted file mode 100644 index 3db3582..0000000 --- a/automated-tests/TET/tet_scen +++ /dev/null @@ -1,129 +0,0 @@ -all - "Starting Full Test Suite" - ^TEST - "Completed Full Test Suite" - -##### All PUBLIC and INTERNAL Tests ##### - -# Test scenario -TEST - ^PUBLIC - ^INTERNAL - -##### PUBLIC Tests ##### - -PUBLIC - ^alignment - ^bubble-emitter - ^builder - ^buttons - ^cluster - ^control - ^default-controls - ^focus-manager - ^item-view - ^navigation-frame - ^page-turn-view - ^popup - ^scroll-view - ^selectors - ^shader-effects - ^slider - ^super-blur-view - ^table-view - ^text-input - ^text-view - ^toolbar - ^transition-effects - ^view - -alignment - :include:/dali-test-suite/alignment/tslist - -text-input - :include:/dali-test-suite/text-input/tslist - -text-view - :include:/dali-test-suite/text-view/tslist - -toolbar - :include:/dali-test-suite/toolbar/tslist - -buttons - :include:/dali-test-suite/buttons/tslist - -default-controls - :include:/dali-test-suite/default-controls/tslist - -view - :include:/dali-test-suite/view/tslist - -table-view - :include:/dali-test-suite/table-view/tslist - -item-view - :include:/dali-test-suite/item-view/tslist - -cluster - :include:/dali-test-suite/cluster/tslist - -shader-effects - :include:/dali-test-suite/shader-effects/tslist - -selectors - :include:/dali-test-suite/selectors/tslist - -scroll-view - :include:/dali-test-suite/scroll-view/tslist - -popup - :include:/dali-test-suite/popup/tslist - -builder - :include:/dali-test-suite/builder/tslist - -control - :include:/dali-test-suite/control/tslist - -focus-manager - :include:/dali-test-suite/focus-manager/tslist - -transition-effects - :include:/dali-test-suite/transition-effects/tslist - -page-turn-view - :include:/dali-test-suite/page-turn-view/tslist - -super-blur-view - :include:/dali-test-suite/super-blur-view/tslist - -navigation-frame - :include:/dali-test-suite/navigation-frame/tslist - -bubble-emitter - :include:/dali-test-suite/bubble-emitter/tslist - -slider - :include:/dali-test-suite/slider/tslist - -##### INTERNAL Tests ##### - -INTERNAL - :include:/dali-internal-test-suite/text-input/tslist - :include:/dali-internal-test-suite/text-view/tslist - -internal-text-input - :include:/dali-internal-test-suite/text-input/tslist - -internal-text-view - :include:/dali-internal-test-suite/text-view/tslist - -text-view-full - :include:/dali-test-suite/text-view/tslist - :include:/dali-internal-test-suite/text-view/tslist - -##### DEBUG ##### -debug - /dali-test-suite/buttons/utc-Dali-PushButton - -# EOF diff --git a/automated-tests/TET/tetbuild.cfg b/automated-tests/TET/tetbuild.cfg deleted file mode 100644 index 6a05af6..0000000 --- a/automated-tests/TET/tetbuild.cfg +++ /dev/null @@ -1,5 +0,0 @@ -TET_OUTPUT_CAPTURE=True # capture option for build operation checking -TET_BUILD_TOOL=make # build with using make command -TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build -TET_API_COMPLIANT=False # use TET API in Test Case ? -TET_PASS_TC_NAME=True # report passed TC name in Journal file? diff --git a/automated-tests/TET/tetclean.cfg b/automated-tests/TET/tetclean.cfg deleted file mode 100644 index 2a0477a..0000000 --- a/automated-tests/TET/tetclean.cfg +++ /dev/null @@ -1,5 +0,0 @@ -TET_OUTPUT_CAPTURE=True # capture option -TET_CLEAN_TOOL= make clean # clean tool -TET_CLEAN_FILE= Makefile # file for clean -TET_API_COMPLIANT=True # TET API useage -TET_PASS_TC_NAME=True # showing name , passed TC diff --git a/automated-tests/TET/tetexec.cfg b/automated-tests/TET/tetexec.cfg deleted file mode 100644 index ef3e452..0000000 --- a/automated-tests/TET/tetexec.cfg +++ /dev/null @@ -1,5 +0,0 @@ -TET_OUTPUT_CAPTURE=True # capturing execution or not -TET_EXEC_TOOL= # ex) exec : execution tool set up/ Optional -TET_EXEC_FILE= # ex) exectool : execution file/ Optional -TET_API_COMPLIANT=True # Test case or Tool usesTET API? -TET_PASS_TC_NAME=True # showing Passed TC name ?